diff options
author | Noel Grandin <noel@peralex.com> | 2016-09-07 11:46:23 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-09-07 11:46:23 +0200 |
commit | 21cbf3a33dbf06c119cc3c1f377b953fd97af94b (patch) | |
tree | fdcb998be5e077c7a20c5470d741bc4ddd7d9b8b | |
parent | 93136caef5a34d2d4017376fa7192d332765431b (diff) |
convert HTML_CNTXT constants to typed_flags
Change-Id: I94197bd40e4eca751452494d41abba05f69c8b8c
-rw-r--r-- | sw/source/filter/html/htmlctxt.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/html/htmlsect.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.hxx | 26 |
3 files changed, 31 insertions, 25 deletions
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 780cd6ce893d..feb49388cf3d 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -224,14 +224,14 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) } void SwHTMLParser::SaveDocContext( HTMLAttrContext *pCntxt, - sal_uInt16 nFlags, + HtmlContextFlags nFlags, const SwPosition *pNewPos ) { HTMLAttrContext_SaveDoc *pSave = pCntxt->GetSaveDocContext( true ); - pSave->SetStripTrailingPara( (HTML_CNTXT_STRIP_PARA & nFlags) != 0 ); - pSave->SetKeepNumRules( (HTML_CNTXT_KEEP_NUMRULE & nFlags) != 0 ); - pSave->SetFixHeaderDist( (HTML_CNTXT_HEADER_DIST & nFlags) != 0 ); - pSave->SetFixFooterDist( (HTML_CNTXT_FOOTER_DIST & nFlags) != 0 ); + pSave->SetStripTrailingPara( bool(HtmlContextFlags::StripPara & nFlags) ); + pSave->SetKeepNumRules( bool(HtmlContextFlags::KeepNumrule & nFlags) ); + pSave->SetFixHeaderDist( bool(HtmlContextFlags::HeaderDist & nFlags) ); + pSave->SetFixFooterDist( bool(HtmlContextFlags::FooterDist & nFlags) ); if( pNewPos ) { @@ -246,7 +246,7 @@ void SwHTMLParser::SaveDocContext( HTMLAttrContext *pCntxt, GetNumInfo().Clear(); } - if( (HTML_CNTXT_KEEP_ATTRS & nFlags) != 0 ) + if( HtmlContextFlags::KeepAttrs & nFlags ) { // Attribute an aktueller Position beenden und an neuer neu anfangen SplitAttrTab( *pNewPos ); @@ -263,12 +263,12 @@ void SwHTMLParser::SaveDocContext( HTMLAttrContext *pCntxt, // Mit dem Setzen von nContextStMin koennen automatisch auch // keine gerade offenen Listen (DL/OL/UL) mehr beendet werden. - if( (HTML_CNTXT_PROTECT_STACK & nFlags) != 0 ) + if( HtmlContextFlags::ProtectStack & nFlags ) { pSave->SetContextStMin( m_nContextStMin ); m_nContextStMin = m_aContexts.size(); - if( (HTML_CNTXT_KEEP_ATTRS & nFlags) == 0 ) + if( HtmlContextFlags::KeepAttrs & nFlags ) { pSave->SetContextStAttrMin( m_nContextStAttrMin ); m_nContextStAttrMin = m_aContexts.size(); diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 488758e86f05..423706e55781 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -52,9 +52,9 @@ #include "swcss1.hxx" #include "swhtml.hxx" -#define CONTEXT_FLAGS_MULTICOL (HTML_CNTXT_STRIP_PARA | \ - HTML_CNTXT_KEEP_NUMRULE | \ - HTML_CNTXT_KEEP_ATTRS) +#define CONTEXT_FLAGS_MULTICOL (HtmlContextFlags::StripPara | \ + HtmlContextFlags::KeepNumrule | \ + HtmlContextFlags::KeepAttrs) #define CONTEXT_FLAGS_HDRFTR (CONTEXT_FLAGS_MULTICOL) #define CONTEXT_FLAGS_FTN (CONTEXT_FLAGS_MULTICOL) @@ -149,7 +149,7 @@ void SwHTMLParser::NewDivision( int nToken ) SwFrameFormat *pHdFtFormat; bool bNew = false; - sal_uInt16 nFlags = CONTEXT_FLAGS_HDRFTR; + HtmlContextFlags nFlags = CONTEXT_FLAGS_HDRFTR; if( bHeader ) { pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat()); @@ -160,7 +160,7 @@ void SwHTMLParser::NewDivision( int nToken ) pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat()); bNew = true; } - nFlags |= HTML_CNTXT_HEADER_DIST; + nFlags |= HtmlContextFlags::HeaderDist; } else { @@ -172,7 +172,7 @@ void SwHTMLParser::NewDivision( int nToken ) pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetFooter().GetFooterFormat()); bNew = true; } - nFlags |= HTML_CNTXT_FOOTER_DIST; + nFlags |= HtmlContextFlags::FooterDist; } const SwFormatContent& rFlyContent = pHdFtFormat->GetContent(); @@ -765,7 +765,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, HTMLAttrContext *pCntxt, const OUString& rName, - sal_uInt16 nFlags ) + HtmlContextFlags nFlags ) { RndStdIds eAnchorId = static_cast<const SwFormatAnchor&>(rItemSet.Get( RES_ANCHOR )).GetAnchorId(); diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 0448c8072955..9d7704bbc21b 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -333,16 +333,22 @@ class SwHTMLNumRuleInfo; typedef std::vector<std::unique_ptr<ImageMap>> ImageMaps; -#define HTML_CNTXT_PROTECT_STACK 0x0001 -#define HTML_CNTXT_STRIP_PARA 0x0002 -#define HTML_CNTXT_KEEP_NUMRULE 0x0004 -#define HTML_CNTXT_HEADER_DIST 0x0008 -#define HTML_CNTXT_FOOTER_DIST 0x0010 -#define HTML_CNTXT_KEEP_ATTRS 0x0020 +enum class HtmlContextFlags { + ProtectStack = 0x0001, + StripPara = 0x0002, + KeepNumrule = 0x0004, + HeaderDist = 0x0008, + FooterDist = 0x0010, + KeepAttrs = 0x0020, +}; +namespace o3tl +{ + template<> struct typed_flags<HtmlContextFlags> : is_typed_flags<HtmlContextFlags, 0x03f> {}; +} #define CONTEXT_FLAGS_ABSPOS \ - (HTML_CNTXT_PROTECT_STACK | \ - HTML_CNTXT_STRIP_PARA) + (HtmlContextFlags::ProtectStack | \ + HtmlContextFlags::StripPara) enum class HtmlFrameFormatFlags { Box = 0x0001, @@ -590,9 +596,9 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient // Fly-Frames einfuegen/verlassen void InsertFlyFrame( const SfxItemSet& rItemSet, HTMLAttrContext *pCntxt, - const OUString& rId, sal_uInt16 nFlags ); + const OUString& rId, HtmlContextFlags nFlags ); - void SaveDocContext( HTMLAttrContext *pCntxt, sal_uInt16 nFlags, + void SaveDocContext( HTMLAttrContext *pCntxt, HtmlContextFlags nFlags, const SwPosition *pNewPos ); void RestoreDocContext( HTMLAttrContext *pCntxt ); |