From 0360a0ad1602f795bedea54dbae554c5769b7e61 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Nov 2010 17:12:39 +0100 Subject: vcl118: #i111868# clean up MapModeVDev, reuse MapModeVDev --- vcl/inc/vcl/outdev.hxx | 4 ++++ vcl/source/gdi/outdev.cxx | 14 ++++++++++++++ vcl/source/gdi/print2.cxx | 35 ++++++++++++++++------------------- 3 files changed, 34 insertions(+), 19 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 12c4202af144..8edc8c3d6c47 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -1108,6 +1108,10 @@ public: void Push( USHORT nFlags = PUSH_ALL ); void Pop(); + // returns the curren stack depth; that is the number of Push() calls minus the number of Pop() calls + // this should not normally be used since Push and Pop must always be used symmetrically + // however this may be e.g. a help when debugging code in which this somehow is not the case + sal_uInt32 GetGCStackDepth() const; /** Query availability of alpha channel diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 847a8d7a299a..26a831c7600c 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -3159,6 +3159,20 @@ void OutputDevice::DrawPolyLine( // ----------------------------------------------------------------------- +sal_uInt32 OutputDevice::GetGCStackDepth() const +{ + const ImplObjStack* pData = mpObjStack; + sal_uInt32 nDepth = 0; + while( pData ) + { + nDepth++; + pData = pData->mpPrev; + } + return nDepth; +} + +// ----------------------------------------------------------------------- + void OutputDevice::Push( USHORT nFlags ) { DBG_TRACE( "OutputDevice::Push()" ); diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 25ba80003fd7..c95322538e43 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -854,13 +854,12 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, ++nActionNum; } - ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. + // clean up aMapModeVDev + sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth(); + while( nCount-- ) + aMapModeVDev.Pop(); - // create an OutputDevice to record mapmode changes and the like - VirtualDevice aMapModeVDev2; - aMapModeVDev2.mnDPIX = mnDPIX; - aMapModeVDev2.mnDPIY = mnDPIY; - aMapModeVDev2.EnableOutput(FALSE); + ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. // fast-forward until one after the last background action // (need to reconstruct map mode vdev state) @@ -875,7 +874,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct, nActionNum) ); // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev2 ); + pCurrAct->Execute( &aMapModeVDev ); pCurrAct=const_cast(rInMtf).NextAction(); ++nActionNum; } @@ -892,10 +891,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct=const_cast(rInMtf).NextAction(), ++nActionNum ) { // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev2 ); + pCurrAct->Execute( &aMapModeVDev ); // cache bounds of current action - const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev2) ); + const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); // accumulate collected bounds here, initialize with current action Rectangle aTotalBounds( aBBCurrAct ); // thus, @@ -924,7 +923,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // not be considered for connected components, // too. Just put each of them into a separate // component. - aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev2); + aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev); if( !aBBCurrAct.IsEmpty() && !aTotalComponents.bIsFullyTransparent ) @@ -1310,18 +1309,16 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, } } + // clean up aMapModeVDev + nCount = aMapModeVDev.GetGCStackDepth(); + while( nCount-- ) + aMapModeVDev.Pop(); + // // STAGE 4: Copy actions to output metafile // ======================================== // - // create an OutputDevice to record color settings, mapmode - // changes and the like - VirtualDevice aMapModeVDev3; - aMapModeVDev3.mnDPIX = mnDPIX; - aMapModeVDev3.mnDPIY = mnDPIY; - aMapModeVDev3.EnableOutput(FALSE); - // iterate over all actions and duplicate the ones not in a // special aCCList member into rOutMtf for( pCurrAct=const_cast(rInMtf).FirstAction(), nActionNum=0; @@ -1349,7 +1346,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // given background color ImplConvertTransparentAction(rOutMtf, *pCurrAct, - aMapModeVDev3, + aMapModeVDev, aBackgroundComponent.aBgColor); } else @@ -1358,7 +1355,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) ); } - pCurrAct->Execute(&aMapModeVDev3); + pCurrAct->Execute(&aMapModeVDev); } } -- cgit From 05bc6abcc21637283b639e1e801c6041b384c9bf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Nov 2010 17:24:17 +0100 Subject: vcl118: #i111868# fix an assertion --- vcl/source/gdi/bitmap.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 074935086b0b..2d879d83a247 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -236,9 +236,13 @@ bool BitmapPalette::IsGreyPalette() const const int nEntryCount = GetEntryCount(); if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping return true; - const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount ); - if( rGreyPalette == *this ) - return true; + // see above: only certain entry values will result in a valid call to GetGreyPalette + if( nEntryCount == 2 || nEntryCount == 4 || nEntryCount == 16 || nEntryCount == 256 ) + { + const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount ); + if( rGreyPalette == *this ) + return true; + } // TODO: is it worth to compare the entries? return false; } -- cgit From 598bd3e1bf5721d1aabd4a5051199c2bf379b037 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 1 Dec 2010 15:28:37 +0100 Subject: #i105655# fix LineInfo::operator== --- vcl/inc/vcl/lineinfo.hxx | 2 ++ vcl/source/gdi/lineinfo.cxx | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx index 9b12966a52ff..3dfdc999cb09 100644 --- a/vcl/inc/vcl/lineinfo.hxx +++ b/vcl/inc/vcl/lineinfo.hxx @@ -56,6 +56,8 @@ struct ImplLineInfo ImplLineInfo(); ImplLineInfo( const ImplLineInfo& rImplLineInfo ); + bool operator==( const ImplLineInfo& ) const; + friend SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ); friend SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ); }; diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index bb57a0b582e6..3c642388fc86 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -70,6 +70,20 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) : { } +// ----------------------------------------------------------------------- + +inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const +{ + return(meStyle == rB.meStyle + && mnWidth == rB.mnWidth + && mnDashCount == rB.mnDashCount + && mnDashLen == rB.mnDashLen + && mnDotCount == rB.mnDotCount + && mnDotLen == rB.mnDotLen + && mnDistance == rB.mnDistance + && meLineJoin == rB.meLineJoin); +} + // ------------ // - LineInfo - // ------------ @@ -125,13 +139,7 @@ BOOL LineInfo::operator==( const LineInfo& rLineInfo ) const DBG_CHKOBJ( &rLineInfo, LineInfo, NULL ); return( mpImplLineInfo == rLineInfo.mpImplLineInfo || - ( mpImplLineInfo->meStyle == rLineInfo.mpImplLineInfo->meStyle && - mpImplLineInfo->mnWidth == rLineInfo.mpImplLineInfo->mnWidth && - mpImplLineInfo->mnDashCount == rLineInfo.mpImplLineInfo->mnDashCount && - mpImplLineInfo->mnDashLen == rLineInfo.mpImplLineInfo->mnDashLen && - mpImplLineInfo->mnDotCount == rLineInfo.mpImplLineInfo->mnDotCount && - mpImplLineInfo->mnDotLen == rLineInfo.mpImplLineInfo->mnDotLen && - mpImplLineInfo->mnDistance == rLineInfo.mpImplLineInfo->mnDistance ) ); + *mpImplLineInfo == *rLineInfo.mpImplLineInfo ); } // ----------------------------------------------------------------------- -- cgit From 6b142d676ff9461e78a4cbe5afbea5d71c8d82f7 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 1 Dec 2010 16:53:56 +0100 Subject: #i51583# avoid text clipping in MsgBox --- vcl/source/window/msgbox.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index d00d569883d5..78a09e50c09f 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -422,6 +422,8 @@ void MessBox::ImplPosControls() } mpFixedText = new FixedText( this, nWinStyle ); + if( mpFixedText->GetStyle() & WB_EXTRAOFFSET ) // TODO: use CalcMinimumSize() instead + aFixedSize.Width() += 2; mpFixedText->SetPosSizePixel( aTextPos, aFixedSize ); mpFixedText->SetText( aMessText ); mpFixedText->Show(); -- cgit From 8130d39f6b56271aedad5dcfd0d2f065ef15acaf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 2 Dec 2010 14:26:04 +0100 Subject: vcl118: #i115871# include proper header --- vcl/unx/inc/dtint.hxx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/inc/dtint.hxx b/vcl/unx/inc/dtint.hxx index 75f197c81e13..6e6cf13575ed 100644 --- a/vcl/unx/inc/dtint.hxx +++ b/vcl/unx/inc/dtint.hxx @@ -31,19 +31,12 @@ #include #include #include +#include "svunx.h" class SalBitmap; class SalDisplay; class AllSettings; -#ifndef _XLIB_H_ -// forwards from X -struct Display; -struct XEvent; -#define Atom UINT32 -#define XLIB_Window UINT32 -#endif - enum DtType { DtGeneric, DtCDE -- cgit From c54074891ced6fae534d1d1c5c8725a2116ec72c Mon Sep 17 00:00:00 2001 From: caolanm Date: Mon, 6 Dec 2010 11:28:14 +0100 Subject: fix glyph fallback for cairocanvas (thanks cmc) * set font fallback info on glyph vector inside vcl * pick actual fallback font when rendering glyphs in cairocanvas --- vcl/inc/vcl/sysdata.hxx | 5 ++++- vcl/source/gdi/outdev3.cxx | 8 ++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx index 1146f1b3b842..b9feeaf3a2aa 100644 --- a/vcl/inc/vcl/sysdata.hxx +++ b/vcl/inc/vcl/sysdata.hxx @@ -150,6 +150,7 @@ struct SystemGlyphData unsigned long index; double x; double y; + int fallbacklevel; }; @@ -178,12 +179,14 @@ struct SystemFontData // - SystemTextLayoutData - // -------------------- +typedef std::vector SystemGlyphDataVector; + struct SystemTextLayoutData { unsigned long nSize; // size in bytes of this structure std::vector rGlyphData; // glyph data int orientation; // Text orientation - SystemFontData aSysFontData; // Font data for the text layout }; #endif // _SV_SYSDATA_HXX + diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index f4ea98484c33..ad99b7be2070 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -7414,7 +7414,6 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c // setup glyphs Point aPos; sal_GlyphId aGlyphId; - int nFallbacklevel = 0; for( int nStart = 0; rLayout->GetNextGlyphs( 1, &aGlyphId, aPos, nStart ); ) { // NOTE: Windows backend is producing unicode chars (ucs4), so on windows, @@ -7424,15 +7423,12 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c aGlyph.index = static_cast (aGlyphId & GF_IDXMASK); aGlyph.x = aPos.X(); aGlyph.y = aPos.Y(); - aSysLayoutData.rGlyphData.push_back(aGlyph); - int nLevel = (aGlyphId & GF_FONTMASK) >> GF_FONTSHIFT; - if (nLevel > nFallbacklevel && nLevel < MAX_FALLBACK) - nFallbacklevel = nLevel; + aGlyph.fallbacklevel = nLevel < MAX_FALLBACK ? nLevel : 0; + aSysLayoutData.rGlyphData.push_back(aGlyph); } // Get font data - aSysLayoutData.aSysFontData = GetSysFontData(nFallbacklevel); aSysLayoutData.orientation = rLayout->GetOrientation(); rLayout->Release(); -- cgit From 307b80588f4ff2b8aa4493b11c75f7123bd26961 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 30 Nov 2010 15:55:22 +0100 Subject: vcl118: #i115838# enable OutDevSupport_B2DClip on Windows --- vcl/win/source/gdi/salgdi.cxx | 37 ++++++++++++++++++++++++++++++----- vcl/win/source/gdi/salgdi2.cxx | 3 +++ vcl/win/source/gdi/salgdi_gdiplus.cxx | 0 3 files changed, 35 insertions(+), 5 deletions(-) mode change 100644 => 100755 vcl/win/source/gdi/salgdi.cxx mode change 100644 => 100755 vcl/win/source/gdi/salgdi2.cxx mode change 100644 => 100755 vcl/win/source/gdi/salgdi_gdiplus.cxx (limited to 'vcl') diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx old mode 100644 new mode 100755 index eb260eb808c6..a42636295592 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -37,6 +37,8 @@ #include #include #include +#include +#include #ifndef _RTL_STRINGBUF_HXX #include #endif @@ -927,10 +929,34 @@ BOOL WinSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeigh // ----------------------------------------------------------------------- -bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) +bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPolygon ) { - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; + const sal_uInt32 nCount(rPolyPolygon.count()); + + if( nCount ) + { + std::vector< POINT > aPolyPoints; + aPolyPoints.reserve( 1024 ); + std::vector< INT > aPolyCounts( nCount, 0 ); + for(sal_uInt32 a(0); a < nCount; a++) + { + basegfx::B2DPolygon aPoly( rPolyPolygon.getB2DPolygon(a) ); + aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); + const sal_uInt32 nPoints = aPoly.count(); + aPolyCounts[a] = nPoints; + for( sal_uInt32 b = 0; b < nPoints; b++ ) + { + basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + POINT aPOINT; + aPOINT.x = (LONG)aPt.getX(); + aPOINT.y = (LONG)aPt.getY(); + aPolyPoints.push_back( aPOINT ); + } + } + mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE ); + } + + return true; } // ----------------------------------------------------------------------- @@ -944,7 +970,7 @@ void WinSalGraphics::EndSetClipRegion() mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); } - else + else if( mpClipRgnData->rdh.nCount > 1 ) { ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); @@ -973,7 +999,8 @@ void WinSalGraphics::EndSetClipRegion() delete [] mpClipRgnData; } - SelectClipRgn( mhDC, mhRegion ); + if( mhRegion ) + SelectClipRgn( mhDC, mhRegion ); } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx old mode 100644 new mode 100755 index 803c0886f429..68d70c4ce74c --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -51,6 +51,9 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const case OutDevSupport_TransparentRect: bRet = mbVirDev || mbWindow; break; + case OutDevSupport_B2DClip: + bRet = true; + break; case OutDevSupport_B2DDraw: bRet = bAllowForTest; default: break; diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx old mode 100644 new mode 100755 -- cgit From baddf3f156c3c557c3615aec46b1f95df292a0fd Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 1 Dec 2010 14:42:59 +0100 Subject: vcl118: #i115838# improve region with respect to polygonal regions --- vcl/inc/vcl/region.hxx | 4 ++ vcl/source/gdi/region.cxx | 175 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) mode change 100644 => 100755 vcl/inc/vcl/region.hxx mode change 100644 => 100755 vcl/source/gdi/region.cxx (limited to 'vcl') diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx old mode 100644 new mode 100755 index ddfba57ffdcf..87946574707c --- a/vcl/inc/vcl/region.hxx +++ b/vcl/inc/vcl/region.hxx @@ -76,6 +76,10 @@ private: SAL_DLLPRIVATE void ImplBeginAddRect( ); SAL_DLLPRIVATE BOOL ImplAddRect( const Rectangle& rRect ); SAL_DLLPRIVATE void ImplEndAddRect( ); + SAL_DLLPRIVATE void ImplIntersectWithPolyPolygon( const Region& ); + SAL_DLLPRIVATE void ImplExcludePolyPolygon( const Region& ); + SAL_DLLPRIVATE void ImplUnionPolyPolygon( const Region& ); + SAL_DLLPRIVATE void ImplXOrPolyPolygon( const Region& ); #ifdef DBG_UTIL friend const char* ImplDbgTestRegion( const void* pObj ); diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx old mode 100644 new mode 100755 index 4931ee66e93f..067f5c214323 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include #include @@ -1376,6 +1378,28 @@ BOOL Region::Union( const Rectangle& rRect ) if ( rRect.IsEmpty() ) return TRUE; + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = rRect; + return true; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); // no instance data? -> create! @@ -1446,6 +1470,22 @@ BOOL Region::Intersect( const Rectangle& rRect ) return TRUE; } + else if( mpImplRegion->mpB2DPolyPoly ) + { + // #127431# make ImplRegion unique, if not already. + if( mpImplRegion->mnRefCount > 1 ) + { + mpImplRegion->mnRefCount--; + mpImplRegion = new ImplRegion( *mpImplRegion->mpB2DPolyPoly ); + } + + *mpImplRegion->mpB2DPolyPoly = + basegfx::tools::clipPolyPolygonOnRange( *mpImplRegion->mpB2DPolyPoly, + basegfx::B2DRange( rRect.Left(), rRect.Top(), + rRect.Right(), rRect.Bottom() ), + true, false ); + return TRUE; + } else ImplPolyPolyRegionToBandRegion(); @@ -1529,6 +1569,25 @@ BOOL Region::Exclude( const Rectangle& rRect ) if ( rRect.IsEmpty() ) return TRUE; + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + return TRUE; + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); // no instance data? -> create! @@ -1571,6 +1630,28 @@ BOOL Region::XOr( const Rectangle& rRect ) if ( rRect.IsEmpty() ) return TRUE; + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = rRect; + return TRUE; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); // no instance data? -> create! @@ -1604,11 +1685,38 @@ BOOL Region::XOr( const Rectangle& rRect ) } // ----------------------------------------------------------------------- +void Region::ImplUnionPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); + + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); + + *this = Region( aClip ); +} BOOL Region::Union( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplUnionPolyPolygon( rRegion ); + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); @@ -1654,6 +1762,22 @@ BOOL Region::Union( const Region& rRegion ) } // ----------------------------------------------------------------------- +void Region::ImplIntersectWithPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast(i_rRegion).ConvertToB2DPolyPolygon() ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aOtherPolyPoly, aThisPolyPoly, true, false ); + *this = Region( aClip ); +} BOOL Region::Intersect( const Region& rRegion ) { @@ -1663,6 +1787,12 @@ BOOL Region::Intersect( const Region& rRegion ) if ( mpImplRegion == rRegion.mpImplRegion ) return TRUE; + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplIntersectWithPolyPolygon( rRegion ); + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); @@ -1793,11 +1923,32 @@ BOOL Region::Intersect( const Region& rRegion ) } // ----------------------------------------------------------------------- +void Region::ImplExcludePolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + return; + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); +} BOOL Region::Exclude( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplExcludePolyPolygon( rRegion ); + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); @@ -1846,11 +1997,35 @@ BOOL Region::Exclude( const Region& rRegion ) } // ----------------------------------------------------------------------- +void Region::ImplXOrPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); +} BOOL Region::XOr( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplXOrPolyPolygon( rRegion ); + return TRUE; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); -- cgit From ead04f8f0b7f51bf281ce41d8d590df0ca14af38 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 3 Dec 2010 16:21:36 +0100 Subject: vcl118: #i115905# improved clip region interface on SAL layer (part 1, windows implementation) --- vcl/inc/vcl/outdev.hxx | 2 - vcl/inc/vcl/region.hxx | 9 +- vcl/inc/vcl/salgdi.hxx | 11 +- vcl/source/gdi/outdev.cxx | 829 +--------------------------------------- vcl/source/gdi/salgdilayout.cxx | 60 +-- vcl/win/inc/salgdi.h | 10 +- vcl/win/source/gdi/salgdi.cxx | 226 ++++++----- 7 files changed, 170 insertions(+), 977 deletions(-) mode change 100644 => 100755 vcl/inc/vcl/outdev.hxx mode change 100644 => 100755 vcl/inc/vcl/salgdi.hxx mode change 100644 => 100755 vcl/source/gdi/outdev.cxx (limited to 'vcl') diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx old mode 100644 new mode 100755 index 8edc8c3d6c47..9fad9b0af619 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -400,7 +400,6 @@ public: SAL_DLLPRIVATE void ImplInitClipRegion(); SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL ); SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion ); - SAL_DLLPRIVATE void ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon ); SAL_DLLPRIVATE SalLayout* ImplLayout( const String&, xub_StrLen nIndex, xub_StrLen nLen, const Point& rLogicPos = Point(0,0), @@ -838,7 +837,6 @@ public: void SetClipRegion(); void SetClipRegion( const Region& rRegion ); - void SetTriangleClipRegion( const PolyPolygon &rRegion ); Region GetClipRegion() const; BOOL IsClipRegion() const { return mbClipRegion; } Region GetActiveClipRegion() const; diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx index 87946574707c..ed1dc27f85eb 100755 --- a/vcl/inc/vcl/region.hxx +++ b/vcl/inc/vcl/region.hxx @@ -69,10 +69,6 @@ private: SAL_DLLPRIVATE inline void ImplPolyPolyRegionToBandRegion(); SAL_DLLPRIVATE const ImplRegion* ImplGetImplRegion() const { return mpImplRegion; } SAL_DLLPRIVATE ImplRegion* ImplGetImplRegion() { return mpImplRegion; } - SAL_DLLPRIVATE BOOL ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, - long& nX, long& nY, long& nWidth, long& nHeight ) const; - SAL_DLLPRIVATE BOOL ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, - long& nX, long& nY, long& nWidth, long& nHeight ) const; SAL_DLLPRIVATE void ImplBeginAddRect( ); SAL_DLLPRIVATE BOOL ImplAddRect( const Rectangle& rRect ); SAL_DLLPRIVATE void ImplEndAddRect( ); @@ -81,6 +77,11 @@ private: SAL_DLLPRIVATE void ImplUnionPolyPolygon( const Region& ); SAL_DLLPRIVATE void ImplXOrPolyPolygon( const Region& ); +public: // public within vcl + SAL_DLLPRIVATE BOOL ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, + long& nX, long& nY, long& nWidth, long& nHeight ) const; + SAL_DLLPRIVATE BOOL ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, + long& nX, long& nY, long& nWidth, long& nHeight ) const; #ifdef DBG_UTIL friend const char* ImplDbgTestRegion( const void* pObj ); #endif diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx old mode 100644 new mode 100755 index d8276406746e..135d0a85b28e --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -114,8 +114,7 @@ public: virtual ~SalGraphics(); protected: - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ) = 0; + virtual bool setClipRegion( const Region& ) = 0; // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ) = 0; virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0; @@ -205,11 +204,6 @@ public: // set the clip region to empty virtual void ResetClipRegion() = 0; - // begin setting the clip region, add rectangles to the - // region with the UnionClipRegion call - virtual void BeginSetClipRegion( ULONG nCount ) = 0; - // all rectangles were added and the clip region should be set now - virtual void EndSetClipRegion() = 0; // set the line color to transparent (= don't draw lines) virtual void SetLineColor() = 0; @@ -358,8 +352,7 @@ public: // non virtual methods; these do eventual coordinate mirroring and // then delegate to protected virtual methods - BOOL UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ); - BOOL UnionClipRegion( const ::basegfx::B2DPolyPolygon&, const OutputDevice* ); + bool SetClipRegion( const Region&, const OutputDevice *pOutDev ); // draw --> LineColor and FillColor and RasterOp and ClipRegion void DrawPixel( long nX, long nY, const OutputDevice *pOutDev ); diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx old mode 100644 new mode 100755 index 26a831c7600c..c9a75bb12053 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -214,91 +214,8 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr pGraphics = mpGraphics; } - if( rRegion.HasPolyPolygon() - && pGraphics->supportsOperation( OutDevSupport_B2DClip ) ) - { - const ::basegfx::B2DPolyPolygon& rB2DPolyPolygon = rRegion.GetB2DPolyPolygon(); - pGraphics->BeginSetClipRegion( 0 ); - pGraphics->UnionClipRegion( rB2DPolyPolygon, pOutDev ); - pGraphics->EndSetClipRegion(); - return true; - } - - long nX; - long nY; - long nWidth; - long nHeight; - ULONG nRectCount; - ImplRegionInfo aInfo; - BOOL bRegionRect; - BOOL bClipRegion = TRUE; - const BOOL bClipDeviceBounds( !pOutDev->GetPDFWriter() - && pOutDev->GetOutDevType() != OUTDEV_PRINTER ); - - nRectCount = rRegion.GetRectCount(); - pGraphics->BeginSetClipRegion( nRectCount ); - bRegionRect = rRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); - if( bClipDeviceBounds ) - { - // #b6520266# Perform actual rect clip against outdev - // dimensions, to generate empty clips whenever one of the - // values is completely off the device. - const long nOffX( pOutDev->mnOutOffX ); - const long nOffY( pOutDev->mnOutOffY ); - const long nDeviceWidth( pOutDev->GetOutputWidthPixel() ); - const long nDeviceHeight( pOutDev->GetOutputHeightPixel() ); - Rectangle aDeviceBounds( nOffX, nOffY, - nOffX+nDeviceWidth-1, - nOffY+nDeviceHeight-1 ); - while ( bRegionRect ) - { - // #i59315# Limit coordinates passed to sal layer to actual - // outdev dimensions - everything else bears the risk of - // overflowing internal coordinates (e.g. the 16 bit wire - // format of X11). - Rectangle aTmpRect(nX,nY,nX+nWidth-1,nY+nHeight-1); - aTmpRect.Intersection(aDeviceBounds); - - if( !aTmpRect.IsEmpty() ) - { - if ( !pGraphics->UnionClipRegion( aTmpRect.Left(), - aTmpRect.Top(), - aTmpRect.GetWidth(), - aTmpRect.GetHeight(), - pOutDev ) ) - { - bClipRegion = FALSE; - } - } - else - { - // #i79850# Fake off-screen clip - if ( !pGraphics->UnionClipRegion( nDeviceWidth+1, - nDeviceHeight+1, - 1, 1, - pOutDev ) ) - { - bClipRegion = FALSE; - } - } - DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't create region" ); - bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); - } - } - else - { - // #i65720# Actually, _don't_ clip anything on printer or PDF - // export, since output might be visible outside the specified - // device boundaries. - while ( bRegionRect ) - { - if ( !pGraphics->UnionClipRegion( nX, nY, nWidth, nHeight, pOutDev ) ) - bClipRegion = FALSE; - DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" ); - bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); - } - } - pGraphics->EndSetClipRegion(); + bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); + OSL_ENSURE( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" ); return bClipRegion; } @@ -1075,9 +992,22 @@ void OutputDevice::ImplInitClipRegion() else { mbOutputClipped = FALSE; - ImplSelectClipRegion( - // #102532# Respect output offset also for clip region - ImplPixelToDevicePixel( maRegion ) ); + + // #102532# Respect output offset also for clip region + Region aRegion( ImplPixelToDevicePixel( maRegion ) ); + const BOOL bClipDeviceBounds( ! GetPDFWriter() + && GetOutDevType() != OUTDEV_PRINTER ); + if( bClipDeviceBounds ) + { + // #b6520266# Perform actual rect clip against outdev + // dimensions, to generate empty clips whenever one of the + // values is completely off the device. + Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, + mnOutOffX+GetOutputWidthPixel()-1, + mnOutOffY+GetOutputHeightPixel()-1 ); + aRegion.Intersect( aDeviceBounds ); + } + ImplSelectClipRegion( aRegion ); } mbClipRegionSet = TRUE; @@ -1122,693 +1052,6 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion ) // ----------------------------------------------------------------------- -namespace -{ - inline int iround( float x ) - { - union - { - float f; - sal_Int32 i; - }; - f = x; - sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF); - sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent; - r &= ((exponent - 32) >> 31); - sal_Int32 sign = i >> 31; - return r = (r ^ sign) - sign; - } - - inline int floorDiv(int a, int b) - { - if(b == 0) - return 0x80000000; - if(a >= 0) - return a / b; - int q = -(-a / b); // quotient - int r = -a % b; // remainder - if(r) - q--; - return q; - } - - inline int floorMod( int a, int b ) - { - if(b == 0) - return 0x80000000; - if(a >= 0) - return a % b; - int r = -a % b; // remainder - if(r) - r = b - r; - return r; - } - - inline int ceilDiv( int a, int b ) - { - if(b == 0) - return 0x80000000; - a += - 1 + b; - if(a >= 0) - return a / b; - int q = -(-a / b); // quotient - int r = -a % b; // remainder - if(r) - q--; - return q; - } - - inline int ceilMod( int a, int b ) - { - if(b == 0) - return 0x80000000; - a += - 1 + b; - if(a >= 0) - return (a % b) + 1 - b; - int r = -a % b; - if(r) - r = b - r; - return r + 1 - b; - } - - inline int ceilFix4(int x) { return (x + 0xF) & 0xFFFFFFF0; } - - struct vertex - { - float x,y; - inline vertex( const Point &p ) - : x((float)p.getX()),y((float)p.getY()) {} - }; - - template inline void swap(T &a, T &b) { T t=a; a=b; b=t; } - - class SpanIterator - { - public: - - SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines ); - std::pair GetNextSpan( void ); - sal_Int32 GetNumRemainingScanlines( void ); - sal_Int32 GetNumEqualScanlines( void ); - SpanIterator &operator++ (); - SpanIterator &Skip( sal_Int32 dwNumScanlines ); - sal_Int32 GetRemainingSpans( void ) const { return maNumSpans; } - - private: - - sal_Int32 *mpTable; - sal_Int32 *mpSpanArray; - sal_Int32 maNumSpans; - sal_Int32 maRemainingScanlines; - size_t maPitch; - }; - - inline SpanIterator::SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines ) - : mpTable(pTable),maRemainingScanlines(dwNumScanlines),maPitch(dwPitch) - { - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast(pNumSpans+2); - maNumSpans = *pNumSpans; - } - - inline SpanIterator &SpanIterator::operator++ () - { - --maRemainingScanlines; - mpTable += maPitch; - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast(pNumSpans+2); - maNumSpans = *pNumSpans; - return (*this); - } - - inline SpanIterator &SpanIterator::Skip( sal_Int32 dwNumScanlines ) - { - // don't skip more scanlines than there are... - if(dwNumScanlines > maRemainingScanlines) - dwNumScanlines = maRemainingScanlines; - - // skip in one fellow swoop... - maRemainingScanlines -= dwNumScanlines; - mpTable += maPitch * dwNumScanlines; - - // initialize necessary query fields... - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast(pNumSpans+2); - maNumSpans = *pNumSpans; - return (*this); - } - - inline std::pair SpanIterator::GetNextSpan( void ) - { - sal_Int32 x(0); - sal_Int32 w(0); - if(maNumSpans) - { - x = *mpSpanArray++; - w = *mpSpanArray++; - --maNumSpans; - } - return std::pair(x,w); - } - - inline sal_Int32 SpanIterator::GetNumEqualScanlines( void ) - { - return mpTable[1]; - } - - inline sal_Int32 SpanIterator::GetNumRemainingScanlines( void ) - { - return maRemainingScanlines; - } - - class ScanlineContainer - { - - public: - - ScanlineContainer( sal_uInt32 dwNumScanlines, - sal_uInt32 dwNumSpansPerScanline ); - - ~ScanlineContainer( void ); - - void InsertSpan( sal_Int32 y, sal_Int32 lx, sal_Int32 rx ); - - SpanIterator Iterate( void ) const { return SpanIterator(mpTable,maPitch,maNumScanlines); } - - inline sal_uInt32 GetNumSpans( void ) const { return maNumberOfSpans; } - - void Consolidate( void ); - - private: - - // the span table will assist in determinate exactly how many clipping - // regions [that is *spans*] we will end up with. - // the counter for this purpose is right ahead. - sal_uInt32 maNumberOfSpans; - - struct span - { - sal_Int32 x; - sal_Int32 w; - }; - - sal_uInt32 maNumScanlines; - sal_uInt32 maNumSpansPerScanline; - sal_Int32 *mpTable; - size_t maPitch; - }; - - ScanlineContainer::ScanlineContainer( sal_uInt32 dwNumScanlines, - sal_uInt32 dwNumSpansPerScanline ) : maNumScanlines(dwNumScanlines), - maNumSpansPerScanline(dwNumSpansPerScanline) - { - // #128002# add one scanline buffer at the end, as - // SpanIterator::Skip reads two bytes past the end. - ++dwNumScanlines; - - // since each triangle could possibly add another span - // we can calculate the upper limit by [num scanlines * num triangles]. - const sal_uInt32 dwNumPossibleRegions = dwNumScanlines*dwNumSpansPerScanline; - - // calculate the number of bytes the span table will consume - const size_t dwTableSize = dwNumPossibleRegions*sizeof(span)+dwNumScanlines*(sizeof(sal_Int32)<<1); - - // allocate the span table [on the stack] - mpTable = static_cast(rtl_allocateMemory(dwTableSize)); - - // calculate the table pitch, that is how many int's do i need to get from a scanline to the next. - maPitch = (dwNumSpansPerScanline*sizeof(span)/sizeof(sal_Int32))+2; - - // we need to initialize the table here. - // the first *int* on each scanline tells us how many spans are on it. - sal_Int32 *pNumSpans = mpTable; - for(unsigned int i=0; i(pNumSpans+2); - - // retrieve the number of already contained spans. - sal_Int32 dwNumSpan = *pNumSpans; - - // since we need to sort the spans from top to bottom - // and left to right, we need to find the correct location - // in the table. - sal_Int32 dwIndex = 0; - while(dwIndex lx) - break; - - // forward to next element in the list. - ++dwIndex; - } - - // if we reach here, the new span needs to be stored - // in the table, increase the number of spans in the - // current scanline. - *pNumSpans = dwNumSpan+1; - - // keep the list of spans in sorted order. 'dwIndex' - // is where we want to store the new span. 'dwNumSpan' - // is the number of spans already there. now we need - // to move the offending spans out of the way. - while(dwIndex != dwNumSpan) - { - pSpanArray[dwNumSpan].x = pSpanArray[dwNumSpan-1].x; - pSpanArray[dwNumSpan].w = pSpanArray[dwNumSpan-1].w; - --dwNumSpan; - } - - // insert the new span - pSpanArray[dwIndex].x = lx; - pSpanArray[dwIndex].w = rx-lx; - - // remember the total number of spans in the table. - ++maNumberOfSpans; - } - } - - void ScanlineContainer::Consolidate( void ) - { - sal_Int32 *pScanline = mpTable; - - sal_Int32 dwRemaining = maNumScanlines; - while(dwRemaining) - { - sal_Int32 dwNumSpans = pScanline[0]; - sal_Int32 *pSpanArray = pScanline+2; - - sal_Int32 dwRest = dwRemaining-1; - sal_Int32 *pNext = pScanline; - while(dwRest) - { - pNext += maPitch; - sal_Int32 dwNumNextSpans = pNext[0]; - sal_Int32 *pSpanArrayNext = pNext+2; - if(dwNumSpans != dwNumNextSpans) - break; - - sal_Int32 dwCompare = dwNumSpans<<1; - while(dwCompare) - { - if(pSpanArray[dwCompare-1] != pSpanArrayNext[dwCompare-1]) - break; - --dwCompare; - } - if(dwCompare) - break; - - --dwRest; - } - - const sal_Int32 dwNumEqualScanlines(dwRemaining-dwRest); - pScanline[1] = dwNumEqualScanlines; - pScanline += maPitch*dwNumEqualScanlines; - dwRemaining -= dwNumEqualScanlines; - - // since we track the total number of spans to generate, - // we need to account for consolidated scanlines here. - if(dwNumEqualScanlines > 1) - maNumberOfSpans -= dwNumSpans * (dwNumEqualScanlines-1); - } - } -} - -// TODO: we should consider passing a basegfx b2dpolypolygon here to -// ensure that the signature isn't misleading. -// if we could pass a b2dpolypolygon here, we could easily triangulate it. -void OutputDevice::ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon ) -{ - DBG_TESTSOLARMUTEX(); - - if(!(IsDeviceOutputNecessary())) - return; - if(!(mpGraphics)) - if(!(ImplGetGraphics())) - return; - - if( mpGraphics->supportsOperation( OutDevSupport_B2DClip ) ) - { -#if 0 - ::basegfx::B2DPolyPolygon aB2DPolyPolygon = rPolyPolygon.getB2DPolyPolygon(); -#else - // getB2DPolyPolygon() "optimizes away" some points - // which prevents reliable undoing of the "triangle thingy" parameter - // so the toolspoly -> b2dpoly conversion has to be done manually - ::basegfx::B2DPolyPolygon aB2DPolyPolygon; - for( USHORT nPolyIdx = 0; nPolyIdx < rPolyPolygon.Count(); ++nPolyIdx ) - { - const Polygon& rPolygon = rPolyPolygon[ nPolyIdx ]; - ::basegfx::B2DPolygon aB2DPoly; - for( USHORT nPointIdx = 0; nPointIdx < rPolygon.GetSize(); ++nPointIdx ) - { - const Point& rPoint = rPolygon[ nPointIdx ]; - const ::basegfx::B2DPoint aB2DPoint( rPoint.X(), rPoint.Y() ); - aB2DPoly.append( aB2DPoint ); - } - aB2DPolyPolygon.append( aB2DPoly ); - } -#endif - - const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); - aB2DPolyPolygon.transform( aTransform ); - - // the rPolyPolygon argument is a "triangle thingy" - // so convert it to a normal polypolyon first - ::basegfx::B2DPolyPolygon aPolyTriangle; - const int nPolyCount = aB2DPolyPolygon.count(); - for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) - { - const ::basegfx::B2DPolygon rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - const int nPointCount = rPolygon.count(); - for( int nPointIdx = 0; nPointIdx+2 < nPointCount; nPointIdx +=3 ) - { - ::basegfx::B2DPolygon aTriangle; - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+0 ) ); - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+1 ) ); - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+2 ) ); - aPolyTriangle.append( aTriangle ); - } - } - - // now set the clip region with the real polypolygon - mpGraphics->BeginSetClipRegion( 0 ); - mpGraphics->UnionClipRegion( aPolyTriangle, this ); - mpGraphics->EndSetClipRegion(); - - // and mark the clip status as ready - mbOutputClipped = FALSE; - mbClipRegion = TRUE; - mbClipRegionSet = TRUE; - mbInitClipRegion = FALSE; - return; - } - - sal_Int32 offset_x = 0; - sal_Int32 offset_y = 0; - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - offset_x = mnOutOffX+mnOutOffOrigX; - offset_y = mnOutOffY+mnOutOffOrigY; - } - - // first of all we need to know the upper limit - // of the amount of possible clipping regions. - sal_Int32 maxy = SAL_MIN_INT32; - sal_Int32 miny = SAL_MAX_INT32; - sal_uInt32 dwNumTriangles = 0; - for(USHORT i=0; i maxy) - maxy = p.Y(); - } - dwNumTriangles += dwNumVertices / 3; - } - } - - const sal_uInt32 dwNumScanlines = (maxy-miny); - if(!(dwNumScanlines)) - { - // indicates that no output needs to be produced - // since the clipping region did not provide any - // visible areas. - mbOutputClipped = TRUE; - - // indicates that a clip region has been - // presented to the output device. - mbClipRegion = TRUE; - - // indicates that the set clipping region - // has been processed. - mbClipRegionSet = TRUE; - - // under 'normal' circumstances a new clipping region - // needs to be processed by ImplInitClipRegion(), - // which we need to circumvent. - mbInitClipRegion = FALSE; - return; - } - - // this container provides all services we need to - // efficiently store/retrieve spans from the table. - const sal_uInt32 dwNumSpansPerScanline = dwNumTriangles; - ScanlineContainer container(dwNumScanlines,dwNumSpansPerScanline); - - // convert the incoming polypolygon to spans, we assume that - // the polypolygon has already been triangulated since we don't - // want to use the basegfx-types here. this could be leveraged - // after the tools-types had been removed. - for(USHORT i=0; i v2.y) ::swap(v0, v2); - if(v1.y > v2.y) ::swap(v1, v2); - if(v0.y > v1.y) ::swap(v0, v1); - - const float float2fixed(16.0f); - - // vertex coordinates of the triangle [28.4 fixed-point] - const int i4x0 = iround(float2fixed * (v0.x - 0.5f)); - const int i4y0 = iround(float2fixed * (v0.y - 0.5f)); - const int i4x1 = iround(float2fixed * (v1.x - 0.5f)); - const int i4y1 = iround(float2fixed * (v1.y - 0.5f)); - const int i4x2 = iround(float2fixed * (v2.x - 0.5f)); - const int i4y2 = iround(float2fixed * (v2.y - 0.5f)); - - // vertex coordinate deltas [28.4 fixed-point] - const int i4dx12 = i4x1-i4x0; - const int i4dy12 = i4y1-i4y0; - const int i4dx13 = i4x2-i4x0; - const int i4dy13 = i4y2-i4y0; - const int i4dx23 = i4x2-i4x1; - const int i4dy23 = i4y2-i4y1; - - // slope of edges [quotient,remainder] - const int mq12 = floorDiv(i4dx12 << 4, i4dy12 << 4); - const int mq13 = floorDiv(i4dx13 << 4, i4dy13 << 4); - const int mq23 = floorDiv(i4dx23 << 4, i4dy23 << 4); - const int mr12 = floorMod(i4dx12 << 4, i4dy12 << 4); - const int mr13 = floorMod(i4dx13 << 4, i4dy13 << 4); - const int mr23 = floorMod(i4dx23 << 4, i4dy23 << 4); - - // convert the vertical coordinates back to integers. - // according to the top-left fillrule we need to step - // the coordinates to the ceiling. - const int y0 = (i4y0+15)>>4; - const int y1 = (i4y1+15)>>4; - const int y2 = (i4y2+15)>>4; - - // calculate the value of the horizontal coordinate - // from the edge that 'spans' the triangle. - const int x = ceilDiv(i4dx13*i4dy12 + i4x0*i4dy13, i4dy13); - - // this will hold the horizontal coordinates - // of the seperate spans during the rasterization process. - int lx,rx; - - // this pair will serve as the error accumulator while - // we step along the edges. - int ld,rd,lD,rD; - - // these are the edge and error stepping values that - // will be used while stepping. - int lQ,rQ,lR,rR; - - if(i4x1 < x) - { - lx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - ld = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - rx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rd = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - lQ = mq12; - rQ = mq13; - lR = mr12; - rR = mr13; - lD = i4dy12 << 4; - rD = i4dy13 << 4; - } - else - { - lx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - ld = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - rd = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - lQ = mq13; - rQ = mq12; - lR = mr13; - rR = mr12; - lD = i4dy13 << 4; - rD = i4dy12 << 4; - } - - for(signed int y=y0; y 0) { ld -= lD; lx += 1; } - rx += rQ; rd += rR; - if(rd > 0) { rd -= rD; rx += 1; } - } - - if(i4x1 < x) - { - lx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - ld = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rx = ceilDiv(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rd = ceilMod(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - lQ = mq23; - lR = mr23; - lD = i4dy23 << 4; - } - else - { - rx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rd = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rQ = mq23; - rR = mr23; - rD = i4dy23 << 4; - } - - for(signed int y=y1; y 0) { ld -= lD; lx += 1; } - rx += rQ; rd += rR; - if(rd > 0) { rd -= rD; rx += 1; } - } - } - } - } - - // now try to consolidate as many scanlines as possible. - // please note that this will probably change the number - // of spans [at least this is why we do all this hassle]. - // so, if you use 'consolidate' you should *use* this - // information during iteration, because the 'graphics' - // object we tell all those regions about is a bit, - // hm, how to say, *picky* if you supply not correctly - // the amount of regions. - container.Consolidate(); - - // now forward the spantable to the graphics handler. - SpanIterator it(container.Iterate()); - mpGraphics->BeginSetClipRegion( container.GetNumSpans() ); - while(miny < maxy) - { - const sal_Int32 dwNumEqual(it.GetNumEqualScanlines()); - while(it.GetRemainingSpans()) - { - // retrieve the next span [x-coordinate, width] from the current scanline. - std::pair span(it.GetNextSpan()); - - // now forward this to the graphics object. - // the only part that is worth noting is that we use - // the number of equal spanlines [the current is always the - // first one of the equal bunch] as the height of the region. - mpGraphics->UnionClipRegion( offset_x+span.first, - offset_y+miny, - span.second, - dwNumEqual, - this ); - } - it.Skip(dwNumEqual); - miny += dwNumEqual; - } - mpGraphics->EndSetClipRegion(); - - // indicates that no output needs to be produced - // since the clipping region did not provide any - // visible areas. the clip covers the whole area - // if there's not a single region. - mbOutputClipped = (container.GetNumSpans() == 0); - - // indicates that a clip region has been - // presented to the output device. - mbClipRegion = TRUE; - - // indicates that the set clipping region - // has been processed. - mbClipRegionSet = TRUE; - - // under 'normal' circumstances a new clipping region - // needs to be processed by ImplInitClipRegion(), - // which we need to circumvent. - mbInitClipRegion = FALSE; -} - -// ----------------------------------------------------------------------- - void OutputDevice::SetClipRegion() { DBG_TRACE( "OutputDevice::SetClipRegion()" ); @@ -1848,42 +1091,6 @@ void OutputDevice::SetClipRegion( const Region& rRegion ) // ----------------------------------------------------------------------- -void OutputDevice::SetTriangleClipRegion( const PolyPolygon &rPolyPolygon ) -{ - DBG_TRACE( "OutputDevice::SetTriangleClipRegion( rPolyPolygon )" ); - DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - - // in case the passed polypolygon is empty, use the - // existing SetClipRegion() method which gracefully - // unsets any previously set clipping region. - if(!(rPolyPolygon.Count())) - SetClipRegion(); - - sal_Int32 offset_x = 0; - sal_Int32 offset_y = 0; - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - offset_x = mnOutOffX+mnOutOffOrigX; - offset_y = mnOutOffY+mnOutOffOrigY; - } - - // play nice with the rest of the system and provide an old-style region. - // the rest of this method does not rely on this. - maRegion = Region::GetRegionFromPolyPolygon( LogicToPixel(rPolyPolygon) ); - maRegion.Move(offset_x,offset_x); - - // feed region to metafile - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( maRegion, TRUE ) ); - - ImplSetTriangleClipRegion( rPolyPolygon ); - - if( mpAlphaVDev ) - mpAlphaVDev->SetTriangleClipRegion( rPolyPolygon ); -} - -// ----------------------------------------------------------------------- - Region OutputDevice::GetClipRegion() const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 97e11c5a6aa4..f8cb5529c1df 100755 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -253,14 +253,29 @@ BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * void SalGraphics::mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack ) const { - // mirror the bounding rect and move Region by resulting offset - Rectangle aRect( rRgn.GetBoundRect() ); - long nWidth = aRect.GetWidth(); - long x = aRect.Left(); - long x_org = x; + if( rRgn.HasPolyPolygon() ) + { + basegfx::B2DPolyPolygon aPolyPoly( rRgn.ConvertToB2DPolyPolygon() ); + aPolyPoly = mirror( aPolyPoly, pOutDev, bBack ); + rRgn = Region( aPolyPoly ); + } + else + { + ImplRegionInfo aInfo; + bool bRegionRect; + Region aMirroredRegion; + long nX, nY, nWidth, nHeight; - mirror( x, nWidth, pOutDev, bBack ); - rRgn.Move( x - x_org, 0 ); + bRegionRect = rRgn.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); + while ( bRegionRect ) + { + Rectangle aRect( Point(nX, nY), Size(nWidth, nHeight) ); + mirror( aRect, pOutDev, bBack ); + aMirroredRegion.Union( aRect ); + bRegionRect = rRgn.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); + } + rRgn = aMirroredRegion; + } } void SalGraphics::mirror( Rectangle& rRect, const OutputDevice *pOutDev, bool bBack ) const @@ -358,22 +373,15 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP // ---------------------------------------------------------------------------- -BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) +bool SalGraphics::SetClipRegion( const Region& i_rClip, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) - mirror( nX, nWidth, pOutDev ); - return unionClipRegion( nX, nY, nWidth, nHeight ); -} - -bool SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - return false; -} - -BOOL SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const OutputDevice* pOutDev ) -{ - (void)pOutDev;// TODO: SAL_LAYOUT_BIDI_RTL - return unionClipRegion( rPoly ); + { + Region aMirror( i_rClip ); + mirror( aMirror, pOutDev ); + return setClipRegion( aMirror ); + } + return setClipRegion( i_rClip ); } void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) @@ -465,7 +473,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) ); bRet = drawPolyPolygon( aMirror, i_fTransparency ); @@ -483,7 +491,7 @@ bool SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) { sal_Bool bResult = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -498,7 +506,7 @@ sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) { sal_Bool bResult = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -514,7 +522,7 @@ sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt3 const SalPoint* const* i_pPtAry, const BYTE* const* i_pFlgAry, const OutputDevice* i_pOutDev ) { sal_Bool bRet = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[i_nPoly]; @@ -542,7 +550,7 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin ); diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index f592f53ae29c..43f8967497a2 100755 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -152,8 +152,6 @@ public: COLORREF mnTextColor; // TextColor RGNDATA* mpClipRgnData; // ClipRegion-Data RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data - RECT* mpNextClipRect; // Naechstes ClipRegion-Rect - BOOL mbFirstClipRect; // Flag for first cliprect to insert LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x) ImplFontAttrCache* mpFontAttrCache; // Cache font attributes from files in so/share/fonts BYTE* mpFontCharSets; // All Charsets for the current font @@ -183,8 +181,7 @@ public: virtual ~WinSalGraphics(); protected: - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); + virtual bool setClipRegion( const Region& ); // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ); virtual void drawPixel( long nX, long nY, SalColor nSalColor ); @@ -256,11 +253,6 @@ public: // set the clip region to empty virtual void ResetClipRegion(); - // begin setting the clip region, add rectangles to the - // region with the UnionClipRegion call - virtual void BeginSetClipRegion( ULONG nCount ); - // all rectangles were added and the clip region should be set now - virtual void EndSetClipRegion(); // set the line color to transparent (= don't draw lines) virtual void SetLineColor(); diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index a42636295592..96e10def3388 100755 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -39,9 +39,8 @@ #include #include #include -#ifndef _RTL_STRINGBUF_HXX #include -#endif +#include using namespace rtl; @@ -851,7 +850,7 @@ void WinSalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void WinSalGraphics::BeginSetClipRegion( ULONG nRectCount ) +bool WinSalGraphics::setClipRegion( const Region& i_rClip ) { if ( mhRegion ) { @@ -859,148 +858,143 @@ void WinSalGraphics::BeginSetClipRegion( ULONG nRectCount ) mhRegion = 0; } - ULONG nRectBufSize = sizeof(RECT)*nRectCount; - if ( nRectCount < SAL_CLIPRECT_COUNT ) + if( i_rClip.HasPolyPolygon() ) { - if ( !mpStdClipRgnData ) - mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; - mpClipRgnData = mpStdClipRgnData; + // TODO: ConvertToB2DPolyPolygon actually is kind of const, just it does not advertise it in the header + basegfx::B2DPolyPolygon aPolyPolygon( const_cast(i_rClip).ConvertToB2DPolyPolygon() ); + const sal_uInt32 nCount(aPolyPolygon.count()); + + if( nCount ) + { + std::vector< POINT > aPolyPoints; + aPolyPoints.reserve( 1024 ); + std::vector< INT > aPolyCounts( nCount, 0 ); + for(sal_uInt32 a(0); a < nCount; a++) + { + basegfx::B2DPolygon aPoly( aPolyPolygon.getB2DPolygon(a) ); + aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); + const sal_uInt32 nPoints = aPoly.count(); + aPolyCounts[a] = nPoints; + for( sal_uInt32 b = 0; b < nPoints; b++ ) + { + basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + POINT aPOINT; + aPOINT.x = (LONG)aPt.getX(); + aPOINT.y = (LONG)aPt.getY(); + aPolyPoints.push_back( aPOINT ); + } + } + mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE ); + } } else - mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; - mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); - mpClipRgnData->rdh.iType = RDH_RECTANGLES; - mpClipRgnData->rdh.nCount = nRectCount; - mpClipRgnData->rdh.nRgnSize = nRectBufSize; - SetRectEmpty( &(mpClipRgnData->rdh.rcBound) ); - mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); - mbFirstClipRect = TRUE; -} - - -// ----------------------------------------------------------------------- - -BOOL WinSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if ( nWidth && nHeight ) { - RECT* pRect = mpNextClipRect; - RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); - long nRight = nX + nWidth; - long nBottom = nY + nHeight; + ULONG nRectCount = i_rClip.GetRectCount(); - if ( mbFirstClipRect ) + ULONG nRectBufSize = sizeof(RECT)*nRectCount; + if ( nRectCount < SAL_CLIPRECT_COUNT ) { - pBoundRect->left = nX; - pBoundRect->top = nY; - pBoundRect->right = nRight; - pBoundRect->bottom = nBottom; - mbFirstClipRect = FALSE; + if ( !mpStdClipRgnData ) + mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; + mpClipRgnData = mpStdClipRgnData; } else + mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; + mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); + mpClipRgnData->rdh.iType = RDH_RECTANGLES; + mpClipRgnData->rdh.nCount = nRectCount; + mpClipRgnData->rdh.nRgnSize = nRectBufSize; + RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); + SetRectEmpty( pBoundRect ); + RECT* pNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); + bool bFirstClipRect = true; + + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) { - if ( nX < pBoundRect->left ) - pBoundRect->left = (int)nX; - - if ( nY < pBoundRect->top ) - pBoundRect->top = (int)nY; - - if ( nRight > pBoundRect->right ) - pBoundRect->right = (int)nRight; - - if ( nBottom > pBoundRect->bottom ) - pBoundRect->bottom = (int)nBottom; - } + if ( nW && nH ) + { + long nRight = nX + nW; + long nBottom = nY + nH; - pRect->left = (int)nX; - pRect->top = (int)nY; - pRect->right = (int)nRight; - pRect->bottom = (int)nBottom; - mpNextClipRect++; - } - else - { - mpClipRgnData->rdh.nCount--; - mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); - } + if ( bFirstClipRect ) + { + pBoundRect->left = nX; + pBoundRect->top = nY; + pBoundRect->right = nRight; + pBoundRect->bottom = nBottom; + bFirstClipRect = false; + } + else + { + if ( nX < pBoundRect->left ) + pBoundRect->left = (int)nX; - return TRUE; -} + if ( nY < pBoundRect->top ) + pBoundRect->top = (int)nY; -// ----------------------------------------------------------------------- + if ( nRight > pBoundRect->right ) + pBoundRect->right = (int)nRight; -bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPolygon ) -{ - const sal_uInt32 nCount(rPolyPolygon.count()); + if ( nBottom > pBoundRect->bottom ) + pBoundRect->bottom = (int)nBottom; + } - if( nCount ) - { - std::vector< POINT > aPolyPoints; - aPolyPoints.reserve( 1024 ); - std::vector< INT > aPolyCounts( nCount, 0 ); - for(sal_uInt32 a(0); a < nCount; a++) - { - basegfx::B2DPolygon aPoly( rPolyPolygon.getB2DPolygon(a) ); - aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); - const sal_uInt32 nPoints = aPoly.count(); - aPolyCounts[a] = nPoints; - for( sal_uInt32 b = 0; b < nPoints; b++ ) + pNextClipRect->left = (int)nX; + pNextClipRect->top = (int)nY; + pNextClipRect->right = (int)nRight; + pNextClipRect->bottom = (int)nBottom; + pNextClipRect++; + } + else { - basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); - POINT aPOINT; - aPOINT.x = (LONG)aPt.getX(); - aPOINT.y = (LONG)aPt.getY(); - aPolyPoints.push_back( aPOINT ); + mpClipRgnData->rdh.nCount--; + mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); } - mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE ); - } - - return true; -} - -// ----------------------------------------------------------------------- - -void WinSalGraphics::EndSetClipRegion() -{ - // create clip region from ClipRgnData - if ( mpClipRgnData->rdh.nCount == 1 ) - { - RECT* pRect = &(mpClipRgnData->rdh.rcBound); - mhRegion = CreateRectRgn( pRect->left, pRect->top, - pRect->right, pRect->bottom ); - } - else if( mpClipRgnData->rdh.nCount > 1 ) - { - ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); - mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); - - // if ExtCreateRegion(...) is not supported - if( !mhRegion ) + // create clip region from ClipRgnData + if ( mpClipRgnData->rdh.nCount == 1 ) { - RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; + RECT* pRect = &(mpClipRgnData->rdh.rcBound); + mhRegion = CreateRectRgn( pRect->left, pRect->top, + pRect->right, pRect->bottom ); + } + else if( mpClipRgnData->rdh.nCount > 1 ) + { + ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); - if( pHeader->nCount ) + // if ExtCreateRegion(...) is not supported + if( !mhRegion ) { - RECT* pRect = (RECT*) mpClipRgnData->Buffer; - mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - pRect++; + RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; - for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ ) + if( pHeader->nCount ) { - HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); - DeleteRegion( hRgn ); + RECT* pRect = (RECT*) mpClipRgnData->Buffer; + mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + pRect++; + + for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ ) + { + HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); + DeleteRegion( hRgn ); + } } } - } - if ( mpClipRgnData != mpStdClipRgnData ) - delete [] mpClipRgnData; + if ( mpClipRgnData != mpStdClipRgnData ) + delete [] mpClipRgnData; + } } if( mhRegion ) SelectClipRgn( mhDC, mhRegion ); + return mhRegion != 0; } // ----------------------------------------------------------------------- -- cgit From 65d95afb7eadeabb540de3a3ea31a35ae41ec70e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 3 Dec 2010 17:47:10 +0100 Subject: vcl118: #i115905# improved clip region interface on SAL layer (part 2, mac implementation) --- vcl/aqua/inc/salgdi.h | 8 +----- vcl/aqua/source/gdi/salgdi.cxx | 59 +++++++++++++++++++----------------------- vcl/source/gdi/outdev.cxx | 4 --- 3 files changed, 27 insertions(+), 44 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 17c4aa7acd44..b1262dca499c 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -176,8 +176,7 @@ public: // InvalidateContext does an UnsetState and sets mrContext to 0 void InvalidateContext(); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); + virtual bool setClipRegion( const Region& ); // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ); @@ -250,11 +249,6 @@ public: // set the clip region to empty virtual void ResetClipRegion(); - // begin setting the clip region, add rectangles to the - // region with the UnionClipRegion call - virtual void BeginSetClipRegion( ULONG nCount ); - // all rectangles were added and the clip region should be set now - virtual void EndSetClipRegion(); // set the line color to transparent (= don't draw lines) virtual void SetLineColor(); diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index e1daf649f6da..9fcf3edcdddf 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -41,6 +41,7 @@ #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" #include "vcl/svapp.hxx" +#include "vcl/region.h" #include "osl/file.hxx" #include "osl/process.h" @@ -562,7 +563,7 @@ void AquaSalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) +bool AquaSalGraphics::setClipRegion( const Region& i_rClip ) { // release old clip path if( mxClipPath ) @@ -570,41 +571,33 @@ void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) CGPathRelease( mxClipPath ); mxClipPath = NULL; } -} - -// ----------------------------------------------------------------------- - -BOOL AquaSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if( (nWidth <= 0) || (nHeight <= 0) ) - return TRUE; - - if( !mxClipPath ) - mxClipPath = CGPathCreateMutable(); - const CGRect aClipRect = {{nX,nY},{nWidth,nHeight}}; - CGPathAddRect( mxClipPath, NULL, aClipRect ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -bool AquaSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPolygon ) -{ - if( rPolyPolygon.count() <= 0 ) - return true; - - if( !mxClipPath ) - mxClipPath = CGPathCreateMutable(); - AddPolyPolygonToPath( mxClipPath, rPolyPolygon, !getAntiAliasB2DDraw(), false ); - return true; -} - -// ----------------------------------------------------------------------- + mxClipPath = CGPathCreateMutable(); -void AquaSalGraphics::EndSetClipRegion() -{ + // set current path, either as polypolgon or sequence of rectangles + if( i_rClip.HasPolyPolygon() ) + { + basegfx::B2DPolyPolygon aClip( const_cast(i_rClip).ConvertToB2DPolyPolygon() ); + AddPolyPolygonToPath( mxClipPath, aClip, !getAntiAliasB2DDraw(), false ); + } + else + { + long nX, nY, nW, nH; + ImplRegionInfo aInfo; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if( nW && nH ) + { + CGRect aRect = {{nX,nY}, {nW,nH}}; + CGPathAddRect( mxClipPath, NULL, aRect ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + } + // set the current path as clip region if( CheckContext() ) SetState(); + return true; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index c9a75bb12053..7be953358e35 100755 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -202,10 +202,6 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr { DBG_TESTSOLARMUTEX(); - // TODO(Q3): Change from static to plain method - everybody's - // calling it with pOutDev=this! - // => done, but only with minimal changes for now => TODO - OutputDevice* const pOutDev = this; if( !pGraphics ) { if( !mpGraphics ) -- cgit From 6d85cb5f029b0c3ac8e597d02e5875974dc9757f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 6 Dec 2010 15:21:36 +0100 Subject: vcl118: #i115905# improved clip region interface on SAL layer (part 3, X11 implementation) --- vcl/inc/vcl/dllapi.h | 6 +++ vcl/inc/vcl/region.hxx | 4 +- vcl/unx/gtk/app/gtkdata.cxx | 6 ++- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 25 ++-------- vcl/unx/headless/svpgdi.cxx | 50 +++++++++---------- vcl/unx/headless/svpgdi.hxx | 5 +- vcl/unx/headless/svppspgraphics.cxx | 36 +++++++------- vcl/unx/headless/svppspgraphics.hxx | 5 +- vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 5 +- vcl/unx/inc/pspgraphics.h | 5 +- vcl/unx/inc/salgdi.h | 7 +-- vcl/unx/source/gdi/pspgraphics.cxx | 36 +++++++------- vcl/unx/source/gdi/salgdi.cxx | 84 +++++++++++++++----------------- vcl/unx/source/gdi/salgdi2.cxx | 12 ++--- vcl/unx/source/gdi/salgdi3.cxx | 24 ++++----- 15 files changed, 136 insertions(+), 174 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/dllapi.h b/vcl/inc/vcl/dllapi.h index bcf4001aa671..2c5c2c6801ac 100644 --- a/vcl/inc/vcl/dllapi.h +++ b/vcl/inc/vcl/dllapi.h @@ -37,4 +37,10 @@ #define VCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT #endif +#if defined UNX && ! defined MACOS +#define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC +#else +#define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE +#endif + #endif diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx index ed1dc27f85eb..c33144a45d36 100755 --- a/vcl/inc/vcl/region.hxx +++ b/vcl/inc/vcl/region.hxx @@ -78,9 +78,9 @@ private: SAL_DLLPRIVATE void ImplXOrPolyPolygon( const Region& ); public: // public within vcl - SAL_DLLPRIVATE BOOL ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, + VCL_PLUGIN_PUBLIC BOOL ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, long& nX, long& nY, long& nWidth, long& nHeight ) const; - SAL_DLLPRIVATE BOOL ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, + VCL_PLUGIN_PUBLIC BOOL ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, long& nX, long& nY, long& nWidth, long& nHeight ) const; #ifdef DBG_UTIL friend const char* ImplDbgTestRegion( const void* pObj ); diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index f308822df147..a031c3dc242e 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 318f593ac6a3..812394b488ce 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( ULONG nCount ) -{ - m_aClipRegion.SetNull(); - X11SalGraphics::BeginSetClipRegion( nCount ); -} - -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 68d8be7cb4eb..01a953987640 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -29,6 +29,7 @@ #include "svpbmp.hxx" #include +#include #include #include #include @@ -152,11 +153,16 @@ void SvpSalGraphics::ResetClipRegion() m_aClipMap.reset(); } -void SvpSalGraphics::BeginSetClipRegion( 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( ULONG n ) B2IVector aSize = m_aDevice->getSize(); m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY ); m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) ); - } -} -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 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 93ec080d0136..9d26d576a664 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( ULONG nCount ); - virtual 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 c7b1f4f41fca..ad3cc099157f 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( ULONG n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -BOOL PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (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 138198239621..ba60a50dedeb 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( ULONG nCount ); - virtual 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/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 38c79b3e11df..7729d14a42fe 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( ULONG nCount ); - virtual 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 d4f5a9f156e0..a4f5bbf86d5f 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( ULONG nCount ); - virtual 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 b5fdce50eee9..a43ff9dc363b 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -93,7 +93,7 @@ protected: CairoFontsCache m_aCairoFontsCache; XLIB_Region pPaintRegion_; - XLIB_Region pClipRegion_; + XLIB_Region mpClipRegion; GC pPenGC_; // Pen attributes SalColor nPenColor_; @@ -235,10 +235,7 @@ public: virtual long GetGraphicsHeight() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual 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/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index bab78b0cb2df..d1d78f5f390b 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 #include @@ -290,28 +291,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( ULONG n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -BOOL PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (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 9215f2e25b16..cd8df8439247 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; @@ -170,7 +171,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; @@ -260,8 +261,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_; @@ -579,7 +580,7 @@ long X11SalGraphics::GetGraphicsHeight() const // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void X11SalGraphics::ResetClipRegion() { - if( pClipRegion_ ) + if( mpClipRegion ) { bPenGC_ = FALSE; bFontGC_ = FALSE; @@ -591,46 +592,36 @@ void X11SalGraphics::ResetClipRegion() bStippleGC_ = FALSE; bTrackingGC_ = FALSE; - XDestroyRegion( pClipRegion_ ); - pClipRegion_ = NULL; + XDestroyRegion( mpClipRegion ); + mpClipRegion = NULL; } } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::BeginSetClipRegion( 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 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 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_ = FALSE; bFontGC_ = FALSE; bBrushGC_ = FALSE; @@ -641,11 +632,12 @@ void X11SalGraphics::EndSetClipRegion() bStippleGC_ = FALSE; bTrackingGC_ = FALSE; - if( XEmptyRegion( pClipRegion_ ) ) + if( XEmptyRegion( mpClipRegion ) ) { - XDestroyRegion( pClipRegion_ ); - pClipRegion_= NULL; + XDestroyRegion( mpClipRegion ); + mpClipRegion= NULL; } + return true; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -1054,8 +1046,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 { @@ -1192,8 +1184,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 1cb2abbedf43..6cf1c3e1f470 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 62e575ebc5ef..670966f1c2ea 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -1016,16 +1016,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); } @@ -1109,8 +1109,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(); @@ -1193,10 +1193,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; -- cgit From 3a6b23954f4a19158fdfab283f2f4c55e46be67d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 6 Dec 2010 15:27:52 +0100 Subject: vcl118: #i115905# improved clip region interface on SAL layer (part 4, OS2 implementation) --- vcl/os2/inc/salgdi.h | 8 +------ vcl/os2/source/gdi/salgdi.cxx | 50 +++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 35 deletions(-) (limited to 'vcl') diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index 94b2b98b4183..1c9b66d89a0b 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -151,8 +151,6 @@ public: virtual ~Os2SalGraphics(); protected: - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ); virtual void drawPixel( long nX, long nY, SalColor nSalColor ); @@ -226,11 +224,7 @@ public: // set the clip region to empty virtual void ResetClipRegion(); - // begin setting the clip region, add rectangles to the - // region with the UnionClipRegion call - virtual void BeginSetClipRegion( ULONG nCount ); - // all rectangles were added and the clip region should be set now - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); // set the line color to transparent (= don't draw lines) virtual void SetLineColor(); diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index dff1557170fb..069abb1026e3 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -38,6 +38,7 @@ #ifndef _RTL_STRINGBUF_HXX #include #endif +#include "vcl/region.h" #ifndef __H_FT2LIB #include @@ -217,38 +218,29 @@ void Os2SalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void Os2SalGraphics::BeginSetClipRegion( ULONG nCount ) +bool Os2SalGraphics::setClipRegion( const Region& i_rClip ) { + ULONG nCount = i_rClip.GetRectCount(); + mpClipRectlAry = new RECTL[ nCount ]; mnClipElementCount = 0; -} - -// ----------------------------------------------------------------------- -BOOL Os2SalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ]; - pClipRect->xLeft = nX; - pClipRect->yTop = mnHeight - nY; - pClipRect->xRight = nX + nWidth; - pClipRect->yBottom = mnHeight - (nY + nHeight); - mnClipElementCount++; - - return TRUE; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::EndSetClipRegion() -{ + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ]; + pClipRect->xLeft = nX; + pClipRect->yTop = mnHeight - nY; + pClipRect->xRight = nX + nW; + pClipRect->yBottom = mnHeight - (nY + nH); + mnClipElementCount++; + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } #ifdef SAL_PRINTER_CLIPPATH if ( mbPrinter ) { @@ -287,6 +279,8 @@ void Os2SalGraphics::EndSetClipRegion() } delete [] mpClipRectlAry; + + return true; } // ----------------------------------------------------------------------- -- cgit From 62364aa5411b5ac6ed1169748706b26a704d8ecc Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 6 Dec 2010 17:02:05 +0100 Subject: vcl118: fix a warning --- vcl/unx/inc/salgdi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'vcl') diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index a43ff9dc363b..72b3766d9bb0 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -137,6 +137,7 @@ protected: bool bXORMode_ : 1; // is ROP XOR Mode set BOOL bDitherBrush_ : 1; // is solid or tile + using SalGraphics::SetClipRegion; void SetClipRegion( GC pGC, XLIB_Region pXReg = NULL ) const; -- cgit From 6019b3a2c1d014e46e3c603a1612fd8997966db5 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 6 Dec 2010 17:06:23 +0100 Subject: vcl118: fix dll exports --- vcl/inc/vcl/print.hxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 810fbd353f8c..b5595f2cde20 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -514,24 +514,24 @@ public: bool isDirectPrint() const; // implementation details, not usable outside vcl - // don't use outside vcl. Some of these ar exported for + // don't use outside vcl. Some of these are exported for // the benefit of vcl's plugins. // Still: DO NOT USE OUTSIDE VCL - int getFilteredPageCount(); + VCL_PLUGIN_PUBLIC int getFilteredPageCount(); SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); - PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); + VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); SAL_DLLPRIVATE void printFilteredPage( int i_nPage ); SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr& ); SAL_DLLPRIVATE void setOptionChangeHdl( const Link& ); - void createProgressDialog(); - bool isProgressCanceled() const; + VCL_PLUGIN_PUBLIC void createProgressDialog(); + VCL_PLUGIN_PUBLIC bool isProgressCanceled() const; SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const; - void setLastPage( sal_Bool i_bLastPage ); + VCL_PLUGIN_PUBLIC void setLastPage( sal_Bool i_bLastPage ); SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse ); SAL_DLLPRIVATE bool getReversePrint() const; SAL_DLLPRIVATE void pushPropertiesToPrinter(); - void setJobState( com::sun::star::view::PrintableState ); + VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState ); SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent ); SAL_DLLPRIVATE int getPageCountProtected() const; -- cgit From 0ff80de8b71106beca31cbef6bc1464f6fcd770e Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 7 Dec 2010 11:03:38 +0100 Subject: vcl118: restrict more dll exports to vcl-plugins only This should help to prevent more false positives like those mentioned in http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=28195 --- vcl/inc/vcl/graphite_adaptors.hxx | 2 +- vcl/inc/vcl/graphite_layout.hxx | 6 ++---- vcl/inc/vcl/graphite_serverfont.hxx | 8 +++----- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx index ae2ff2962adb..66f264faf9ef 100644 --- a/vcl/inc/vcl/graphite_adaptors.hxx +++ b/vcl/inc/vcl/graphite_adaptors.hxx @@ -84,7 +84,7 @@ namespace grutils // the Graphite engine. // @author tse // -class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font +class VCL_PLUGIN_PUBLIC GraphiteFontAdaptor : public gr::Font { typedef std::map > GlyphMetricMap; friend class GrFontHasher; diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx index cd22abdcdb26..ebd323bebf28 100644 --- a/vcl/inc/vcl/graphite_layout.hxx +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -85,7 +85,7 @@ namespace grutils { class GrFeatureParser; } // This class uses the SIL Graphite engine to provide complex text layout services to the VCL // @author tse // -class VCL_DLLPUBLIC GraphiteLayout : public SalLayout +class VCL_PLUGIN_PUBLIC GraphiteLayout : public SalLayout { public: // Mask to allow Word break status to be stored within mvChar2BaseGlyph @@ -133,7 +133,7 @@ private: const grutils::GrFeatureParser * mpFeatures; public: - GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * features = NULL) throw(); + explicit GraphiteLayout( const gr::Font& font, const grutils::GrFeatureParser* features = NULL ) throw(); // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout @@ -183,6 +183,4 @@ private: void expandOrCondense(ImplLayoutArgs &rArgs); }; - - #endif // _SV_GRAPHITELAYOUT_HXX diff --git a/vcl/inc/vcl/graphite_serverfont.hxx b/vcl/inc/vcl/graphite_serverfont.hxx index 19eb70b11908..cdaed20476e2 100644 --- a/vcl/inc/vcl/graphite_serverfont.hxx +++ b/vcl/inc/vcl/graphite_serverfont.hxx @@ -37,7 +37,7 @@ // Modules -class VCL_DLLPUBLIC GraphiteLayoutImpl : public GraphiteLayout +class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout { public: GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw() @@ -51,14 +51,14 @@ private: // This class implments the server font specific parts. // @author tse // -class VCL_DLLPUBLIC GraphiteServerFontLayout : public ServerFontLayout +class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout { private: mutable GraphiteFontAdaptor * mpFont; // mutable so that the DrawOffset/DrawBase can be set mutable GraphiteLayoutImpl maImpl; public: - GraphiteServerFontLayout(GraphiteFontAdaptor * font) throw(); + explicit GraphiteServerFontLayout( GraphiteFontAdaptor* font ) throw(); virtual bool LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); }; // first step of layout virtual void AdjustLayout( ImplLayoutArgs& rArgs) @@ -94,7 +94,5 @@ public: int getMaxCharPos() const { return mnEndCharPos; } }; - - #endif #endif //_SV_GRAPHITESERVERFONT_HXX -- cgit From 3e9afb1f744f71488ae67e3c9029b8b9ea2692fe Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 8 Dec 2010 13:53:30 +0100 Subject: vcl118: export more sal-symbols to vcl-plugins only --- vcl/inc/vcl/fontcache.hxx | 2 +- vcl/inc/vcl/fontmanager.hxx | 2 +- vcl/inc/vcl/impfont.hxx | 8 ++------ vcl/inc/vcl/salframe.hxx | 2 +- vcl/inc/vcl/salgdi.hxx | 2 +- vcl/inc/vcl/sallayout.hxx | 12 ++++++------ vcl/inc/vcl/salmenu.hxx | 4 ++-- vcl/inc/vcl/salnativewidgets.hxx | 10 +++++----- vcl/inc/vcl/salobj.hxx | 2 +- vcl/inc/vcl/salprn.hxx | 6 +++--- vcl/inc/vcl/salsession.hxx | 2 +- vcl/inc/vcl/salsys.hxx | 2 +- vcl/inc/vcl/saltimer.hxx | 2 +- vcl/inc/vcl/salvd.hxx | 2 +- 14 files changed, 27 insertions(+), 31 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/fontcache.hxx b/vcl/inc/vcl/fontcache.hxx index b18748ed5791..7747b99015fe 100644 --- a/vcl/inc/vcl/fontcache.hxx +++ b/vcl/inc/vcl/fontcache.hxx @@ -38,7 +38,7 @@ namespace psp { -class VCL_DLLPUBLIC FontCache +class VCL_PLUGIN_PUBLIC FontCache { struct FontDir; friend class FontDir; diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 33fece8d88e1..f97f21a8f72d 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -222,7 +222,7 @@ class FontCache; class FontCache; -class VCL_DLLPUBLIC PrintFontManager +class VCL_PLUGIN_PUBLIC PrintFontManager { struct PrintFont; struct TrueTypeFontFile; diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx index e38e1dea78d4..e414ab883fcc 100644 --- a/vcl/inc/vcl/impfont.hxx +++ b/vcl/inc/vcl/impfont.hxx @@ -174,7 +174,7 @@ public: class CmapResult; -class VCL_DLLPUBLIC ImplFontCharMap +class VCL_PLUGIN_PUBLIC ImplFontCharMap { public: explicit ImplFontCharMap( const CmapResult& ); @@ -218,11 +218,7 @@ private: }; // CmapResult is a normalized version of the many CMAP formats -class -#ifdef UNX - VCL_DLLPUBLIC // vcl-plugins need it -#endif // UNX -CmapResult +class VCL_PLUGIN_PUBLIC CmapResult { public: explicit CmapResult( bool bSymbolic = false, diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 08548d7dda40..1f3c52d51352 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -143,7 +143,7 @@ using namespace rtl; struct SystemParentData; -class VCL_DLLPUBLIC SalFrame : public vcl::DeletionNotifier +class VCL_PLUGIN_PUBLIC SalFrame : public vcl::DeletionNotifier { // the VCL window corresponding to this frame Window* m_pWindow; diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 135d0a85b28e..da4cde655516 100755 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -97,7 +97,7 @@ typedef std::vector< sal_Int32 > Int32Vector; // note: all positions are in pixel and relative to // the top/left-position of the virtual output area -class VCL_DLLPUBLIC SalGraphics +class VCL_PLUGIN_PUBLIC SalGraphics { int m_nLayout; // 0: mirroring off, 1: mirror x-axis diff --git a/vcl/inc/vcl/sallayout.hxx b/vcl/inc/vcl/sallayout.hxx index e23090c42392..bb5c6e829a70 100755 --- a/vcl/inc/vcl/sallayout.hxx +++ b/vcl/inc/vcl/sallayout.hxx @@ -72,7 +72,7 @@ class ImplFontData; // ----------------- // used for managing runs e.g. for BiDi, glyph and script fallback -class VCL_DLLPUBLIC ImplLayoutRuns +class VCL_PLUGIN_PUBLIC ImplLayoutRuns { private: int mnRunIndex; @@ -148,7 +148,7 @@ sal_UCS4 GetVerticalChar( sal_UCS4 ); // #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx // VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType ); -VCL_DLLPUBLIC const char* GetAutofallback( sal_UCS4 ) ; +VCL_PLUGIN_PUBLIC const char* GetAutofallback( sal_UCS4 ) ; // ------------- // - SalLayout - @@ -179,7 +179,7 @@ typedef sal_uInt32 sal_GlyphId; // all positions/widths are in font units // one exception: drawposition is in pixel units -class VCL_DLLPUBLIC SalLayout +class VCL_PLUGIN_PUBLIC SalLayout { public: // used by upper layers @@ -258,7 +258,7 @@ protected: // - MultiSalLayout - // ------------------ -class VCL_DLLPUBLIC MultiSalLayout : public SalLayout +class VCL_PLUGIN_PUBLIC MultiSalLayout : public SalLayout { public: virtual void DrawText( SalGraphics& ) const; @@ -271,7 +271,7 @@ public: virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const; // used only by OutputDevice::ImplLayout, TODO: make friend - MultiSalLayout( SalLayout& rBaseLayout, + explicit MultiSalLayout( SalLayout& rBaseLayout, const ImplFontData* pBaseFont = NULL ); virtual bool AddFallback( SalLayout& rFallbackLayout, ImplLayoutRuns&, const ImplFontData* pFallbackFont ); @@ -341,7 +341,7 @@ typedef std::vector GlyphVector; // --------------- -class VCL_DLLPUBLIC GenericSalLayout : public SalLayout +class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout { public: // used by layout engines diff --git a/vcl/inc/vcl/salmenu.hxx b/vcl/inc/vcl/salmenu.hxx index cc0438c4e177..8143fa95ec12 100644 --- a/vcl/inc/vcl/salmenu.hxx +++ b/vcl/inc/vcl/salmenu.hxx @@ -60,14 +60,14 @@ struct SalMenuButtonItem : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {} }; -class VCL_DLLPUBLIC SalMenuItem +class VCL_PLUGIN_PUBLIC SalMenuItem { public: SalMenuItem() {} virtual ~SalMenuItem(); }; -class VCL_DLLPUBLIC SalMenu +class VCL_PLUGIN_PUBLIC SalMenu { public: SalMenu() {} diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index 19c34cbc5e34..8cf7dd84b7c4 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -268,7 +268,7 @@ enum ButtonValue { * Generic value container for all control parts. */ -class VCL_DLLPUBLIC ImplControlValue +class VCL_PLUGIN_PUBLIC ImplControlValue { friend class SalFrame; @@ -306,7 +306,7 @@ class VCL_DLLPUBLIC ImplControlValue * * Value container for scrollbars. */ - class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue + class VCL_PLUGIN_PUBLIC ScrollbarValue : public ImplControlValue { public: long mnMin; @@ -332,7 +332,7 @@ class VCL_DLLPUBLIC ImplControlValue virtual ~ScrollbarValue(); }; -class VCL_DLLPUBLIC SliderValue : public ImplControlValue +class VCL_PLUGIN_PUBLIC SliderValue : public ImplControlValue { public: long mnMin; @@ -360,7 +360,7 @@ class VCL_DLLPUBLIC SliderValue : public ImplControlValue #define TABITEM_FIRST_IN_GROUP 0x004 // the tabitem is the first in group of tabitems #define TABITEM_LAST_IN_GROUP 0x008 // the tabitem is the last in group of tabitems -class VCL_DLLPUBLIC TabitemValue : public ImplControlValue +class VCL_PLUGIN_PUBLIC TabitemValue : public ImplControlValue { public: unsigned int mnAlignment; @@ -386,7 +386,7 @@ class VCL_DLLPUBLIC TabitemValue : public ImplControlValue * Note: the other parameters of DrawNativeControl will have no meaning * all parameters for spinbuttons are carried here */ -class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue +class VCL_PLUGIN_PUBLIC SpinbuttonValue : public ImplControlValue { public: Rectangle maUpperRect; diff --git a/vcl/inc/vcl/salobj.hxx b/vcl/inc/vcl/salobj.hxx index e453bf5c6f87..ffc6f74e6222 100644 --- a/vcl/inc/vcl/salobj.hxx +++ b/vcl/inc/vcl/salobj.hxx @@ -47,7 +47,7 @@ struct SystemEnvData; // - SalObject - // ------------- -class VCL_DLLPUBLIC SalObject +class VCL_PLUGIN_PUBLIC SalObject { void* m_pInst; SALOBJECTPROC m_pCallback; diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx index 19f023108349..28717f333e05 100644 --- a/vcl/inc/vcl/salprn.hxx +++ b/vcl/inc/vcl/salprn.hxx @@ -44,7 +44,7 @@ namespace vcl { class PrinterController; } // - SalPrinterQueueInfo - // ----------------------- -struct VCL_DLLPUBLIC SalPrinterQueueInfo +struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo { XubString maPrinterName; XubString maDriver; @@ -62,7 +62,7 @@ struct VCL_DLLPUBLIC SalPrinterQueueInfo // - SalInfoPrinter - // ------------------ -class VCL_DLLPUBLIC SalInfoPrinter +class VCL_PLUGIN_PUBLIC SalInfoPrinter { public: std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats @@ -104,7 +104,7 @@ public: // - SalPrinter - // -------------- -class VCL_DLLPUBLIC SalPrinter +class VCL_PLUGIN_PUBLIC SalPrinter { public: // public for Sal Implementation SalPrinter() {} diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx index 2da1ae551074..c11054a79eef 100644 --- a/vcl/inc/vcl/salsession.hxx +++ b/vcl/inc/vcl/salsession.hxx @@ -85,7 +85,7 @@ struct SalSessionQuitEvent : public SalSessionEvent typedef void(*SessionProc)( SalSessionEvent *pEvent); -class VCL_DLLPUBLIC SalSession +class VCL_PLUGIN_PUBLIC SalSession { SessionProc m_aProc; public: diff --git a/vcl/inc/vcl/salsys.hxx b/vcl/inc/vcl/salsys.hxx index 310b0a27e30f..da16d8d5b656 100644 --- a/vcl/inc/vcl/salsys.hxx +++ b/vcl/inc/vcl/salsys.hxx @@ -58,7 +58,7 @@ const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO = 7; // - SalSystem - // ------------- -class VCL_DLLPUBLIC SalSystem +class VCL_PLUGIN_PUBLIC SalSystem { public: SalSystem() {} diff --git a/vcl/inc/vcl/saltimer.hxx b/vcl/inc/vcl/saltimer.hxx index d693070138d2..08512adcaefb 100644 --- a/vcl/inc/vcl/saltimer.hxx +++ b/vcl/inc/vcl/saltimer.hxx @@ -42,7 +42,7 @@ * this needed to be virtualized for the sal plugin migration */ -class VCL_DLLPUBLIC SalTimer +class VCL_PLUGIN_PUBLIC SalTimer { SALTIMERPROC m_pProc; public: diff --git a/vcl/inc/vcl/salvd.hxx b/vcl/inc/vcl/salvd.hxx index fcbe1fb35383..04b84aed90b2 100644 --- a/vcl/inc/vcl/salvd.hxx +++ b/vcl/inc/vcl/salvd.hxx @@ -37,7 +37,7 @@ class SalGraphics; // - SalVirtualDevice - // -------------------- -class VCL_DLLPUBLIC SalVirtualDevice +class VCL_PLUGIN_PUBLIC SalVirtualDevice { public: // public for Sal Implementation SalVirtualDevice() {} -- cgit From a50d8d23e7542a688b99febc889856188a45f391 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 8 Dec 2010 14:49:18 +0100 Subject: vcl118: yet another round of vcl-plugin-only export restricts --- vcl/inc/vcl/cvtsvm.hxx | 2 +- vcl/inc/vcl/glyphcache.hxx | 12 ++++++------ vcl/inc/vcl/outfont.hxx | 12 ++++++------ vcl/inc/vcl/print.h | 2 +- vcl/inc/vcl/salbmp.hxx | 2 +- vcl/inc/vcl/saldatabasic.hxx | 2 +- vcl/inc/vcl/salimestatus.hxx | 2 +- vcl/inc/vcl/salinst.hxx | 4 ++-- vcl/inc/vcl/svdata.hxx | 4 ++-- vcl/inc/vcl/syswin.hxx | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx index 03948ac56690..a8e0d632f7bb 100644 --- a/vcl/inc/vcl/cvtsvm.hxx +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -92,7 +92,7 @@ class Stack; -class VCL_DLLPUBLIC SVMConverter +class VCL_PLUGIN_PUBLIC SVMConverter { private: //#if 0 // _SOLAR__PRIVATE diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx index 0e77d5dd6bc4..6d5c7b0ec8a6 100644 --- a/vcl/inc/vcl/glyphcache.hxx +++ b/vcl/inc/vcl/glyphcache.hxx @@ -57,7 +57,7 @@ class ServerFontLayout; // ======================================================================= -class VCL_DLLPUBLIC GlyphCache +class VCL_PLUGIN_PUBLIC GlyphCache { public: explicit GlyphCache( GlyphCachePeer& ); @@ -172,7 +172,7 @@ private: // ======================================================================= -class VCL_DLLPUBLIC ServerFont +class VCL_PLUGIN_PUBLIC ServerFont { public: virtual const ::rtl::OString* GetFontFileName() const { return NULL; } @@ -254,7 +254,7 @@ private: // ======================================================================= // a class for cache entries for physical font instances that are based on serverfonts -class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry +class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry { private: ServerFont* mpServerFont; @@ -271,7 +271,7 @@ public: // ======================================================================= -class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout +class VCL_PLUGIN_PUBLIC ServerFontLayout : public GenericSalLayout { private: ServerFont& mrServerFont; @@ -316,7 +316,7 @@ protected: // ======================================================================= -class VCL_DLLPUBLIC RawBitmap +class VCL_PLUGIN_PUBLIC RawBitmap { public: RawBitmap(); @@ -349,7 +349,7 @@ inline void ServerFont::SetExtended( int nInfo, void* pVoid ) // ExtraKernInfo allows an on-demand query of extra kerning info #i29881# // The kerning values have to be scaled to match the font size before use -class VCL_DLLPUBLIC ExtraKernInfo +class VCL_PLUGIN_PUBLIC ExtraKernInfo { public: ExtraKernInfo( sal_IntPtr nFontId ); diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 4bbf7176ddb2..693e88562692 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -116,7 +116,7 @@ public: // TODO: hide members behind accessor methods // TODO: make cloning cheaper // abstract base class for physical font faces -class VCL_DLLPUBLIC ImplFontData : public ImplDevFontAttributes +class VCL_PLUGIN_PUBLIC ImplFontData : public ImplDevFontAttributes { public: // by using an ImplFontData object as a factory for its corresponding @@ -140,7 +140,7 @@ public: virtual ImplFontData* Clone() const = 0; protected: - ImplFontData( const ImplDevFontAttributes&, int nMagic ); + explicit ImplFontData( const ImplDevFontAttributes&, int nMagic ); void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } long mnWidth; // Width (in pixels) @@ -185,7 +185,7 @@ public: // TODO: change to private // TODO: merge with ImplFontCache // TODO: rename to LogicalFontManager -class VCL_DLLPUBLIC ImplDevFontList +class VCL_PLUGIN_PUBLIC ImplDevFontList { private: friend class WinGlyphFallbackSubstititution; @@ -267,7 +267,7 @@ struct ImplKernPairData class ImplFontMetricData : public ImplFontAttributes { public: - ImplFontMetricData( const ImplFontSelectData& ); + explicit ImplFontMetricData( const ImplFontSelectData& ); void ImplInitTextLineSize( const OutputDevice* pDev ); void ImplInitAboveTextLineSize(); @@ -324,10 +324,10 @@ public: // TODO: hide members behind accessor methods // TODO: rename ImplFontEntry to LogicalFontInstance // TODO: allow sharing of metrics for related fonts -class VCL_DLLPUBLIC ImplFontEntry +class VCL_PLUGIN_PUBLIC ImplFontEntry { public: - ImplFontEntry( const ImplFontSelectData& ); + explicit ImplFontEntry( const ImplFontSelectData& ); virtual ~ImplFontEntry(); public: // TODO: make data members private diff --git a/vcl/inc/vcl/print.h b/vcl/inc/vcl/print.h index 78c1bb647575..7ac0d04d6dac 100644 --- a/vcl/inc/vcl/print.h +++ b/vcl/inc/vcl/print.h @@ -55,7 +55,7 @@ struct ImplPrnQueueData // - ImplPrnQueueList - // -------------------- -class VCL_DLLPUBLIC ImplPrnQueueList +class VCL_PLUGIN_PUBLIC ImplPrnQueueList { public: std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash > diff --git a/vcl/inc/vcl/salbmp.hxx b/vcl/inc/vcl/salbmp.hxx index 4aca4a9277e9..2fc9dcbf39ac 100644 --- a/vcl/inc/vcl/salbmp.hxx +++ b/vcl/inc/vcl/salbmp.hxx @@ -38,7 +38,7 @@ class SalGraphics; class BitmapPalette; struct BitmapSystemData; -class VCL_DLLPUBLIC SalBitmap +class VCL_PLUGIN_PUBLIC SalBitmap { public: SalBitmap() {} diff --git a/vcl/inc/vcl/saldatabasic.hxx b/vcl/inc/vcl/saldatabasic.hxx index a40cd045611c..d3c1a7254513 100644 --- a/vcl/inc/vcl/saldatabasic.hxx +++ b/vcl/inc/vcl/saldatabasic.hxx @@ -37,7 +37,7 @@ namespace psp class PrinterInfoManager; } -class VCL_DLLPUBLIC SalData +class VCL_PLUGIN_PUBLIC SalData { public: SalInstance* m_pInstance; // pointer to instance diff --git a/vcl/inc/vcl/salimestatus.hxx b/vcl/inc/vcl/salimestatus.hxx index 779a75c9afaa..20184a059d9a 100644 --- a/vcl/inc/vcl/salimestatus.hxx +++ b/vcl/inc/vcl/salimestatus.hxx @@ -30,7 +30,7 @@ #include -class VCL_DLLPUBLIC SalI18NImeStatus +class VCL_PLUGIN_PUBLIC SalI18NImeStatus { public: SalI18NImeStatus() {} diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 71b820803473..30212fa5c960 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -68,7 +68,7 @@ namespace vos { class IMutex; } // - SalInstance - // --------------- -class VCL_DLLPUBLIC SalInstance +class VCL_PLUGIN_PUBLIC SalInstance { public: typedef bool(*Callback)(void*,void*,int); @@ -197,7 +197,7 @@ void DestroySalInstance( SalInstance* pInst ); void SalAbort( const XubString& rErrorText ); -VCL_DLLPUBLIC const ::rtl::OUString& SalGetDesktopEnvironment(); +VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment(); // ----------- // - SalData - diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 67aa6806be49..16a3b8c4ded1 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -391,8 +391,8 @@ void ImplFreeEventHookData(); long ImplCallPreNotify( NotifyEvent& rEvt ); long ImplCallEvent( NotifyEvent& rEvt ); -extern VCL_DLLPUBLIC ImplSVData* pImplSVData; -inline VCL_DLLPUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; } +extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData; +inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; } inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); } bool ImplInitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled ); diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index b3a7d9b8775e..d1b3dd4d8799 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -85,7 +85,7 @@ class TaskPaneList; #define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((ULONG)0x00000010) #define WINDOWSTATE_STATE_MAXIMIZED_VERT ((ULONG)0x00000020) -class VCL_DLLPUBLIC WindowStateData +class VCL_PLUGIN_PUBLIC WindowStateData { private: sal_uInt32 mnValidMask; -- cgit From 7cbfd9da26a31ca6f32eea39f71af00590d4a93b Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 8 Dec 2010 14:54:55 +0100 Subject: vcl118: Octree and InverseColorMap are vcl-internal only --- vcl/inc/vcl/octree.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/octree.hxx b/vcl/inc/vcl/octree.hxx index a7ce5e49c31d..ea08fbbe04d2 100644 --- a/vcl/inc/vcl/octree.hxx +++ b/vcl/inc/vcl/octree.hxx @@ -65,7 +65,7 @@ typedef PNODE* PPNODE; class ImpNodeCache; class BitmapReadAccess; -class VCL_DLLPUBLIC Octree +class VCL_PLUGIN_PUBLIC Octree { private: @@ -127,7 +127,7 @@ inline USHORT Octree::GetBestPaletteIndex( const BitmapColor& rColor ) // - InverseColorMap - // ------------------- -class VCL_DLLPUBLIC InverseColorMap +class VCL_PLUGIN_PUBLIC InverseColorMap { private: @@ -143,7 +143,7 @@ private: public: - InverseColorMap( const BitmapPalette& rPal ); + explicit InverseColorMap( const BitmapPalette& rPal ); ~InverseColorMap(); inline USHORT GetBestPaletteIndex( const BitmapColor& rColor ); -- cgit From 623ab0e0da586fd1d9d756f59f4655a736896bb7 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 8 Dec 2010 19:15:37 +0100 Subject: vcl118: #i115837# add a murphy factor to checkbox width --- vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index d19290d8320a..c6703b58be88 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -813,7 +813,6 @@ static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO [pBtn setEnabled: NO]; linebreakCell( [pBtn cell], rText ); [pBtn sizeToFit]; - [pCurParent addSubview: [pBtn autorelease]]; rRightColumn.push_back( ColumnItem( pBtn ) ); @@ -825,10 +824,17 @@ static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO [pBtn setTag: nTag]; aCheckRect = [pBtn frame]; + // #i115837# add a murphy factor; it can apparently occasionally happen + // that sizeToFit does not a perfect job and that the button linebreaks again + // if - and only if - there is already a '\n' contained in the text and the width + // is minimally of + aCheckRect.size.width += 1; // move to rCurY aCheckRect.origin.y = rCurY - aCheckRect.size.height; [pBtn setFrame: aCheckRect]; + + [pCurParent addSubview: [pBtn autorelease]]; // update rCurY rCurY = aCheckRect.origin.y - 5; -- cgit From 485d404dc2d12f86acd9c69f19e9075bd375e861 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 9 Dec 2010 15:48:26 +0100 Subject: vcl118: #i115788# fix file specs vs. URI --- vcl/source/gdi/pdfwriter_impl.cxx | 50 +++++++++++++++++++++++++++++---------- vcl/source/gdi/pdfwriter_impl.hxx | 2 +- 2 files changed, 39 insertions(+), 13 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 325ccef1c3a6..b3d723ae12c4 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2037,9 +2037,25 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OString& rInSt appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer); } -inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer ) +void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc ) { - rtl::OString aBufferString( rtl::OUStringToOString( rInString, RTL_TEXTENCODING_ASCII_US ) ); + rtl::OString aBufferString( rtl::OUStringToOString( rInString, nEnc ) ); + sal_Int32 nLen = aBufferString.getLength(); + rtl::OStringBuffer aBuf( nLen ); + const sal_Char* pT = aBufferString.getStr(); + + for( sal_Int32 i = 0; i < nLen; i++, pT++ ) + { + if( (*pT & 0x80) == 0 ) + aBuf.append( *pT ); + else + { + aBuf.append( '<' ); + appendHex( *pT, aBuf ); + aBuf.append( '>' ); + } + } + aBufferString = aBuf.makeStringAndClear(); appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer); } @@ -4634,18 +4650,20 @@ we check in the following sequence: { aLine.append( "/Launch/Win<>" ); } else { - sal_Int32 nSetRelative = 0; + bool bSetRelative = false; + bool bFileSpec = false; //check if relative file link is requested and if the protocol is 'file://' if( m_aContext.RelFsys && eBaseProtocol == eTargetProtocol && eTargetProtocol == INET_PROT_FILE ) - nSetRelative++; + bSetRelative = true; rtl::OUString aFragment = aTargetURL.GetMark( INetURLObject::NO_DECODE /*DECODE_WITH_CHARSET*/ ); //fragment as is, if( nSetGoToRMode == 0 ) + { switch( m_aContext.DefaultLinkAction ) { default: @@ -4665,19 +4683,24 @@ we check in the following sequence: eTargetProtocol != INET_PROT_FILE ) aLine.append( "/URI/URI" ); else + { aLine.append( "/Launch/F" ); + bFileSpec = true; + } break; } + } //fragment are encoded in the same way as in the named destination processing - rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); if( nSetGoToRMode ) {//add the fragment + rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); aLine.append("/GoToR"); aLine.append("/F"); - appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark, + bFileSpec = true; + appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET ) : - aURLNoMark, rLink.m_nObject, aLine ); + aURLNoMark, rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); if( aFragment.getLength() > 0 ) { aLine.append("/D/"); @@ -4696,13 +4719,16 @@ we check in the following sequence: //substitute the fragment aTargetURL.SetMark( aLineLoc.getStr() ); } - rtl::OUString aURL = aTargetURL.GetMainURL( (nSetRelative || eTargetProtocol == INET_PROT_FILE) ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); + rtl::OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); // check if we have a URL available, if the string is empty, set it as the original one // if( aURL.getLength() == 0 ) // appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine ); // else - appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL ) : - aURL , rLink.m_nObject, aLine ); + appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, + INetURLObject::WAS_ENCODED, + bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE + ) : + aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); } //<--- i56629 } @@ -5606,7 +5632,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() { // create a submit form action aLine.append( "/AA< Date: Thu, 9 Dec 2010 20:00:24 +0100 Subject: vcl118: #i65970# use shadings for gradients to increase efficiency and avoid paint problems --- vcl/source/gdi/pdfwriter_impl.cxx | 108 +++++++++++++------------------------ vcl/source/gdi/pdfwriter_impl.hxx | 2 - vcl/source/gdi/pdfwriter_impl2.cxx | 25 ++------- 3 files changed, 43 insertions(+), 92 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b3d723ae12c4..cd3b204a2cd8 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2962,12 +2962,9 @@ bool PDFWriterImpl::emitTilings() aTilingObj.setLength( 0 ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( "PDFWriterImpl::emitTilings" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::emitTilings" ); + #endif sal_Int32 nX = (sal_Int32)it->m_aRectangle.Left(); sal_Int32 nY = (sal_Int32)it->m_aRectangle.Top(); @@ -3455,10 +3452,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont // now we can actually write the font stream ! #if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::emitEmbeddedFont" ); - emitComment( aLine.getStr() ); - } + emitComment( " PDFWriterImpl::emitEmbeddedFont" ); #endif OStringBuffer aLine( 512 ); nStreamObject = createObject(); @@ -3884,12 +3878,9 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, delete pCodec; #endif -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::createToUnicodeCMap" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::createToUnicodeCMap" ); + #endif OStringBuffer aLine( 40 ); aLine.append( nStream ); @@ -4076,10 +4067,7 @@ bool PDFWriterImpl::emitFonts() CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) ); #if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine1( " PDFWriterImpl::emitFonts" ); - emitComment( aLine1.getStr() ); - } + emitComment( "PDFWriterImpl::emitFonts" ); #endif sal_Int32 nFontStream = createObject(); sal_Int32 nStreamLengthObject = createObject(); @@ -5384,12 +5372,9 @@ bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDi pApppearanceStream->Seek( STREAM_SEEK_TO_BEGIN ); sal_Int32 nObject = createObject(); CHECK_RETURN( updateObject( nObject ) ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::emitAppearances" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::emitAppearances" ); + #endif OStringBuffer aLine; aLine.append( nObject ); @@ -9277,12 +9262,9 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) rObject.m_pContentStream->Seek( STREAM_SEEK_TO_END ); ULONG nSize = rObject.m_pContentStream->Tell(); rObject.m_pContentStream->Seek( STREAM_SEEK_TO_BEGIN ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeTransparentObject" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeTransparentObject" ); + #endif OStringBuffer aLine( 512 ); CHECK_RETURN( updateObject( rObject.m_nObject ) ); aLine.append( rObject.m_nObject ); @@ -9426,28 +9408,21 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) sal_Int32 nFunctionObject = createObject(); CHECK_RETURN( updateObject( nFunctionObject ) ); - OutputDevice* pRefDevice = getReferenceDevice(); - pRefDevice->Push( PUSH_ALL ); - if( rObject.m_aSize.Width() > pRefDevice->GetOutputSizePixel().Width() ) - rObject.m_aSize.Width() = pRefDevice->GetOutputSizePixel().Width(); - if( rObject.m_aSize.Height() > pRefDevice->GetOutputSizePixel().Height() ) - rObject.m_aSize.Height() = pRefDevice->GetOutputSizePixel().Height(); - pRefDevice->SetMapMode( MapMode( MAP_PIXEL ) ); - pRefDevice->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); + VirtualDevice aDev; + aDev.SetOutputSizePixel( rObject.m_aSize ); + aDev.SetMapMode( MapMode( MAP_PIXEL ) ); + aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); - Bitmap aSample = pRefDevice->GetBitmap( Point( 0, 0 ), rObject.m_aSize ); + Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize ); BitmapReadAccess* pAccess = aSample.AcquireReadAccess(); AccessReleaser aReleaser( pAccess ); Size aSize = aSample.GetSizePixel(); sal_Int32 nStreamLengthObject = createObject(); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeGradientFunction" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeGradientFunction" ); + #endif OStringBuffer aLine( 120 ); aLine.append( nFunctionObject ); aLine.append( " 0 obj\n" @@ -9475,7 +9450,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) checkAndEnableStreamEncryption( nFunctionObject ); beginCompression(); - for( int y = 0; y < aSize.Height(); y++ ) + for( int y = aSize.Height()-1; y >= 0; y-- ) { for( int x = 0; x < aSize.Width(); x++ ) { @@ -9526,8 +9501,6 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) "endobj\n\n" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); - pRefDevice->Pop(); - return true; } @@ -9556,12 +9529,9 @@ bool PDFWriterImpl::writeJPG( JPGEmit& rObject ) m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDF13 ); } -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeJPG" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeJPG" ); + #endif OStringBuffer aLine(200); aLine.append( rObject.m_nObject ); @@ -9681,12 +9651,9 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) sal_Int32 nStreamLengthObject = createObject(); sal_Int32 nMaskObject = 0; -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeBitmapObject" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeBitmapObject" ); + #endif OStringBuffer aLine(1024); aLine.append( rObject.m_nObject ); aLine.append( " 0 obj\n" @@ -10076,15 +10043,16 @@ sal_Int32 PDFWriterImpl::createGradient( const Gradient& rGradient, const Size& rSize ) ); // check if we already have this gradient std::list::iterator it; + // rounding to point will generally lose some pixels + // round up to point boundary + aPtSize.Width()++; + aPtSize.Height()++; for( it = m_aGradients.begin(); it != m_aGradients.end(); ++it ) { if( it->m_aGradient == rGradient ) { - if( it->m_aSize.Width() < aPtSize.Width() ) - it->m_aSize.Width() = aPtSize.Width(); - if( it->m_aSize.Height() <= aPtSize.Height() ) - it->m_aSize.Height() = aPtSize.Height(); - break; + if( it->m_aSize == aPtSize ) + break; } } if( it == m_aGradients.end() ) @@ -10159,12 +10127,12 @@ void PDFWriterImpl::drawGradient( const PolyPolygon& rPolyPoly, const Gradient& return; } - sal_Int32 nGradient = createGradient( rGradient, rPolyPoly.GetBoundRect().GetSize() ); + Rectangle aBoundRect = rPolyPoly.GetBoundRect(); + sal_Int32 nGradient = createGradient( rGradient, aBoundRect.GetSize() ); updateGraphicsState(); - Rectangle aBoundRect = rPolyPoly.GetBoundRect(); - Point aTranslate = aBoundRect.BottomLeft() + Point( 0, 1 ); + Point aTranslate = aBoundRect.BottomLeft(); int nPolygons = rPolyPoly.Count(); OStringBuffer aLine( 80*nPolygons ); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 84e3ae183ad3..7b9096ea21eb 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1052,8 +1052,6 @@ i12626 bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); // helper for playMetafile - void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, - VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index ee1fe1cc6bc5..19834ea6955d 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -55,21 +55,6 @@ using namespace com::sun::star::beans; // ----------------------------------------------------------------------------- -void PDFWriterImpl::implWriteGradient( const PolyPolygon& i_rPolyPoly, const Gradient& i_rGradient, - VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) -{ - GDIMetaFile aTmpMtf; - - i_pDummyVDev->AddGradientActions( i_rPolyPoly.GetBoundRect(), i_rGradient, aTmpMtf ); - - m_rOuterFace.Push(); - m_rOuterFace.IntersectClipRegion( i_rPolyPoly.getB2DPolyPolygon() ); - playMetafile( aTmpMtf, NULL, i_rContext, i_pDummyVDev ); - m_rOuterFace.Pop(); -} - -// ----------------------------------------------------------------------------- - void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx, VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) { @@ -354,16 +339,14 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa case( META_GRADIENT_ACTION ): { const MetaGradientAction* pA = (const MetaGradientAction*) pAction; - const PolyPolygon aPolyPoly( pA->GetRect() ); - - implWriteGradient( aPolyPoly, pA->GetGradient(), pDummyVDev, i_rContext ); + m_rOuterFace.DrawGradient( pA->GetRect(), pA->GetGradient() ); } break; case( META_GRADIENTEX_ACTION ): { const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction; - implWriteGradient( pA->GetPolyPolygon(), pA->GetGradient(), pDummyVDev, i_rContext ); + m_rOuterFace.DrawGradient( pA->GetPolyPolygon(), pA->GetGradient() ); } break; @@ -518,7 +501,9 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa } if( pGradAction ) - implWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pDummyVDev, i_rContext ); + { + m_rOuterFace.DrawGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient() ); + } } else { -- cgit From 7c0d414bcfde64715552807a985eddb748d96218 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 10 Dec 2010 16:58:03 +0100 Subject: vcl118: #i65970# increase gradient quality especially in ghostscript --- vcl/source/gdi/pdfwriter_impl.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'vcl') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index cd3b204a2cd8..427b025f2051 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9435,6 +9435,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) aLine.append( " ]\n" "/BitsPerSample 8\n" "/Range[ 0 1 0 1 0 1 ]\n" + "/Order 3\n" "/Length " ); aLine.append( nStreamLengthObject ); aLine.append( " 0 R\n" -- cgit From 98e9b844f2f2038d69ae159ee67cc6c3ba7d1a76 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 13 Dec 2010 13:42:14 +0100 Subject: vcl118: #i116048# improve shutdown behavior of unix clipboard (thanks sb !) --- vcl/inc/vcl/displayconnectiondispatch.hxx | 52 +++++++++++++++++++ vcl/inc/vcl/salinst.hxx | 34 +++---------- vcl/inc/vcl/svdata.hxx | 7 +-- vcl/inc/vcl/xconnection.hxx | 15 +++--- vcl/source/app/session.cxx | 36 +++++++------ vcl/source/app/svapp.cxx | 5 +- vcl/source/app/svdata.cxx | 13 +++-- vcl/source/app/svmain.cxx | 16 +++--- vcl/source/control/edit.cxx | 24 ++++----- vcl/source/gdi/pdfwriter_impl2.cxx | 10 ++-- vcl/source/helper/xconnection.cxx | 77 ++++++++++++++-------------- vcl/source/window/window.cxx | 82 +++++++++++++++--------------- vcl/unx/source/dtrans/X11_clipboard.hxx | 26 +++++----- vcl/unx/source/dtrans/X11_dndcontext.hxx | 6 +-- vcl/unx/source/dtrans/X11_selection.cxx | 68 +++++++++++++++---------- vcl/unx/source/dtrans/X11_selection.hxx | 39 +++++++------- vcl/unx/source/dtrans/X11_service.cxx | 24 +++++---- vcl/unx/source/dtrans/X11_transferable.hxx | 4 +- vcl/unx/source/fontmanager/fontmanager.cxx | 10 +++- 19 files changed, 314 insertions(+), 234 deletions(-) create mode 100644 vcl/inc/vcl/displayconnectiondispatch.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/displayconnectiondispatch.hxx b/vcl/inc/vcl/displayconnectiondispatch.hxx new file mode 100644 index 000000000000..fea1d0b7cba9 --- /dev/null +++ b/vcl/inc/vcl/displayconnectiondispatch.hxx @@ -0,0 +1,52 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_VCL_DISPLAYCONNECTIONDISPATCH_HXX +#define INCLUDED_VCL_DISPLAYCONNECTIONDISPATCH_HXX + +#include "sal/config.h" + +#include "com/sun/star/awt/XDisplayConnection.hpp" +#include "cppuhelper/implbase1.hxx" + +namespace vcl { + +class DisplayConnectionDispatch: + public cppu::WeakImplHelper1< com::sun::star::awt::XDisplayConnection > +{ +public: + virtual bool dispatchEvent(void * pData, int nBytes) = 0; + + virtual bool dispatchErrorEvent(void * pData, int nBytes) = 0; + +protected: + virtual ~DisplayConnectionDispatch() {} +}; + +} + +#endif diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 30212fa5c960..10441d7527b7 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -31,10 +31,12 @@ #include "com/sun/star/uno/Reference.hxx" #include "vcl/sv.h" +#include "vcl/displayconnectiondispatch.hxx" #include "vcl/dllapi.h" #include "tools/string.hxx" +#include "rtl/ref.hxx" #include "rtl/string.hxx" #include @@ -70,21 +72,11 @@ namespace vos { class IMutex; } class VCL_PLUGIN_PUBLIC SalInstance { -public: - typedef bool(*Callback)(void*,void*,int); private: - void* m_pEventInst; - void* m_pErrorInst; - Callback m_pEventCallback; - Callback m_pErrorCallback; + rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst; public: - SalInstance() : - m_pEventInst( NULL ), - m_pErrorInst( NULL ), - m_pEventCallback( NULL ), - m_pErrorCallback( NULL ) - {} + SalInstance() {} virtual ~SalInstance(); // Frame @@ -154,22 +146,12 @@ public: // methods for XDisplayConnection - // the parameters for the callbacks are: - // void* pInst: pInstance form the SetCallback call - // void* pEvent: address of the system specific event structure - // int nBytes: length of the system specific event structure - void SetEventCallback( void* pInstance, Callback pCallback ) - { m_pEventInst = pInstance; m_pEventCallback = pCallback; } - Callback GetEventCallback() const - { return m_pEventCallback; } + void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance ) + { m_pEventInst = pInstance; } bool CallEventCallback( void* pEvent, int nBytes ) - { return m_pEventCallback ? m_pEventCallback( m_pEventInst, pEvent, nBytes ) : false; } - void SetErrorEventCallback( void* pInstance, Callback pCallback ) - { m_pErrorInst = pInstance; m_pErrorCallback = pCallback; } - Callback GetErrorEventCallback() const - { return m_pErrorCallback; } + { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); } bool CallErrorCallback( void* pEvent, int nBytes ) - { return m_pErrorCallback ? m_pErrorCallback( m_pErrorInst, pEvent, nBytes ) : false; } + { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); } enum ConnectionIdentifierType { AsciiCString, Blob }; virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0; diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 16a3b8c4ded1..035cd1eaccc7 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -28,6 +28,7 @@ #ifndef _SV_SVDATA_HXX #define _SV_SVDATA_HXX +#include "rtl/ref.hxx" #include "vos/thread.hxx" #include "tools/string.hxx" #include "tools/gen.hxx" @@ -51,9 +52,6 @@ namespace lang { namespace frame { class XSessionManagerClient; } -namespace awt { - class XDisplayConnection; -} }}} struct ImplTimerData; @@ -361,8 +359,7 @@ struct ImplSVData BOOL mbIsTestTool; vos::OThread::TThreadIdentifier mnMainThreadId; - ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XDisplayConnection > mxDisplayConnection; + rtl::Reference< vcl::DisplayConnection > mxDisplayConnection; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge; com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient; diff --git a/vcl/inc/vcl/xconnection.hxx b/vcl/inc/vcl/xconnection.hxx index aa9d37430ea6..d43e02941cb3 100644 --- a/vcl/inc/vcl/xconnection.hxx +++ b/vcl/inc/vcl/xconnection.hxx @@ -28,11 +28,12 @@ #ifndef _VCL_XCONNECTION_HXX #define _VCL_XCONNECTION_HXX -#include -#include #include +#include #include +#include "vcl/displayconnectiondispatch.hxx" + #ifndef _STLP_LIST #include #endif @@ -40,7 +41,7 @@ namespace vcl { class DisplayConnection : - public ::cppu::WeakImplHelper1< ::com::sun::star::awt::XDisplayConnection > + public DisplayConnectionDispatch { ::osl::Mutex m_aMutex; ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler > > @@ -52,9 +53,11 @@ namespace vcl { DisplayConnection(); virtual ~DisplayConnection(); - static bool dispatchEvent( void* pThis, void* pData, int nBytes ); - static bool dispatchErrorEvent( void* pThis, void* pData, int nBytes ); - void dispatchDowningEvent(); + void start(); + void terminate(); + + virtual bool dispatchEvent( void* pData, int nBytes ); + virtual bool dispatchErrorEvent( void* pData, int nBytes ); // XDisplayConnection virtual void SAL_CALL addEventHandler( const ::com::sun::star::uno::Any& window, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(); diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index c65eb13224e1..4a9ea98ae3e8 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -39,6 +39,12 @@ #include +namespace { + +namespace css = com::sun::star; + +} + using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::frame; @@ -52,12 +58,12 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient { struct Listener { - Reference< XSessionManagerListener > m_xListener; + css::uno::Reference< XSessionManagerListener > m_xListener; bool m_bInteractionRequested; bool m_bInteractionDone; bool m_bSaveDone; - Listener( const Reference< XSessionManagerListener >& xListener ) + Listener( const css::uno::Reference< XSessionManagerListener >& xListener ) : m_xListener( xListener ), m_bInteractionRequested( false ), m_bInteractionDone( false ), @@ -84,11 +90,11 @@ public: VCLSession(); virtual ~VCLSession(); - virtual void SAL_CALL addSessionManagerListener( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL removeSessionManagerListener( const Reference< XSessionManagerListener>& xListener ) throw( RuntimeException ); - virtual void SAL_CALL queryInteraction( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL interactionDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException ); + virtual void SAL_CALL queryInteraction( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException ); }; @@ -212,7 +218,7 @@ void VCLSession::callQuit() ULONG nAcquireCount = Application::ReleaseSolarMutex(); for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) { - Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); + css::uno::Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); if( xListener2.is() ) xListener2->doQuit(); } @@ -244,14 +250,14 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) } } -void SAL_CALL VCLSession::addSessionManagerListener( const Reference& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); m_aListeners.push_back( Listener( xListener ) ); } -void SAL_CALL VCLSession::removeSessionManagerListener( const Reference& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); @@ -268,7 +274,7 @@ void SAL_CALL VCLSession::removeSessionManagerListener( const Reference& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference& xListener ) throw( RuntimeException ) { if( m_bInteractionGranted ) { @@ -295,7 +301,7 @@ void SAL_CALL VCLSession::queryInteraction( const Reference& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); int nRequested = 0, nDone = 0; @@ -318,7 +324,7 @@ void SAL_CALL VCLSession::interactionDone( const Reference< XSessionManagerListe } } -void SAL_CALL VCLSession::saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); @@ -359,11 +365,11 @@ Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames() return aRet; } -Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) +css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) { ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->xSMClient.is() ) pSVData->xSMClient = new VCLSession(); - return Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); + return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index e503172eb2c6..759d28e30bb1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1761,9 +1761,12 @@ void Application::SetUnoWrapper( UnoWrapperBase* pWrapper ) ImplSVData* pSVData = ImplGetSVData(); if( !pSVData->mxDisplayConnection.is() ) + { pSVData->mxDisplayConnection.set( new ::vcl::DisplayConnection ); + pSVData->mxDisplayConnection->start(); + } - return pSVData->mxDisplayConnection; + return pSVData->mxDisplayConnection.get(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 935d2c1894ea..01647af81f7f 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -53,6 +53,7 @@ #include "vcl/salimestatus.hxx" #include "vcl/salsys.hxx" #include "vcl/svids.hrc" +#include "vcl/xconnection.hxx" #include "unotools/fontcfg.hxx" @@ -71,6 +72,12 @@ #include +namespace { + +namespace css = com::sun::star; + +} + using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::awt; @@ -362,12 +369,12 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mxAccessBridge.is() ) { - Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory()); + css::uno::Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory()); if( xFactory.is() ) { - Reference< XExtendedToolkit > xToolkit = - Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY); + css::uno::Reference< XExtendedToolkit > xToolkit = + css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY); Sequence< Any > arguments(1); arguments[0] = makeAny(xToolkit); diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 4efa2b659e7c..2da07db443fd 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -89,6 +89,12 @@ #include "rtl/strbuf.hxx" #endif +namespace { + +namespace css = com::sun::star; + +} + using namespace ::rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -171,7 +177,7 @@ BOOL ImplSVMain() DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); - Reference xMS; + css::uno::Reference xMS; BOOL bInit = InitVCL( xMS ); @@ -186,11 +192,7 @@ BOOL ImplSVMain() if( pSVData->mxDisplayConnection.is() ) { - vcl::DisplayConnection* pConnection = - dynamic_cast(pSVData->mxDisplayConnection.get()); - - if( pConnection ) - pConnection->dispatchDowningEvent(); + pSVData->mxDisplayConnection->terminate(); pSVData->mxDisplayConnection.clear(); } @@ -199,7 +201,7 @@ BOOL ImplSVMain() // be some events in the AWT EventQueue, which need the SolarMutex which // - on the other hand - is destroyed in DeInitVCL(). So empty the queue // here .. - Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY); + css::uno::Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY); if( xComponent.is() ) { ULONG nCount = Application::ReleaseSolarMutex(); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 5091a4722845..a2c2d9a1ce4c 100755 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -795,19 +795,19 @@ String Edit::ImplGetValidString( const String& rString ) const } // ----------------------------------------------------------------------- -Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const +uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const { //!! since we don't want to become incompatible in the next minor update //!! where this code will get integrated into, xISC will be a local //!! variable instead of a class member! - Reference < i18n::XBreakIterator > xBI; + uno::Reference < i18n::XBreakIterator > xBI; // if ( !xBI.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) ); + Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); x >>= xBI; } } @@ -815,19 +815,19 @@ Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const } // ----------------------------------------------------------------------- -Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const +uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const { //!! since we don't want to become incompatible in the next minor update //!! where this code will get integrated into, xISC will be a local //!! variable instead of a class member! - Reference < i18n::XExtendedInputSequenceChecker > xISC; + uno::Reference < i18n::XExtendedInputSequenceChecker > xISC; // if ( !xISC.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) ); + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) ); if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XExtendedInputSequenceChecker >*)0) ); + Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) ); x >>= xISC; } } @@ -902,8 +902,8 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ // get access to the configuration of this office module try { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig( + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig( xMSF, sModule, ::comphelper::ConfigurationHelper::E_READONLY ), diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 19834ea6955d..8a284e908922 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -163,13 +163,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz try { uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm ); - Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); - Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance( + uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); + uno::Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ); if ( xGraphicProvider.is() ) { - Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); - Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); + uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); + uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); rtl::OUString aMimeType( ::rtl::OUString::createFromAscii( "image/jpeg" ) ); uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 ); aOutMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" ); @@ -192,7 +192,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz Sequence< PropertyValue > aArgs( 1 ); aArgs[ 0 ].Name = ::rtl::OUString::createFromAscii( "InputStream" ); aArgs[ 0 ].Value <<= xStream; - Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) ); + uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) ); if ( xPropSet.is() ) { sal_Int16 nBitsPerPixel = 24; diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index caf7ee237d67..c038b8e97b28 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -29,11 +29,18 @@ #include "precompiled_vcl.hxx" #include "svsys.h" +#include "rtl/ref.hxx" #include "vcl/xconnection.hxx" #include "vcl/svdata.hxx" #include "vcl/salinst.hxx" #include "vcl/svapp.hxx" +namespace { + +namespace css = com::sun::star; + +} + namespace vcl { class SolarMutexReleaser @@ -62,13 +69,9 @@ using namespace com::sun::star::awt; DisplayConnection::DisplayConnection() { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->SetEventCallback( this, dispatchEvent ); - pSVData->mpDefInst->SetErrorEventCallback( this, dispatchErrorEvent ); - SalInstance::ConnectionIdentifierType eType; int nBytes; - void* pBytes = pSVData->mpDefInst->GetConnectionIdentifier( eType, nBytes ); + void* pBytes = ImplGetSVData()->mpDefInst->GetConnectionIdentifier( eType, nBytes ); switch( eType ) { case SalInstance::AsciiCString: @@ -81,39 +84,54 @@ DisplayConnection::DisplayConnection() } DisplayConnection::~DisplayConnection() +{} + +void DisplayConnection::start() +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mpDefInst->SetEventCallback( this ); +} + +void DisplayConnection::terminate() { ImplSVData* pSVData = ImplGetSVData(); if( pSVData ) { - pSVData->mpDefInst->SetEventCallback( NULL, NULL ); - pSVData->mpDefInst->SetErrorEventCallback( NULL, NULL ); + pSVData->mpDefInst->SetEventCallback( NULL ); } -} + SolarMutexReleaser aRel; + + MutexGuard aGuard( m_aMutex ); + Any aEvent; + std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers ); + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) + (*it)->handleEvent( aEvent ); +} -void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() +void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.remove( handler ); } -void SAL_CALL DisplayConnection::addErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); @@ -125,52 +143,37 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw() return m_aAny; } -void DisplayConnection::dispatchDowningEvent() -{ - SolarMutexReleaser aRel; - - MutexGuard aGuard( m_aMutex ); - Any aEvent; - std::list< Reference< XEventHandler > > aLocalList( m_aHandlers ); - for( ::std::list< Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) - (*it)->handleEvent( aEvent ); -} - -bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; } -bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aErrorHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aErrorHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f6bedc1bfa25..1de1516e8c19 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4360,7 +4360,7 @@ Window::~Window() // Dispose of the canvas implementation (which, currently, has an // own wrapper window as a child to this one. - Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); + uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); if( xCanvas.is() ) { uno::Reference < lang::XComponent > xCanvasComponent( xCanvas, @@ -4405,12 +4405,12 @@ Window::~Window() // deregister drop target listener if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() ) { - Reference< XDragGestureRecognizer > xDragGestureRecognizer = - Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); + uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = + uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); if( xDragGestureRecognizer.is() ) { xDragGestureRecognizer->removeDragGestureListener( - Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); + uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); } mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); @@ -4418,7 +4418,7 @@ Window::~Window() } // shutdown drag and drop for this frame window - Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY ); + uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY ); // DNDEventDispatcher does not hold a reference of the DropTarget, // so it's ok if it does not support XComponent @@ -8455,7 +8455,7 @@ void Window::ImplStartDnd() // ----------------------------------------------------------------------- -Reference< XDropTarget > Window::GetDropTarget() +uno::Reference< XDropTarget > Window::GetDropTarget() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8468,7 +8468,7 @@ Reference< XDropTarget > Window::GetDropTarget() if( ! mpWindowImpl->mpFrameData->mxDropTarget.is() ) { // initialization is done in GetDragSource - Reference< XDragSource > xDragSource = GetDragSource(); + uno::Reference< XDragSource > xDragSource = GetDragSource(); } if( mpWindowImpl->mpFrameData->mxDropTarget.is() ) @@ -8484,13 +8484,13 @@ Reference< XDropTarget > Window::GetDropTarget() mpWindowImpl->mpFrameData->mxDropTarget->addDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); // register also as drag gesture listener if directly supported by drag source - Reference< XDragGestureRecognizer > xDragGestureRecognizer = - Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); + uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = + uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); if( xDragGestureRecognizer.is() ) { xDragGestureRecognizer->addDragGestureListener( - Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); + uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); } else mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = TRUE; @@ -8512,12 +8512,12 @@ Reference< XDropTarget > Window::GetDropTarget() } // this object is located in the same process, so there will be no runtime exception - return Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY ); + return uno::Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY ); } // ----------------------------------------------------------------------- -Reference< XDragSource > Window::GetDragSource() +uno::Reference< XDragSource > Window::GetDragSource() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8527,7 +8527,7 @@ Reference< XDragSource > Window::GetDragSource() { try { - Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); if ( xFactory.is() ) { const SystemEnvData * pEnvData = GetSystemData(); @@ -8561,10 +8561,10 @@ Reference< XDragSource > Window::GetDragSource() aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() ); #endif if( aDragSourceSN.getLength() ) - mpWindowImpl->mpFrameData->mxDragSource = Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); if( aDropTargetSN.getLength() ) - mpWindowImpl->mpFrameData->mxDropTarget = Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); } } } @@ -8581,12 +8581,12 @@ Reference< XDragSource > Window::GetDragSource() return mpWindowImpl->mpFrameData->mxDragSource; } - return Reference< XDragSource > (); + return uno::Reference< XDragSource > (); } // ----------------------------------------------------------------------- -void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Reference< XDropTarget > &xDropTarget ) +void Window::GetDragSourceDropTarget(uno::Reference< XDragSource >& xDragSource, uno::Reference< XDropTarget > &xDropTarget ) // only for RVP transmission { if( mpWindowImpl->mpFrameData ) @@ -8604,14 +8604,14 @@ void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Refe // ----------------------------------------------------------------------- -Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer() +uno::Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer() { - return Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY ); + return uno::Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY ); } // ----------------------------------------------------------------------- -Reference< XClipboard > Window::GetClipboard() +uno::Reference< XClipboard > Window::GetClipboard() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8621,19 +8621,19 @@ Reference< XClipboard > Window::GetClipboard() { try { - Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); if( xFactory.is() ) { - mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY ); if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) - mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized if( mpWindowImpl->mpFrameData->mxClipboard.is() ) { - Reference< XInitialization > xInit = Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); + uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); if( xInit.is() ) { @@ -8665,7 +8665,7 @@ Reference< XClipboard > Window::GetClipboard() // ----------------------------------------------------------------------- -Reference< XClipboard > Window::GetPrimarySelection() +uno::Reference< XClipboard > Window::GetPrimarySelection() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8675,7 +8675,7 @@ Reference< XClipboard > Window::GetPrimarySelection() { try { - Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); if( xFactory.is() ) { @@ -8685,16 +8685,16 @@ Reference< XClipboard > Window::GetPrimarySelection() aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) ); aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); - mpWindowImpl->mpFrameData->mxSelection = Reference< XClipboard >( xFactory->createInstanceWithArguments( + mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ), aArgumentList ), UNO_QUERY ); # else - static Reference< XClipboard > s_xSelection; + static uno::Reference< XClipboard > s_xSelection; if ( !s_xSelection.is() ) - s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY ); if ( !s_xSelection.is() ) - s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY ); mpWindowImpl->mpFrameData->mxSelection = s_xSelection; # endif @@ -9519,7 +9519,7 @@ BOOL Window::IsTopWindow() const { // #113722#, cache result of expensive queryInterface call Window *pThisWin = (Window*)this; - Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); + uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0; } return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? TRUE : FALSE; @@ -9655,12 +9655,12 @@ BOOL Window::IsNativeWidgetEnabled() const #include #endif -Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize, +uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const { // try to retrieve hard reference from weak member - Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); + uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); // canvas still valid? Then we're done. if( xCanvas.is() ) @@ -9699,17 +9699,17 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) ); aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? sal_True : sal_False ); - aArg[ 4 ] = makeAny( Reference< awt::XWindow >( + aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >( const_cast(this)->GetComponentInterface(), uno::UNO_QUERY )); - Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); // Create canvas instance with window handle // ========================================= if ( xFactory.is() ) { - static Reference xCanvasFactory( + static uno::Reference xCanvasFactory( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star." @@ -9759,21 +9759,21 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi return xCanvas; } -Reference< rendering::XCanvas > Window::GetCanvas() const +uno::Reference< rendering::XCanvas > Window::GetCanvas() const { return ImplGetCanvas( Size(), false, false ); } -Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const +uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const { - Reference< rendering::XSpriteCanvas > xSpriteCanvas( + uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY ); return xSpriteCanvas; } -Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const +uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const { - Reference< rendering::XSpriteCanvas > xSpriteCanvas( + uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( ImplGetCanvas( rFullscreenSize, true, true ), uno::UNO_QUERY ); return xSpriteCanvas; } 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 xBM( new BmpTransporter( aData ) ); + css::uno::Reference xBM( new BmpTransporter( aData ) ); Sequence aArgs(2), aOutArgs; Sequence 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(this) ); + return css::uno::Reference< XInterface >( static_cast(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 #include +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() ) -- cgit From 9d264d2667daa4284d08afe0e4e93d0c67efa85e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 6 Jan 2011 15:27:01 +0100 Subject: vcl118: #i116120# cope with too small geometries --- vcl/source/control/tabctrl.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index e9696aa8c492..7b9e2dcb08f9 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -461,15 +461,18 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight ) { Size aWinSize = Control::GetOutputSizePixel(); - if ( nWidth == -1 ) + if ( nWidth < 0 ) nWidth = aWinSize.Width(); - if ( nHeight == -1 ) + if ( nHeight < 0 ) nHeight = aWinSize.Height(); if ( mpTabCtrlData->maItemList.empty() ) { - return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), - Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) ); + long nW = nWidth-TAB_OFFSET*2; + long nH = nHeight-TAB_OFFSET*2; + return (nW > 0 && nH > 0) + ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); } if ( nItemPos == TAB_PAGERECT ) @@ -481,9 +484,11 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight nLastPos = 0; Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight ); - aRect = Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), - Size( nWidth-TAB_OFFSET*2, - nHeight-aRect.Bottom()-TAB_OFFSET*2 ) ); + long nW = nWidth-TAB_OFFSET*2; + long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2; + aRect = (nW > 0 && nH > 0) + ? Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); return aRect; } -- cgit From 27103fadc0eabf17ae4124975f8d4ac977618695 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 7 Jan 2011 14:56:55 +0100 Subject: vcl118: fix a namespace problem --- vcl/aqua/source/gdi/salprn.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index c79add81d791..0187f312b2ca 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -380,14 +380,14 @@ static bool getUseNativeDialog() try { // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); // create configuration hierachical access name if( xSMgr.is() ) { try { - Reference< XMultiServiceFactory > xConfigProvider( - Reference< XMultiServiceFactory >( + uno::Reference< XMultiServiceFactory > xConfigProvider( + uno::Reference< XMultiServiceFactory >( xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))), UNO_QUERY ) @@ -399,8 +399,8 @@ static bool getUseNativeDialog() aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Misc" ) ); aArgs.getArray()[0] <<= aVal; - Reference< XNameAccess > xConfigAccess( - Reference< XNameAccess >( + uno::Reference< XNameAccess > xConfigAccess( + uno::Reference< XNameAccess >( xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ), -- cgit From c23439dc8491926ff6de6e354faef4194085f7e3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 7 Jan 2011 15:40:32 +0100 Subject: vcl118: fix a namespace problem --- vcl/aqua/source/dtrans/DragSource.cxx | 13 +++++++------ vcl/aqua/source/dtrans/service_entry.cxx | 14 +++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index 1a8f950e50d4..b3c2498c0eb8 100644 --- a/vcl/aqua/source/dtrans/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -47,6 +47,7 @@ using namespace rtl; using namespace cppu; using namespace osl; +using namespace com::sun::star; using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::datatransfer::dnd; @@ -61,7 +62,7 @@ using namespace std; // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut -Reference DragSource::g_XTransferable = Reference(); +uno::Reference DragSource::g_XTransferable; NSView* DragSource::g_DragSourceView = nil; bool DragSource::g_DropSuccessSet = false; bool DragSource::g_DropSuccess = false; @@ -138,7 +139,7 @@ Sequence dragSource_getSupportedServiceNames() bDropSuccess ); mDragSource->mXDragSrcListener->dragDropEnd(dsde); - mDragSource->mXDragSrcListener = Reference(); + mDragSource->mXDragSrcListener = uno::Reference(); } @@ -242,8 +243,8 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference& transferable, - const Reference& listener ) + const uno::Reference& transferable, + const uno::Reference& listener ) throw( RuntimeException) { MutexGuard guard(m_aMutex); @@ -257,7 +258,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, mXCurrentContext = static_cast(new DragSourceContext(this)); auto_ptr clipb(new AquaClipboard(NULL, false)); g_XTransferable = transferable; - clipb->setContents(g_XTransferable, Reference()); + clipb->setContents(g_XTransferable, uno::Reference()); mDragSourceActions = sourceActions; g_DragSourceView = mView; @@ -297,7 +298,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, [dragImage release]; - g_XTransferable = Reference(); + g_XTransferable = uno::Reference(); g_DragSourceView = nil; // reset drop success flags diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx index 16308951bcfe..3781d6cbbc30 100644 --- a/vcl/aqua/source/dtrans/service_entry.cxx +++ b/vcl/aqua/source/dtrans/service_entry.cxx @@ -37,28 +37,28 @@ using namespace ::osl; using namespace ::rtl; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::cppu; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::datatransfer::clipboard; -Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) +uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) { SalData* pSalData = GetSalData(); if( ! pSalData->mxClipboard.is() ) - pSalData->mxClipboard = Reference(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); + pSalData->mxClipboard = uno::Reference(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); return pSalData->mxClipboard; } - -Reference AquaSalInstance::CreateDragSource() +uno::Reference AquaSalInstance::CreateDragSource() { - return Reference(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); + return uno::Reference(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); } -Reference AquaSalInstance::CreateDropTarget() +uno::Reference AquaSalInstance::CreateDropTarget() { - return Reference(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); + return uno::Reference(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); } -- cgit From e73cc303e5201dc04c61a30572b80d3da13a2699 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 13:35:20 +0100 Subject: gridsort: Help::ShowQuickHelp: new flag QUICKHELP_FORCE_REPOSITION, which re-positions the window even if the quick help text didn't change. Use this in the table control, this prevents the help text appearing too far from the mouse position --- vcl/inc/vcl/help.hxx | 21 +++++++++++---------- vcl/source/app/help.cxx | 16 ++++++++++------ 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index 1f4ba36d8f43..e4f9aa45b139 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -40,16 +40,17 @@ class Window; // - Help-Types - // -------------- -#define QUICKHELP_LEFT ((USHORT)0x0001) -#define QUICKHELP_CENTER ((USHORT)0x0002) -#define QUICKHELP_RIGHT ((USHORT)0x0004) -#define QUICKHELP_TOP ((USHORT)0x0008) -#define QUICKHELP_VCENTER ((USHORT)0x0010) -#define QUICKHELP_BOTTOM ((USHORT)0x0020) -#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) -#define QUICKHELP_CTRLTEXT ((USHORT)0x0040) -#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) -#define QUICKHELP_BIDI_RTL ((USHORT)0x8000) +#define QUICKHELP_LEFT ((USHORT)0x0001) +#define QUICKHELP_CENTER ((USHORT)0x0002) +#define QUICKHELP_RIGHT ((USHORT)0x0004) +#define QUICKHELP_TOP ((USHORT)0x0008) +#define QUICKHELP_VCENTER ((USHORT)0x0010) +#define QUICKHELP_BOTTOM ((USHORT)0x0020) +#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) +#define QUICKHELP_CTRLTEXT ((USHORT)0x0040) +#define QUICKHELP_FORCE_REPOSITION ((USHORT)0x0080) +#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) +#define QUICKHELP_BIDI_RTL ((USHORT)0x8000) // By changes you must also change: rsc/vclrsc.hxx #define OOO_HELP_INDEX ".help:index" diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 2c7ad2fa9c3e..37e7917d5e78 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -590,10 +590,14 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, { DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" ); - if ( (( pHelpWin->GetHelpText() != rHelpText ) || - ( pHelpWin->GetWinStyle() != nHelpWinStyle ) || - ( pHelpArea && ( pHelpWin->GetHelpArea() != *pHelpArea ) ) ) - && pSVData->maHelpData.mbRequestingHelp ) + if ( ( ( pHelpWin->GetHelpText() != rHelpText ) + || ( pHelpWin->GetWinStyle() != nHelpWinStyle ) + || ( pHelpArea + && ( pHelpWin->GetHelpArea() != *pHelpArea ) + ) + ) + && pSVData->maHelpData.mbRequestingHelp + ) { // remove help window if no HelpText or other HelpText or // other help mode. but keep it if we are scrolling, ie not requesting help @@ -605,8 +609,8 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, } else { - bool bTextChanged = rHelpText != pHelpWin->GetHelpText(); - if( bTextChanged ) + bool const bTextChanged = rHelpText != pHelpWin->GetHelpText(); + if ( bTextChanged || ( ( nStyle & QUICKHELP_FORCE_REPOSITION ) != 0 ) ) { Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow(); Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow ) ); -- cgit From 69e0e16e0e50074127c6a4bef1f45dd6323b0164 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 21:45:01 +0100 Subject: gridsort: +QUICKHELP_NO_DELAY --- vcl/inc/vcl/help.hxx | 1 + vcl/source/app/help.cxx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index e4f9aa45b139..4fb039b25bec 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -49,6 +49,7 @@ class Window; #define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) #define QUICKHELP_CTRLTEXT ((USHORT)0x0040) #define QUICKHELP_FORCE_REPOSITION ((USHORT)0x0080) +#define QUICKHELP_NO_DELAY ((USHORT)0x0100) #define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) #define QUICKHELP_BIDI_RTL ((USHORT)0x8000) diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 37e7917d5e78..46f5e2132e5c 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -629,7 +629,9 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, if ( !pHelpWin && rHelpText.Len() ) { ULONG nCurTime = Time::GetSystemTicks(); - if( (nCurTime - pSVData->maHelpData.mnLastHelpHideTime) < pParent->GetSettings().GetHelpSettings().GetTipDelay() ) + if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() ) + || ( ( nStyle & QUICKHELP_NO_DELAY ) != 0 ) + ) nDelayMode = HELPDELAY_NONE; DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" ); -- cgit From 0a4c6941671d13891aafec23778baabc38980a70 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 12 Jan 2011 17:11:03 +0100 Subject: vcl118: #i37400# implement Fax G4 encoding for 1bit images --- vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/gdi/pdfwriter_impl.hxx | 5 + vcl/source/gdi/pdfwriter_impl2.cxx | 473 +++++++++++++++++++++++++++++++++++++ 3 files changed, 519 insertions(+), 23 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 427b025f2051..5540a5f0c48e 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9660,15 +9660,24 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) aLine.append( " 0 obj\n" "<>\n" ); + } #endif if( ! bMask ) { @@ -9736,7 +9745,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { if( aBitmap.GetBitCount() == 1 ) { - aLine.append( " /ImageMask true\n" ); + aLine.append( "/ImageMask true\n" ); sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color( COL_BLACK ) ) ); DBG_ASSERT( nBlackIndex == 0 || nBlackIndex == 1, "wrong black index" ); if( nBlackIndex ) @@ -9798,33 +9807,42 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos )) ); checkAndEnableStreamEncryption( rObject.m_nObject ); - beginCompression(); - if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) +#ifndef DEBUG_DISABLE_PDFCOMPRESSION + if( nBitsPerComponent == 1 ) { - const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); - - for( int i = 0; i < pAccess->Height(); i++ ) - { - CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); - } + writeG4Stream( pAccess ); } else +#endif { - const int nScanLineBytes = pAccess->Width()*3; - boost::shared_array pCol( new sal_uInt8[ nScanLineBytes ] ); - for( int y = 0; y < pAccess->Height(); y++ ) + beginCompression(); + if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) + { + const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); + + for( int i = 0; i < pAccess->Height(); i++ ) + { + CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); + } + } + else { - for( int x = 0; x < pAccess->Width(); x++ ) + const int nScanLineBytes = pAccess->Width()*3; + boost::shared_array pCol( new sal_uInt8[ nScanLineBytes ] ); + for( int y = 0; y < pAccess->Height(); y++ ) { - BitmapColor aColor = pAccess->GetColor( y, x ); - pCol[3*x+0] = aColor.GetRed(); - pCol[3*x+1] = aColor.GetGreen(); - pCol[3*x+2] = aColor.GetBlue(); + for( int x = 0; x < pAccess->Width(); x++ ) + { + BitmapColor aColor = pAccess->GetColor( y, x ); + pCol[3*x+0] = aColor.GetRed(); + pCol[3*x+1] = aColor.GetGreen(); + pCol[3*x+2] = aColor.GetBlue(); + } + CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) ); } - CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) ); } + endCompression(); } - endCompression(); disableStreamEncryption(); sal_uInt64 nEndPos = 0; diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 7b9096ea21eb..23d923b9990b 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -59,6 +59,7 @@ class ImplFontMetricData; class FontSubsetInfo; class ZCodec; class EncHashTransporter; +struct BitStreamState; // the maximum password length #define ENCRYPTED_PWD_SIZE 32 @@ -1055,6 +1056,10 @@ i12626 void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); + // helpers for CCITT 1bit bitmap stream + void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ); + void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ); + void writeG4Stream( BitmapReadAccess* i_pBitmap ); public: PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& ); ~PDFWriterImpl(); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 8a284e908922..1aa41af93a72 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -33,6 +33,7 @@ #include "vcl/virdev.hxx" #include "vcl/gdimtf.hxx" #include "vcl/metaact.hxx" +#include "vcl/bmpacc.hxx" #include "vcl/graph.hxx" #include "vcl/svdata.hxx" #include "unotools/streamwrap.hxx" @@ -1523,3 +1524,475 @@ bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter, /* end i12626 methods */ +static const long unsetRun[256] = +{ + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */ +}; + +static const long setRun[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */ +}; + +inline bool isSet( const Scanline i_pLine, long i_nIndex ) +{ + return (i_pLine[ i_nIndex/8 ] & (0x80 >> (i_nIndex&7))) != 0; +} + +long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet ) +{ + if( i_nStartIndex < 0 ) + return i_nW; + + long nIndex = i_nStartIndex; + if( nIndex < i_nW ) + { + const sal_uInt8 * pByte = static_cast(i_pLine) + (nIndex/8); + sal_uInt8 nByte = *pByte; + + // run up to byte boundary + long nBitInByte = (nIndex & 7); + if( nBitInByte ) + { + sal_uInt8 nMask = 0x80 >> nBitInByte; + while( nBitInByte != 8 ) + { + if( (nByte & nMask) != (i_bSet ? nMask : 0) ) + return nIndex < i_nW ? nIndex : i_nW; + nMask = nMask >> 1; + nBitInByte++; + nIndex++; + } + if( nIndex < i_nW ) + { + pByte++; + nByte = *pByte; + } + } + + sal_uInt8 nRunByte; + const long* pRunTable; + if( i_bSet ) + { + nRunByte = 0xff; + pRunTable = setRun; + } + else + { + nRunByte = 0; + pRunTable = unsetRun; + } + + while( nByte == nRunByte && nIndex < i_nW ) + { + nIndex += 8; + pByte++; + nByte = *pByte; + } + if( nIndex < i_nW ) + { + nIndex += pRunTable[nByte]; + } + } + return nIndex < i_nW ? nIndex : i_nW; +} + +struct BitStreamState +{ + sal_uInt8 mnBuffer; + sal_uInt32 mnNextBitPos; + + BitStreamState() + : mnBuffer( 0 ) + , mnNextBitPos( 8 ) + { + } + + const sal_uInt8* getByte() const { return &mnBuffer; } + void flush() { mnNextBitPos = 8; mnBuffer = 0; } +}; + +void PDFWriterImpl::putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ) +{ + while( i_nLength > io_rState.mnNextBitPos ) + { + io_rState.mnBuffer |= static_cast( i_nCode >> (i_nLength - io_rState.mnNextBitPos) ); + i_nLength -= io_rState.mnNextBitPos; + writeBuffer( io_rState.getByte(), 1 ); + io_rState.flush(); + } + OSL_ASSERT( i_nLength < 9 ); + static const unsigned int msbmask[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; + io_rState.mnBuffer |= static_cast( (i_nCode & msbmask[i_nLength]) << (io_rState.mnNextBitPos - i_nLength) ); + io_rState.mnNextBitPos -= i_nLength; + if( io_rState.mnNextBitPos == 0 ) + { + writeBuffer( io_rState.getByte(), 1 ); + io_rState.flush(); + } +} + +struct PixelCode +{ + sal_uInt32 mnEncodedPixels; + sal_uInt32 mnCodeBits; + sal_uInt32 mnCode; +}; + +static const PixelCode WhitePixelCodes[] = +{ + { 0, 8, 0x35 }, // 0011 0101 + { 1, 6, 0x7 }, // 0001 11 + { 2, 4, 0x7 }, // 0111 + { 3, 4, 0x8 }, // 1000 + { 4, 4, 0xB }, // 1011 + { 5, 4, 0xC }, // 1100 + { 6, 4, 0xE }, // 1110 + { 7, 4, 0xF }, // 1111 + { 8, 5, 0x13 }, // 1001 1 + { 9, 5, 0x14 }, // 1010 0 + { 10, 5, 0x7 }, // 0011 1 + { 11, 5, 0x8 }, // 0100 0 + { 12, 6, 0x8 }, // 0010 00 + { 13, 6, 0x3 }, // 0000 11 + { 14, 6, 0x34 }, // 1101 00 + { 15, 6, 0x35 }, // 1101 01 + { 16, 6, 0x2A }, // 1010 10 + { 17, 6, 0x2B }, // 1010 11 + { 18, 7, 0x27 }, // 0100 111 + { 19, 7, 0xC }, // 0001 100 + { 20, 7, 0x8 }, // 0001 000 + { 21, 7, 0x17 }, // 0010 111 + { 22, 7, 0x3 }, // 0000 011 + { 23, 7, 0x4 }, // 0000 100 + { 24, 7, 0x28 }, // 0101 000 + { 25, 7, 0x2B }, // 0101 011 + { 26, 7, 0x13 }, // 0010 011 + { 27, 7, 0x24 }, // 0100 100 + { 28, 7, 0x18 }, // 0011 000 + { 29, 8, 0x2 }, // 0000 0010 + { 30, 8, 0x3 }, // 0000 0011 + { 31, 8, 0x1A }, // 0001 1010 + { 32, 8, 0x1B }, // 0001 1011 + { 33, 8, 0x12 }, // 0001 0010 + { 34, 8, 0x13 }, // 0001 0011 + { 35, 8, 0x14 }, // 0001 0100 + { 36, 8, 0x15 }, // 0001 0101 + { 37, 8, 0x16 }, // 0001 0110 + { 38, 8, 0x17 }, // 0001 0111 + { 39, 8, 0x28 }, // 0010 1000 + { 40, 8, 0x29 }, // 0010 1001 + { 41, 8, 0x2A }, // 0010 1010 + { 42, 8, 0x2B }, // 0010 1011 + { 43, 8, 0x2C }, // 0010 1100 + { 44, 8, 0x2D }, // 0010 1101 + { 45, 8, 0x4 }, // 0000 0100 + { 46, 8, 0x5 }, // 0000 0101 + { 47, 8, 0xA }, // 0000 1010 + { 48, 8, 0xB }, // 0000 1011 + { 49, 8, 0x52 }, // 0101 0010 + { 50, 8, 0x53 }, // 0101 0011 + { 51, 8, 0x54 }, // 0101 0100 + { 52, 8, 0x55 }, // 0101 0101 + { 53, 8, 0x24 }, // 0010 0100 + { 54, 8, 0x25 }, // 0010 0101 + { 55, 8, 0x58 }, // 0101 1000 + { 56, 8, 0x59 }, // 0101 1001 + { 57, 8, 0x5A }, // 0101 1010 + { 58, 8, 0x5B }, // 0101 1011 + { 59, 8, 0x4A }, // 0100 1010 + { 60, 8, 0x4B }, // 0100 1011 + { 61, 8, 0x32 }, // 0011 0010 + { 62, 8, 0x33 }, // 0011 0011 + { 63, 8, 0x34 }, // 0011 0100 + { 64, 5, 0x1B }, // 1101 1 + { 128, 5, 0x12 }, // 1001 0 + { 192, 6, 0x17 }, // 0101 11 + { 256, 7, 0x37 }, // 0110 111 + { 320, 8, 0x36 }, // 0011 0110 + { 384, 8, 0x37 }, // 0011 0111 + { 448, 8, 0x64 }, // 0110 0100 + { 512, 8, 0x65 }, // 0110 0101 + { 576, 8, 0x68 }, // 0110 1000 + { 640, 8, 0x67 }, // 0110 0111 + { 704, 9, 0xCC }, // 0110 0110 0 + { 768, 9, 0xCD }, // 0110 0110 1 + { 832, 9, 0xD2 }, // 0110 1001 0 + { 896, 9, 0xD3 }, // 0110 1001 1 + { 960, 9, 0xD4 }, // 0110 1010 0 + { 1024, 9, 0xD5 }, // 0110 1010 1 + { 1088, 9, 0xD6 }, // 0110 1011 0 + { 1152, 9, 0xD7 }, // 0110 1011 1 + { 1216, 9, 0xD8 }, // 0110 1100 0 + { 1280, 9, 0xD9 }, // 0110 1100 1 + { 1344, 9, 0xDA }, // 0110 1101 0 + { 1408, 9, 0xDB }, // 0110 1101 1 + { 1472, 9, 0x98 }, // 0100 1100 0 + { 1536, 9, 0x99 }, // 0100 1100 1 + { 1600, 9, 0x9A }, // 0100 1101 0 + { 1664, 6, 0x18 }, // 0110 00 + { 1728, 9, 0x9B }, // 0100 1101 1 + { 1792, 11, 0x8 }, // 0000 0001 000 + { 1856, 11, 0xC }, // 0000 0001 100 + { 1920, 11, 0xD }, // 0000 0001 101 + { 1984, 12, 0x12 }, // 0000 0001 0010 + { 2048, 12, 0x13 }, // 0000 0001 0011 + { 2112, 12, 0x14 }, // 0000 0001 0100 + { 2176, 12, 0x15 }, // 0000 0001 0101 + { 2240, 12, 0x16 }, // 0000 0001 0110 + { 2304, 12, 0x17 }, // 0000 0001 0111 + { 2368, 12, 0x1C }, // 0000 0001 1100 + { 2432, 12, 0x1D }, // 0000 0001 1101 + { 2496, 12, 0x1E }, // 0000 0001 1110 + { 2560, 12, 0x1F } // 0000 0001 1111 +}; + +static const PixelCode BlackPixelCodes[] = +{ + { 0, 10, 0x37 }, // 0000 1101 11 + { 1, 3, 0x2 }, // 010 + { 2, 2, 0x3 }, // 11 + { 3, 2, 0x2 }, // 10 + { 4, 3, 0x3 }, // 011 + { 5, 4, 0x3 }, // 0011 + { 6, 4, 0x2 }, // 0010 + { 7, 5, 0x3 }, // 0001 1 + { 8, 6, 0x5 }, // 0001 01 + { 9, 6, 0x4 }, // 0001 00 + { 10, 7, 0x4 }, // 0000 100 + { 11, 7, 0x5 }, // 0000 101 + { 12, 7, 0x7 }, // 0000 111 + { 13, 8, 0x4 }, // 0000 0100 + { 14, 8, 0x7 }, // 0000 0111 + { 15, 9, 0x18 }, // 0000 1100 0 + { 16, 10, 0x17 }, // 0000 0101 11 + { 17, 10, 0x18 }, // 0000 0110 00 + { 18, 10, 0x8 }, // 0000 0010 00 + { 19, 11, 0x67 }, // 0000 1100 111 + { 20, 11, 0x68 }, // 0000 1101 000 + { 21, 11, 0x6C }, // 0000 1101 100 + { 22, 11, 0x37 }, // 0000 0110 111 + { 23, 11, 0x28 }, // 0000 0101 000 + { 24, 11, 0x17 }, // 0000 0010 111 + { 25, 11, 0x18 }, // 0000 0011 000 + { 26, 12, 0xCA }, // 0000 1100 1010 + { 27, 12, 0xCB }, // 0000 1100 1011 + { 28, 12, 0xCC }, // 0000 1100 1100 + { 29, 12, 0xCD }, // 0000 1100 1101 + { 30, 12, 0x68 }, // 0000 0110 1000 + { 31, 12, 0x69 }, // 0000 0110 1001 + { 32, 12, 0x6A }, // 0000 0110 1010 + { 33, 12, 0x6B }, // 0000 0110 1011 + { 34, 12, 0xD2 }, // 0000 1101 0010 + { 35, 12, 0xD3 }, // 0000 1101 0011 + { 36, 12, 0xD4 }, // 0000 1101 0100 + { 37, 12, 0xD5 }, // 0000 1101 0101 + { 38, 12, 0xD6 }, // 0000 1101 0110 + { 39, 12, 0xD7 }, // 0000 1101 0111 + { 40, 12, 0x6C }, // 0000 0110 1100 + { 41, 12, 0x6D }, // 0000 0110 1101 + { 42, 12, 0xDA }, // 0000 1101 1010 + { 43, 12, 0xDB }, // 0000 1101 1011 + { 44, 12, 0x54 }, // 0000 0101 0100 + { 45, 12, 0x55 }, // 0000 0101 0101 + { 46, 12, 0x56 }, // 0000 0101 0110 + { 47, 12, 0x57 }, // 0000 0101 0111 + { 48, 12, 0x64 }, // 0000 0110 0100 + { 49, 12, 0x65 }, // 0000 0110 0101 + { 50, 12, 0x52 }, // 0000 0101 0010 + { 51, 12, 0x53 }, // 0000 0101 0011 + { 52, 12, 0x24 }, // 0000 0010 0100 + { 53, 12, 0x37 }, // 0000 0011 0111 + { 54, 12, 0x38 }, // 0000 0011 1000 + { 55, 12, 0x27 }, // 0000 0010 0111 + { 56, 12, 0x28 }, // 0000 0010 1000 + { 57, 12, 0x58 }, // 0000 0101 1000 + { 58, 12, 0x59 }, // 0000 0101 1001 + { 59, 12, 0x2B }, // 0000 0010 1011 + { 60, 12, 0x2C }, // 0000 0010 1100 + { 61, 12, 0x5A }, // 0000 0101 1010 + { 62, 12, 0x66 }, // 0000 0110 0110 + { 63, 12, 0x67 }, // 0000 0110 0111 + { 64, 10, 0xF }, // 0000 0011 11 + { 128, 12, 0xC8 }, // 0000 1100 1000 + { 192, 12, 0xC9 }, // 0000 1100 1001 + { 256, 12, 0x5B }, // 0000 0101 1011 + { 320, 12, 0x33 }, // 0000 0011 0011 + { 384, 12, 0x34 }, // 0000 0011 0100 + { 448, 12, 0x35 }, // 0000 0011 0101 + { 512, 13, 0x6C }, // 0000 0011 0110 0 + { 576, 13, 0x6D }, // 0000 0011 0110 1 + { 640, 13, 0x4A }, // 0000 0010 0101 0 + { 704, 13, 0x4B }, // 0000 0010 0101 1 + { 768, 13, 0x4C }, // 0000 0010 0110 0 + { 832, 13, 0x4D }, // 0000 0010 0110 1 + { 896, 13, 0x72 }, // 0000 0011 1001 0 + { 960, 13, 0x73 }, // 0000 0011 1001 1 + { 1024, 13, 0x74 }, // 0000 0011 1010 0 + { 1088, 13, 0x75 }, // 0000 0011 1010 1 + { 1152, 13, 0x76 }, // 0000 0011 1011 0 + { 1216, 13, 0x77 }, // 0000 0011 1011 1 + { 1280, 13, 0x52 }, // 0000 0010 1001 0 + { 1344, 13, 0x53 }, // 0000 0010 1001 1 + { 1408, 13, 0x54 }, // 0000 0010 1010 0 + { 1472, 13, 0x55 }, // 0000 0010 1010 1 + { 1536, 13, 0x5A }, // 0000 0010 1101 0 + { 1600, 13, 0x5B }, // 0000 0010 1101 1 + { 1664, 13, 0x64 }, // 0000 0011 0010 0 + { 1728, 13, 0x65 }, // 0000 0011 0010 1 + { 1792, 11, 0x8 }, // 0000 0001 000 + { 1856, 11, 0xC }, // 0000 0001 100 + { 1920, 11, 0xD }, // 0000 0001 101 + { 1984, 12, 0x12 }, // 0000 0001 0010 + { 2048, 12, 0x13 }, // 0000 0001 0011 + { 2112, 12, 0x14 }, // 0000 0001 0100 + { 2176, 12, 0x15 }, // 0000 0001 0101 + { 2240, 12, 0x16 }, // 0000 0001 0110 + { 2304, 12, 0x17 }, // 0000 0001 0111 + { 2368, 12, 0x1C }, // 0000 0001 1100 + { 2432, 12, 0x1D }, // 0000 0001 1101 + { 2496, 12, 0x1E }, // 0000 0001 1110 + { 2560, 12, 0x1F } // 0000 0001 1111 +}; + + +void PDFWriterImpl::putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ) +{ + const PixelCode* pTable = i_bWhitePixel ? WhitePixelCodes : BlackPixelCodes; + // maximum encoded span is 2560 consecutive pixels + while( i_nSpan > 2623 ) + { + // write 2560 bits, that is entry (63 + (2560 >> 6)) == 103 in the appropriate table + putG4Bits( pTable[103].mnCodeBits, pTable[103].mnCode, io_rState ); + i_nSpan -= pTable[103].mnEncodedPixels; + } + // write multiples of 64 pixels up to 2560 + if( i_nSpan > 63 ) + { + sal_uInt32 nTabIndex = 63 + (i_nSpan >> 6); + OSL_ASSERT( pTable[nTabIndex].mnEncodedPixels == static_cast(64*(i_nSpan >> 6)) ); + putG4Bits( pTable[nTabIndex].mnCodeBits, pTable[nTabIndex].mnCode, io_rState ); + i_nSpan -= pTable[nTabIndex].mnEncodedPixels; + } + putG4Bits( pTable[i_nSpan].mnCodeBits, pTable[i_nSpan].mnCode, io_rState ); +} + +void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) +{ + long nW = i_pBitmap->Width(); + long nH = i_pBitmap->Height(); + if( nW <= 0 || nH <= 0 ) + return; + if( i_pBitmap->GetBitCount() != 1 ) + return; + + BitStreamState aBitState; + + // the first reference line is virtual and completely empty + const Scanline pFirstRefLine = (Scanline)rtl_allocateZeroMemory( nW/8 + 1 ); + Scanline pRefLine = pFirstRefLine; + for( long nY = 0; nY < nH; nY++ ) + { + const Scanline pCurLine = i_pBitmap->GetScanline( nY ); + long nLineIndex = 0; + bool bRunSet = (*pCurLine & 0x80) ? true : false; + bool bRefSet = (*pRefLine & 0x80) ? true : false; + long nRunIndex1 = bRunSet ? 0 : findBitRun( pCurLine, 0, nW, bRunSet ); + long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet ); + for( ; nLineIndex < nW; ) + { + long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW, isSet( pRefLine, nRefIndex1 ) ); + if( nRefIndex2 >= nRunIndex1 ) + { + long nDiff = nRefIndex1 - nRunIndex1; + if( -3 <= nDiff && nDiff <= 3 ) + { // vertical coding + static const struct + { + sal_uInt32 mnCodeBits; + sal_uInt32 mnCode; + } VerticalCodes[7] = { + { 7, 0x03 }, // 0000 011 + { 6, 0x03 }, // 0000 11 + { 3, 0x03 }, // 011 + { 1, 0x1 }, // 1 + { 3, 0x2 }, // 010 + { 6, 0x02 }, // 0000 10 + { 7, 0x02 } // 0000 010 + }; + // convert to index + nDiff += 3; + + // emit diff code + putG4Bits( VerticalCodes[nDiff].mnCodeBits, VerticalCodes[nDiff].mnCode, aBitState ); + nLineIndex = nRunIndex1; + } + else + { // difference too large, horizontal coding + // emit horz code 001 + putG4Bits( 3, 0x1, aBitState ); + long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW, isSet( pCurLine, nRunIndex1 ) ); + bool bWhiteFirst = ( nLineIndex + nRunIndex1 == 0 || ! isSet( pCurLine, nLineIndex ) ); + putG4Span( nRunIndex1 - nLineIndex, bWhiteFirst, aBitState ); + putG4Span( nRunIndex2 - nRunIndex1, ! bWhiteFirst, aBitState ); + nLineIndex = nRunIndex2; + } + } + else + { // emit pass code 0001 + putG4Bits( 4, 0x1, aBitState ); + nLineIndex = nRefIndex2; + } + if( nLineIndex < nW ) + { + bool bSet = isSet( pCurLine, nLineIndex ); + nRunIndex1 = findBitRun( pCurLine, nLineIndex, nW, bSet ); + nRefIndex1 = findBitRun( pRefLine, nLineIndex, nW, ! bSet ); + nRefIndex1 = findBitRun( pRefLine, nRefIndex1, nW, bSet ); + } + } + + // the current line is the reference for the next line + pRefLine = pCurLine; + } + // terminate strip with EOFB + putG4Bits( 12, 1, aBitState ); + putG4Bits( 12, 1, aBitState ); + if( aBitState.mnNextBitPos != 8 ) + { + writeBuffer( aBitState.getByte(), 1 ); + aBitState.flush(); + } + + rtl_freeMemory( pFirstRefLine ); +} -- cgit From 37a550ad7f196f3fc66a95ed2dea80a9f18213d4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 13 Jan 2011 15:07:15 +0100 Subject: vcl118: solve a namespace conflict --- vcl/win/source/gdi/salprn.cxx | 9 +++++---- vcl/win/source/window/salframe.cxx | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) mode change 100644 => 100755 vcl/win/source/gdi/salprn.cxx (limited to 'vcl') diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx old mode 100644 new mode 100755 index 702ff639ed84..1d36a35c7171 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -93,6 +93,7 @@ #endif +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ui::dialogs; @@ -2084,16 +2085,16 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, if( mpInfoPrinter->maPortName.EqualsIgnoreCaseAscii( "FILE:" ) && !(pFileName && pFileName->Len()) ) { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); if( xFactory.is() ) { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( + uno::Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); + uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); + uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) { Sequence< Any > aServiceType( 1 ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 89a191c99ef6..019ffa76bc27 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -104,6 +104,7 @@ using ::std::max; #include using ::rtl::OUString; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; @@ -875,11 +876,11 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, try { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) ) { - Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); + uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); com::sun::star::awt::Rectangle aRect; if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) { -- cgit From 09d66c1f31b05a8bbd06f88a2af8ae2d9ddb2eff Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 13 Jan 2011 17:05:56 +0100 Subject: vcl118: ImplControlValue is needed outside vcl after all --- vcl/inc/vcl/salnativewidgets.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index 31fdb769cc1a..64e120b54257 100755 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -269,7 +269,7 @@ enum ButtonValue { * Generic value container for all control parts. */ -class VCL_PLUGIN_PUBLIC ImplControlValue +class VCL_DLLPUBLIC ImplControlValue { friend class SalFrame; @@ -307,7 +307,7 @@ class VCL_PLUGIN_PUBLIC ImplControlValue * * Value container for scrollbars. */ - class VCL_PLUGIN_PUBLIC ScrollbarValue : public ImplControlValue +class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue { public: long mnMin; @@ -333,7 +333,7 @@ class VCL_PLUGIN_PUBLIC ImplControlValue virtual ~ScrollbarValue(); }; -class VCL_PLUGIN_PUBLIC SliderValue : public ImplControlValue +class VCL_DLLPUBLIC SliderValue : public ImplControlValue { public: long mnMin; @@ -361,7 +361,7 @@ class VCL_PLUGIN_PUBLIC SliderValue : public ImplControlValue #define TABITEM_FIRST_IN_GROUP 0x004 // the tabitem is the first in group of tabitems #define TABITEM_LAST_IN_GROUP 0x008 // the tabitem is the last in group of tabitems -class VCL_PLUGIN_PUBLIC TabitemValue : public ImplControlValue +class VCL_DLLPUBLIC TabitemValue : public ImplControlValue { public: unsigned int mnAlignment; @@ -387,7 +387,7 @@ class VCL_PLUGIN_PUBLIC TabitemValue : public ImplControlValue * Note: the other parameters of DrawNativeControl will have no meaning * all parameters for spinbuttons are carried here */ -class VCL_PLUGIN_PUBLIC SpinbuttonValue : public ImplControlValue +class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue { public: Rectangle maUpperRect; -- cgit From d0cdc38a6771473b81f002da6769b7b723d657ff Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 12:23:42 +0100 Subject: gridsort: TableDataWindow: use Help::ShowTip instead of Help::ShowQuickHelp. This means it doesn't interfere with the "normal" quick help (which is a singleton really dedicated to, well, quickly displaying help). Also, it means we do not need the QUICKHELP_NO_DELAY flag. To prevent flickering when repeatedly showing such a tip, introduced Help::UpdateTip, which updates an existing tip, instead of destroying the old tip window, and creating a new one. Used this new UpdateTip also in the BrowseBox, means means some less flickering there, too. --- vcl/inc/vcl/help.hxx | 4 ++++ vcl/inc/vcl/helpwin.hxx | 1 + vcl/source/app/help.cxx | 23 ++++++++++++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index 4fb039b25bec..a43b0fe84862 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -118,6 +118,10 @@ public: static ULONG ShowTip( Window* pParent, const Rectangle& rScreenRect, const XubString& rText, USHORT nStyle = 0 ); + static void UpdateTip( ULONG nId, + Window* pParent, + const Rectangle& rScreenRect, + const XubString& rText ); static void HideTip( ULONG nId ); }; diff --git a/vcl/inc/vcl/helpwin.hxx b/vcl/inc/vcl/helpwin.hxx index 244ae1b7d846..799685251e02 100644 --- a/vcl/inc/vcl/helpwin.hxx +++ b/vcl/inc/vcl/helpwin.hxx @@ -66,6 +66,7 @@ public: const String& GetHelpText() const { return maHelpText; } void SetHelpText( const String& rHelpText ); USHORT GetWinStyle() const { return mnHelpWinStyle; } + USHORT GetStyle() const { return mnStyle; } // Nur merken: void SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; } diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 46f5e2132e5c..09650cee9231 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -36,6 +36,7 @@ #include "vcl/help.hxx" #include "vcl/helpwin.hxx" #include "tools/debug.hxx" +#include "tools/diagnose_ex.h" #include "tools/time.hxx" // ======================================================================= @@ -274,18 +275,30 @@ BOOL Help::ShowQuickHelp( Window* pParent, // ----------------------------------------------------------------------- -ULONG Help::ShowTip( Window* pParent, const Rectangle& rRect, +ULONG Help::ShowTip( Window* pParent, const Rectangle& rScreenRect, const XubString& rText, USHORT nStyle ) { USHORT nHelpWinStyle = HELPWINSTYLE_QUICK; HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle ); + ULONG nId = reinterpret_cast< ULONG >( pHelpWin ); + UpdateTip( nId, pParent, rScreenRect, rText ); + + pHelpWin->ShowHelp( HELPDELAY_NONE ); + return nId; +} + +// ----------------------------------------------------------------------- + +void Help::UpdateTip( ULONG nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText ) +{ + HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId ); + ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" ); + Size aSz = pHelpWin->CalcOutSize(); pHelpWin->SetOutputSizePixel( aSz ); - ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, - pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect ); - pHelpWin->ShowHelp( HELPDELAY_NONE ); - return (ULONG)pHelpWin; + ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(), + pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); } // ----------------------------------------------------------------------- -- cgit From f64fd0b4a2b5c1e8fe4f5742d8ef530b02cd9f22 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 13:56:26 +0100 Subject: gridsort: +QUICKHELP_TIP_STYLE_BALLOON, to be used with ShowTip, to force a tip to appear in balloon-style --- vcl/inc/vcl/help.hxx | 4 ++++ vcl/source/app/help.cxx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index a43b0fe84862..9a1afad5618b 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -48,8 +48,12 @@ class Window; #define QUICKHELP_BOTTOM ((USHORT)0x0020) #define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) #define QUICKHELP_CTRLTEXT ((USHORT)0x0040) +/// force the existent tip window to be re-positioned, even if the previous incarnation has the same text. Applies to ShowBallon and ShowQuickHelp. #define QUICKHELP_FORCE_REPOSITION ((USHORT)0x0080) +/// no delay when opening the quick help. Applies to ShowBallon and ShowQuickHelp #define QUICKHELP_NO_DELAY ((USHORT)0x0100) +/// force balloon-style in ShowTip +#define QUICKHELP_TIP_STYLE_BALLOON ((USHORT)0x0200) #define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) #define QUICKHELP_BIDI_RTL ((USHORT)0x8000) diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 09650cee9231..7e58a7cc4dc8 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -278,7 +278,7 @@ BOOL Help::ShowQuickHelp( Window* pParent, ULONG Help::ShowTip( Window* pParent, const Rectangle& rScreenRect, const XubString& rText, USHORT nStyle ) { - USHORT nHelpWinStyle = HELPWINSTYLE_QUICK; + USHORT nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK; HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle ); ULONG nId = reinterpret_cast< ULONG >( pHelpWin ); -- cgit From 9c169fd0b2c6dc4961177b49d21d6e51dcb40701 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 17 Jan 2011 09:13:00 +0100 Subject: gridsort: UpdateTip: don't ignore the given text --- vcl/source/app/help.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 7e58a7cc4dc8..6f432e046a3b 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -299,6 +299,8 @@ void Help::UpdateTip( ULONG nId, Window* pParent, const Rectangle& rScreenRect, pHelpWin->SetOutputSizePixel( aSz ); ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(), pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); + + pHelpWin->SetHelpText( rText ); } // ----------------------------------------------------------------------- -- cgit From 20a8cc813f0b12c5a0be5f1fbb6ef47f539ae589 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 17 Jan 2011 16:24:56 +0100 Subject: vcl118: #i116133# convert to greyscale for PDFWriter --- vcl/inc/vcl/pdfwriter.hxx | 9 +++- vcl/source/gdi/pdfwriter_impl.cxx | 84 ++++++++++++++++++++++++++++---------- vcl/source/gdi/pdfwriter_impl.hxx | 4 ++ vcl/source/gdi/pdfwriter_impl2.cxx | 9 ++++ vcl/unx/source/gdi/salprnpsp.cxx | 2 + 5 files changed, 86 insertions(+), 22 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 52e4b5014120..949e242d9b39 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -537,6 +537,11 @@ The following structure describes the permissions used in PDF security String Producer; // OpenOffice }; + enum ColorMode + { + DrawColor, DrawGreyscale + }; + struct PDFWriterContext { /* must be a valid file: URL usable by osl */ @@ -599,6 +604,7 @@ The following structure describes the permissions used in PDF security com::sun::star::lang::Locale DocumentLocale; // defines the document default language sal_uInt32 DPIx, DPIy; // how to handle MapMode( MAP_PIXEL ) // 0 here specifies a default handling + PDFWriter::ColorMode ColorMode; PDFWriterContext() : RelFsys( false ), //i56629, i49415?, i64585? @@ -627,7 +633,8 @@ The following structure describes the permissions used in PDF security OpenBookmarkLevels( -1 ), Encryption(), DPIx( 0 ), - DPIy( 0 ) + DPIy( 0 ), + ColorMode( PDFWriter::DrawColor ) {} }; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 5540a5f0c48e..c3d6bf0d6a2a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -887,34 +888,44 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrec } -static void appendColor( const Color& rColor, OStringBuffer& rBuffer ) +static void appendColor( const Color& rColor, OStringBuffer& rBuffer, bool bConvertToGrey = false ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendDouble( (double)rColor.GetRed() / 255.0, rBuffer ); - rBuffer.append( ' ' ); - appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer ); - rBuffer.append( ' ' ); - appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer ); + if( bConvertToGrey ) + { + sal_uInt8 cByte = rColor.GetLuminance(); + appendDouble( (double)cByte / 255.0, rBuffer ); + } + else + { + appendDouble( (double)rColor.GetRed() / 255.0, rBuffer ); + rBuffer.append( ' ' ); + appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer ); + rBuffer.append( ' ' ); + appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer ); + } } } -static void appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) +void PDFWriterImpl::appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendColor( rColor, rBuffer ); - rBuffer.append( " RG" ); + bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale; + appendColor( rColor, rBuffer, bGrey ); + rBuffer.append( bGrey ? " G" : " RG" ); } } -static void appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) +void PDFWriterImpl::appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendColor( rColor, rBuffer ); - rBuffer.append( " rg" ); + bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale; + appendColor( rColor, rBuffer, bGrey ); + rBuffer.append( bGrey ? " g" : " rg" ); } } @@ -9411,6 +9422,10 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) VirtualDevice aDev; aDev.SetOutputSizePixel( rObject.m_aSize ); aDev.SetMapMode( MapMode( MAP_PIXEL ) ); + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + aDev.SetDrawMode( aDev.GetDrawMode() | + ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize ); @@ -9882,8 +9897,25 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const if( ! (rSizePixel.Width() && rSizePixel.Height()) ) return; - SvMemoryStream* pStream = new SvMemoryStream; rDCTData.Seek( 0 ); + if( bIsTrueColor && m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + // need to convert to grayscale; + // load stream to bitmap and draw the bitmap instead + Graphic aGraphic; + GraphicConverter::Import( rDCTData, aGraphic, CVT_JPG ); + Bitmap aBmp( aGraphic.GetBitmap() ); + if( !!rMask && rMask.GetSizePixel() == aBmp.GetSizePixel() ) + { + BitmapEx aBmpEx( aBmp, rMask ); + drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx ); + } + else + drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmp ); + return; + } + + SvMemoryStream* pStream = new SvMemoryStream; *pStream << rDCTData; pStream->Seek( STREAM_SEEK_TO_END ); @@ -9974,18 +10006,28 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize, writeBuffer( aLine.getStr(), aLine.getLength() ); } -const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& rBitmap, bool bDrawMask ) +const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, bool bDrawMask ) { + BitmapEx aBitmap( i_rBitmap ); + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS; + int nDepth = aBitmap.GetBitmap().GetBitCount(); + if( nDepth <= 4 ) + eConv = BMP_CONVERSION_4BIT_GREYS; + if( nDepth > 1 ) + aBitmap.Convert( eConv ); + } BitmapID aID; - aID.m_aPixelSize = rBitmap.GetSizePixel(); - aID.m_nSize = rBitmap.GetBitCount(); - aID.m_nChecksum = rBitmap.GetBitmap().GetChecksum(); + aID.m_aPixelSize = aBitmap.GetSizePixel(); + aID.m_nSize = aBitmap.GetBitCount(); + aID.m_nChecksum = aBitmap.GetBitmap().GetChecksum(); aID.m_nMaskChecksum = 0; - if( rBitmap.IsAlpha() ) - aID.m_nMaskChecksum = rBitmap.GetAlpha().GetChecksum(); + if( aBitmap.IsAlpha() ) + aID.m_nMaskChecksum = aBitmap.GetAlpha().GetChecksum(); else { - Bitmap aMask = rBitmap.GetMask(); + Bitmap aMask = aBitmap.GetMask(); if( ! aMask.IsEmpty() ) aID.m_nMaskChecksum = aMask.GetChecksum(); } @@ -9999,7 +10041,7 @@ const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx { m_aBitmaps.push_front( BitmapEmit() ); m_aBitmaps.front().m_aID = aID; - m_aBitmaps.front().m_aBitmap = rBitmap; + m_aBitmaps.front().m_aBitmap = aBitmap; m_aBitmaps.front().m_nObject = createObject(); m_aBitmaps.front().m_bDrawMask = bDrawMask; it = m_aBitmaps.begin(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 23d923b9990b..78b8c37d6fbe 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1060,6 +1060,10 @@ i12626 void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ); void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ); void writeG4Stream( BitmapReadAccess* i_pBitmap ); + + // color helper functions + void appendStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer ); + void appendNonStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer ); public: PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& ); ~PDFWriterImpl(); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 1aa41af93a72..e2179bb9749f 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -126,6 +126,15 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz const Size aSizePixel( aBitmapEx.GetSizePixel() ); if ( aSizePixel.Width() && aSizePixel.Height() ) { + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS; + int nDepth = aBitmapEx.GetBitmap().GetBitCount(); + if( nDepth <= 4 ) + eConv = BMP_CONVERSION_4BIT_GREYS; + if( nDepth > 1 ) + aBitmapEx.Convert( eConv ); + } sal_Bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression; if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) ) bUseJPGCompression = sal_False; diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index ece724d717cb..750c390bbcbc 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -1188,6 +1188,8 @@ BOOL PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobNam 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; -- cgit From 36a9d8b0104235c72b5659b1ed2416329e8c6c90 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 17 Jan 2011 18:21:18 +0100 Subject: vcl118: #i110916# move reverse page order checkbox to print range --- vcl/inc/vcl/prndlg.hxx | 2 +- vcl/inc/vcl/svids.hrc | 2 +- vcl/source/src/print.src | 15 ++++++++------- vcl/source/window/printdlg.cxx | 21 +++++++++++++++------ 4 files changed, 25 insertions(+), 15 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index d21e517d12f7..ddd387904fa6 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -169,6 +169,7 @@ namespace vcl NumericField maCopyCountField; CheckBox maCollateBox; FixedImage maCollateImage; + CheckBox maReverseOrderBox; Image maCollateImg; Image maCollateHCImg; @@ -197,7 +198,6 @@ namespace vcl FixedLine maOptionsLine; CheckBox maToFileBox; CheckBox maCollateSingleJobsBox; - CheckBox maReverseOrderBox; boost::shared_ptr mxOptGroup; diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 432a30c3a748..e05474a2b301 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -147,12 +147,12 @@ #define SV_PRINT_LOCATION_TXT 21 #define SV_PRINT_COMMENT_TXT 22 #define SV_PRINT_DETAILS_BTN 23 +#define SV_PRINT_OPT_REVERSE 24 #define SV_PRINT_TAB_OPT 3 #define SV_PRINT_OPT_PRINT_FL 1 #define SV_PRINT_OPT_TOFILE 2 #define SV_PRINT_OPT_SINGLEJOBS 3 -#define SV_PRINT_OPT_REVERSE 4 #define SV_DLG_PRINT_PROGRESS 2049 #define SV_PRINT_PROGRESS_CANCEL 1 diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 04ab77f09288..48f8dc5612ef 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -412,6 +412,14 @@ ModalDialog SV_DLG_PRINT { ImageBitmap = Bitmap { File = "ncollate_h.png" ; }; }; + + CheckBox SV_PRINT_OPT_REVERSE + { + HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse"; + Pos = MAP_APPFONT( 10, 50 ); + Size = MAP_APPFONT( 200, 12 ); + Text [en-US] = "Print in ~reverse page order"; + }; }; TabPage SV_PRINT_TAB_OPT @@ -440,13 +448,6 @@ ModalDialog SV_DLG_PRINT Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "~Create single print jobs for collated output"; }; - CheckBox SV_PRINT_OPT_REVERSE - { - HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse"; - Pos = MAP_APPFONT( 10, 50 ); - Size = MAP_APPFONT( 200, 12 ); - Text [en-US] = "Print in ~reverse page order"; - }; }; }; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 574cef4e5a07..cd9db93f1b2f 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -613,6 +613,7 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) , maCopyCountField( this, VclResId( SV_PRINT_COPYCOUNT_FIELD ) ) , maCollateBox( this, VclResId( SV_PRINT_COLLATE ) ) , maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) ) + , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) , maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) ) , maCollateHCImg( VclResId( SV_PRINT_COLLATE_HC_IMG ) ) , maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) ) @@ -741,7 +742,6 @@ PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rRe , maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) ) , maToFileBox( this, VclResId( SV_PRINT_OPT_TOFILE ) ) , maCollateSingleJobsBox( this, VclResId( SV_PRINT_OPT_SINGLEJOBS ) ) - , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) { FreeResource(); @@ -765,7 +765,6 @@ void PrintDialog::OutputOptPage::setupLayout() mxOptGroup = xCol; xCol->addWindow( &maToFileBox ); xCol->addWindow( &maCollateSingleJobsBox ); - xCol->addWindow( &maReverseOrderBox ); } void PrintDialog::OutputOptPage::readFromSettings() @@ -833,7 +832,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrgetReversePrint() ); + maJobPage.maReverseOrderBox.Check( maPController->getReversePrint() ); // fill printer listbox const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() ); @@ -906,7 +905,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrshow( false, false ); maJobPage.maCopySpacer.Show( FALSE ); + maJobPage.maReverseOrderBox.Show( FALSE ); + } + else + { + // add an indent to the current column + vcl::Indenter* pIndent = new vcl::Indenter( maJobPage.mxPrintRange.get(), -1 ); + maJobPage.mxPrintRange->addChild( pIndent ); + // and create a column inside the indent + pIndent->setWindow( &maJobPage.maReverseOrderBox ); + maJobPage.maReverseOrderBox.Show( TRUE ); } #ifdef WNT @@ -2187,9 +2196,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) makeAny( sal_Bool(isCollate()) ) ); checkControlDependencies(); } - else if( pButton == &maOptionsPage.maReverseOrderBox ) + else if( pButton == &maJobPage.maReverseOrderBox ) { - sal_Bool bChecked = maOptionsPage.maReverseOrderBox.IsChecked(); + sal_Bool bChecked = maJobPage.maReverseOrderBox.IsChecked(); maPController->setReversePrint( bChecked ); maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ), makeAny( bChecked ) ); -- cgit From 9381025d4abb0a10fb458117542c2a063c7b1cfd Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 18 Jan 2011 18:44:14 +0100 Subject: vcl118: #i116501# migrated padmin module to gbuild system --- vcl/prj/d.lst | 2 ++ vcl/source/salmain/makefile.mk | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 307064f7555d..d99694fdd458 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -12,6 +12,8 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\%__SRC%\misc\vcl?????.map %_DEST%\bin%_EXT%\vcl?????.map ..\%__SRC%\obj\salmain.obj %_DEST%\lib%_EXT%\salmain.obj ..\%__SRC%\obj\salmain.o %_DEST%\lib%_EXT%\salmain.o +..\%__SRC%\lib\libvclmain.a %_DEST%\lib%_EXT%\libvclmain.a +..\%__SRC%\lib\vclmain.lib %_DEST%\lib%_EXT%\vclmain.lib ..\inc\vcl\accel.hxx %_DEST%\inc%_EXT%\vcl\accel.hxx ..\inc\vcl\alpha.hxx %_DEST%\inc%_EXT%\vcl\alpha.hxx diff --git a/vcl/source/salmain/makefile.mk b/vcl/source/salmain/makefile.mk index de085b482c4d..8b62991f65a6 100644 --- a/vcl/source/salmain/makefile.mk +++ b/vcl/source/salmain/makefile.mk @@ -28,11 +28,15 @@ PRJ = ..$/.. PRJNAME = vcl TARGET = salmain -LIBTARGET = NO ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk OBJFILES = $(OBJ)$/salmain.obj +LIB1TARGET=$(LB)$/vclmain.lib +LIB1ARCHIV=$(LB)$/libvclmain.a +LIB1FILES=$(LB)$/salmain.lib + + .INCLUDE: target.mk -- cgit From cc01ab8a817f6badf4b9631097a43e0ea11d0f8a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 19 Jan 2011 16:33:54 +0100 Subject: vcl118: #i115048# revert brochure printing in writer to old behavior taking the paper size form the printer driver, add paper name to print preview --- vcl/inc/vcl/print.hxx | 3 +++ vcl/inc/vcl/prndlg.hxx | 4 +++- vcl/inc/vcl/svdata.hxx | 7 +++++-- vcl/inc/vcl/svids.hrc | 2 ++ vcl/source/app/svdata.cxx | 2 ++ vcl/source/gdi/print.cxx | 44 +++++++++++++++++++++++++++++++++++++++++ vcl/source/src/print.src | 45 ++++++++++++++++++++++++++++++++++++++++++ vcl/source/window/printdlg.cxx | 11 ++++++++++- 8 files changed, 114 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 9d046269d7bc..1b5daffcdea0 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -340,6 +340,9 @@ public: BOOL SetPaperSizeUser( const Size& rSize ); BOOL SetPaperSizeUser( const Size& rSize, bool bMatchNearest ); Paper GetPaper() const; + static rtl::OUString GetPaperName( Paper ePaper ); + // return a UI string for the current paper; i_bPaperUser == false means an empty string for PAPER_USER + rtl::OUString GetPaperName( bool i_bPaperUser = true ) const; // returns number of available paper formats int GetPaperInfoCount() const; diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index ddd387904fa6..39f326d6d089 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -73,7 +73,9 @@ namespace vcl virtual void Resize(); virtual void DataChanged( const DataChangedEvent& ); - void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&, + void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, + const rtl::OUString& i_rPaperName, + const rtl::OUString& i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale ); diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 035cd1eaccc7..72dd0fc22cda 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -43,6 +43,8 @@ #include "com/sun/star/uno/Reference.hxx" #include "unotools/options.hxx" +#include + namespace com { namespace sun { namespace star { @@ -365,14 +367,15 @@ struct ImplSVData com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient; ::vcl::SettingsConfigItem* mpSettingsConfigItem; std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; + std::hash_map< int, rtl::OUString >* mpPaperNames; }; void ImplInitSVData(); void ImplDeInitSVData(); void ImplDestroySVData(); Window* ImplGetDefaultWindow(); -VCL_DLLPUBLIC ResMgr* ImplGetResMgr(); -VCL_DLLPUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr +VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr(); +VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr DockingManager* ImplGetDockingManager(); void ImplWindowAutoMnemonic( Window* pWindow ); diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index e05474a2b301..61622bcabade 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -58,6 +58,8 @@ #define SV_DISCLOSURE_PLUS_HC 1062 #define SV_DISCLOSURE_MINUS_HC 1063 +#define RID_STR_PAPERNAMES 1070 + #define SV_RESID_MENU_EDIT 2000 #define SV_MENU_EDIT_UNDO 1 #define SV_MENU_EDIT_CUT 2 diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 01647af81f7f..f0e1652cde17 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -179,6 +179,8 @@ void ImplDeInitSVData() delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; if( pSVData->maCtrlData.mpCleanUnitStrings ) delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL; + if( pSVData->mpPaperNames ) + delete pSVData->mpPaperNames, pSVData->mpPaperNames = NULL; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 78456992340f..fe01bd44f5d3 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#include #include @@ -1280,6 +1282,48 @@ int Printer::GetPaperInfoCount() const // ----------------------------------------------------------------------- +rtl::OUString Printer::GetPaperName( Paper ePaper ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpPaperNames ) + { + pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >(); + if( ImplGetResMgr() ) + { + ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) ); + static const int PaperIndex[] = + { + PAPER_A0, PAPER_A1, PAPER_A2, PAPER_A3, PAPER_A4, PAPER_A5, + PAPER_B4_ISO, PAPER_B5_ISO, PAPER_LETTER, PAPER_LEGAL, PAPER_TABLOID, + PAPER_USER, PAPER_B6_ISO, PAPER_ENV_C4, PAPER_ENV_C5, PAPER_ENV_C6, PAPER_ENV_C65, + PAPER_ENV_DL, PAPER_SLIDE_DIA, PAPER_SCREEN, PAPER_C, PAPER_D, PAPER_E, + PAPER_EXECUTIVE, PAPER_FANFOLD_LEGAL_DE, PAPER_ENV_MONARCH, PAPER_ENV_PERSONAL, + PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16, + PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS + }; + OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" ); + for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ ) + (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i); + } + } + + std::hash_map::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); + return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + +rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const +{ + Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); + Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); + if( ePaper == PAPER_USER ) + ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); + return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + const PaperInfo& Printer::GetPaperInfo( int nPaper ) const { if( ! mpInfoPrinter ) diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 48f8dc5612ef..f41e65f4939f 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -499,3 +499,48 @@ StringArray SV_PRINT_NATIVE_STRINGS < "Print selection only"; >; }; }; + +StringArray RID_STR_PAPERNAMES +{ + ItemList [en-US] = + { + < "A0"; >; + < "A1"; >; + < "A2"; >; + < "A3"; >; + < "A4"; >; + < "A5"; >; + < "B4 (ISO)"; >; + < "B5 (ISO)"; >; + < "Letter"; >; + < "Legal"; >; + < "Tabloid"; >; + < "User Defined"; >; + < "B6 (ISO)"; >; + < "C4 Envelope"; >; + < "C5 Envelope"; >; + < "C6 Envelope"; >; + < "C6/5 Envelope"; >; + < "DL Envelope"; >; + < "Dia Slide"; >; + < "Screen"; >; + < "C"; >; + < "D"; >; + < "E"; >; + < "Executive"; >; + < "Long Bond"; >; + < "#8 (Monarch) Envelope"; >; + < "#6 3/4 (Personal) Envelope"; >; + < "#9 Envelope"; >; + < "#10 Envelope"; >; + < "#11 Envelope"; >; + < "#12 Envelope"; >; + < "16 Kai"; >; + < "32 Kai"; >; + < "Big 32 Kai"; >; + < "B4 (JIS)"; >; + < "B5 (JIS)"; >; + < "B6 (JIS)"; >; + }; +}; + diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index cd9db93f1b2f..9d9376e4c8ab 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -310,6 +310,7 @@ void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, const Size& i_rOrigSize, + const rtl::OUString& i_rPaperName, const rtl::OUString& i_rReplacement, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, @@ -344,6 +345,12 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); aBuf.append( aNumText ); aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + if( i_rPaperName.getLength() ) + { + aBuf.appendAscii( " (" ); + aBuf.append( i_rPaperName ); + aBuf.append( sal_Unicode(')') ); + } maHorzDim.SetText( aBuf.makeStringAndClear() ); aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); @@ -1891,7 +1898,9 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) } Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); - maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr, + maPreviewWindow.setPreview( aMtf, aCurPageSize, + aPrt->GetPaperName( false ), + nPages > 0 ? rtl::OUString() : maNoPageStr, aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() ); -- cgit From ab645d9d6f0f7844fe64d490445313215b50f69b Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Wed, 19 Jan 2011 18:15:46 +0100 Subject: accfixes: Completed VCL Window API for accessible releations, renamed GetLabeledBy to GetAccessibleRelationLabeledBy --- vcl/inc/vcl/window.h | 18 +++++++++++ vcl/inc/vcl/window.hxx | 14 +++++++-- vcl/source/window/dlgctrl.cxx | 73 +++++++++++++++++++++++++++++++++++++++++-- vcl/source/window/window.cxx | 60 +++++++++++++++++++++++------------ 4 files changed, 140 insertions(+), 25 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index 73b6f1078ca9..ede8df9f8ac7 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -200,6 +200,24 @@ struct ImplFrameData BOOL mbInternalDragGestureRecognizer; }; +// ----------------------- +// - ImplAccessibleInfos - +// ----------------------- + +struct ImplAccessibleInfos +{ + USHORT nAccessibleRole; + String* pAccessibleName; + String* pAccessibleDescription; + Window* pLabeledByWindow; + Window* pLabelForWindow; + Window* pMemberOfWindow; + + ImplAccessibleInfos(); + ~ImplAccessibleInfos(); +}; + + // --------------- // - WindowImpl - // --------------- diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index fa136f6d514d..6a773d755a77 100755 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1052,9 +1052,20 @@ public: void SetAccessibleDescription( const String& rDescr ); String GetAccessibleDescription() const; + void SetAccessibleRelationLabeledBy( Window* pLabeledBy ); + Window* GetAccessibleRelationLabeledBy() const; + + void SetAccessibleRelationLabelFor( Window* pLabelFor ); + Window* GetAccessibleRelationLabelFor() const; + + void SetAccessibleRelationMemberOf( Window* pMemberOf ); + Window* GetAccessibleRelationMemberOf() const; + + // to avoid sending accessibility events in cases like closing dialogs // by default checks complete parent path BOOL IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath = TRUE ); + void SetAccessibilityEventsSuppressed(BOOL bSuppressed); /// request XCanvas render interface for this window ::com::sun::star::uno::Reference< @@ -1079,8 +1090,7 @@ public: BOOL IsCreatedWithToolkit() const; void SetCreatedWithToolkit( BOOL b ); - Window* GetLabelFor() const; - Window* GetLabeledBy() const; + // Deprecated - can use SetAccessibleRelationLabelFor/By nowadys virtual Window* GetParentLabelFor( const Window* pLabel ) const; virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; KeyEvent GetActivationKey() const; diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 055b7e9fe80b..faef1b7ba208 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1120,11 +1120,15 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window return pWindow; } -Window* Window::GetLabelFor() const +Window* Window::GetAccessibleRelationLabelFor() const { if ( mpWindowImpl->mbDisableAccessibleLabelForRelation ) return NULL; + if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow ) + return mpWindowImpl->mpAccessibleInfos->pLabelForWindow; + + Window* pWindow = NULL; Window* pFrameWindow = ImplGetFrameWindow(); @@ -1205,11 +1209,14 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo return pWindow; } -Window* Window::GetLabeledBy() const +Window* Window::GetAccessibleRelationLabeledBy() const { if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation ) return NULL; + if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow ) + return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow; + Window* pWindow = NULL; Window* pFrameWindow = ImplGetFrameWindow(); @@ -1238,6 +1245,62 @@ Window* Window::GetLabeledBy() const return pWindow; } +Window* Window::GetAccessibleRelationMemberOf() const +{ + Window* pWindow = NULL; + Window* pFrameWindow = GetParent(); + if ( !pFrameWindow ) + { + pFrameWindow = ImplGetFrameWindow(); + } + // if( ! ( GetType() == WINDOW_FIXEDTEXT || + if( !( GetType() == WINDOW_FIXEDLINE || + GetType() == WINDOW_GROUPBOX ) ) + { + // search for a control that makes member of this window + // it is considered the last fixed line or group box + // that comes before this control; with the exception of push buttons + // which are labeled only if the fixed line or group box + // is directly before the control + // get form start and form end and index of this control + USHORT nIndex, nFormStart, nFormEnd; + Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, + const_cast(this), + nIndex, + nFormStart, + nFormEnd ); + if( pSWindow && nIndex != nFormStart ) + { + if( GetType() == WINDOW_PUSHBUTTON || + GetType() == WINDOW_HELPBUTTON || + GetType() == WINDOW_OKBUTTON || + GetType() == WINDOW_CANCELBUTTON ) + { + nFormStart = nIndex-1; + } + for( USHORT nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) + { + USHORT nFoundIndex = 0; + pSWindow = ::ImplGetChildWindow( pFrameWindow, + nSearchIndex, + nFoundIndex, + FALSE ); + if( pSWindow && pSWindow->IsVisible() && + ( pSWindow->GetType() == WINDOW_FIXEDLINE || + pSWindow->GetType() == WINDOW_GROUPBOX ) ) + { + pWindow = pSWindow; + break; + } + if( nFoundIndex > nSearchIndex || nSearchIndex == 0 ) + break; + } + } + } + return pWindow; +} +//-----IAccessibility2 Implementation 2009 + // ----------------------------------------------------------------------- KeyEvent Window::GetActivationKey() const @@ -1247,7 +1310,7 @@ KeyEvent Window::GetActivationKey() const sal_Unicode nAccel = getAccel( GetText() ); if( ! nAccel ) { - Window* pWindow = GetLabeledBy(); + Window* pWindow = GetAccessibleRelationLabeledBy(); if( pWindow ) nAccel = getAccel( pWindow->GetText() ); } @@ -1260,6 +1323,10 @@ KeyEvent Window::GetActivationKey() const nCode = KEY_A + (nAccel-'A'); else if( nAccel >= '0' && nAccel <= '9' ) nCode = KEY_0 + (nAccel-'0'); + else if( nAccel == '.' ) + nCode = KEY_POINT; + else if( nAccel == '-' ) + nCode = KEY_SUBTRACT; KeyCode aKeyCode( nCode, FALSE, FALSE, TRUE, FALSE ); aKeyEvent = KeyEvent( nAccel, aKeyCode ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index fe2af486c53a..c80415ca974f 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -136,25 +136,21 @@ struct ImplCalcToTopData Region* mpInvalidateRegion; }; -struct ImplAccessibleInfos +ImplAccessibleInfos::ImplAccessibleInfos() { - USHORT nAccessibleRole; - String* pAccessibleName; - String* pAccessibleDescription; - - ImplAccessibleInfos() - { - nAccessibleRole = 0xFFFF; - pAccessibleName = NULL; - pAccessibleDescription = NULL; - } + nAccessibleRole = 0xFFFF; + pAccessibleName = NULL; + pAccessibleDescription = NULL; + pLabeledByWindow = NULL; + pLabelForWindow = NULL; + pMemberOfWindow = NULL; +} - ~ImplAccessibleInfos() - { - delete pAccessibleName; - delete pAccessibleDescription; - } -}; +ImplAccessibleInfos::~ImplAccessibleInfos() +{ + delete pAccessibleName; + delete pAccessibleDescription; +} // ----------------------------------------------------------------------- @@ -8066,7 +8062,7 @@ void Window::SetText( const XubString& rStr ) // name change. if ( IsReallyVisible() ) { - Window* pWindow = GetLabelFor(); + Window* pWindow = GetAccessibleRelationLabelFor(); if ( pWindow && pWindow != this ) pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle ); } @@ -9140,7 +9136,7 @@ void Window::SetAccessibleName( const String& rName ) if ( !mpWindowImpl->mpAccessibleInfos ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; - DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName, "AccessibleName already set!" ); + DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName || !rName.Len(), "AccessibleName already set!" ); delete mpWindowImpl->mpAccessibleInfos->pAccessibleName; mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName ); } @@ -9183,7 +9179,7 @@ String Window::GetAccessibleName() const case WINDOW_TREELISTBOX: { - Window *pLabel = GetLabeledBy(); + Window *pLabel = GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != this ) aAccessibleName = pLabel->GetText(); } @@ -9242,6 +9238,26 @@ String Window::GetAccessibleDescription() const return aAccessibleDescription; } +void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy; +} + +void Window::SetAccessibleRelationLabelFor( Window* pLabelFor ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor; +} + +void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin; +} BOOL Window::IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath ) { if( !bTraverseParentPath ) @@ -9259,6 +9275,10 @@ BOOL Window::IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath ) return FALSE; } } +void Window::SetAccessibilityEventsSuppressed(BOOL bSuppressed) +{ + mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed; +} void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect ) { -- cgit From 3f195d1684cba759adce69bc4b3c53d6cb9adf23 Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Wed, 19 Jan 2011 19:12:11 +0100 Subject: accfixes: Introduced WINDOW_RULER --- vcl/source/window/window.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'vcl') diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c80415ca974f..94fa4a89302b 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9110,6 +9110,7 @@ USHORT Window::GetAccessibleRole() const case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break; + case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break; case WINDOW_WINDOW: case WINDOW_CONTROL: case WINDOW_BORDERWINDOW: -- cgit From 3b184bbda31958c250bc896aff76a68d30c57a49 Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Fri, 21 Jan 2011 15:42:55 +0100 Subject: accfixes: accessible name for WINDOW_METRICBOX --- vcl/source/window/window.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 94fa4a89302b..33d4b491ef67 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9178,7 +9178,7 @@ String Window::GetAccessibleName() const case WINDOW_LISTBOX: case WINDOW_MULTILISTBOX: case WINDOW_TREELISTBOX: - + case WINDOW_METRICBOX: { Window *pLabel = GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != this ) -- cgit From da7495384bf7cb1d574fc072f03a8d5e135ae108 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 1 Feb 2011 16:12:05 +0100 Subject: vcl118: #i65970# revert earlier changes --- vcl/source/gdi/pdfwriter_impl.hxx | 2 ++ vcl/source/gdi/pdfwriter_impl2.cxx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'vcl') diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 78b8c37d6fbe..cef25ee49f85 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1053,6 +1053,8 @@ i12626 bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); // helper for playMetafile + void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, + VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index e2179bb9749f..3912d56959da 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -48,6 +48,8 @@ #include +#undef USE_PDFGRADIENTS + using namespace vcl; using namespace rtl; using namespace com::sun::star; @@ -56,6 +58,21 @@ using namespace com::sun::star::beans; // ----------------------------------------------------------------------------- +void PDFWriterImpl::implWriteGradient( const PolyPolygon& i_rPolyPoly, const Gradient& i_rGradient, + VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) +{ + GDIMetaFile aTmpMtf; + + i_pDummyVDev->AddGradientActions( i_rPolyPoly.GetBoundRect(), i_rGradient, aTmpMtf ); + + m_rOuterFace.Push(); + m_rOuterFace.IntersectClipRegion( i_rPolyPoly.getB2DPolyPolygon() ); + playMetafile( aTmpMtf, NULL, i_rContext, i_pDummyVDev ); + m_rOuterFace.Pop(); +} + +// ----------------------------------------------------------------------------- + void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx, VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) { @@ -349,14 +366,23 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa case( META_GRADIENT_ACTION ): { const MetaGradientAction* pA = (const MetaGradientAction*) pAction; + #ifdef USE_PDFGRADIENTS m_rOuterFace.DrawGradient( pA->GetRect(), pA->GetGradient() ); + #else + const PolyPolygon aPolyPoly( pA->GetRect() ); + implWriteGradient( aPolyPoly, pA->GetGradient(), pDummyVDev, i_rContext ); + #endif } break; case( META_GRADIENTEX_ACTION ): { const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction; + #ifdef USE_PDFGRADIENTS m_rOuterFace.DrawGradient( pA->GetPolyPolygon(), pA->GetGradient() ); + #else + implWriteGradient( pA->GetPolyPolygon(), pA->GetGradient(), pDummyVDev, i_rContext ); + #endif } break; @@ -512,7 +538,11 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa if( pGradAction ) { + #if USE_PDFGRADIENTS m_rOuterFace.DrawGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient() ); + #else + implWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pDummyVDev, i_rContext ); + #endif } } else -- cgit From e19fb157f15046b2482637812c3e9dcc651d4bbb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 14 Feb 2011 17:42:00 +0100 Subject: fix a merge problem --- vcl/source/gdi/region.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 0f578804d16a..96e67aaabffa 100755 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1397,7 +1397,7 @@ sal_Bool Region::Union( const Rectangle& rRect ) basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); *this = Region( aClip ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); @@ -1484,7 +1484,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) basegfx::B2DRange( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ), true, false ); - return TRUE; + return sal_True; } else ImplPolyPolyRegionToBandRegion(); @@ -1576,7 +1576,7 @@ sal_Bool Region::Exclude( const Rectangle& rRect ) aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); if( aThisPolyPoly.count() == 0 ) - return TRUE; + return sal_True; // get the other B2DPolyPolygon basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); @@ -1585,7 +1585,7 @@ sal_Bool Region::Exclude( const Rectangle& rRect ) basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); *this = Region( aClip ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); @@ -1639,7 +1639,7 @@ sal_Bool Region::XOr( const Rectangle& rRect ) if( aThisPolyPoly.count() == 0 ) { *this = rRect; - return TRUE; + return sal_True; } // get the other B2DPolyPolygon @@ -1649,7 +1649,7 @@ sal_Bool Region::XOr( const Rectangle& rRect ) basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); *this = Region( aClip ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); @@ -1714,7 +1714,7 @@ sal_Bool Region::Union( const Region& rRegion ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) { ImplUnionPolyPolygon( rRegion ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); @@ -1946,7 +1946,7 @@ sal_Bool Region::Exclude( const Region& rRegion ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) { ImplExcludePolyPolygon( rRegion ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); @@ -2023,7 +2023,7 @@ sal_Bool Region::XOr( const Region& rRegion ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) { ImplXOrPolyPolygon( rRegion ); - return TRUE; + return sal_True; } ImplPolyPolyRegionToBandRegion(); -- cgit From bf3f4fe64712e3443b04caa8b9107ae5b47eb43a Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Tue, 15 Feb 2011 18:50:56 +0100 Subject: fixed compile errors after resync to m100 --- vcl/inc/vcl/window.h | 2 +- vcl/source/window/dlgctrl.cxx | 8 ++++---- vcl/source/window/window.cxx | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index 9533822ea307..4011584890cf 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -216,7 +216,7 @@ struct ImplFrameData struct ImplAccessibleInfos { - USHORT nAccessibleRole; + sal_uInt16 nAccessibleRole; String* pAccessibleName; String* pAccessibleDescription; Window* pLabeledByWindow; diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 7d77e83796d4..32fc4755a62d 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1263,7 +1263,7 @@ Window* Window::GetAccessibleRelationMemberOf() const // which are labeled only if the fixed line or group box // is directly before the control // get form start and form end and index of this control - USHORT nIndex, nFormStart, nFormEnd; + sal_uInt16 nIndex, nFormStart, nFormEnd; Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, const_cast(this), nIndex, @@ -1278,13 +1278,13 @@ Window* Window::GetAccessibleRelationMemberOf() const { nFormStart = nIndex-1; } - for( USHORT nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) + for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) { - USHORT nFoundIndex = 0; + sal_uInt16 nFoundIndex = 0; pSWindow = ::ImplGetChildWindow( pFrameWindow, nSearchIndex, nFoundIndex, - FALSE ); + sal_False ); if( pSWindow && pSWindow->IsVisible() && ( pSWindow->GetType() == WINDOW_FIXEDLINE || pSWindow->GetType() == WINDOW_GROUPBOX ) ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b8859c7b94f2..f1bac57825a1 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9297,7 +9297,8 @@ sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath ) return sal_False; } } -void Window::SetAccessibilityEventsSuppressed(BOOL bSuppressed) + +void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed) { mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed; } -- cgit