diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-21 07:31:11 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-21 09:17:32 +0200 |
commit | a69f8ea61ce274a5839f1904d1eba9ea91ce6676 (patch) | |
tree | eb7693e3cca148c3013220bcbc4c3b322b0f8123 /vcl/source/gdi | |
parent | 46bf3068de40192e0b69ef5f6ab3b2f43c71ef71 (diff) |
vcl: convert push flags to type-safe enum-like class
Change-Id: Ib49a0dd5ecee0225f51bea2ff1c0ab5326595a47
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/gdimetafiletools.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 6 |
6 files changed, 22 insertions, 20 deletions
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx index 04d52cb036c8..a0afe289a93f 100644 --- a/vcl/source/gdi/gdimetafiletools.cxx +++ b/vcl/source/gdi/gdimetafiletools.cxx @@ -270,7 +270,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) GDIMetaFile aTarget; bool bChanged(false); std::vector< basegfx::B2DPolyPolygon > aClips; - std::vector< sal_uInt16 > aPushFlags; + std::vector< PushFlags > aPushFlags; std::vector< MapMode > aMapModes; // start with empty region @@ -367,7 +367,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) case META_PUSH_ACTION : { const MetaPushAction* pA = static_cast< const MetaPushAction* >(pAction); - const sal_uInt16 nFlags(pA->GetFlags()); + const PushFlags nFlags(pA->GetFlags()); aPushFlags.push_back(nFlags); @@ -388,7 +388,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) if(aPushFlags.size()) { - const sal_uInt16 nFlags(aPushFlags.back()); + const PushFlags nFlags(aPushFlags.back()); aPushFlags.pop_back(); if(nFlags & PUSH_CLIPREGION) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 5217f2561ee8..480e0ab68d94 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1402,7 +1402,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai aMapVDev.SetMapMode( GetPrefMapMode() ); std::vector<Rectangle> aClipStack( 1, Rectangle() ); - std::vector<sal_uInt16> aPushFlagStack; + std::vector<PushFlags> aPushFlagStack; Rectangle aBound; @@ -1789,7 +1789,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaPushAction* pAct = (MetaPushAction*) pAction; aPushFlagStack.push_back( pAct->GetFlags() ); - if( (aPushFlagStack.back() & PUSH_CLIPREGION) != 0 ) + if( aPushFlagStack.back() & PUSH_CLIPREGION ) { Rectangle aRect( aClipStack.back() ); aClipStack.push_back( aRect ); @@ -1800,7 +1800,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai // sanity check if( ! aPushFlagStack.empty() ) { - if( (aPushFlagStack.back() & PUSH_CLIPREGION) != 0 ) + if( aPushFlagStack.back() & PUSH_CLIPREGION ) { if( aClipStack.size() > 1 ) aClipStack.pop_back(); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index cad74be4c1d3..93dbfa6aace7 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -3106,13 +3106,13 @@ void MetaFontAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) MetaPushAction::MetaPushAction() : MetaAction ( META_PUSH_ACTION ), - mnFlags ( 0 ) + mnFlags ( PUSH_NONE ) {} MetaPushAction::~MetaPushAction() {} -MetaPushAction::MetaPushAction( sal_uInt16 nFlags ) : +MetaPushAction::MetaPushAction( PushFlags nFlags ) : MetaAction ( META_PUSH_ACTION ), mnFlags ( nFlags ) {} @@ -3144,7 +3144,9 @@ void MetaPushAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaPushAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompat aCompat(rIStm, STREAM_READ); - rIStm.ReadUInt16( mnFlags ); + sal_uInt16 tmp; + rIStm.ReadUInt16( tmp ); + mnFlags = static_cast<PushFlags>(tmp); } MetaPopAction::MetaPopAction() : diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 8acf85f6e0f1..81e29a9a1c35 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -224,7 +224,7 @@ void PDFWriter::EndTransparencyGroup( const Rectangle& rRect, sal_uInt16 nTransp pImplementation->endTransparencyGroup( rRect, nTransparentPercent ); } -void PDFWriter::Push( sal_uInt16 nFlags ) +void PDFWriter::Push( PushFlags nFlags ) { pImplementation->push( nFlags ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 8b18321d7665..e9a14792ec0b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4681,7 +4681,7 @@ void PDFWriterImpl::createDefaultPushButtonAppearance( PDFWidget& rButton, const const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); // save graphics state - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL ); // transform relative to control's coordinates since an // appearance stream is a form XObject @@ -4788,7 +4788,7 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); SvMemoryStream* pEditStream = new SvMemoryStream( 1024, 1024 ); - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL ); // prepare font to use, draw field border Font aFont = drawFieldBorder( rEdit, rWidget, rSettings ); @@ -4840,7 +4840,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); SvMemoryStream* pListBoxStream = new SvMemoryStream( 1024, 1024 ); - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL ); // prepare font to use, draw field border Font aFont = drawFieldBorder( rBox, rWidget, rSettings ); @@ -4891,7 +4891,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const PDFW const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); // save graphics state - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL ); if( rWidget.Background || rWidget.Border ) { @@ -5016,7 +5016,7 @@ void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const P const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); // save graphics state - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL ); if( rWidget.Background || rWidget.Border ) { @@ -5104,7 +5104,7 @@ void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const P rBox.m_aRect = aCheckRect; // create appearance streams - push( sal::static_int_cast<sal_uInt16>(~0U) ); + push( PUSH_ALL); SvMemoryStream* pCheckStream = new SvMemoryStream( 256, 256 ); beginRedirect( pCheckStream, aCheckRect ); @@ -10604,7 +10604,7 @@ void PDFWriterImpl::setFont( const Font& rFont ) m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont; } -void PDFWriterImpl::push( sal_uInt16 nFlags ) +void PDFWriterImpl::push( PushFlags nFlags ) { OSL_ENSURE( !m_aGraphicsStack.empty(), "invalid graphics stack" ); m_aGraphicsStack.push_front( m_aGraphicsStack.front() ); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index ed4013befcd8..201528131b1c 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -713,7 +713,7 @@ private: ComplexTextLayoutMode m_nLayoutMode; LanguageType m_aDigitLanguage; sal_Int32 m_nTransparentPercent; - sal_uInt16 m_nFlags; + PushFlags m_nFlags; sal_uInt16 m_nUpdateFlags; static const sal_uInt16 updateFont = 0x0001; @@ -738,7 +738,7 @@ private: m_nLayoutMode( TEXT_LAYOUT_DEFAULT ), m_aDigitLanguage( 0 ), m_nTransparentPercent( 0 ), - m_nFlags( 0xffff ), + m_nFlags( PUSH_ALL ), m_nUpdateFlags( 0xffff ) {} GraphicsState( const GraphicsState& rState ) : @@ -1104,7 +1104,7 @@ public: { m_aContext.DocumentLocale = rLoc; } /* graphics state */ - void push( sal_uInt16 nFlags ); + void push( PushFlags nFlags ); void pop(); void setFont( const Font& rFont ); |