From 46a63a2af38e694327c5308168f499a549fb724e Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 1 Oct 2008 13:31:44 +0000 Subject: CWS-TOOLING: integrate CWS vcl92 --- psprint/inc/psprint/printergfx.hxx | 3 +- psprint/source/fontsubset/gsub.cxx | 10 +- psprint/source/fontsubset/gsub.h | 4 +- psprint/source/fontsubset/sft.c | 5 +- psprint/source/printergfx/common_gfx.cxx | 9 +- vcl/aqua/inc/saldata.hxx | 2 + vcl/aqua/inc/salgdi.h | 4 +- vcl/aqua/source/app/saldata.cxx | 8 +- vcl/aqua/source/gdi/salgdi.cxx | 55 +-- vcl/inc/vcl/outdev.hxx | 31 ++ vcl/inc/vcl/pdfwriter.hxx | 8 +- vcl/inc/vcl/print.hxx | 21 +- vcl/inc/vcl/salgdi.hxx | 3 - vcl/inc/vcl/window.h | 4 +- vcl/os2/inc/salgdi.h | 5 +- vcl/os2/source/gdi/salgdi.cxx | 10 +- vcl/prj/build.lst | 2 +- vcl/source/control/field.cxx | 9 +- vcl/source/gdi/impprn.cxx | 42 ++- vcl/source/gdi/pdfwriter_impl.hxx | 9 + vcl/source/gdi/print2.cxx | 577 ++++++++++++++++++++++--------- vcl/source/window/window.cxx | 20 +- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 108 +++++- vcl/unx/headless/svpgdi.cxx | 5 - vcl/unx/headless/svpgdi.hxx | 1 - vcl/unx/headless/svppspgraphics.cxx | 5 - vcl/unx/headless/svppspgraphics.hxx | 1 - vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 7 +- vcl/unx/inc/pspgraphics.h | 1 - vcl/unx/inc/saldisp.hxx | 3 +- vcl/unx/inc/salgdi.h | 1 - vcl/unx/kde/salnativewidgets-kde.cxx | 15 +- vcl/unx/source/app/randrwrapper.cxx | 10 +- vcl/unx/source/app/saldisp.cxx | 25 -- vcl/unx/source/gdi/pspgraphics.cxx | 5 - vcl/unx/source/gdi/salgdi.cxx | 6 - vcl/util/makefile.mk | 1 + vcl/win/inc/salgdi.h | 3 - vcl/win/source/gdi/salgdi.cxx | 8 - vcl/win/source/window/salframe.cxx | 2 +- 40 files changed, 667 insertions(+), 381 deletions(-) diff --git a/psprint/inc/psprint/printergfx.hxx b/psprint/inc/psprint/printergfx.hxx index 4b26051f212c..30c141fb1a88 100644 --- a/psprint/inc/psprint/printergfx.hxx +++ b/psprint/inc/psprint/printergfx.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: printergfx.hxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.19.18.1 $ * * This file is part of OpenOffice.org. * @@ -339,7 +339,6 @@ public: // query depth and size void GetResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const; - void GetScreenFontResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const; sal_uInt16 GetBitCount (); // clip region diff --git a/psprint/source/fontsubset/gsub.cxx b/psprint/source/fontsubset/gsub.cxx index df3efd23e2f2..f49eb54c575a 100644 --- a/psprint/source/fontsubset/gsub.cxx +++ b/psprint/source/fontsubset/gsub.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gsub.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.18.1 $ * * This file is part of OpenOffice.org. * @@ -322,10 +322,16 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, } } } - return true; } +void ReleaseGSUB(struct _TrueTypeFont* pTTFile) +{ + GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; + if( pGlyphSubstitution ) + delete pGlyphSubstitution; +} + int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph, int /*wmode*/ ) { GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; diff --git a/psprint/source/fontsubset/gsub.h b/psprint/source/fontsubset/gsub.h index bfd25abca6b3..c64b2abb7e00 100644 --- a/psprint/source/fontsubset/gsub.h +++ b/psprint/source/fontsubset/gsub.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gsub.h,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.18.1 $ * * This file is part of OpenOffice.org. * @@ -41,6 +41,8 @@ int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph, int wmode ); int ReadGSUB( struct _TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ); +void ReleaseGSUB( struct _TrueTypeFont* pTTFile ); + #ifdef __cplusplus } #endif diff --git a/psprint/source/fontsubset/sft.c b/psprint/source/fontsubset/sft.c index 49dce7043388..cc63a7f3a897 100644 --- a/psprint/source/fontsubset/sft.c +++ b/psprint/source/fontsubset/sft.c @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sft.c,v $ - * $Revision: 1.47 $ + * $Revision: 1.47.4.1 $ * * This file is part of OpenOffice.org. * @@ -1925,6 +1925,9 @@ void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/ free(ttf->tables); free(ttf->tlens); free(ttf->kerntables); + + ReleaseGSUB(ttf); + free(ttf); return; } diff --git a/psprint/source/printergfx/common_gfx.cxx b/psprint/source/printergfx/common_gfx.cxx index 7cb6ae33d0aa..70342de05222 100644 --- a/psprint/source/printergfx/common_gfx.cxx +++ b/psprint/source/printergfx/common_gfx.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: common_gfx.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.18.1 $ * * This file is part of OpenOffice.org. * @@ -115,13 +115,6 @@ PrinterGfx::GetResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const rDpiY = mnDpi; } -void -PrinterGfx::GetScreenFontResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const -{ - rDpiX = mnDpi; - rDpiY = mnDpi; -} - sal_uInt16 PrinterGfx::GetBitCount () { diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index 1d684ac113e8..209c7525e21f 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -93,6 +93,8 @@ struct SalData CGColorSpaceRef mxRGBSpace; CGColorSpaceRef mxGraySpace; + CGColorSpaceRef mxP50Space; + CGPatternRef mxP50Pattern; std::vector< NSCursor* > maCursors; std::vector< NSMenuItem* > maFallbackMenu; diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index b39685d35579..8b3911d79850 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -240,9 +240,6 @@ public: // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); - // get resolution for fonts (an implementations specific adjustment, - // ideally would be the same as the Resolution) - virtual void GetScreenFontResolution( long& rDPIX, long& rDPIY ); // get the depth of the device virtual USHORT GetBitCount(); // get the width of the device @@ -356,6 +353,7 @@ private: bool IsFlipped() const { return mbWindow; } void ApplyXorContext(); + void Pattern50Fill(); }; class XorEmulation diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index ff3bf7866aaa..c8339fdc3082 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -54,6 +54,8 @@ SalData::SalData() mpStatusItem( nil ), mxRGBSpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB) ), mxGraySpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericGray) ), + mxP50Space( NULL ), + mxP50Pattern( NULL ), maCursors( POINTER_COUNT, INVALID_CURSOR_PTR ), mbIsScrollbarDoubleMax( false ), mnSystemVersion( VER_TIGER ), @@ -65,8 +67,10 @@ SalData::SalData() SalData::~SalData() { - CFRelease( mxRGBSpace ); - CFRelease( mxGraySpace ); + CGPatternRelease( mxP50Pattern ); + CGColorSpaceRelease( mxP50Space ); + CGColorSpaceRelease( mxRGBSpace ); + CGColorSpaceRelease( mxGraySpace ); for( unsigned int i = 0; i < maCursors.size(); i++ ) { NSCursor* pCurs = maCursors[i]; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 62bab663dadb..e90932d739c9 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -417,24 +417,6 @@ void AquaSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) // ----------------------------------------------------------------------- -void AquaSalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY ) -{ - GetResolution( rDPIX, rDPIY ); - - // the screen font resolution should equal the real resolution - // but to satisfy the quite insane heuristics in Window::ImplUpdateGlobalSettings() - // it needs to be tweaked - // TODO: remove the tweaking below if it becomes possible - if( (rDPIX < 72) || (rDPIY < 72) ) - { - const long nMinDPI = (rDPIX <= rDPIY) ? rDPIX : rDPIY; - rDPIX = (72 * rDPIX + (nMinDPI/2)) / nMinDPI; - rDPIY = (72 * rDPIY + (nMinDPI/2)) / nMinDPI; - } -} - -// ----------------------------------------------------------------------- - USHORT AquaSalGraphics::GetBitCount() { USHORT nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24; @@ -1232,6 +1214,31 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY ) // ----------------------------------------------------------------------- + +static void DrawPattern50( void* info, CGContextRef rContext ) +{ + static const CGRect aRects[2] = { { {0,0}, { 2, 2 } }, { { 2, 2 }, { 2, 2 } } }; + CGContextAddRects( rContext, aRects, 2 ); + CGContextFillPath( rContext ); +} + +void AquaSalGraphics::Pattern50Fill() +{ + static const float aFillCol[4] = { 1,1,1,1 }; + static const CGPatternCallbacks aCallback = { 0, &DrawPattern50, NULL }; + if( ! GetSalData()->mxP50Space ) + GetSalData()->mxP50Space = CGColorSpaceCreatePattern( GetSalData()->mxRGBSpace ); + if( ! GetSalData()->mxP50Pattern ) + GetSalData()->mxP50Pattern = CGPatternCreate( NULL, CGRectMake( 0, 0, 4, 4 ), + CGAffineTransformIdentity, 4, 4, + kCGPatternTilingConstantSpacing, + false, &aCallback ); + + CGContextSetFillColorSpace( mrContext, GetSalData()->mxP50Space ); + CGContextSetFillPattern( mrContext, GetSalData()->mxP50Pattern, aFillCol ); + CGContextFillPath( mrContext ); +} + void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) { if ( CheckContext() ) @@ -1250,11 +1257,10 @@ void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalIn } else if ( nFlags & SAL_INVERT_50 ) { - //workaround - // no xor in Core Graphics, so just invert + //CGContextSetAllowsAntialiasing( mrContext, false ); CGContextSetBlendMode(mrContext, kCGBlendModeDifference); - CGContextSetRGBFillColor( mrContext,1.0, 1.0, 1.0 , 1.0 ); - CGContextFillRect ( mrContext, aCGRect ); + CGContextAddRect( mrContext, aCGRect ); + Pattern50Fill(); } else // just invert { @@ -1288,11 +1294,8 @@ void AquaSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert } else if ( nSalFlags & SAL_INVERT_50 ) { - // workaround - // no xor in Core Graphics, so just invert CGContextSetBlendMode(mrContext, kCGBlendModeDifference); - CGContextSetRGBFillColor( mrContext,1.0, 1.0, 1.0 , 1.0 ); - CGContextFillPath( mrContext ); + Pattern50Fill(); } else // just invert { diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 761657067543..6d8f9f70492d 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -1087,6 +1087,37 @@ public: LanguageType eLang, ULONG nFlags, const OutputDevice* pOutDev = NULL ); + + /** helper method removing transparencies from a metafile (e.g. for printing) + + @returns + true: transparencies were removed + false: output metafile is unchanged input metafile + + @attention this is a member method, so current state can influence the result ! + */ + bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, + long nMaxBmpDPIX, long nMaxBmpDPIY, + bool bReduceTransparency, + bool bTransparencyAutoMode, + bool bDownsampleBitmaps + ); + /** Retrieve downsampled and cropped bitmap + + @attention This method ignores negative rDstSz values, thus + mirroring must happen outside this method (e.g. in DrawBitmap) + */ + Bitmap GetDownsampledBitmap( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY ); + /** Retrieve downsampled and cropped bitmapEx + + @attention This method ignores negative rDstSz values, thus + mirroring must happen outside this method (e.g. in DrawBitmapEx) + */ + BitmapEx GetDownsampledBitmapEx( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ); }; #endif // _SV_OUTDEV_HXX diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 80bcda8968c1..c69553b8f3de 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter.hxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.86.1 $ * * This file is part of OpenOffice.org. * @@ -224,7 +224,11 @@ public: // a form action was exported that is not suitable for PDF/A // the action was skipped - Warning_FormAction_Omitted_PDFA + Warning_FormAction_Omitted_PDFA, + + // transparent objects were converted to a bitmap in order + // to removetransparencies from the output + Warning_Transparency_Converted }; struct VCL_DLLPUBLIC AnyWidget diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index c6a4a6c1adf9..2f579f4e4dc2 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: print.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.86.1 $ * * This file is part of OpenOffice.org. * @@ -47,7 +47,6 @@ class SalPrinter; class VirtualDevice; class Window; class ImplQPrinter; -class RmPrinter; struct ImplPrivatePrinterData; namespace com { namespace sun { namespace star { namespace uno { @@ -273,24 +272,6 @@ private: #ifdef _SPOOLPRINTER_EXT public: - void GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, - long nMaxBmpDPIX, long nMaxBmpDPIY ); - /** Retrieve downsampled and cropped bitmap - - @attention This method ignores negative rDstSz values, thus - mirroring must happen outside this method (e.g. in DrawBitmap) - */ - Bitmap GetPreparedBitmap( const Size& rDstSz, - const Point& rSrcPt, const Size& rSrcSz, - const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY ); - /** Retrieve downsampled and cropped bitmapEx - - @attention This method ignores negative rDstSz values, thus - mirroring must happen outside this method (e.g. in DrawBitmapEx) - */ - BitmapEx GetPreparedBitmapEx( const Size& rDstSz, - const Point& rSrcPt, const Size& rSrcSz, - const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ); void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ); diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 207bfbf1e46f..b651a8d02ade 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -191,9 +191,6 @@ public: // get device resolution virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0; - // get resolution for fonts (an implementations specific adjustment, - // ideally would be the same as the Resolution) - virtual void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0; // get the depth of the device virtual USHORT GetBitCount() = 0; // get the width of the device diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index de70cedf5083..d745f3dcf081 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: window.h,v $ - * $Revision: 1.7 $ + * $Revision: 1.6.86.2 $ * * This file is part of OpenOffice.org. * @@ -165,8 +165,6 @@ struct ImplFrameData ImplFontCache* mpFontCache; // Font-Cache for this frame sal_Int32 mnDPIX; // Original Screen Resolution sal_Int32 mnDPIY; // Original Screen Resolution - sal_Int32 mnFontDPIX; // Original Font Resolution - sal_Int32 mnFontDPIY; // Original Font Resolution ImplMapRes maMapUnitRes; // for LogicUnitToPixel ULONG mnAllSaveBackSize; // Groesse aller Bitmaps fuer Hintergrund-Sicherung ULONG mnFocusId; // FocusId for PostUserLink diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index 44526909c569..1a82e068b434 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salgdi.h,v $ - * $Revision: 1.10 $ + * $Revision: 1.9.6.2 $ * * This file is part of OpenOffice.org. * @@ -219,9 +219,6 @@ public: // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); - // get resolution for fonts (an implementations specific adjustment, - // ideally would be the same as the Resolution) - virtual void GetScreenFontResolution( long& rDPIX, long& rDPIY ); // get the depth of the device virtual USHORT GetBitCount(); // get the width of the device diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index be87cfb7b2bc..ad764f850500 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salgdi.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.6.1 $ * * This file is part of OpenOffice.org. * @@ -169,14 +169,6 @@ void Os2SalGraphics::GetResolution( long& rDPIX, long& rDPIY ) // ----------------------------------------------------------------------- -void Os2SalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY ) -{ - DevQueryCaps( mhDC, CAPS_HORIZONTAL_FONT_RES, 1, &rDPIX ); - DevQueryCaps( mhDC, CAPS_VERTICAL_FONT_RES, 1, &rDPIY ); -} - -// ----------------------------------------------------------------------- - USHORT Os2SalGraphics::GetBitCount() { LONG nBitCount; diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 0f4dbc16a2d8..fb2059d2d580 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : BOOST:boost psprint rsc sot ucbhelper unotools ICU:icu i18npool unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc NULL +vc vcl : BOOST:boost psprint rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 4774e961b310..1bc6af51f369 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: field.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.86.1 $ * * This file is part of OpenOffice.org. * @@ -46,6 +46,7 @@ #include "vcl/svapp.hxx" #include "vcl/svdata.hxx" #include "vcl/unohelp.hxx" +#include "i18nutil/unicode.hxx" #include "rtl/math.hxx" @@ -1062,11 +1063,7 @@ static XubString ImplMetricGetUnitText( const XubString& rStr ) for ( short i = rStr.Len()-1; i >= 0; i-- ) { xub_Unicode c = rStr.GetChar( i ); - if ( ((c >= 'A') && (c <= 'Z')) || - ((c >= 'a') && (c <= 'z')) || - // #i69080# check for hebrew characters - // FIXME: need a general solution for all languages/scripts - ((c >= 0x590) && (c <= 0x5FF)) || + if ( unicode::isAlpha( c ) || (c == '\'') || (c == '\"') || (c == '%' ) ) aStr.Insert( c, 0 ); else diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx index 5da5f951f203..8b51b040f466 100644 --- a/vcl/source/gdi/impprn.cxx +++ b/vcl/source/gdi/impprn.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: impprn.cxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.18.86.3 $ * * This file is part of OpenOffice.org. * @@ -148,6 +148,16 @@ void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nM // execute action here to avoid DPI processing of bitmap; pAct->Execute( this ); +#ifdef VERBOSE_DEBUG + Push(); + SetLineColor(COL_RED); + SetFillColor(); + DrawRect( Rectangle( + static_cast(pAct)->GetPoint(), + static_cast(pAct)->GetSize()) ); + Pop(); +#endif + // seek to end of this comment do { @@ -173,9 +183,9 @@ void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nM const Bitmap& rBmp = pBmpScaleAction->GetBitmap(); DrawBitmap( pBmpScaleAction->GetPoint(), pBmpScaleAction->GetSize(), - GetPreparedBitmap( pBmpScaleAction->GetSize(), - Point(), rBmp.GetSizePixel(), - rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) ); + GetDownsampledBitmap( pBmpScaleAction->GetSize(), + Point(), rBmp.GetSizePixel(), + rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) ); bExecuted = sal_True; } @@ -185,9 +195,9 @@ void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nM const Bitmap& rBmp = pBmpScalePartAction->GetBitmap(); DrawBitmap( pBmpScalePartAction->GetDestPoint(), pBmpScalePartAction->GetDestSize(), - GetPreparedBitmap( pBmpScalePartAction->GetDestSize(), - pBmpScalePartAction->GetSrcPoint(), pBmpScalePartAction->GetSrcSize(), - rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) ); + GetDownsampledBitmap( pBmpScalePartAction->GetDestSize(), + pBmpScalePartAction->GetSrcPoint(), pBmpScalePartAction->GetSrcSize(), + rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) ); bExecuted = sal_True; } @@ -197,9 +207,9 @@ void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nM const BitmapEx& rBmpEx = pBmpExScaleAction->GetBitmapEx(); DrawBitmapEx( pBmpExScaleAction->GetPoint(), pBmpExScaleAction->GetSize(), - GetPreparedBitmapEx( pBmpExScaleAction->GetSize(), - Point(), rBmpEx.GetSizePixel(), - rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) ); + GetDownsampledBitmapEx( pBmpExScaleAction->GetSize(), + Point(), rBmpEx.GetSizePixel(), + rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) ); bExecuted = sal_True; } @@ -209,9 +219,9 @@ void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nM const BitmapEx& rBmpEx = pBmpExScalePartAction->GetBitmapEx(); DrawBitmapEx( pBmpExScalePartAction->GetDestPoint(), pBmpExScalePartAction->GetDestSize(), - GetPreparedBitmapEx( pBmpExScalePartAction->GetDestSize(), - pBmpExScalePartAction->GetSrcPoint(), pBmpExScalePartAction->GetSrcSize(), - rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) ); + GetDownsampledBitmapEx( pBmpExScalePartAction->GetDestSize(), + pBmpExScalePartAction->GetSrcPoint(), pBmpExScalePartAction->GetSrcSize(), + rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) ); bExecuted = sal_True; } @@ -332,7 +342,11 @@ void ImplQPrinter::PrePrintPage( QueuePage* pPage ) } maCurPageMetaFile = GDIMetaFile(); - GetPreparedMetaFile( *pPage->mpMtf, maCurPageMetaFile, mnMaxBmpDPIX, mnMaxBmpDPIY ); + RemoveTransparenciesFromMetaFile( *pPage->mpMtf, maCurPageMetaFile, mnMaxBmpDPIX, mnMaxBmpDPIY, + rPrinterOptions.IsReduceTransparency(), + rPrinterOptions.GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO, + rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency() + ); } void ImplQPrinter::PostPrintPage() diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index b14b19c13712..8bfaa121dab8 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1060,6 +1060,15 @@ public: sal_Int32 newPage( sal_Int32 nPageWidth , sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ); bool emit(); std::set< PDFWriter::ErrorCode > getErrors(); + void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); } + + Size getCurPageSize() const + { + Size aSize; + if( m_nCurrentPage >= 0 && m_nCurrentPage < (sal_Int32)m_aPages.size() ) + aSize = Size( m_aPages[ m_nCurrentPage ].m_nPageWidth, m_aPages[ m_nCurrentPage ].m_nPageHeight ); + return aSize; + } PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; } void setDocInfo( const PDFDocInfo& rInfo ); diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index e0764595583d..685f68fe7af3 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: print2.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.86.3 $ * * This file is part of OpenOffice.org. * @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -49,6 +51,8 @@ #include #include +#include "pdfwriter_impl.hxx" + // ----------- // - Defines - // ----------- @@ -56,11 +60,43 @@ #define MAX_TILE_WIDTH 1024 #define MAX_TILE_HEIGHT 1024 +// --------- +// - Types - +// --------- + +typedef ::std::pair< MetaAction*, int > Component; // MetaAction plus index in metafile + +typedef ::std::list< Component > ComponentList; + +// List of (intersecting) actions, plus overall bounds +struct ConnectedComponents +{ + ConnectedComponents() : + aComponentList(), + aBounds(), + aBgColor(COL_WHITE), + bIsSpecial(false), + bIsFullyTransparent(false) + {} + + ComponentList aComponentList; + Rectangle aBounds; + Color aBgColor; + bool bIsSpecial; + bool bIsFullyTransparent; +}; + +typedef ::std::list< ConnectedComponents > ConnectedComponentsList; + + // ----------- // - Printer - // ----------- -// #i10613# Extracted from Printer::GetPreparedMetaFile +/** #i10613# Extracted from Printer::GetPreparedMetaFile. Returns true + if given action requires special handling (usually because of + transparency) +*/ static bool ImplIsActionSpecial( const MetaAction& rAct ) { switch( rAct.GetType() ) @@ -72,99 +108,181 @@ static bool ImplIsActionSpecial( const MetaAction& rAct ) return true; case META_BMPEX_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() != 0; + return static_cast(rAct).GetBitmapEx().IsTransparent(); case META_BMPEXSCALE_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() != 0; + return static_cast(rAct).GetBitmapEx().IsTransparent(); case META_BMPEXSCALEPART_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() != 0; + return static_cast(rAct).GetBitmapEx().IsTransparent(); default: return false; } } -// #107169# Check whether given metaaction is a masked bitmap -static bool ImplIsActionMaskedBitmap( const MetaAction& rAct ) +/** Check whether rCurrRect rectangle fully covers io_rPrevRect - if + yes, return true and update o_rBgColor + */ +static bool checkRect( Rectangle& io_rPrevRect, + Color& o_rBgColor, + const Rectangle& rCurrRect, + OutputDevice& rMapModeVDev ) { - switch( rAct.GetType() ) - { - case META_BMPEX_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() == 0; - - case META_BMPEXSCALE_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() == 0; + // shape needs to fully cover previous content, and have uniform + // color + const bool bRet( + rMapModeVDev.LogicToPixel(rCurrRect).IsInside(io_rPrevRect) && + rMapModeVDev.IsFillColor() ); - case META_BMPEXSCALEPART_ACTION: - return static_cast(rAct).GetBitmapEx().IsAlpha() == 0; - - default: - return false; + if( bRet ) + { + io_rPrevRect = rCurrRect; + o_rBgColor = rMapModeVDev.GetFillColor(); } + + return bRet; } -// #107169# Convert BitmapEx with mask to Bitmap with white background at masked-out places -static Bitmap ImplConvertBmpEx2Bmp( const MetaAction& rAct ) +/** #107169# Convert BitmapEx to Bitmap with appropriately blended + color. Convert MetaTransparentAction to plain polygon, + appropriately colored + + @param o_rMtf + Add converted actions to this metafile +*/ +static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, + const MetaAction& rAct, + const OutputDevice& rStateOutDev, + Color aBgColor ) { - BitmapEx aBmpEx; - - switch( rAct.GetType() ) + if( rAct.GetType() == META_TRANSPARENT_ACTION ) { - case META_BMPEX_ACTION: - aBmpEx = static_cast(rAct).GetBitmapEx(); - break; + const MetaTransparentAction* pTransAct = static_cast(&rAct); + USHORT nTransparency( pTransAct->GetTransparence() ); - case META_BMPEXSCALE_ACTION: - aBmpEx = static_cast(rAct).GetBitmapEx(); - break; + // #i10613# Respect transparency for draw color + if( nTransparency ) + { + o_rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR|PUSH_FILLCOLOR ) ); + + // assume white background for alpha blending + Color aLineColor( rStateOutDev.GetLineColor() ); + aLineColor.SetRed( static_cast( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetRed()) / 100L ) ); + aLineColor.SetGreen( static_cast( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetGreen()) / 100L ) ); + aLineColor.SetBlue( static_cast( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetBlue()) / 100L ) ); + o_rMtf.AddAction( new MetaLineColorAction(aLineColor, TRUE) ); + + Color aFillColor( rStateOutDev.GetFillColor() ); + aFillColor.SetRed( static_cast( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetRed()) / 100L ) ); + aFillColor.SetGreen( static_cast( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetGreen()) / 100L ) ); + aFillColor.SetBlue( static_cast( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetBlue()) / 100L ) ); + o_rMtf.AddAction( new MetaFillColorAction(aFillColor, TRUE) ); + } - case META_BMPEXSCALEPART_ACTION: - aBmpEx = static_cast(rAct).GetBitmapEx(); - break; + o_rMtf.AddAction( new MetaPolyPolygonAction(pTransAct->GetPolyPolygon()) ); - default: - DBG_ERROR("Printer::GetPreparedMetafile impossible state reached"); - break; + if( nTransparency ) + o_rMtf.AddAction( new MetaPopAction() ); } + else + { + BitmapEx aBmpEx; - Bitmap aBmp( aBmpEx.GetBitmap() ); - BitmapReadAccess* pRA = aBmp.AcquireReadAccess(); + switch( rAct.GetType() ) + { + case META_BMPEX_ACTION: + aBmpEx = static_cast(rAct).GetBitmapEx(); + break; - if( !pRA ) - return aBmp; // what else should I do? + case META_BMPEXSCALE_ACTION: + aBmpEx = static_cast(rAct).GetBitmapEx(); + break; - Color aWhite( COL_WHITE ); + case META_BMPEXSCALEPART_ACTION: + aBmpEx = static_cast(rAct).GetBitmapEx(); + break; - if( pRA->HasPalette() ) - aWhite = pRA->GetBestPaletteColor( Color( COL_WHITE ) ).operator Color(); + case META_TRANSPARENT_ACTION: - aBmp.ReleaseAccess(pRA); + default: + DBG_ERROR("Printer::GetPreparedMetafile impossible state reached"); + break; + } - // did we get true white? - if( aWhite.GetColorError( Color( COL_WHITE ) ) ) - { - // no, create truecolor bitmap, then - aBmp.Convert( BMP_CONVERSION_24BIT ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + if( !aBmpEx.IsAlpha() ) + { + // blend with mask + BitmapReadAccess* pRA = aBmp.AcquireReadAccess(); - // fill masked out areas white - aBmp.Replace( aBmpEx.GetMask(), COL_WHITE ); - } - else - { - // fill masked out areas white - aBmp.Replace( aBmpEx.GetMask(), aWhite ); - } + if( !pRA ) + return; // what else should I do? - return aBmp; + Color aActualColor( aBgColor ); + + if( pRA->HasPalette() ) + aActualColor = pRA->GetBestPaletteColor( aBgColor ).operator Color(); + + aBmp.ReleaseAccess(pRA); + + // did we get true white? + if( aActualColor.GetColorError( aBgColor ) ) + { + // no, create truecolor bitmap, then + aBmp.Convert( BMP_CONVERSION_24BIT ); + + // fill masked out areas white + aBmp.Replace( aBmpEx.GetMask(), aBgColor ); + } + else + { + // fill masked out areas white + aBmp.Replace( aBmpEx.GetMask(), aActualColor ); + } + } + else + { + // blend with alpha channel + aBmp.Convert( BMP_CONVERSION_24BIT ); + aBmp.Blend(aBmpEx.GetAlpha(),aBgColor); + } + + // add corresponding action + switch( rAct.GetType() ) + { + case META_BMPEX_ACTION: + o_rMtf.AddAction( new MetaBmpAction( + static_cast(rAct).GetPoint(), + aBmp )); + break; + case META_BMPEXSCALE_ACTION: + o_rMtf.AddAction( new MetaBmpScaleAction( + static_cast(rAct).GetPoint(), + static_cast(rAct).GetSize(), + aBmp )); + break; + case META_BMPEXSCALEPART_ACTION: + o_rMtf.AddAction( new MetaBmpScalePartAction( + static_cast(rAct).GetDestPoint(), + static_cast(rAct).GetDestSize(), + static_cast(rAct).GetSrcPoint(), + static_cast(rAct).GetSrcSize(), + aBmp )); + break; + default: + DBG_ERROR("Unexpected case"); + break; + } + } } // #i10613# Extracted from ImplCheckRect::ImplCreate // Returns true, if given action creates visible (i.e. non-transparent) output static bool ImplIsNotTransparent( const MetaAction& rAct, const OutputDevice& rOut ) { - const bool bLineTransparency( rOut.GetLineColor().GetTransparency() == 255 ); - const bool bFillTransparency( rOut.GetFillColor().GetTransparency() == 255 ); + const bool bLineTransparency( rOut.IsLineColor() ? rOut.GetLineColor().GetTransparency() == 255 : true ); + const bool bFillTransparency( rOut.IsFillColor() ? rOut.GetFillColor().GetTransparency() == 255 : true ); bool bRet( false ); switch( rAct.GetType() ) @@ -526,46 +644,18 @@ static bool ImplIsActionHandlingTransparency( const MetaAction& rAct ) } } -// predicate functor for checking whether given element is fully transparent -class Impl_IsTransparent : public ::std::unary_function< ::std::pair< const MetaAction*, int >, bool > -{ -public: - Impl_IsTransparent( const OutputDevice& rOut ) : mrOut(rOut) {} - bool operator()( ::std::pair< const MetaAction*, int > rElem ) - { - return !ImplIsNotTransparent( *rElem.first, mrOut ); - } - -private: - const OutputDevice& mrOut; -}; - -typedef ::std::pair< const MetaAction*, int > Component; // MetaAction plus index in metafile - -// List of (intersecting) actions, plus overall bounds -struct ConnectedComponents -{ - ::std::list< Component > aComponentList; - Rectangle aBounds; - bool bIsSpecial; - bool bIsFullyTransparent; -}; - -typedef ::std::list< ConnectedComponents > ConnectedComponentsList; - // remove comment to enable highlighting of generated output - -void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, - long nMaxBmpDPIX, long nMaxBmpDPIY ) +bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, + long nMaxBmpDPIX, long nMaxBmpDPIY, + bool bReduceTransparency, bool bTransparencyAutoMode, + bool bDownsampleBitmaps ) { - const PrinterOptions& rPrinterOptions = GetPrinterOptions(); MetaAction* pCurrAct; bool bTransparent( false ); rOutMtf.Clear(); - if( !rPrinterOptions.IsReduceTransparency() || - ( PRINTER_TRANSPARENCY_AUTO == rPrinterOptions.GetReducedTransparencyMode() ) ) + if( ! bReduceTransparency || bTransparencyAutoMode ) { // watch for transparent drawing actions for( pCurrAct = ( (GDIMetaFile&) rInMtf ).FirstAction(); @@ -581,8 +671,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // of uniform opacity): if a masked bitmap is printed over // empty background, we convert to a plain bitmap with // white background. - if( ImplIsActionMaskedBitmap( *pCurrAct ) || - ImplIsActionSpecial( *pCurrAct ) ) + if( ImplIsActionSpecial( *pCurrAct ) ) { bTransparent = true; } @@ -624,8 +713,14 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // algorithm was designed by AF. // - ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. - int nActionNum; + // + // STAGE 1: Detect background + // ========================== + // + + // Receives uniform background content, and is _not_ merged + // nor checked for intersection against other aCCList elements + ConnectedComponents aBackgroundComponent; // create an OutputDevice to record mapmode changes and the like VirtualDevice aMapModeVDev; @@ -633,21 +728,140 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM aMapModeVDev.mnDPIY = mnDPIY; aMapModeVDev.EnableOutput(FALSE); + int nLastBgAction, nActionNum; + + // weed out page-filling background objects (if they are + // uniformly coloured). Keeping them outside the other + // connected components often prevents whole-page bitmap + // generation. + bool bStillBackground=true; // true until first non-bg action + nActionNum=0; nLastBgAction=-1; + pCurrAct=const_cast(rInMtf).FirstAction(); + while( pCurrAct && bStillBackground ) + { + switch( pCurrAct->GetType() ) + { + case META_RECT_ACTION: + { + if( !checkRect( + aBackgroundComponent.aBounds, + aBackgroundComponent.aBgColor, + static_cast(pCurrAct)->GetRect(), + aMapModeVDev) ) + bStillBackground=false; // incomplete occlusion of background + else + nLastBgAction=nActionNum; // this _is_ background + break; + } + case META_POLYGON_ACTION: + { + const Polygon aPoly( + static_cast(pCurrAct)->GetPolygon()); + if( !basegfx::tools::isRectangle( + aPoly.getB2DPolygon()) || + !checkRect( + aBackgroundComponent.aBounds, + aBackgroundComponent.aBgColor, + aPoly.GetBoundRect(), + aMapModeVDev) ) + bStillBackground=false; // incomplete occlusion of background + else + nLastBgAction=nActionNum; // this _is_ background + break; + } + case META_POLYPOLYGON_ACTION: + { + const PolyPolygon aPoly( + static_cast(pCurrAct)->GetPolyPolygon()); + if( aPoly.Count() != 1 || + !basegfx::tools::isRectangle( + aPoly[0].getB2DPolygon()) || + !checkRect( + aBackgroundComponent.aBounds, + aBackgroundComponent.aBgColor, + aPoly.GetBoundRect(), + aMapModeVDev) ) + bStillBackground=false; // incomplete occlusion of background + else + nLastBgAction=nActionNum; // this _is_ background + break; + } + case META_WALLPAPER_ACTION: + { + if( !checkRect( + aBackgroundComponent.aBounds, + aBackgroundComponent.aBgColor, + static_cast(pCurrAct)->GetRect(), + aMapModeVDev) ) + bStillBackground=false; // incomplete occlusion of background + else + nLastBgAction=nActionNum; // this _is_ background + break; + } + default: + { + if( ImplIsNotTransparent( *pCurrAct, + aMapModeVDev ) ) + bStillBackground=false; // non-transparent action, possibly + // not uniform + else + // extend current bounds (next uniform action + // needs to fully cover this area) + aBackgroundComponent.aBounds.Union( + ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); + break; + } + } + + // execute action to get correct MapModes etc. + pCurrAct->Execute( &aMapModeVDev ); + + pCurrAct=const_cast(rInMtf).NextAction(); + ++nActionNum; + } + + ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. + + // create an OutputDevice to record mapmode changes and the like + VirtualDevice aMapModeVDev2; + aMapModeVDev2.mnDPIX = mnDPIX; + aMapModeVDev2.mnDPIY = mnDPIY; + aMapModeVDev2.EnableOutput(FALSE); + + // fast-forward until one after the last background action + // (need to reconstruct map mode vdev state) + nActionNum=0; + pCurrAct=const_cast(rInMtf).FirstAction(); + while( pCurrAct && nActionNum<=nLastBgAction ) + { + // up to and including last ink-generating background + // action go to background component + aBackgroundComponent.aComponentList.push_back( + ::std::make_pair( + pCurrAct, nActionNum) ); + + // execute action to get correct MapModes etc. + pCurrAct->Execute( &aMapModeVDev2 ); + pCurrAct=const_cast(rInMtf).NextAction(); + ++nActionNum; + } + // - // STAGE 1: Generate connected components list + // STAGE 2: Generate connected components list // =========================================== // - // iterate over all actions - for( pCurrAct=const_cast(rInMtf).FirstAction(), nActionNum=0; + // iterate over all actions (start where background action + // search left off) + for( ; pCurrAct; pCurrAct=const_cast(rInMtf).NextAction(), ++nActionNum ) { // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev ); + pCurrAct->Execute( &aMapModeVDev2 ); // cache bounds of current action - const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); + const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev2) ); // accumulate collected bounds here, initialize with current action Rectangle aTotalBounds( aBBCurrAct ); // thus, @@ -661,7 +875,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM ConnectedComponents aTotalComponents; // - // STAGE 1.1: Search for intersecting cc entries + // STAGE 2.1: Search for intersecting cc entries // ============================================= // @@ -669,18 +883,33 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // aCCList member. Thus, we can safe us the check. // Furthermore, this ensures that non-output-generating // actions get their own aCCList entry, which is necessary - // when copying them to the output metafile (see stage 3 + // when copying them to the output metafile (see stage 4 // below). // #107169# Wholly transparent objects need // not be considered for connected components, // too. Just put each of them into a separate // component. - aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev); + aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev2); if( !aBBCurrAct.IsEmpty() && !aTotalComponents.bIsFullyTransparent ) { + if( !aBackgroundComponent.aComponentList.empty() && + !aBackgroundComponent.aBounds.IsInside(aTotalBounds) ) + { + // it seems the background is not large enough. to + // be on the safe side, combine with this component. + aTotalBounds.Union( aBackgroundComponent.aBounds ); + + // extract all aCurr actions to aTotalComponents + aTotalComponents.aComponentList.splice( aTotalComponents.aComponentList.end(), + aBackgroundComponent.aComponentList ); + + if( aBackgroundComponent.bIsSpecial ) + bTreatSpecial = true; + } + ConnectedComponentsList::iterator aCurrCC; const ConnectedComponentsList::iterator aLastCC( aCCList.end() ); bool bSomeComponentsChanged; @@ -741,7 +970,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM } // - // STAGE 1.2: Determine special state for cc element + // STAGE 2.2: Determine special state for cc element // ================================================= // @@ -790,7 +1019,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // check whether we're on white background if( aTotalComponents.aComponentList.empty() ) { - // nothing between pCurrAct and empty page + // nothing between pCurrAct and page // background -> don't be special aTotalComponents.bIsSpecial = false; } @@ -812,14 +1041,15 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // - // STAGE 1.3: Add newly generated CC list element + // STAGE 2.3: Add newly generated CC list element // ============================================== // // set new bounds and add action to list aTotalComponents.aBounds = aTotalBounds; - aTotalComponents.aComponentList.push_back( ::std::make_pair( - const_cast(pCurrAct), nActionNum) ); + aTotalComponents.aComponentList.push_back( + ::std::make_pair( + pCurrAct, nActionNum) ); // add aTotalComponents as a new entry to aCCList aCCList.push_back( aTotalComponents ); @@ -851,22 +1081,47 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM const ConnectedComponentsList::iterator aLast( aCCList.end() ); for( ; aCurr != aLast; ++aCurr ) { - ::std::list< Component >::iterator aCurrAct( aCurr->aComponentList.begin() ); - const ::std::list< Component >::iterator aLastAct( aCurr->aComponentList.end() ); - for( ; aCurrAct != aLastAct; ++aCurrAct ) + ComponentList::iterator aCurrentAction( aCurr->aComponentList.begin() ); + const ComponentList::iterator aLastAction( aCurr->aComponentList.end() ); + for( ; aCurrentAction != aLastAction; ++aCurrentAction ) { // set pointer to aCCList element for corresponding index - aCCList_MemberMap[ aCurrAct->second ] = &(*aCurr); + aCCList_MemberMap[ aCurrentAction->second ] = &(*aCurr); } } // - // STAGE 2: Generate banded bitmaps for special regions + // STAGE 3.1: Output background mtf actions (if there are any) + // =========================================================== + // + + ComponentList::iterator aCurrAct( aBackgroundComponent.aComponentList.begin() ); + const ComponentList::iterator aLastAct( aBackgroundComponent.aComponentList.end() ); + for( ; aCurrAct != aLastAct; ++aCurrAct ) + { + // simply add this action (above, we inserted the actions + // starting at index 0 up to and including nLastBgAction) + rOutMtf.AddAction( ( aCurrAct->first->Duplicate(), aCurrAct->first ) ); + } + + + // + // STAGE 3.2: Generate banded bitmaps for special regions // ==================================================== // Point aTmpPoint; - const Rectangle aOutputRect( aTmpPoint, GetOutputSizePixel() ); + Size aTmpSize( GetOutputSizePixel() ); + if( mpPDFWriter ) + { + aTmpSize = mpPDFWriter->getCurPageSize(); + aTmpSize = LogicToPixel( aTmpSize, MapMode( MAP_POINT ) ); + + // also add error code to PDFWriter + mpPDFWriter->insertError( vcl::PDFWriter::Warning_Transparency_Converted ); + } + const Rectangle aOutputRect( aTmpPoint, aTmpSize ); + bool bTiling = dynamic_cast(this) != NULL; // iterate over all aCCList members and generate bitmaps for the special ones for( aCurr = aCCList.begin(); aCurr != aLast; ++aCurr ) @@ -880,9 +1135,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM const double fOutArea( (double) aOutputRect.GetWidth() * aOutputRect.GetHeight() ); // check if output doesn't exceed given size - if( rPrinterOptions.IsReduceTransparency() && - ( PRINTER_TRANSPARENCY_AUTO == rPrinterOptions.GetReducedTransparencyMode() ) && - ( fBmpArea > ( 0.25 * fOutArea ) ) ) + if( bReduceTransparency && bTransparencyAutoMode && ( fBmpArea > ( 0.25 * fOutArea ) ) ) { // output normally. Therefore, we simply clear the // special attribute, as everything non-special is @@ -910,7 +1163,7 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM while( aDstPtPix.Y() <= aBoundRect.Bottom() ) { aDstPtPix.X() = aBoundRect.Left(); - aDstSzPix = Size( MAX_TILE_WIDTH, MAX_TILE_HEIGHT ); + aDstSzPix = bTiling ? Size( MAX_TILE_WIDTH, MAX_TILE_HEIGHT ) : aBoundRect.GetSize(); if( ( aDstPtPix.Y() + aDstSzPix.Height() - 1L ) > aBoundRect.Bottom() ) aDstSzPix.Height() = aBoundRect.Bottom() - aDstPtPix.Y() + 1L; @@ -964,7 +1217,11 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM else if( META_GRADIENT_ACTION == nType ) { MetaGradientAction* pGradientAction = static_cast(pCurrAct); - DrawGradientEx( &aPaintVDev, pGradientAction->GetRect(), pGradientAction->GetGradient() ); + Printer* pPrinter = dynamic_cast< Printer* >(this); + if( pPrinter ) + pPrinter->DrawGradientEx( &aPaintVDev, pGradientAction->GetRect(), pGradientAction->GetGradient() ); + else + DrawGradient( pGradientAction->GetRect(), pGradientAction->GetGradient() ); } else { @@ -981,11 +1238,11 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) ); // scale down bitmap, if requested - if( rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency() ) + if( bDownsampleBitmaps ) { - aBandBmp = GetPreparedBitmap( aDstSzPix, - Point(), aBandBmp.GetSizePixel(), - aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY ); + aBandBmp = GetDownsampledBitmap( aDstSzPix, + Point(), aBandBmp.GetSizePixel(), + aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY ); } rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) ); @@ -1013,10 +1270,17 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM } // - // STAGE 3: Copy actions to output metafile + // 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; @@ -1027,70 +1291,47 @@ void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutM // NOTE: This relies on the fact that map-mode or draw // mode changing actions are solitary aCCList elements and - // have empty bounding boxes, see comment on stage 1.1 + // have empty bounding boxes, see comment on stage 2.1 // above if( pCurrAssociatedComponent && (pCurrAssociatedComponent->aBounds.IsEmpty() || !pCurrAssociatedComponent->bIsSpecial) ) { - // #107169# Treat masked bitmaps special, if they are - // the first (or sole) action in their bounds + // #107169# Treat transparent bitmaps special, if they + // are the first (or sole) action in their bounds // list. Note that we previously ensured that no // fully-transparent objects are before us here. - if( ImplIsActionMaskedBitmap( *pCurrAct ) && + if( ImplIsActionHandlingTransparency( *pCurrAct ) && pCurrAssociatedComponent->aComponentList.begin()->first == pCurrAct ) { - // convert to plain Bitmap, where masked-out parts are white - Bitmap aBmp( ImplConvertBmpEx2Bmp(*pCurrAct) ); - - // add corresponding action - switch( pCurrAct->GetType() ) - { - case META_BMPEX_ACTION: - rOutMtf.AddAction( new MetaBmpExAction( - static_cast(pCurrAct)->GetPoint(), - aBmp ) ); - break; - - case META_BMPEXSCALE_ACTION: - rOutMtf.AddAction( new MetaBmpExScaleAction( - static_cast(pCurrAct)->GetPoint(), - static_cast(pCurrAct)->GetSize(), - aBmp ) ); - break; - - case META_BMPEXSCALEPART_ACTION: - rOutMtf.AddAction( new MetaBmpExScalePartAction( - static_cast(pCurrAct)->GetDestPoint(), - static_cast(pCurrAct)->GetDestSize(), - static_cast(pCurrAct)->GetSrcPoint(), - static_cast(pCurrAct)->GetSrcSize(), - aBmp ) ); - break; - - default: - DBG_ERROR("Printer::GetPreparedMetafile impossible state reached"); - break; - } + // convert actions, where masked-out parts are of + // given background color + ImplConvertTransparentAction(rOutMtf, + *pCurrAct, + aMapModeVDev3, + aBackgroundComponent.aBgColor); } else { // simply add this action rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) ); } + + pCurrAct->Execute(&aMapModeVDev3); } } rOutMtf.SetPrefMapMode( rInMtf.GetPrefMapMode() ); rOutMtf.SetPrefSize( rInMtf.GetPrefSize() ); } + return bTransparent; } // ----------------------------------------------------------------------------- -Bitmap Printer::GetPreparedBitmap( const Size& rDstSz, - const Point& rSrcPt, const Size& rSrcSz, - const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY ) +Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY ) { Bitmap aBmp( rBmp ); @@ -1157,9 +1398,9 @@ Bitmap Printer::GetPreparedBitmap( const Size& rDstSz, // ----------------------------------------------------------------------------- -BitmapEx Printer::GetPreparedBitmapEx( const Size& rDstSz, - const Point& rSrcPt, const Size& rSrcSz, - const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ) +BitmapEx OutputDevice::GetDownsampledBitmapEx( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ) { BitmapEx aBmpEx( rBmpEx ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 71ddf0e7d5e8..8116cbf04088 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -891,15 +891,12 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste { mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX; mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY; - mpWindowImpl->mpFrameData->mnFontDPIX = pParent->mpWindowImpl->mpFrameData->mnFontDPIX; - mpWindowImpl->mpFrameData->mnFontDPIY = pParent->mpWindowImpl->mpFrameData->mnFontDPIY; } else { if ( ImplGetGraphics() ) { mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); - mpGraphics->GetScreenFontResolution( mpWindowImpl->mpFrameData->mnFontDPIX, mpWindowImpl->mpFrameData->mnFontDPIY ); } } @@ -1683,13 +1680,13 @@ void Window::ImplPointToLogic( Font& rFont ) const if ( aSize.Width() ) { - aSize.Width() *= mpWindowImpl->mpFrameData->mnFontDPIX; + aSize.Width() *= mpWindowImpl->mpFrameData->mnDPIX; aSize.Width() += 72/2; aSize.Width() /= 72; aSize.Width() *= nScreenFontZoom; aSize.Width() /= 100; } - aSize.Height() *= mpWindowImpl->mpFrameData->mnFontDPIY; + aSize.Height() *= mpWindowImpl->mpFrameData->mnDPIY; aSize.Height() += 72/2; aSize.Height() /= 72; aSize.Height() *= nScreenFontZoom; @@ -1716,14 +1713,14 @@ void Window::ImplLogicToPoint( Font& rFont ) const aSize.Width() *= 100; aSize.Width() /= nScreenFontZoom; aSize.Width() *= 72; - aSize.Width() += mpWindowImpl->mpFrameData->mnFontDPIX/2; - aSize.Width() /= mpWindowImpl->mpFrameData->mnFontDPIX; + aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX/2; + aSize.Width() /= mpWindowImpl->mpFrameData->mnDPIX; } aSize.Height() *= 100; aSize.Height() /= nScreenFontZoom; aSize.Height() *= 72; - aSize.Height() += mpWindowImpl->mpFrameData->mnFontDPIY/2; - aSize.Height() /= mpWindowImpl->mpFrameData->mnFontDPIY; + aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY/2; + aSize.Height() /= mpWindowImpl->mpFrameData->mnDPIY; rFont.SetSize( aSize ); } @@ -5911,12 +5908,13 @@ Font Window::GetPointFont() const // ----------------------------------------------------------------------- +// TODO: remove in next incompatible build void Window::GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - nDPIX = mpWindowImpl->mpFrameData->mnFontDPIX; - nDPIY = mpWindowImpl->mpFrameData->mnFontDPIY; + nDPIX = mpWindowImpl->mpFrameData->mnDPIX; + nDPIY = mpWindowImpl->mpFrameData->mnDPIY; } // ----------------------------------------------------------------------- diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index b85339a415a9..784826b032b9 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salnativewidgets-gtk.cxx,v $ - * $Revision: 1.47 $ + * $Revision: 1.47.32.4 $ * * This file is part of OpenOffice.org. * @@ -98,6 +98,7 @@ struct NWFWidgetData GtkWidget * gMenuItemRadioMenuWidget; GtkWidget * gTooltipPopup; GtkWidget * gProgressBar; + GtkWidget * gTreeView; NWPixmapCacheList* gNWPixmapCacheList; NWPixmapCache* gCacheTabItems; @@ -132,6 +133,7 @@ struct NWFWidgetData gMenuItemRadioMenuWidget( NULL ), gTooltipPopup( NULL ), gProgressBar( NULL ), + gTreeView( NULL ), gNWPixmapCacheList( NULL ), gCacheTabItems( NULL ), gCacheTabPages( NULL ) @@ -168,6 +170,7 @@ static void NWEnsureGTKMenubar ( int nScreen ); static void NWEnsureGTKMenu ( int nScreen ); static void NWEnsureGTKTooltip ( int nScreen ); static void NWEnsureGTKProgressBar ( int nScreen ); +static void NWEnsureGTKTreeView ( int nScreen ); static void NWConvertVCLStateToGTKState( ControlState nVCLState, GtkStateType* nGTKState, GtkShadowType* nGTKShadow ); static void NWAddWidgetToCacheWindow( GtkWidget* widget, int nScreen ); @@ -574,6 +577,9 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP || (nPart==PART_MENU_ITEM_RADIO_MARK) ) || ((nType == CTRL_PROGRESS) && + ( (nPart == PART_ENTIRE_CONTROL) ) + ) || + ((nType == CTRL_LISTNODE || nType == CTRL_LISTNET) && ( (nPart == PART_ENTIRE_CONTROL) ) ) ) @@ -852,6 +858,16 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, { returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); } + else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) ) + { + returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + } + else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) ) + { + // don't actually draw anything; gtk treeviews do not draw lines + returnVal = true; + } + if( pixmap ) { returnVal = NWRenderPixmapToScreen( pixmap, aPixmapRect ) && returnVal; @@ -2285,11 +2301,11 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, // Allow the tab to draw a right border if needed tabRect.Right() -= 1; - } - // #129732# avoid degenerate cases which might lead to crashes - if( tabRect.GetWidth() <= 1 || tabRect.GetHeight() <= 1 ) - return false; + // #129732# avoid degenerate cases which might lead to crashes + if( tabRect.GetWidth() <= 1 || tabRect.GetHeight() <= 1 ) + return false; + } if( nType == CTRL_TAB_ITEM ) { @@ -2857,6 +2873,57 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip( return( TRUE ); } +BOOL GtkSalGraphics::NWPaintGTKListNode( + GdkDrawable*, + ControlType, ControlPart, + const Rectangle& rControlRectangle, + const clipList&, + ControlState nState, const ImplControlValue& rValue, + SalControlHandle&, const OUString& ) +{ + NWEnsureGTKTreeView( m_nScreen ); + + Rectangle aRect( rControlRectangle ); + aRect.Left() -= 2; + aRect.Right() += 2; + aRect.Top() -= 2; + aRect.Bottom() += 2; + gint w, h; + w = aRect.GetWidth(); + h = aRect.GetHeight(); + + GtkStateType stateType; + GtkShadowType shadowType; + NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); + + ButtonValue aButtonValue = rValue.getTristateVal(); + GtkExpanderStyle eStyle = GTK_EXPANDER_EXPANDED; + + switch( aButtonValue ) + { + case BUTTONVALUE_ON: eStyle = GTK_EXPANDER_EXPANDED;break; + case BUTTONVALUE_OFF: eStyle = GTK_EXPANDER_COLLAPSED; break; + default: + break; + } + + GdkPixmap* pixmap = NWGetPixmapFromScreen( aRect ); + if( ! pixmap ) + return FALSE; + + GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); + gtk_draw_expander( gWidgetData[m_nScreen].gTreeView->style, + pixDrawable, + stateType, + w/2, h/2, + eStyle ); + + BOOL bRet = NWRenderPixmapToScreen( pixmap, aRect ); + g_object_unref( pixmap ); + + return bRet; +} + BOOL GtkSalGraphics::NWPaintGTKProgress( GdkDrawable*, ControlType, ControlPart, @@ -3222,7 +3289,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // UI font OString aFamily = pango_font_description_get_family( pStyle->font_desc ); - int nPixelHeight = pango_font_description_get_size( pStyle->font_desc )/PANGO_SCALE; + int nPangoHeight = pango_font_description_get_size( pStyle->font_desc ); PangoStyle eStyle = pango_font_description_get_style( pStyle->font_desc ); PangoWeight eWeight = pango_font_description_get_weight( pStyle->font_desc ); PangoStretch eStretch = pango_font_description_get_stretch( pStyle->font_desc ); @@ -3275,17 +3342,17 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif - sal_Int32 nDPIX, nDPIY; sal_Int32 nDispDPIY = GetDisplay()->GetResolution().B(); - GetDisplay()->GetScreenFontResolution( nDPIX, nDPIY ); - int nHeight = nPixelHeight * nDispDPIY / nDPIY; - // allow for rounding in back conversion (at SetFont) - while( (nHeight * nDPIY / nDispDPIY) > nPixelHeight ) - nHeight--; - while( (nHeight * nDPIY / nDispDPIY) < nPixelHeight ) - nHeight++; - - Font aFont( aInfo.m_aFamilyName, Size( 0, nHeight ) ); + int nPointHeight = 0; + static gboolean(*pAbso)(const PangoFontDescription*) = + (gboolean(*)(const PangoFontDescription*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "pango_font_description_get_size_is_absolute" ); + + if( ! pAbso || pAbso( pStyle->font_desc ) ) + nPointHeight = (nPangoHeight * 72 + nDispDPIY*PANGO_SCALE/2) / (nDispDPIY * PANGO_SCALE); + else + nPointHeight = nPangoHeight/PANGO_SCALE; + + Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); if( aInfo.m_eWeight != psp::weight::Unknown ) aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); if( aInfo.m_eWidth != psp::width::Unknown ) @@ -3812,3 +3879,12 @@ static void NWEnsureGTKProgressBar( int nScreen ) NWAddWidgetToCacheWindow( gWidgetData[nScreen].gProgressBar, nScreen ); } } + +static void NWEnsureGTKTreeView( int nScreen ) +{ + if( !gWidgetData[nScreen].gTreeView ) + { + gWidgetData[nScreen].gTreeView = gtk_tree_view_new (); + NWAddWidgetToCacheWindow( gWidgetData[nScreen].gTreeView, nScreen ); + } +} diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 59dd5f4d50cb..6f3879289976 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -134,11 +134,6 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) rDPIX = rDPIY = 96; } -void SvpSalGraphics::GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) -{ - rDPIX = rDPIY = 96; -} - USHORT SvpSalGraphics::GetBitCount() { return SvpElement::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() ); diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index c38f81275556..353ef24a7f01 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -67,7 +67,6 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); virtual USHORT GetBitCount(); virtual long GetGraphicsWidth() const; diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index d56bd1b6ae9d..45a07f8bd558 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -201,11 +201,6 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -void PspGraphics::GetScreenFontResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) -{ - m_pPrinterGfx->GetScreenFontResolution (rDPIX, rDPIY); -} - USHORT PspGraphics::GetBitCount() { return m_pPrinterGfx->GetBitCount(); diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 43abc5033a95..2469bdcebf1b 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -98,7 +98,6 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); virtual USHORT GetBitCount(); virtual long GetGraphicsWidth() const; diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 2458ff45a974..5211367c355a 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gtkgdi.hxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.50.1 $ * * This file is part of OpenOffice.org. * @@ -171,6 +171,11 @@ protected: const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + SalControlHandle& rControlHandle, const OUString& rCaption ); BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index 5cc0d38090b2..e8cf38dfc49e 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -97,7 +97,6 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); virtual USHORT GetBitCount(); virtual long GetGraphicsWidth() const; diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 011d9a4fa5b1..d662ce51d855 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: saldisp.hxx,v $ - * $Revision: 1.47 $ + * $Revision: 1.47.6.1 $ * * This file is part of OpenOffice.org. * @@ -495,7 +495,6 @@ public: bool GetExactResolution() const { return mbExactResolution; } ULONG GetProperties() const { return nProperties_; } ULONG GetMaxRequestSize() const { return nMaxRequestSize_; } - void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) const; BOOL MouseCaptured( const SalFrame *pFrameData ) const { return m_pCapture == pFrameData; } diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index c16ca3bf1086..b3e1efbdab44 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -226,7 +226,6 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual void GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); virtual USHORT GetBitCount(); virtual long GetGraphicsWidth() const; virtual long GetGraphicsHeight() const; diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 667de25490b0..9252d0b9d5c5 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salnativewidgets-kde.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.86.1 $ * * This file is part of OpenOffice.org. * @@ -1827,19 +1827,8 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r if ( nPointHeight <= 0 ) nPointHeight = rQFont.pointSize(); - sal_Int32 nDPIX, nDPIY; - sal_Int32 nDispDPIY = GetX11SalData()->GetDisplay()->GetResolution().B(); - GetX11SalData()->GetDisplay()->GetScreenFontResolution( nDPIX, nDPIY ); - - int nHeight = nPointHeight * nDispDPIY / nDPIY; - // allow for rounding in back conversion (at SetFont) - while( (nHeight * nDPIY / nDispDPIY) > nPointHeight ) - nHeight--; - while( (nHeight * nDPIY / nDispDPIY) < nPointHeight ) - nHeight++; - // Create the font - Font aFont( aInfo.m_aFamilyName, Size( 0, nHeight ) ); + Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); if( aInfo.m_eWeight != psp::weight::Unknown ) aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); if( aInfo.m_eWidth != psp::width::Unknown ) diff --git a/vcl/unx/source/app/randrwrapper.cxx b/vcl/unx/source/app/randrwrapper.cxx index f9bf6e2e168f..b079e2909e71 100644 --- a/vcl/unx/source/app/randrwrapper.cxx +++ b/vcl/unx/source/app/randrwrapper.cxx @@ -8,7 +8,7 @@ * * $RCSfile: randrwrapper.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.5.10.1 $ * * This file is part of OpenOffice.org. * @@ -281,6 +281,7 @@ void RandRWrapper::releaseWrapper() #endif #include "saldisp.hxx" +#include "salframe.h" void SalDisplay::InitRandR( XLIB_Window aRoot ) const { @@ -314,6 +315,7 @@ int SalDisplay::processRandREvent( XEvent* pEvent ) if( nRet == 1 && pEvent->type != ConfigureNotify) // this should then be a XRRScreenChangeNotifyEvent { // update screens + bool bNotify = false; for( size_t i = 0; i < m_aScreens.size(); i++ ) { if( m_aScreens[i].m_bInit ) @@ -329,6 +331,10 @@ int SalDisplay::processRandREvent( XEvent* pEvent ) pSizes = pWrapper->XRRConfigSizes( pConfig, &nSizes ); XRRScreenSize *pTargetSize = pSizes + nId; + bNotify = bNotify || + m_aScreens[i].m_aSize.Width() != pTargetSize->width || + m_aScreens[i].m_aSize.Height() != pTargetSize->height; + m_aScreens[i].m_aSize = Size( pTargetSize->width, pTargetSize->height ); pWrapper->XRRFreeScreenConfigInfo( pConfig ); @@ -338,6 +344,8 @@ int SalDisplay::processRandREvent( XEvent* pEvent ) #endif } } + if( bNotify && ! m_aFrames.empty() ) + m_aFrames.front()->CallCallback( SALEVENT_DISPLAYCHANGED, 0 ); } } #else diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index a1f51a33c618..ac4506c0ac6c 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2609,31 +2609,6 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } -void SalDisplay::GetScreenFontResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) const -{ - rDPIX = aResolution_.A(); - rDPIY = aResolution_.B(); - if( mbExactResolution ) - return; - - int nThreshold; - if (m_aScreens[m_nDefaultScreen].m_aSize.Height() <= 600) - nThreshold = 96; - else if (m_aScreens[m_nDefaultScreen].m_aSize.Height() <= 768) - nThreshold = 108; - else - nThreshold = 120; - - if( rDPIY < nThreshold ) - { - rDPIX = Divide( rDPIX * nThreshold, rDPIY ); - rDPIY = nThreshold; - } - - // #i18602# always equalize x- and y-resolution - rDPIX = rDPIY; -} - void SalDisplay::InitXinerama() { if( m_aScreens.size() > 1 ) diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 60111ff2acd5..44c3e19f589f 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -275,11 +275,6 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -void PspGraphics::GetScreenFontResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) -{ - m_pPrinterGfx->GetScreenFontResolution (rDPIX, rDPIY); -} - USHORT PspGraphics::GetBitCount() { return m_pPrinterGfx->GetBitCount(); diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index bb861ba020fd..2b21397248ef 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -517,12 +517,6 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons } } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::GetScreenFontResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const -{ - GetDisplay()->GetScreenFontResolution( rDPIX, rDPIY ); -} - // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= USHORT X11SalGraphics::GetBitCount() // const { diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index adae0f075198..ffda4f31dab7 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -171,6 +171,7 @@ SHL1STDLIBS+=\ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(I18NISOLANGLIB) \ + $(I18NUTILLIB) \ $(COMPHELPERLIB) \ $(UCBHELPERLIB) \ $(CPPUHELPERLIB) \ diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index b35dfb93d825..a43efed328b0 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -240,9 +240,6 @@ public: // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); - // get resolution for fonts (an implementations specific adjustment, - // ideally would be the same as the Resolution) - virtual void GetScreenFontResolution( long& rDPIX, long& rDPIY ); // get the depth of the device virtual USHORT GetBitCount(); // get the width of the device diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 5a8a51ddd741..29bf48081e60 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -808,14 +808,6 @@ void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) // ----------------------------------------------------------------------- -void WinSalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY ) -{ - rDPIX = GetDeviceCaps( mhDC, LOGPIXELSX ); - rDPIY = GetDeviceCaps( mhDC, LOGPIXELSY ); -} - -// ----------------------------------------------------------------------- - USHORT WinSalGraphics::GetBitCount() { return (USHORT)GetDeviceCaps( mhDC, BITSPIXEL ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 5650d9d37ef4..1da5a3fdc8ac 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2181,7 +2181,7 @@ static void ImplSalToTop( HWND hWnd, USHORT nFlags ) } } - if ( !IsIconic( hWnd ) ) + if ( !IsIconic( hWnd ) && IsWindowVisible( hWnd ) ) { SetFocus( hWnd ); -- cgit v1.2.3