[Libreoffice-commits] core.git: sw/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Wed Sep 21 12:39:23 UTC 2016


 sw/source/filter/html/htmlctxt.cxx |    3 +--
 sw/source/filter/html/htmlsect.cxx |   15 +++++----------
 sw/source/filter/html/swhtml.hxx   |    7 ++-----
 3 files changed, 8 insertions(+), 17 deletions(-)

New commits:
commit 5057c70ed8fea6f68c1bb28cfc35243d46cf712b
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Sep 21 12:33:05 2016 +0200

    remove #defines for HtmlContextFlags masks
    
    InsertFlyFrame was always called with CONTEXT_FLAGS_ABSPOS mask.
    Put the value of CONTEXT_FLAGS_ABSPOS in the function and remove
    parameter.
    CONTEXT_FLAGS_MULTICOL is used for headers/footers and footnote
    contexts. Put the mask in the enum class.
    
    Change-Id: I9b1bcd27270ee7fc0eddfaf10afa430a36b2adc9
    Reviewed-on: https://gerrit.libreoffice.org/29138
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
    Tested-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index bca76fb..dee8fc7 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -443,8 +443,7 @@ bool SwHTMLParser::DoPositioning( SfxItemSet &rItemSet,
                         HtmlFrameFormatFlags::Box|HtmlFrameFormatFlags::Padding|HtmlFrameFormatFlags::Background|HtmlFrameFormatFlags::Direction,
                         aFrameItemSet );
 
-        InsertFlyFrame( aFrameItemSet, pContext, rPropInfo.aId,
-                        CONTEXT_FLAGS_ABSPOS );
+        InsertFlyFrame(aFrameItemSet, pContext, rPropInfo.aId);
         pContext->SetPopStack( true );
         rPropInfo.aId.clear();
         bRet = true;
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 423706e..7b8d2c8 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -52,11 +52,6 @@
 #include "swcss1.hxx"
 #include "swhtml.hxx"
 
-#define CONTEXT_FLAGS_MULTICOL (HtmlContextFlags::StripPara |  \
-                                HtmlContextFlags::KeepNumrule | \
-                                HtmlContextFlags::KeepAttrs)
-#define CONTEXT_FLAGS_HDRFTR (CONTEXT_FLAGS_MULTICOL)
-#define CONTEXT_FLAGS_FTN (CONTEXT_FLAGS_MULTICOL)
 
 using namespace ::com::sun::star;
 
@@ -149,7 +144,7 @@ void SwHTMLParser::NewDivision( int nToken )
 
         SwFrameFormat *pHdFtFormat;
         bool bNew = false;
-        HtmlContextFlags nFlags = CONTEXT_FLAGS_HDRFTR;
+        HtmlContextFlags nFlags = HtmlContextFlags::MultiColMask;
         if( bHeader )
         {
             pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat());
@@ -233,7 +228,7 @@ void SwHTMLParser::NewDivision( int nToken )
                     m_pDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode();
                 SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd);
                 SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) );
-                SaveDocContext( pCntxt, CONTEXT_FLAGS_FTN, &aNewPos );
+                SaveDocContext( pCntxt, HtmlContextFlags::MultiColMask, &aNewPos );
                 aId.clear();
                 aPropInfo.aId.clear();
             }
@@ -648,7 +643,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
             aPropInfo.aId.clear();
         }
 
-        InsertFlyFrame( aFrameItemSet, pCntxt, aFlyName, CONTEXT_FLAGS_ABSPOS );
+        InsertFlyFrame(aFrameItemSet, pCntxt, aFlyName);
 
         pCntxt->SetPopStack( true );
         bPositioned = true;
@@ -764,8 +759,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
 
 void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet,
                                    HTMLAttrContext *pCntxt,
-                                   const OUString& rName,
-                                   HtmlContextFlags nFlags )
+                                   const OUString& rName )
 {
     RndStdIds eAnchorId =
         static_cast<const SwFormatAnchor&>(rItemSet.Get( RES_ANCHOR )).GetAnchorId();
@@ -785,6 +779,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet,
                             ->GetContentNode();
 
     SwPosition aNewPos( SwNodeIndex( rFlyCntIdx, 1 ), SwIndex( pCNd, 0 ) );
+    const HtmlContextFlags nFlags = (HtmlContextFlags::ProtectStack|HtmlContextFlags::StripPara);
     SaveDocContext( pCntxt, nFlags, &aNewPos );
 }
 
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 204f515..e861d2f 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -340,16 +340,13 @@ enum class HtmlContextFlags {
     HeaderDist      = 0x0008,
     FooterDist      = 0x0010,
     KeepAttrs       = 0x0020,
+    MultiColMask    = StripPara | KeepNumrule | KeepAttrs // for headers, footers or footnotes
 };
 namespace o3tl
 {
     template<> struct typed_flags<HtmlContextFlags> : is_typed_flags<HtmlContextFlags, 0x03f> {};
 }
 
-#define CONTEXT_FLAGS_ABSPOS    \
-    (HtmlContextFlags::ProtectStack | \
-     HtmlContextFlags::StripPara)
-
 enum class HtmlFrameFormatFlags {
     Box                 = 0x0001,
     Background          = 0x0002,
@@ -595,7 +592,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 
     // Fly-Frames einfuegen/verlassen
     void InsertFlyFrame( const SfxItemSet& rItemSet, HTMLAttrContext *pCntxt,
-                         const OUString& rId, HtmlContextFlags nFlags );
+                         const OUString& rId );
 
     void SaveDocContext( HTMLAttrContext *pCntxt, HtmlContextFlags nFlags,
                        const SwPosition *pNewPos );


More information about the Libreoffice-commits mailing list