diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 20:56:35 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 23:34:09 +1000 |
commit | cf3c6cb40f99fa1761a6af3d7447a899b9447868 (patch) | |
tree | 39586a006b6d3c1942d95050f0fd994d6d10e99a | |
parent | ef3b68886c2bf851ac4ff7511c0418ba8393ee29 (diff) |
VCL: ImpObjStack replaced with std::stack
ImpObjStack uses it's own home-grown stack and stack functions. There
is a function that unwinds the stack, but really it would be better if
we used std::set. In fact, this is better, because the name ImpObjStack
is really not terribly descriptive. I've replaced it with a stack of
OutDevState objects.
Change-Id: I87bdd4340ad77b7ffd9ff176fa5a9ffeac8b8666
-rw-r--r-- | include/vcl/outdev.hxx | 26 | ||||
-rw-r--r-- | include/vcl/outdevstate.hxx | 78 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 14 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 458 | ||||
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 82 |
6 files changed, 371 insertions, 288 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index da3b4b39ca0a..c0a230640594 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -34,6 +34,8 @@ #include <vcl/metaact.hxx> #include <vcl/salnativewidgets.hxx> +#include <vcl/outdevstate.hxx> + #include <basegfx/vector/b2enums.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -45,6 +47,7 @@ #include <com/sun/star/uno/Reference.h> #include <vector> +#include <stack> #if defined UNX #define GLYPH_FONT_HEIGHT 128 @@ -57,7 +60,7 @@ struct ImplOutDevData; class ImplFontEntry; -struct ImplObjStack; +class OutDevState; struct SystemGraphicsData; struct SystemFontData; struct SystemTextLayoutData; @@ -141,25 +144,6 @@ struct ImplThresholdRes // OutputDevice-Types -// Flags for Push() -#define PUSH_LINECOLOR ((sal_uInt16)0x0001) -#define PUSH_FILLCOLOR ((sal_uInt16)0x0002) -#define PUSH_FONT ((sal_uInt16)0x0004) -#define PUSH_TEXTCOLOR ((sal_uInt16)0x0008) -#define PUSH_MAPMODE ((sal_uInt16)0x0010) -#define PUSH_CLIPREGION ((sal_uInt16)0x0020) -#define PUSH_RASTEROP ((sal_uInt16)0x0040) -#define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080) -#define PUSH_TEXTALIGN ((sal_uInt16)0x0100) -#define PUSH_REFPOINT ((sal_uInt16)0x0200) -#define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400) -#define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800) -#define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000) -#define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000) -#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE) -#define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT) -#define PUSH_ALL ((sal_uInt16)0xFFFF) - // Flags for DrawText() #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001) #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002) @@ -300,7 +284,7 @@ private: mutable PhysicalFontCollection* mpFontCollection; mutable ImplGetDevFontList* mpGetDevFontList; mutable ImplGetDevSizeList* mpGetDevSizeList; - ImplObjStack* mpObjStack; + std::stack < OutDevState* >* mpOutDevStateStack; ImplOutDevData* mpOutDevData; VCLXGraphicsList_impl* mpUnoGraphicsList; vcl::PDFWriterImpl* mpPDFWriter; diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx new file mode 100644 index 000000000000..1a08845f9694 --- /dev/null +++ b/include/vcl/outdevstate.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_OUTDEVSTATE_HXX +#define INCLUDED_VCL_INC_OUTDEVSTATE_HXX + +#include <sal/types.h> + +#include <vcl/mapmod.hxx> +#include <vcl/region.hxx> +#include <vcl/font.hxx> +#include <vcl/vclenum.hxx> + +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> + +// Flags for OutputDevice::Push() and OutDevState +#define PUSH_LINECOLOR ((sal_uInt16)0x0001) +#define PUSH_FILLCOLOR ((sal_uInt16)0x0002) +#define PUSH_FONT ((sal_uInt16)0x0004) +#define PUSH_TEXTCOLOR ((sal_uInt16)0x0008) +#define PUSH_MAPMODE ((sal_uInt16)0x0010) +#define PUSH_CLIPREGION ((sal_uInt16)0x0020) +#define PUSH_RASTEROP ((sal_uInt16)0x0040) +#define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080) +#define PUSH_TEXTALIGN ((sal_uInt16)0x0100) +#define PUSH_REFPOINT ((sal_uInt16)0x0200) +#define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400) +#define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800) +#define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000) +#define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000) +#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE) +#define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT) +#define PUSH_ALL ((sal_uInt16)0xFFFF) + +class OutDevState +{ +public: + ~OutDevState(); + + MapMode* mpMapMode; + bool mbMapActive; + Region* mpClipRegion; + Color* mpLineColor; + Color* mpFillColor; + Font* mpFont; + Color* mpTextColor; + Color* mpTextFillColor; + Color* mpTextLineColor; + Color* mpOverlineColor; + Point* mpRefPoint; + TextAlign meTextAlign; + RasterOp meRasterOp; + sal_uLong mnTextLayoutMode; + LanguageType meTextLanguage; + sal_uInt16 mnFlags; +}; + +#endif // INCLUDED_VCL_INC_OUTDEVSTATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 4d40694bc96a..1d22db81256d 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -235,6 +235,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/gdi/octree \ vcl/source/gdi/oldprintadaptor \ vcl/source/outdev/outdev \ + vcl/source/outdev/outdevstate \ vcl/source/outdev/clipping \ vcl/source/outdev/polygon \ vcl/source/outdev/transparent \ diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index ad9bfa11f292..ff37b98b611f 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -33,13 +33,13 @@ #include <vcl/IconThemeScanner.hxx> #include <vcl/IconThemeSelector.hxx> #include <vcl/IconThemeInfo.hxx> -#include "vcl/svapp.hxx" -#include "vcl/event.hxx" -#include "vcl/settings.hxx" -#include "vcl/i18nhelp.hxx" -#include "vcl/configsettings.hxx" -#include "vcl/gradient.hxx" -#include "vcl/outdev.hxx" +#include <vcl/svapp.hxx> +#include <vcl/event.hxx> +#include <vcl/settings.hxx> +#include <vcl/i18nhelp.hxx> +#include <vcl/configsettings.hxx> +#include <vcl/gradient.hxx> +#include <vcl/outdev.hxx> #include "unotools/fontcfg.hxx" #include "unotools/localedatawrapper.hxx" diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index b141ea51593f..270f4b3cc3a1 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -31,9 +31,11 @@ #include <vcl/outdev.hxx> #include <vcl/unowrap.hxx> #include <vcl/settings.hxx> -#include <svsys.h> #include <vcl/sysdata.hxx> +#include <vcl/outdevstate.hxx> + +#include <svsys.h> #include <salgdi.hxx> #include <sallayout.hxx> #include <salframe.hxx> @@ -43,6 +45,7 @@ #include <window.h> #include <outdev.h> #include <outdata.hxx> + #include "PhysicalFontCollection.hxx" #include <basegfx/point/b2dpoint.hxx> @@ -62,6 +65,7 @@ #include <comphelper/processfactory.hxx> #include <numeric> +#include <stack> #ifdef DISABLE_DYNLOADING // Linking all needed LO code into one .so/executable, these already @@ -73,76 +77,6 @@ namespace { } #endif -struct ImplObjStack -{ - ImplObjStack* mpPrev; - MapMode* mpMapMode; - bool mbMapActive; - Region* mpClipRegion; - Color* mpLineColor; - Color* mpFillColor; - Font* mpFont; - Color* mpTextColor; - Color* mpTextFillColor; - Color* mpTextLineColor; - Color* mpOverlineColor; - Point* mpRefPoint; - TextAlign meTextAlign; - RasterOp meRasterOp; - sal_uLong mnTextLayoutMode; - LanguageType meTextLanguage; - sal_uInt16 mnFlags; -}; - -static void ImplDeleteObjStack( ImplObjStack* pObjStack ) -{ - if ( pObjStack->mnFlags & PUSH_LINECOLOR ) - { - if ( pObjStack->mpLineColor ) - delete pObjStack->mpLineColor; - } - if ( pObjStack->mnFlags & PUSH_FILLCOLOR ) - { - if ( pObjStack->mpFillColor ) - delete pObjStack->mpFillColor; - } - if ( pObjStack->mnFlags & PUSH_FONT ) - delete pObjStack->mpFont; - if ( pObjStack->mnFlags & PUSH_TEXTCOLOR ) - delete pObjStack->mpTextColor; - if ( pObjStack->mnFlags & PUSH_TEXTFILLCOLOR ) - { - if ( pObjStack->mpTextFillColor ) - delete pObjStack->mpTextFillColor; - } - if ( pObjStack->mnFlags & PUSH_TEXTLINECOLOR ) - { - if ( pObjStack->mpTextLineColor ) - delete pObjStack->mpTextLineColor; - } - if ( pObjStack->mnFlags & PUSH_OVERLINECOLOR ) - { - if ( pObjStack->mpOverlineColor ) - delete pObjStack->mpOverlineColor; - } - if ( pObjStack->mnFlags & PUSH_MAPMODE ) - { - if ( pObjStack->mpMapMode ) - delete pObjStack->mpMapMode; - } - if ( pObjStack->mnFlags & PUSH_CLIPREGION ) - { - if ( pObjStack->mpClipRegion ) - delete pObjStack->mpClipRegion; - } - if ( pObjStack->mnFlags & PUSH_REFPOINT ) - { - if ( pObjStack->mpRefPoint ) - delete pObjStack->mpRefPoint; - } - - delete pObjStack; -} bool OutputDevice::ImplIsAntiparallel() const { @@ -175,7 +109,7 @@ OutputDevice::OutputDevice() : mpFontCollection = NULL; mpGetDevFontList = NULL; mpGetDevSizeList = NULL; - mpObjStack = NULL; + mpOutDevStateStack = new std::stack< OutDevState* >(); mpOutDevData = NULL; mpPDFWriter = NULL; mpAlphaVDev = NULL; @@ -277,25 +211,25 @@ OutputDevice::~OutputDevice() delete mpOutDevData; } - ImplObjStack* pData = mpObjStack; - if ( pData ) + // for some reason, we haven't removed state from the stack properly + if ( !mpOutDevStateStack->empty() ) { SAL_WARN( "vcl.gdi", "OutputDevice::~OutputDevice(): OutputDevice::Push() calls != OutputDevice::Pop() calls" ); - while ( pData ) + while ( !mpOutDevStateStack->empty() ) { - ImplObjStack* pTemp = pData; - pData = pData->mpPrev; - ImplDeleteObjStack( pTemp ); + mpOutDevStateStack->pop(); } } // release the active font instance if( mpFontEntry ) mpFontCache->Release( mpFontEntry ); + // remove cached results of GetDevFontList/GetDevSizeList // TODO: use smart pointers for them if( mpGetDevFontList ) delete mpGetDevFontList; + if( mpGetDevSizeList ) delete mpGetDevSizeList; @@ -323,6 +257,191 @@ OutputDevice::~OutputDevice() delete mpAlphaVDev; } +void OutputDevice::Push( sal_uInt16 nFlags ) +{ + + if ( mpMetaFile ) + mpMetaFile->AddAction( new MetaPushAction( nFlags ) ); + + OutDevState* pState = new OutDevState; + + pState->mnFlags = nFlags; + + if ( nFlags & PUSH_LINECOLOR ) + { + if ( mbLineColor ) + pState->mpLineColor = new Color( maLineColor ); + else + pState->mpLineColor = NULL; + } + if ( nFlags & PUSH_FILLCOLOR ) + { + if ( mbFillColor ) + pState->mpFillColor = new Color( maFillColor ); + else + pState->mpFillColor = NULL; + } + if ( nFlags & PUSH_FONT ) + pState->mpFont = new Font( maFont ); + if ( nFlags & PUSH_TEXTCOLOR ) + pState->mpTextColor = new Color( GetTextColor() ); + if ( nFlags & PUSH_TEXTFILLCOLOR ) + { + if ( IsTextFillColor() ) + pState->mpTextFillColor = new Color( GetTextFillColor() ); + else + pState->mpTextFillColor = NULL; + } + if ( nFlags & PUSH_TEXTLINECOLOR ) + { + if ( IsTextLineColor() ) + pState->mpTextLineColor = new Color( GetTextLineColor() ); + else + pState->mpTextLineColor = NULL; + } + if ( nFlags & PUSH_OVERLINECOLOR ) + { + if ( IsOverlineColor() ) + pState->mpOverlineColor = new Color( GetOverlineColor() ); + else + pState->mpOverlineColor = NULL; + } + if ( nFlags & PUSH_TEXTALIGN ) + pState->meTextAlign = GetTextAlign(); + if( nFlags & PUSH_TEXTLAYOUTMODE ) + pState->mnTextLayoutMode = GetLayoutMode(); + if( nFlags & PUSH_TEXTLANGUAGE ) + pState->meTextLanguage = GetDigitLanguage(); + if ( nFlags & PUSH_RASTEROP ) + pState->meRasterOp = GetRasterOp(); + if ( nFlags & PUSH_MAPMODE ) + { + pState->mpMapMode = new MapMode( maMapMode ); + pState->mbMapActive = mbMap; + } + if ( nFlags & PUSH_CLIPREGION ) + { + if ( mbClipRegion ) + pState->mpClipRegion = new Region( maRegion ); + else + pState->mpClipRegion = NULL; + } + if ( nFlags & PUSH_REFPOINT ) + { + if ( mbRefPoint ) + pState->mpRefPoint = new Point( maRefPoint ); + else + pState->mpRefPoint = NULL; + } + + mpOutDevStateStack->push( pState ); + + if( mpAlphaVDev ) + mpAlphaVDev->Push(); +} + +void OutputDevice::Pop() +{ + + if( mpMetaFile ) + mpMetaFile->AddAction( new MetaPopAction() ); + + GDIMetaFile* pOldMetaFile = mpMetaFile; + OutDevState* pState = new OutDevState; + mpMetaFile = NULL; + + if ( mpOutDevStateStack->empty() ) + { + SAL_WARN( "vcl.gdi", "OutputDevice::Pop() without OutputDevice::Push()" ); + return; + } + + if( mpAlphaVDev ) + mpAlphaVDev->Pop(); + + if ( pState->mnFlags & PUSH_LINECOLOR ) + { + if ( pState->mpLineColor ) + SetLineColor( *pState->mpLineColor ); + else + SetLineColor(); + } + + if ( pState->mnFlags & PUSH_FILLCOLOR ) + { + if ( pState->mpFillColor ) + SetFillColor( *pState->mpFillColor ); + else + SetFillColor(); + } + + if ( pState->mnFlags & PUSH_FONT ) + SetFont( *pState->mpFont ); + + if ( pState->mnFlags & PUSH_TEXTCOLOR ) + SetTextColor( *pState->mpTextColor ); + + if ( pState->mnFlags & PUSH_TEXTFILLCOLOR ) + { + if ( pState->mpTextFillColor ) + SetTextFillColor( *pState->mpTextFillColor ); + else + SetTextFillColor(); + } + + if ( pState->mnFlags & PUSH_TEXTLINECOLOR ) + { + if ( pState->mpTextLineColor ) + SetTextLineColor( *pState->mpTextLineColor ); + else + SetTextLineColor(); + } + + if ( pState->mnFlags & PUSH_OVERLINECOLOR ) + { + if ( pState->mpOverlineColor ) + SetOverlineColor( *pState->mpOverlineColor ); + else + SetOverlineColor(); + } + + if ( pState->mnFlags & PUSH_TEXTALIGN ) + SetTextAlign( pState->meTextAlign ); + + if( pState->mnFlags & PUSH_TEXTLAYOUTMODE ) + SetLayoutMode( pState->mnTextLayoutMode ); + + if( pState->mnFlags & PUSH_TEXTLANGUAGE ) + SetDigitLanguage( pState->meTextLanguage ); + + if ( pState->mnFlags & PUSH_RASTEROP ) + SetRasterOp( pState->meRasterOp ); + + if ( pState->mnFlags & PUSH_MAPMODE ) + { + if ( pState->mpMapMode ) + SetMapMode( *pState->mpMapMode ); + else + SetMapMode(); + mbMap = pState->mbMapActive; + } + + if ( pState->mnFlags & PUSH_CLIPREGION ) + SetDeviceClipRegion( pState->mpClipRegion ); + + if ( pState->mnFlags & PUSH_REFPOINT ) + { + if ( pState->mpRefPoint ) + SetRefPoint( *pState->mpRefPoint ); + else + SetRefPoint(); + } + + mpOutDevStateStack->pop(); + + mpMetaFile = pOldMetaFile; +} + bool OutputDevice::supportsOperation( OutDevSupportType eType ) const { if( !mpGraphics ) @@ -993,188 +1112,7 @@ void OutputDevice::SetRefPoint( const Point& rRefPoint ) sal_uInt32 OutputDevice::GetGCStackDepth() const { - const ImplObjStack* pData = mpObjStack; - sal_uInt32 nDepth = 0; - while( pData ) - { - nDepth++; - pData = pData->mpPrev; - } - return nDepth; -} - -void OutputDevice::Push( sal_uInt16 nFlags ) -{ - - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaPushAction( nFlags ) ); - - ImplObjStack* pData = new ImplObjStack; - pData->mpPrev = mpObjStack; - mpObjStack = pData; - - pData->mnFlags = nFlags; - - if ( nFlags & PUSH_LINECOLOR ) - { - if ( mbLineColor ) - pData->mpLineColor = new Color( maLineColor ); - else - pData->mpLineColor = NULL; - } - if ( nFlags & PUSH_FILLCOLOR ) - { - if ( mbFillColor ) - pData->mpFillColor = new Color( maFillColor ); - else - pData->mpFillColor = NULL; - } - if ( nFlags & PUSH_FONT ) - pData->mpFont = new Font( maFont ); - if ( nFlags & PUSH_TEXTCOLOR ) - pData->mpTextColor = new Color( GetTextColor() ); - if ( nFlags & PUSH_TEXTFILLCOLOR ) - { - if ( IsTextFillColor() ) - pData->mpTextFillColor = new Color( GetTextFillColor() ); - else - pData->mpTextFillColor = NULL; - } - if ( nFlags & PUSH_TEXTLINECOLOR ) - { - if ( IsTextLineColor() ) - pData->mpTextLineColor = new Color( GetTextLineColor() ); - else - pData->mpTextLineColor = NULL; - } - if ( nFlags & PUSH_OVERLINECOLOR ) - { - if ( IsOverlineColor() ) - pData->mpOverlineColor = new Color( GetOverlineColor() ); - else - pData->mpOverlineColor = NULL; - } - if ( nFlags & PUSH_TEXTALIGN ) - pData->meTextAlign = GetTextAlign(); - if( nFlags & PUSH_TEXTLAYOUTMODE ) - pData->mnTextLayoutMode = GetLayoutMode(); - if( nFlags & PUSH_TEXTLANGUAGE ) - pData->meTextLanguage = GetDigitLanguage(); - if ( nFlags & PUSH_RASTEROP ) - pData->meRasterOp = GetRasterOp(); - if ( nFlags & PUSH_MAPMODE ) - { - pData->mpMapMode = new MapMode( maMapMode ); - pData->mbMapActive = mbMap; - } - if ( nFlags & PUSH_CLIPREGION ) - { - if ( mbClipRegion ) - pData->mpClipRegion = new Region( maRegion ); - else - pData->mpClipRegion = NULL; - } - if ( nFlags & PUSH_REFPOINT ) - { - if ( mbRefPoint ) - pData->mpRefPoint = new Point( maRefPoint ); - else - pData->mpRefPoint = NULL; - } - - if( mpAlphaVDev ) - mpAlphaVDev->Push(); -} - -void OutputDevice::Pop() -{ - - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaPopAction() ); - - GDIMetaFile* pOldMetaFile = mpMetaFile; - ImplObjStack* pData = mpObjStack; - mpMetaFile = NULL; - - if ( !pData ) - { - SAL_WARN( "vcl.gdi", "OutputDevice::Pop() without OutputDevice::Push()" ); - return; - } - - if( mpAlphaVDev ) - mpAlphaVDev->Pop(); - - mpObjStack = pData->mpPrev; - - if ( pData->mnFlags & PUSH_LINECOLOR ) - { - if ( pData->mpLineColor ) - SetLineColor( *pData->mpLineColor ); - else - SetLineColor(); - } - if ( pData->mnFlags & PUSH_FILLCOLOR ) - { - if ( pData->mpFillColor ) - SetFillColor( *pData->mpFillColor ); - else - SetFillColor(); - } - if ( pData->mnFlags & PUSH_FONT ) - SetFont( *pData->mpFont ); - if ( pData->mnFlags & PUSH_TEXTCOLOR ) - SetTextColor( *pData->mpTextColor ); - if ( pData->mnFlags & PUSH_TEXTFILLCOLOR ) - { - if ( pData->mpTextFillColor ) - SetTextFillColor( *pData->mpTextFillColor ); - else - SetTextFillColor(); - } - if ( pData->mnFlags & PUSH_TEXTLINECOLOR ) - { - if ( pData->mpTextLineColor ) - SetTextLineColor( *pData->mpTextLineColor ); - else - SetTextLineColor(); - } - if ( pData->mnFlags & PUSH_OVERLINECOLOR ) - { - if ( pData->mpOverlineColor ) - SetOverlineColor( *pData->mpOverlineColor ); - else - SetOverlineColor(); - } - if ( pData->mnFlags & PUSH_TEXTALIGN ) - SetTextAlign( pData->meTextAlign ); - if( pData->mnFlags & PUSH_TEXTLAYOUTMODE ) - SetLayoutMode( pData->mnTextLayoutMode ); - if( pData->mnFlags & PUSH_TEXTLANGUAGE ) - SetDigitLanguage( pData->meTextLanguage ); - if ( pData->mnFlags & PUSH_RASTEROP ) - SetRasterOp( pData->meRasterOp ); - if ( pData->mnFlags & PUSH_MAPMODE ) - { - if ( pData->mpMapMode ) - SetMapMode( *pData->mpMapMode ); - else - SetMapMode(); - mbMap = pData->mbMapActive; - } - if ( pData->mnFlags & PUSH_CLIPREGION ) - SetDeviceClipRegion( pData->mpClipRegion ); - if ( pData->mnFlags & PUSH_REFPOINT ) - { - if ( pData->mpRefPoint ) - SetRefPoint( *pData->mpRefPoint ); - else - SetRefPoint(); - } - - ImplDeleteObjStack( pData ); - - mpMetaFile = pOldMetaFile; + return mpOutDevStateStack->size(); } void OutputDevice::SetConnectMetaFile( GDIMetaFile* pMtf ) diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx new file mode 100644 index 000000000000..da4b0042adfd --- /dev/null +++ b/vcl/source/outdev/outdevstate.cxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sal/types.h> + +#include <vcl/mapmod.hxx> +#include <vcl/region.hxx> +#include <vcl/font.hxx> +#include <vcl/vclenum.hxx> + +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> + +#include <vcl/outdevstate.hxx> +#include "sallayout.hxx" + +OutDevState::~OutDevState() +{ + if ( mnFlags & PUSH_LINECOLOR ) + { + if ( mpLineColor ) + delete mpLineColor; + } + if ( mnFlags & PUSH_FILLCOLOR ) + { + if ( mpFillColor ) + delete mpFillColor; + } + if ( mnFlags & PUSH_FONT ) + delete mpFont; + if ( mnFlags & PUSH_TEXTCOLOR ) + delete mpTextColor; + if ( mnFlags & PUSH_TEXTFILLCOLOR ) + { + if ( mpTextFillColor ) + delete mpTextFillColor; + } + if ( mnFlags & PUSH_TEXTLINECOLOR ) + { + if ( mpTextLineColor ) + delete mpTextLineColor; + } + if ( mnFlags & PUSH_OVERLINECOLOR ) + { + if ( mpOverlineColor ) + delete mpOverlineColor; + } + if ( mnFlags & PUSH_MAPMODE ) + { + if ( mpMapMode ) + delete mpMapMode; + } + if ( mnFlags & PUSH_CLIPREGION ) + { + if ( mpClipRegion ) + delete mpClipRegion; + } + if ( mnFlags & PUSH_REFPOINT ) + { + if ( mpRefPoint ) + delete mpRefPoint; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |