diff options
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 25 | ||||
-rw-r--r-- | vcl/unx/headless/svpgdi.cxx | 50 | ||||
-rw-r--r-- | vcl/unx/headless/svpgdi.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/headless/svppspgraphics.cxx | 36 | ||||
-rw-r--r-- | vcl/unx/headless/svppspgraphics.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/inc/dtint.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/inc/pspgraphics.h | 5 | ||||
-rw-r--r-- | vcl/unx/inc/salgdi.h | 8 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_clipboard.hxx | 26 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_dndcontext.hxx | 6 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_selection.cxx | 68 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_selection.hxx | 39 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_service.cxx | 24 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_transferable.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/source/fontmanager/fontmanager.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/source/gdi/pspgraphics.cxx | 36 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salgdi.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salgdi2.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salgdi3.cxx | 24 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salprnpsp.cxx | 2 |
22 files changed, 233 insertions, 249 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 36d475b8795b..329e6867206b 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -246,13 +246,15 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const int n = 0; GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); #if GTK_CHECK_VERSION(2,20,0) - n = m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)]; + n = gdk_screen_get_primary_monitor(pScreen); #else static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor = (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); if (sym_gdk_screen_get_primary_monitor) - n = m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor( pScreen )]; + n = sym_gdk_screen_get_primary_monitor( pScreen ); #endif + if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) + n = m_aXineramaScreenIndexMap[n]; return n; } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 34a7cfcd196b..def25a0bac9d 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -479,30 +479,13 @@ void GtkSalGraphics::ResetClipRegion() X11SalGraphics::ResetClipRegion(); } -void GtkSalGraphics::BeginSetClipRegion( sal_uLong nCount ) -{ - m_aClipRegion.SetNull(); - X11SalGraphics::BeginSetClipRegion( nCount ); -} - -sal_Bool GtkSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) ); - m_aClipRegion.Union( aRect ); - return X11SalGraphics::unionClipRegion( nX, nY, nWidth, nHeight ); -} - -bool GtkSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void GtkSalGraphics::EndSetClipRegion() +bool GtkSalGraphics::setClipRegion( const Region& i_rClip ) { + m_aClipRegion = i_rClip; + bool bRet = X11SalGraphics::setClipRegion( m_aClipRegion ); if( m_aClipRegion.IsEmpty() ) m_aClipRegion.SetNull(); - X11SalGraphics::EndSetClipRegion(); + return bRet; } void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry, diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 95ce1bb45a1d..a460bb271198 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -29,6 +29,7 @@ #include "svpbmp.hxx" #include <vcl/sysdata.hxx> +#include <vcl/region.h> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2irange.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -152,11 +153,16 @@ void SvpSalGraphics::ResetClipRegion() m_aClipMap.reset(); } -void SvpSalGraphics::BeginSetClipRegion( sal_uLong n ) +bool SvpSalGraphics::setClipRegion( const Region& i_rClip ) { - if( n <= 1 ) + if( i_rClip.IsEmpty() ) + m_aClipMap.reset(); + else if( i_rClip.GetRectCount() == 1 ) { m_aClipMap.reset(); + Rectangle aBoundRect( i_rClip.GetBoundRect() ); + m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice, + basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) ); } else { @@ -164,34 +170,22 @@ void SvpSalGraphics::BeginSetClipRegion( sal_uLong n ) B2IVector aSize = m_aDevice->getSize(); m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY ); m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) ); - } -} -sal_Bool SvpSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if( m_aClipMap ) - { - B2DPolyPolygon aFull; - aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ) ); - m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT ); - } - else - { - m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice, - basegfx::B2IRange(nX,nY,nX+nWidth,nY+nHeight) ); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + B2DPolyPolygon aFull; + aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) ); + m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } } - - return sal_True; -} - -bool SvpSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void SvpSalGraphics::EndSetClipRegion() -{ + return true; } void SvpSalGraphics::SetLineColor() diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index a7486a55198f..9e4971528033 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -68,10 +68,7 @@ public: virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( sal_uLong nCount ); - virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 6fdc8aac75d0..13c5469ed028 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -43,6 +43,7 @@ #include "vcl/svapp.hxx" #include "vcl/salprn.hxx" #include "vcl/sysdata.hxx" +#include "vcl/region.h" #include "basegfx/vector/b2ivector.hxx" #include "basegfx/point/b2ipoint.hxx" @@ -216,28 +217,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( sal_uLong n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -sal_Bool PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (sal_Bool)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY); -} + // TODO: support polygonal clipregions here + m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() ); -bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void PspGraphics::EndSetClipRegion() -{ - m_pPrinterGfx->EndSetClipRegion (); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + m_pPrinterGfx->EndSetClipRegion(); + return true; } void PspGraphics::SetLineColor() diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index fe9352c1fd8b..729116fcc1d2 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -90,10 +90,7 @@ public: virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( sal_uLong nCount ); - virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); diff --git a/vcl/unx/inc/dtint.hxx b/vcl/unx/inc/dtint.hxx index ebe2cae90803..6e6cf13575ed 100644 --- a/vcl/unx/inc/dtint.hxx +++ b/vcl/unx/inc/dtint.hxx @@ -31,12 +31,12 @@ #include <tools/string.hxx> #include <tools/color.hxx> #include <vcl/font.hxx> +#include "svunx.h" class SalBitmap; class SalDisplay; class AllSettings; - enum DtType { DtGeneric, DtCDE diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 0b4439e6881f..57a639f8ad5b 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -78,11 +78,8 @@ public: //helper methods for frame's UpdateSettings void updateSettings( AllSettings& rSettings ); + virtual bool setClipRegion( const Region& ); virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( sal_uLong nCount ); - virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); // some themes set the background pixmap of our window EVERY time // a control is painted; but presentation effects need diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index 143c628eb178..7d9a2b8a3d0e 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -87,10 +87,7 @@ public: virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( sal_uIntPtr nCount ); - virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index c40a85741c5d..2cf3190590f3 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -90,7 +90,7 @@ protected: CairoFontsCache m_aCairoFontsCache; XLIB_Region pPaintRegion_; - XLIB_Region pClipRegion_; + XLIB_Region mpClipRegion; GC pPenGC_; // Pen attributes SalColor nPenColor_; @@ -133,6 +133,7 @@ protected: bool bXORMode_ : 1; // is ROP XOR Mode set sal_Bool bDitherBrush_ : 1; // is solid or tile + using SalGraphics::SetClipRegion; void SetClipRegion( GC pGC, XLIB_Region pXReg = NULL ) const; @@ -228,10 +229,7 @@ public: virtual long GetGraphicsHeight() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( sal_uIntPtr nCount ); - virtual sal_Bool unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); diff --git a/vcl/unx/source/dtrans/X11_clipboard.hxx b/vcl/unx/source/dtrans/X11_clipboard.hxx index 21bf547a9cb7..2c0ee2d95c0d 100644 --- a/vcl/unx/source/dtrans/X11_clipboard.hxx +++ b/vcl/unx/source/dtrans/X11_clipboard.hxx @@ -54,12 +54,12 @@ namespace x11 { >, public SelectionAdaptor { - Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; - Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; SelectionManager& m_rSelectionManager; - Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager; - ::std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; + com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager; + ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; Atom m_aSelection; protected: @@ -100,12 +100,12 @@ namespace x11 { * XClipboard */ - virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() throw(RuntimeException); virtual void SAL_CALL setContents( - const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) throw(RuntimeException); virtual ::rtl::OUString SAL_CALL getName() @@ -122,27 +122,27 @@ namespace x11 { * XClipboardNotifier */ virtual void SAL_CALL addClipboardListener( - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) throw(RuntimeException); virtual void SAL_CALL removeClipboardListener( - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) throw(RuntimeException); /* * SelectionAdaptor */ - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable(); + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable(); virtual void clearTransferable(); virtual void fireContentsChanged(); - virtual Reference< XInterface > getReference() throw(); + virtual com::sun::star::uno::Reference< XInterface > getReference() throw(); }; // ------------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL X11Clipboard_getSupportedServiceNames(); - Reference< XInterface > SAL_CALL X11Clipboard_createInstance( - const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); + com::sun::star::uno::Reference< XInterface > SAL_CALL X11Clipboard_createInstance( + const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); // ------------------------------------------------------------------------ diff --git a/vcl/unx/source/dtrans/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx index 9b48d346f03b..d8ef87444a7a 100644 --- a/vcl/unx/source/dtrans/X11_dndcontext.hxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx @@ -51,7 +51,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DropTargetDropContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DropTargetDropContext(); @@ -70,7 +70,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DropTargetDragContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DropTargetDragContext(); @@ -88,7 +88,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DragSourceContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DragSourceContext(); diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 403ee9707a94..8188f2b1164a 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -80,6 +80,12 @@ EnterWindowMask |\ LeaveWindowMask +namespace { + +namespace css = com::sun::star; + +} + using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::dnd; using namespace com::sun::star::lang; @@ -279,7 +285,8 @@ SelectionManager::SelectionManager() : m_nXdndActionMove( None ), m_nXdndActionLink( None ), m_nXdndActionAsk( None ), - m_nXdndActionPrivate( None ) + m_nXdndActionPrivate( None ), + m_bShutDown( false ) { m_aDropEnterEvent.data.l[0] = None; m_aDragRunning.reset(); @@ -632,7 +639,7 @@ OString SelectionManager::convertToCompound( const OUString& rText ) // ------------------------------------------------------------------------ bool SelectionManager::convertData( - const Reference< XTransferable >& xTransferable, + const css::uno::Reference< XTransferable >& xTransferable, Atom nType, Atom nSelection, int& rFormat, @@ -1527,7 +1534,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "trying bitmap conversion\n" ); #endif - Reference<XBitmap> xBM( new BmpTransporter( aData ) ); + css::uno::Reference<XBitmap> xBM( new BmpTransporter( aData ) ); Sequence<Any> aArgs(2), aOutArgs; Sequence<sal_Int16> aOutIndex; aArgs.getArray()[0] = makeAny( xBM ); @@ -1674,7 +1681,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest if( pAdaptor && XGetSelectionOwner( m_pDisplay, rRequest.selection ) == m_aWindow ) { - Reference< XTransferable > xTrans( pAdaptor->getTransferable() ); + css::uno::Reference< XTransferable > xTrans( pAdaptor->getTransferable() ); if( rRequest.target == m_nTARGETSAtom ) { // someone requests our types @@ -1843,7 +1850,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; } - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); if( xListener.is() ) @@ -2364,7 +2371,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = getUserDragAction(); dsde.DropSuccess = bSuccess; - Reference< XDragSourceListener > xListener = m_xDragSourceListener; + css::uno::Reference< XDragSourceListener > xListener = m_xDragSourceListener; m_xDragSourceListener.clear(); aGuard.clear(); @@ -2448,7 +2455,7 @@ void SelectionManager::sendDragStatus( Atom nDropAction ) dsde.DropAction = m_nSourceActions; dsde.UserAction = getUserDragAction(); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); // caution: do not change anything after this aGuard.clear(); if( xListener.is() ) @@ -2710,7 +2717,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = m_nTargetAcceptAction; dsde.DropSuccess = m_bDropSuccess; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -2776,7 +2783,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -2902,7 +2909,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) m_nDropTimeout = time( NULL ); // HACK :-) aGuard.clear(); - static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() ); + static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, css::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() ); aGuard.reset(); bCancel = false; } @@ -2917,7 +2924,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -3071,7 +3078,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot ) { ResettableMutexGuard aGuard( m_aMutex ); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_nLastDragX = nX; m_nLastDragY = nY; @@ -3231,8 +3238,8 @@ void SelectionManager::startDrag( sal_Int8 sourceActions, sal_Int32, sal_Int32, - const Reference< XTransferable >& transferable, - const Reference< XDragSourceListener >& listener + const css::uno::Reference< XTransferable >& transferable, + const css::uno::Reference< XDragSourceListener >& listener ) throw() { #if OSL_DEBUG_LEVEL > 1 @@ -3516,8 +3523,8 @@ void SelectionManager::dragDoDispatch() { ClearableMutexGuard aGuard(m_aMutex); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); - Reference< XTransferable > xTransferable( m_xDragSourceTransferable ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XTransferable > xTransferable( m_xDragSourceTransferable ); m_xDragSourceListener.clear(); m_xDragSourceTransferable.clear(); @@ -3787,10 +3794,10 @@ void SelectionManager::run( void* pThis ) timeval aLast; gettimeofday( &aLast, 0 ); - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); + css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->addTerminateListener(This); } @@ -3805,7 +3812,7 @@ void SelectionManager::run( void* pThis ) if( (aNow.tv_sec - aLast.tv_sec) > 0 ) { ClearableMutexGuard aGuard(This->m_aMutex); - std::list< std::pair< SelectionAdaptor*, Reference< XInterface > > > aChangeList; + std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList; for( std::hash_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it ) { @@ -3815,7 +3822,7 @@ void SelectionManager::run( void* pThis ) if( aOwner != it->second->m_aLastOwner ) { it->second->m_aLastOwner = aOwner; - std::pair< SelectionAdaptor*, Reference< XInterface > > + std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > aKeep( it->second->m_pAdaptor, it->second->m_pAdaptor->getReference() ); aChangeList.push_back( aKeep ); } @@ -3838,6 +3845,11 @@ void SelectionManager::run( void* pThis ) void SelectionManager::shutdown() throw() { ResettableMutexGuard aGuard(m_aMutex); + if( m_bShutDown ) + { + return; + } + m_bShutDown = true; // stop dispatching if( m_aThread ) { @@ -3927,7 +3939,7 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang:: void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException ) { - Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY ); + css::uno::Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY ); if( xDesktop.is() == sal_True ) xDesktop->removeTerminateListener( this ); #if OSL_DEBUG_LEVEL > 1 @@ -4060,7 +4072,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -4071,7 +4083,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow ) * SelectionAdaptor */ -Reference< XTransferable > SelectionManager::getTransferable() throw() +css::uno::Reference< XTransferable > SelectionManager::getTransferable() throw() { return m_xDragSourceTransferable; } @@ -4091,9 +4103,9 @@ void SelectionManager::fireContentsChanged() throw() // ------------------------------------------------------------------------ -Reference< XInterface > SelectionManager::getReference() throw() +css::uno::Reference< XInterface > SelectionManager::getReference() throw() { - return Reference< XInterface >( static_cast<OWeakObject*>(this) ); + return css::uno::Reference< XInterface >( static_cast<OWeakObject*>(this) ); } // ------------------------------------------------------------------------ @@ -4124,7 +4136,7 @@ void SelectionManagerHolder::initialize( const Sequence< Any >& arguments ) thro if( arguments.getLength() > 0 ) { - Reference< XDisplayConnection > xConn; + css::uno::Reference< XDisplayConnection > xConn; arguments.getConstArray()[0] >>= xConn; if( xConn.is() ) { @@ -4159,8 +4171,8 @@ sal_Int32 SelectionManagerHolder::getDefaultCursor( sal_Int8 dragAction ) throw( void SelectionManagerHolder::startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const css::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const css::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw() { if( m_xRealDragSource.is() ) diff --git a/vcl/unx/source/dtrans/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx index 47baa1776d1a..34a50819bfed 100644 --- a/vcl/unx/source/dtrans/X11_selection.hxx +++ b/vcl/unx/source/dtrans/X11_selection.hxx @@ -66,10 +66,10 @@ namespace x11 { class SelectionAdaptor { public: - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0; + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0; virtual void clearTransferable() = 0; virtual void fireContentsChanged() = 0; - virtual Reference< XInterface > getReference() = 0; + virtual com::sun::star::uno::Reference< XInterface > getReference() = 0; // returns a reference that will keep the SelectionAdaptor alive until the // refernce is released }; @@ -87,9 +87,9 @@ namespace x11 { sal_Int8 m_nDefaultActions; XLIB_Window m_aTargetWindow; class SelectionManager* m_pSelectionManager; - Reference< ::com::sun::star::datatransfer::dnd::XDragSource > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > m_xSelectionManager; - ::std::list< Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > > + ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > > m_aListeners; DropTarget(); @@ -105,8 +105,8 @@ namespace x11 { virtual void SAL_CALL initialize( const Sequence< Any >& args ) throw ( ::com::sun::star::uno::Exception ); // XDropTarget - virtual void SAL_CALL addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); - virtual void SAL_CALL removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL addDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL removeDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); virtual sal_Bool SAL_CALL isActive() throw(); virtual void SAL_CALL setActive( sal_Bool active ) throw(); virtual sal_Int8 SAL_CALL getDefaultActions() throw(); @@ -127,7 +127,7 @@ namespace x11 { > { ::osl::Mutex m_aMutex; - Reference< ::com::sun::star::datatransfer::dnd::XDragSource > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > m_xRealDragSource; public: SelectionManagerHolder(); @@ -148,8 +148,8 @@ namespace x11 { virtual void SAL_CALL startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw(); }; @@ -260,9 +260,9 @@ namespace x11 { oslThread m_aDragExecuteThread; ::osl::Condition m_aDragRunning; XLIB_Window m_aWindow; - Reference< ::com::sun::star::awt::XDisplayConnection > + com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > m_xDisplayConnection; - Reference< com::sun::star::script::XInvocation > + com::sun::star::uno::Reference< com::sun::star::script::XInvocation > m_xBitmapConverter; sal_Int32 m_nSelectionTimeout; XLIB_Time m_nSelectionTimestamp; @@ -285,7 +285,7 @@ namespace x11 { XLIB_Time m_nDropTime; sal_Int8 m_nLastDropAction; // XTransferable for Xdnd with foreign drag source - Reference< ::com::sun::star::datatransfer::XTransferable > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_xDropTransferable; int m_nLastX, m_nLastY; XLIB_Time m_nDropTimestamp; @@ -303,9 +303,9 @@ namespace x11 { XLIB_Window m_aDropProxy; XLIB_Window m_aDragSourceWindow; // XTransferable for Xdnd when we are drag source - Reference< ::com::sun::star::datatransfer::XTransferable > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_xDragSourceTransferable; - Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > m_xDragSourceListener; // root coordinates int m_nLastDragX, m_nLastDragY; @@ -383,6 +383,7 @@ namespace x11 { // since this leads to deadlocks in different Xlib implentations // (XFree as well as Xsun) use an own mutex instead ::osl::Mutex m_aMutex; + bool m_bShutDown; SelectionManager(); ~SelectionManager(); @@ -409,7 +410,7 @@ namespace x11 { bool getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData ); // returns true if conversion was successful - bool convertData( const Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, + bool convertData( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, Atom nType, Atom nSelection, int & rFormat, @@ -494,15 +495,15 @@ namespace x11 { virtual void SAL_CALL startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw(); // SelectionAdaptor for XdndSelection Drag (we are drag source) - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw(); + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw(); virtual void clearTransferable() throw(); virtual void fireContentsChanged() throw(); - virtual Reference< XInterface > getReference() throw(); + virtual com::sun::star::uno::Reference< XInterface > getReference() throw(); // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/vcl/unx/source/dtrans/X11_service.cxx b/vcl/unx/source/dtrans/X11_service.cxx index e14d81643553..d15518c0b9ab 100644 --- a/vcl/unx/source/dtrans/X11_service.cxx +++ b/vcl/unx/source/dtrans/X11_service.cxx @@ -39,6 +39,12 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/compbase1.hxx> +namespace { + +namespace css = com::sun::star; + +} + using namespace rtl; using namespace cppu; using namespace com::sun::star::lang; @@ -69,9 +75,9 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) +css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) { - static std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; + static std::hash_map< OUString, ::std::hash_map< Atom, css::uno::Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; OUString aDisplayName; Atom nSelection; @@ -80,7 +86,7 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& // by SelectionManager.initialize() if no display connection is given. if( arguments.getLength() > 0 ) { - Reference< XDisplayConnection > xConn; + css::uno::Reference< XDisplayConnection > xConn; arguments.getConstArray()[0] >>= xConn; if( xConn.is() ) @@ -107,8 +113,8 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); } - ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); - ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); + ::std::hash_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); + ::std::hash_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection ); if( it != rMap.end() ) return it->second; @@ -120,16 +126,16 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateDragSource() +css::uno::Reference< XInterface > X11SalInstance::CreateDragSource() { - return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); + return css::uno::Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); } // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateDropTarget() +css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget() { - return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); + return css::uno::Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); } diff --git a/vcl/unx/source/dtrans/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx index 57f0d6682cab..65f7d1fdc475 100644 --- a/vcl/unx/source/dtrans/X11_transferable.hxx +++ b/vcl/unx/source/dtrans/X11_transferable.hxx @@ -44,10 +44,10 @@ namespace x11 { ::osl::Mutex m_aMutex; SelectionManager& m_rManager; - Reference< XInterface > m_xCreator; + com::sun::star::uno::Reference< XInterface > m_xCreator; Atom m_aSelection; public: - X11Transferable( SelectionManager& rManager, const Reference< XInterface >& xCreator, Atom selection = None ); + X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None ); virtual ~X11Transferable(); /* diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 21183dc567ec..d72692b86a65 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -87,6 +87,12 @@ #define PRINTER_METRICDIR "fontmetric" +namespace { + +namespace css = com::sun::star; + +} + using namespace vcl; using namespace utl; using namespace psp; @@ -3942,10 +3948,10 @@ bool PrintFontManager::readOverrideMetrics() if( ! m_aOverrideFonts.empty() ) return false; - Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() ); + css::uno::Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() ); if( !xFact.is() ) return false; - Reference< XMaterialHolder > xMat( + css::uno::Reference< XMaterialHolder > xMat( xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.psprint.CompatMetricOverride" ) ) ), UNO_QUERY ); if( !xMat.is() ) diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 0edf2326b58d..f9a156c841fc 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -41,6 +41,7 @@ #include "vcl/svapp.hxx" #include "vcl/salprn.hxx" #include "vcl/sysdata.hxx" +#include "vcl/region.h" #include <stdlib.h> #include <unistd.h> @@ -290,28 +291,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( sal_uLong n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -sal_Bool PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (sal_Bool)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY); -} + // TODO: support polygonal clipregions here + m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() ); -bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void PspGraphics::EndSetClipRegion() -{ - m_pPrinterGfx->EndSetClipRegion (); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + m_pPrinterGfx->EndSetClipRegion(); + return true; } void PspGraphics::SetLineColor() diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 979e3927024a..dc1ec968d859 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -40,6 +40,7 @@ #include "vcl/printergfx.hxx" #include "vcl/jobdata.hxx" +#include "vcl/region.h" #include "tools/debug.hxx" @@ -104,7 +105,7 @@ X11SalGraphics::X11SalGraphics() m_aRenderPicture = 0; m_pRenderFormat = NULL; - pClipRegion_ = NULL; + mpClipRegion = NULL; pPaintRegion_ = NULL; pPenGC_ = NULL; @@ -167,7 +168,7 @@ void X11SalGraphics::freeResources() Display *pDisplay = GetXDisplay(); DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" ); - if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None; + if( mpClipRegion ) XDestroyRegion( mpClipRegion ), mpClipRegion = None; if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None; if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None; @@ -257,8 +258,8 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const int n = 0; XLIB_Region Regions[3]; - if( pClipRegion_ /* && !XEmptyRegion( pClipRegion_ ) */ ) - Regions[n++] = pClipRegion_; + if( mpClipRegion /* && !XEmptyRegion( mpClipRegion ) */ ) + Regions[n++] = mpClipRegion; // if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ ) // Regions[n++] = pPaintRegion_; @@ -571,7 +572,7 @@ long X11SalGraphics::GetGraphicsHeight() const // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void X11SalGraphics::ResetClipRegion() { - if( pClipRegion_ ) + if( mpClipRegion ) { bPenGC_ = sal_False; bFontGC_ = sal_False; @@ -583,46 +584,36 @@ void X11SalGraphics::ResetClipRegion() bStippleGC_ = sal_False; bTrackingGC_ = sal_False; - XDestroyRegion( pClipRegion_ ); - pClipRegion_ = NULL; + XDestroyRegion( mpClipRegion ); + mpClipRegion = NULL; } } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::BeginSetClipRegion( sal_uLong ) -{ - if( pClipRegion_ ) - XDestroyRegion( pClipRegion_ ); - pClipRegion_ = XCreateRegion(); -} - -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) +bool X11SalGraphics::setClipRegion( const Region& i_rClip ) { - if (!nDX || !nDY) - return sal_True; - - XRectangle aRect; - aRect.x = (short)nX; - aRect.y = (short)nY; - aRect.width = (unsigned short)nDX; - aRect.height = (unsigned short)nDY; - - XUnionRectWithRegion( &aRect, pClipRegion_, pClipRegion_ ); - - return sal_True; -} + if( mpClipRegion ) + XDestroyRegion( mpClipRegion ); + mpClipRegion = XCreateRegion(); + + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + XRectangle aRect; + aRect.x = (short)nX; + aRect.y = (short)nY; + aRect.width = (unsigned short)nW; + aRect.height = (unsigned short)nH; -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + XUnionRectWithRegion( &aRect, mpClipRegion, mpClipRegion ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::EndSetClipRegion() -{ + // done, invalidate GCs bPenGC_ = sal_False; bFontGC_ = sal_False; bBrushGC_ = sal_False; @@ -633,11 +624,12 @@ void X11SalGraphics::EndSetClipRegion() bStippleGC_ = sal_False; bTrackingGC_ = sal_False; - if( XEmptyRegion( pClipRegion_ ) ) + if( XEmptyRegion( mpClipRegion ) ) { - XDestroyRegion( pClipRegion_ ); - pClipRegion_= NULL; + XDestroyRegion( mpClipRegion ); + mpClipRegion= NULL; } + return true; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -1047,8 +1039,8 @@ XID X11SalGraphics::GetXRenderPicture() #if 0 // setup clipping so the callers don't have to do it themselves // TODO: avoid clipping if already set correctly - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); else #endif { @@ -1185,8 +1177,8 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr // set clipping // TODO: move into GetXRenderPicture? - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); // render the trapezoids const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8(); diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx index 018f7514dfeb..624360b21d29 100644 --- a/vcl/unx/source/gdi/salgdi2.cxx +++ b/vcl/unx/source/gdi/salgdi2.cxx @@ -308,8 +308,8 @@ int X11SalGraphics::Clip( int &nX, && RectangleOut == Clip( pPaintRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) return RectangleOut; - if( pClipRegion_ - && RectangleOut == Clip( pClipRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) + if( mpClipRegion + && RectangleOut == Clip( mpClipRegion, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) return RectangleOut; int nPaint; @@ -323,9 +323,9 @@ int X11SalGraphics::Clip( int &nX, nPaint = RectangleIn; int nClip; - if( pClipRegion_ ) + if( mpClipRegion ) { - nClip = XRectInRegion( pClipRegion_, nX, nY, nDX, nDY ); + nClip = XRectInRegion( mpClipRegion, nX, nY, nDX, nDY ); if( RectangleOut == nClip ) return RectangleOut; } @@ -888,8 +888,8 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, return false; // set clipping - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); // paint source * mask over destination picture rPeer.CompositePicture( PictOpOver, aSrcPic, aAlphaPic, aDstPic, diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index c719b33a1fbf..6684b5664887 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -528,16 +528,16 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions()) rCairo.set_font_options( cr, pOptions); - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - { - for (long i = 0; i < pClipRegion_->numRects; ++i) + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { + for (long i = 0; i < mpClipRegion->numRects; ++i) + { rCairo.rectangle(cr, - pClipRegion_->rects[i].x1, - pClipRegion_->rects[i].y1, - pClipRegion_->rects[i].x2 - pClipRegion_->rects[i].x1, - pClipRegion_->rects[i].y2 - pClipRegion_->rects[i].y1); - } + mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y1, + mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); + } rCairo.clip(cr); } @@ -621,8 +621,8 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout ) // set clipping // TODO: move into GetXRenderPicture()? - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); ServerFont& rFont = rLayout.GetServerFont(); X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer(); @@ -705,10 +705,10 @@ bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout ) else if( m_pVDev ) nWidth = m_pVDev->GetWidth(), nHeight = m_pVDev->GetHeight(); - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { // get bounding box - XClipBox( pClipRegion_, &aXRect ); + XClipBox( mpClipRegion, &aXRect ); // clip with window if( aXRect.x < 0 ) aXRect.x = 0; diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index f3b50db6a9d9..65a0802e9fe2 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -1188,6 +1188,8 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo aContext.Tagged = false; aContext.EmbedStandardFonts = true; aContext.DocumentLocale = Application::GetSettings().GetLocale(); + aContext.ColorMode = i_rController.getPrinter()->GetPrinterOptions().IsConvertToGreyscales() + ? vcl::PDFWriter::DrawGreyscale : vcl::PDFWriter::DrawColor; // prepare doc info aContext.DocumentInfo.Title = i_rJobName; |