Kaydet (Commit) 5057c70e authored tarafından Jochen Nitschke's avatar Jochen Nitschke

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/29138Reviewed-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
Tested-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
üst adfb650b
...@@ -443,8 +443,7 @@ bool SwHTMLParser::DoPositioning( SfxItemSet &rItemSet, ...@@ -443,8 +443,7 @@ bool SwHTMLParser::DoPositioning( SfxItemSet &rItemSet,
HtmlFrameFormatFlags::Box|HtmlFrameFormatFlags::Padding|HtmlFrameFormatFlags::Background|HtmlFrameFormatFlags::Direction, HtmlFrameFormatFlags::Box|HtmlFrameFormatFlags::Padding|HtmlFrameFormatFlags::Background|HtmlFrameFormatFlags::Direction,
aFrameItemSet ); aFrameItemSet );
InsertFlyFrame( aFrameItemSet, pContext, rPropInfo.aId, InsertFlyFrame(aFrameItemSet, pContext, rPropInfo.aId);
CONTEXT_FLAGS_ABSPOS );
pContext->SetPopStack( true ); pContext->SetPopStack( true );
rPropInfo.aId.clear(); rPropInfo.aId.clear();
bRet = true; bRet = true;
......
...@@ -52,11 +52,6 @@ ...@@ -52,11 +52,6 @@
#include "swcss1.hxx" #include "swcss1.hxx"
#include "swhtml.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; using namespace ::com::sun::star;
...@@ -149,7 +144,7 @@ void SwHTMLParser::NewDivision( int nToken ) ...@@ -149,7 +144,7 @@ void SwHTMLParser::NewDivision( int nToken )
SwFrameFormat *pHdFtFormat; SwFrameFormat *pHdFtFormat;
bool bNew = false; bool bNew = false;
HtmlContextFlags nFlags = CONTEXT_FLAGS_HDRFTR; HtmlContextFlags nFlags = HtmlContextFlags::MultiColMask;
if( bHeader ) if( bHeader )
{ {
pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat()); pHdFtFormat = const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat());
...@@ -233,7 +228,7 @@ void SwHTMLParser::NewDivision( int nToken ) ...@@ -233,7 +228,7 @@ void SwHTMLParser::NewDivision( int nToken )
m_pDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode(); m_pDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode();
SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd); SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd);
SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) ); SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) );
SaveDocContext( pCntxt, CONTEXT_FLAGS_FTN, &aNewPos ); SaveDocContext( pCntxt, HtmlContextFlags::MultiColMask, &aNewPos );
aId.clear(); aId.clear();
aPropInfo.aId.clear(); aPropInfo.aId.clear();
} }
...@@ -648,7 +643,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) ...@@ -648,7 +643,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
aPropInfo.aId.clear(); aPropInfo.aId.clear();
} }
InsertFlyFrame( aFrameItemSet, pCntxt, aFlyName, CONTEXT_FLAGS_ABSPOS ); InsertFlyFrame(aFrameItemSet, pCntxt, aFlyName);
pCntxt->SetPopStack( true ); pCntxt->SetPopStack( true );
bPositioned = true; bPositioned = true;
...@@ -764,8 +759,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) ...@@ -764,8 +759,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet,
HTMLAttrContext *pCntxt, HTMLAttrContext *pCntxt,
const OUString& rName, const OUString& rName )
HtmlContextFlags nFlags )
{ {
RndStdIds eAnchorId = RndStdIds eAnchorId =
static_cast<const SwFormatAnchor&>(rItemSet.Get( RES_ANCHOR )).GetAnchorId(); static_cast<const SwFormatAnchor&>(rItemSet.Get( RES_ANCHOR )).GetAnchorId();
...@@ -785,6 +779,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, ...@@ -785,6 +779,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet,
->GetContentNode(); ->GetContentNode();
SwPosition aNewPos( SwNodeIndex( rFlyCntIdx, 1 ), SwIndex( pCNd, 0 ) ); SwPosition aNewPos( SwNodeIndex( rFlyCntIdx, 1 ), SwIndex( pCNd, 0 ) );
const HtmlContextFlags nFlags = (HtmlContextFlags::ProtectStack|HtmlContextFlags::StripPara);
SaveDocContext( pCntxt, nFlags, &aNewPos ); SaveDocContext( pCntxt, nFlags, &aNewPos );
} }
......
...@@ -340,16 +340,13 @@ enum class HtmlContextFlags { ...@@ -340,16 +340,13 @@ enum class HtmlContextFlags {
HeaderDist = 0x0008, HeaderDist = 0x0008,
FooterDist = 0x0010, FooterDist = 0x0010,
KeepAttrs = 0x0020, KeepAttrs = 0x0020,
MultiColMask = StripPara | KeepNumrule | KeepAttrs // for headers, footers or footnotes
}; };
namespace o3tl namespace o3tl
{ {
template<> struct typed_flags<HtmlContextFlags> : is_typed_flags<HtmlContextFlags, 0x03f> {}; template<> struct typed_flags<HtmlContextFlags> : is_typed_flags<HtmlContextFlags, 0x03f> {};
} }
#define CONTEXT_FLAGS_ABSPOS \
(HtmlContextFlags::ProtectStack | \
HtmlContextFlags::StripPara)
enum class HtmlFrameFormatFlags { enum class HtmlFrameFormatFlags {
Box = 0x0001, Box = 0x0001,
Background = 0x0002, Background = 0x0002,
...@@ -595,7 +592,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient ...@@ -595,7 +592,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
// Fly-Frames einfuegen/verlassen // Fly-Frames einfuegen/verlassen
void InsertFlyFrame( const SfxItemSet& rItemSet, HTMLAttrContext *pCntxt, void InsertFlyFrame( const SfxItemSet& rItemSet, HTMLAttrContext *pCntxt,
const OUString& rId, HtmlContextFlags nFlags ); const OUString& rId );
void SaveDocContext( HTMLAttrContext *pCntxt, HtmlContextFlags nFlags, void SaveDocContext( HTMLAttrContext *pCntxt, HtmlContextFlags nFlags,
const SwPosition *pNewPos ); const SwPosition *pNewPos );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment