summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/aqua/source/dtrans/service_entry.cxx12
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx25
-rw-r--r--vcl/aqua/source/window/salframe.cxx71
-rw-r--r--vcl/source/app/sound.cxx5
4 files changed, 108 insertions, 5 deletions
diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx
index 16308951bcfe..222b5cf40e04 100644
--- a/vcl/aqua/source/dtrans/service_entry.cxx
+++ b/vcl/aqua/source/dtrans/service_entry.cxx
@@ -34,6 +34,7 @@
#include "DropTarget.hxx"
#include "aqua_clipboard.hxx"
#include "osl/diagnose.h"
+#include "vcl/svapp.hxx"
using namespace ::osl;
using namespace ::rtl;
@@ -45,6 +46,9 @@ using namespace ::com::sun::star::datatransfer::clipboard;
Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments )
{
+ if ( Application::IsHeadlessModeEnabled() )
+ return SalInstance::CreateClipboard( i_rArguments );
+
SalData* pSalData = GetSalData();
if( ! pSalData->mxClipboard.is() )
pSalData->mxClipboard = Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY);
@@ -54,11 +58,17 @@ Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >&
Reference<XInterface> AquaSalInstance::CreateDragSource()
{
+ if ( Application::IsHeadlessModeEnabled() )
+ return SalInstance::CreateDragSource();
+
return Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY);
}
Reference<XInterface> AquaSalInstance::CreateDropTarget()
{
- return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY);
+ if ( Application::IsHeadlessModeEnabled() )
+ return SalInstance::CreateDropTarget();
+
+ return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY);
}
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
index eb09a44f5edd..f633dbbdcdce 100644
--- a/vcl/aqua/source/gdi/salvd.cxx
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -33,6 +33,7 @@
#include "salgdi.h"
#include "saldata.hxx"
#include "salframe.h"
+#include <vcl/svapp.hxx>
#include "vcl/sysdata.hxx"
@@ -197,9 +198,27 @@ BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY )
pSalFrame = *GetSalData()->maFrames.begin();
if( pSalFrame )
{
- NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pSalFrame->getWindow()];
- if( pNSContext )
- xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]);
+ // #i91990#
+ NSWindow* pWindow = pSalFrame->getWindow();
+ if ( pWindow )
+ {
+ NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pWindow];
+ if( pNSContext )
+ xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]);
+ }
+ else
+ {
+ // fall back to a bitmap context
+ mnBitmapDepth = 32;
+ const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
+ const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst;
+ const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
+
+ void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
+ mxBitmapContext = ::CGBitmapContextCreate( pRawData, nDX, nDY,
+ 8, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
+ xCGContext = mxBitmapContext;
+ }
}
}
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 4530778c5775..17e034bd6e3d 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -191,8 +191,17 @@ void AquaSalFrame::initWindowAndView()
mnStyleMask |= NSTitledWindowMask;
}
+ // #i91990# support GUI-less (daemon) execution
+ @try
+ {
mpWindow = [[SalFrameWindow alloc] initWithSalFrame: this];
mpView = [[SalFrameView alloc] initWithSalFrame: this];
+ }
+ @catch ( id exception )
+ {
+ return;
+ }
+
if( (mnStyle & SAL_FRAME_STYLE_TOOLTIP) )
[mpWindow setIgnoresMouseEvents: YES];
else
@@ -291,6 +300,9 @@ BOOL AquaSalFrame::PostEvent( void *pData )
// -----------------------------------------------------------------------
void AquaSalFrame::SetTitle(const XubString& rTitle)
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -405,6 +417,9 @@ void AquaSalFrame::SendPaintEvent( const Rectangle* pRect )
void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate)
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -563,6 +578,8 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
+ if ( mpWindow )
+ {
// set normal state
NSRect aStateRect = [mpWindow frame];
aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask];
@@ -599,6 +616,7 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
if( [mpWindow isZoomed] )
[mpWindow zoom: NSApp];
}
+ }
// get new geometry
UpdateFrameGeometry();
@@ -619,7 +637,7 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
if( nEvent )
CallCallback( nEvent, NULL );
- if( mbShown )
+ if( mbShown && mpWindow )
{
// trigger filling our backbuffer
SendPaintEvent();
@@ -633,6 +651,9 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
BOOL AquaSalFrame::GetWindowState( SalFrameState* pState )
{
+ if ( !mpWindow )
+ return FALSE;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -670,6 +691,9 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState )
void AquaSalFrame::SetScreenNumber(unsigned int nScreen)
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -704,6 +728,9 @@ void AquaSalFrame::SetScreenNumber(unsigned int nScreen)
void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay )
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -814,6 +841,9 @@ public:
void AquaSalFrame::StartPresentation( BOOL bStart )
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -841,6 +871,9 @@ void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop )
void AquaSalFrame::ToTop(USHORT nFlags)
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -900,6 +933,9 @@ NSCursor* AquaSalFrame::getCurrentCursor() const
void AquaSalFrame::SetPointer( PointerStyle ePointerStyle )
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1198,6 +1234,9 @@ void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY )
// doesn't make the anything cleaner for now
void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1312,6 +1351,9 @@ void AquaSalFrame::Beep( SoundType eSoundType )
void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags)
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1399,6 +1441,9 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR
void AquaSalFrame::GetWorkArea( Rectangle& rRect )
{
+ if ( !mpWindow )
+ return;
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1537,11 +1582,15 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu )
void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
{
+ if ( mpWindow )
+ {
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
if( (mnExtStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) != (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) )
[mpWindow setDocumentEdited: (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ? YES : NO];
+ }
+
mnExtStyle = nStyle;
}
@@ -1572,6 +1621,11 @@ void AquaSalFrame::SetParent( SalFrame* pNewParent )
void AquaSalFrame::UpdateFrameGeometry()
{
+ if ( !mpWindow )
+ {
+ return;
+ }
+
// keep in mind that view and window coordinates are lower left
// whereas vcl's are upper left
@@ -1644,6 +1698,11 @@ void AquaSalFrame::CaptureMouse( BOOL bCapture )
void AquaSalFrame::ResetClipRegion()
{
+ if ( !mpWindow )
+ {
+ return;
+ }
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1662,6 +1721,11 @@ void AquaSalFrame::ResetClipRegion()
void AquaSalFrame::BeginSetClipRegion( ULONG nRects )
{
+ if ( !mpWindow )
+ {
+ return;
+ }
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
@@ -1696,6 +1760,11 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight
void AquaSalFrame::EndSetClipRegion()
{
+ if ( !mpWindow )
+ {
+ return;
+ }
+
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx
index bac9d50dc5da..d180f2647135 100644
--- a/vcl/source/app/sound.cxx
+++ b/vcl/source/app/sound.cxx
@@ -38,6 +38,7 @@
#include <vcl/salframe.hxx>
#include <tools/debug.hxx>
#include <vcl/svdata.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/sound.hxx>
@@ -45,6 +46,10 @@
void Sound::Beep( SoundType eType, Window* pWindow )
{
+ // #i91990#
+ if ( Application::IsHeadlessModeEnabled() )
+ return;
+
if( !pWindow )
{
Window* pDefWindow = ImplGetDefaultWindow();