sw/inc/unotxdoc.hxx | 6 sw/source/core/layout/paintfrm.cxx | 69 ++- sw/source/filter/html/css1atr.cxx | 34 - sw/source/filter/html/htmlatr.cxx | 14 sw/source/filter/html/htmlcss1.cxx | 54 +-- sw/source/filter/html/htmldrawwriter.cxx | 14 sw/source/filter/html/htmlfly.cxx | 6 sw/source/filter/html/htmlfly.hxx | 105 +++--- sw/source/filter/html/htmlflyt.cxx | 538 +++++++++++++++---------------- sw/source/filter/html/htmlflywriter.cxx | 277 ++++++++------- sw/source/filter/html/htmlforw.cxx | 32 - sw/source/filter/html/htmlplug.cxx | 82 ++-- sw/source/filter/html/svxcss1.cxx | 2 sw/source/filter/html/svxcss1.hxx | 24 - sw/source/filter/html/swcss1.hxx | 4 sw/source/filter/html/wrthtml.hxx | 98 ++--- sw/source/uibase/inc/conttree.hxx | 19 + sw/source/uibase/uno/unotxdoc.cxx | 38 -- sw/source/uibase/utlui/glbltree.cxx | 62 +-- 19 files changed, 751 insertions(+), 727 deletions(-)
New commits: commit b19e71231322a6790759135f3aaab6499d6293dd Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 12:02:14 2016 +0200 convert ENABLE flags to o3tl::typed_flags Change-Id: I47cb052c7437e127c237beee0f2d95948b7c3ad1 diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 98aedef..86068a1 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -28,6 +28,7 @@ #include <memory> #include <o3tl/enumarray.hxx> +#include <o3tl/typed_flags_set.hxx> class SwWrtShell; class SwContentType; @@ -50,6 +51,22 @@ enum class EditEntryMode RENAME = 5, }; +// Flags for PopupMenu-enable/disable +enum class MenuEnableFlags { + NONE = 0x0000, + InsertIdx = 0x0001, + InsertFile = 0x0002, + InsertText = 0x0004, + Edit = 0x0008, + Delete = 0x0010, + Update = 0x0020, + UpdateSel = 0x0040, + EditLink = 0x0080 +}; +namespace o3tl { + template<> struct typed_flags<MenuEnableFlags> : is_typed_flags<MenuEnableFlags, 0x00ff> {}; +} + /** TreeListBox for content indicator */ class SwContentTree : public SvTreeListBox @@ -318,7 +335,7 @@ protected: void OpenDoc(const SwGlblDocContent*); void GotoContent(const SwGlblDocContent*); - sal_uInt16 GetEnableFlags() const; + MenuEnableFlags GetEnableFlags() const; static void SetShowShell(const SfxObjectShell*pSet) {pShowShell = pSet;} DECL_STATIC_LINK(SwGlobalTree, ShowFrameHdl, void*, void); diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 06f44ef..649517d 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -81,16 +81,6 @@ using namespace ::com::sun::star::uno; #define GLOBAL_UPDATE_TIMEOUT 2000 -// Flags for PopupMenu-enable/disable -#define ENABLE_INSERT_IDX 0x0001 -#define ENABLE_INSERT_FILE 0x0002 -#define ENABLE_INSERT_TEXT 0x0004 -#define ENABLE_EDIT 0x0008 -#define ENABLE_DELETE 0x0010 -#define ENABLE_UPDATE 0x0020 -#define ENABLE_UPDATE_SEL 0x0040 -#define ENABLE_EDIT_LINK 0x0080 - // TabPos: push to left #define GLBL_TABPOS_SUB 5 @@ -338,7 +328,7 @@ VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu() if(pActiveShell && !pActiveShell->GetView().GetDocShell()->IsReadOnly()) { - const sal_uInt16 nEnableFlags = GetEnableFlags(); + const MenuEnableFlags nEnableFlags = GetEnableFlags(); pPop = VclPtr<PopupMenu>::Create(); VclPtrInstance<PopupMenu> pSubPop1; VclPtrInstance<PopupMenu> pSubPop2; @@ -348,7 +338,7 @@ VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu() pSubPop2->InsertItem( i, aContextStrings[STR_UPDATE_SEL - STR_GLOBAL_CONTEXT_FIRST - CTX_UPDATE_SEL+ i] ); pSubPop2->SetHelpId(i, aHelpForMenu[i]); } - pSubPop2->EnableItem(CTX_UPDATE_SEL, 0 != (nEnableFlags & ENABLE_UPDATE_SEL)); + pSubPop2->EnableItem(CTX_UPDATE_SEL, bool(nEnableFlags & MenuEnableFlags::UpdateSel)); pSubPop1->InsertItem(CTX_INSERT_ANY_INDEX, aContextStrings[STR_INDEX - STR_GLOBAL_CONTEXT_FIRST]); pSubPop1->SetHelpId(CTX_INSERT_ANY_INDEX, aHelpForMenu[CTX_INSERT_ANY_INDEX]); @@ -363,7 +353,7 @@ VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu() pPop->SetHelpId(CTX_UPDATE, aHelpForMenu[CTX_UPDATE]); pPop->InsertItem(CTX_EDIT, aContextStrings[STR_EDIT_CONTENT - STR_GLOBAL_CONTEXT_FIRST]); pPop->SetHelpId(CTX_EDIT, aHelpForMenu[CTX_EDIT]); - if(nEnableFlags&ENABLE_EDIT_LINK) + if(nEnableFlags&MenuEnableFlags::EditLink) { pPop->InsertItem(CTX_EDIT_LINK, aContextStrings[STR_EDIT_LINK - STR_GLOBAL_CONTEXT_FIRST]); pPop->SetHelpId(CTX_EDIT_LINK, aHelpForMenu[CTX_EDIT_LINK]); @@ -375,15 +365,15 @@ VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu() pPop->SetHelpId(CTX_DELETE, aHelpForMenu[CTX_DELETE]); //disabling if applicable - pSubPop1->EnableItem(CTX_INSERT_ANY_INDEX, 0 != (nEnableFlags & ENABLE_INSERT_IDX )); - pSubPop1->EnableItem(CTX_INSERT_TEXT, 0 != (nEnableFlags & ENABLE_INSERT_TEXT)); - pSubPop1->EnableItem(CTX_INSERT_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE)); - pSubPop1->EnableItem(CTX_INSERT_NEW_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE)); + pSubPop1->EnableItem(CTX_INSERT_ANY_INDEX, bool(nEnableFlags & MenuEnableFlags::InsertIdx )); + pSubPop1->EnableItem(CTX_INSERT_TEXT, bool(nEnableFlags & MenuEnableFlags::InsertText)); + pSubPop1->EnableItem(CTX_INSERT_FILE, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + pSubPop1->EnableItem(CTX_INSERT_NEW_FILE, bool(nEnableFlags & MenuEnableFlags::InsertFile)); - pPop->EnableItem(CTX_UPDATE, 0 != (nEnableFlags & ENABLE_UPDATE)); - pPop->EnableItem(CTX_INSERT, 0 != (nEnableFlags & ENABLE_INSERT_IDX)); - pPop->EnableItem(CTX_EDIT, 0 != (nEnableFlags & ENABLE_EDIT)); - pPop->EnableItem(CTX_DELETE, 0 != (nEnableFlags & ENABLE_DELETE)); + pPop->EnableItem(CTX_UPDATE, bool(nEnableFlags & MenuEnableFlags::Update)); + pPop->EnableItem(CTX_INSERT, bool(nEnableFlags & MenuEnableFlags::InsertIdx)); + pPop->EnableItem(CTX_EDIT, bool(nEnableFlags & MenuEnableFlags::Edit)); + pPop->EnableItem(CTX_DELETE, bool(nEnableFlags & MenuEnableFlags::Delete)); pPop->SetPopupMenu( CTX_INSERT, pSubPop1 ); pPop->SetPopupMenu( CTX_UPDATE, pSubPop2 ); @@ -393,7 +383,7 @@ VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu() void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox) { - const sal_uInt16 nEnableFlags = GetEnableFlags(); + const MenuEnableFlags nEnableFlags = GetEnableFlags(); const OUString sCommand(pBox->GetItemCommand(nTbxId)); if (sCommand == "insert") { @@ -403,10 +393,10 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox) pMenu->InsertItem( i, aContextStrings[STR_INDEX - STR_GLOBAL_CONTEXT_FIRST - CTX_INSERT_ANY_INDEX + i] ); pMenu->SetHelpId(i, aHelpForMenu[i] ); } - pMenu->EnableItem(CTX_INSERT_ANY_INDEX, 0 != (nEnableFlags & ENABLE_INSERT_IDX )); - pMenu->EnableItem(CTX_INSERT_TEXT, 0 != (nEnableFlags & ENABLE_INSERT_TEXT)); - pMenu->EnableItem(CTX_INSERT_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE)); - pMenu->EnableItem(CTX_INSERT_NEW_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE)); + pMenu->EnableItem(CTX_INSERT_ANY_INDEX, bool(nEnableFlags & MenuEnableFlags::InsertIdx )); + pMenu->EnableItem(CTX_INSERT_TEXT, bool(nEnableFlags & MenuEnableFlags::InsertText)); + pMenu->EnableItem(CTX_INSERT_FILE, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + pMenu->EnableItem(CTX_INSERT_NEW_FILE, bool(nEnableFlags & MenuEnableFlags::InsertFile)); pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl)); pMenu->Execute(pBox, pBox->GetItemRect(nTbxId)); pMenu.disposeAndClear(); @@ -421,7 +411,7 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox) pMenu->InsertItem( i, aContextStrings[STR_UPDATE_SEL - STR_GLOBAL_CONTEXT_FIRST - CTX_UPDATE_SEL+ i] ); pMenu->SetHelpId(i, aHelpForMenu[i] ); } - pMenu->EnableItem(CTX_UPDATE_SEL, 0 != (nEnableFlags & ENABLE_UPDATE_SEL)); + pMenu->EnableItem(CTX_UPDATE_SEL, bool(nEnableFlags & MenuEnableFlags::UpdateSel)); pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl)); pMenu->Execute(pBox, pBox->GetItemRect(nTbxId)); pMenu.disposeAndClear(); @@ -430,33 +420,33 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox) } } -sal_uInt16 SwGlobalTree::GetEnableFlags() const +MenuEnableFlags SwGlobalTree::GetEnableFlags() const { SvTreeListEntry* pEntry = FirstSelected(); sal_uLong nSelCount = GetSelectionCount(); sal_uLong nEntryCount = GetEntryCount(); SvTreeListEntry* pPrevEntry = pEntry ? Prev(pEntry) : nullptr; - sal_uInt16 nRet = 0; + MenuEnableFlags nRet = MenuEnableFlags::NONE; if(nSelCount == 1 || !nEntryCount) - nRet |= ENABLE_INSERT_IDX|ENABLE_INSERT_FILE; + nRet |= MenuEnableFlags::InsertIdx|MenuEnableFlags::InsertFile; if(nSelCount == 1) { - nRet |= ENABLE_EDIT; + nRet |= MenuEnableFlags::Edit; if (pEntry && static_cast<SwGlblDocContent*>(pEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN && (!pPrevEntry || static_cast<SwGlblDocContent*>(pPrevEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN)) - nRet |= ENABLE_INSERT_TEXT; + nRet |= MenuEnableFlags::InsertText; if (pEntry && GLBLDOC_SECTION == static_cast<SwGlblDocContent*>(pEntry->GetUserData())->GetType()) - nRet |= ENABLE_EDIT_LINK; + nRet |= MenuEnableFlags::EditLink; } else if(!nEntryCount) { - nRet |= ENABLE_INSERT_TEXT; + nRet |= MenuEnableFlags::InsertText; } if(nEntryCount) - nRet |= ENABLE_UPDATE|ENABLE_DELETE; + nRet |= MenuEnableFlags::Update|MenuEnableFlags::Delete; if(nSelCount) - nRet |= ENABLE_UPDATE_SEL; + nRet |= MenuEnableFlags::UpdateSel; return nRet; } commit 8cd2334da9e8e19ef7e22081e722563612a1f32d Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 11:54:02 2016 +0200 convert SW_CREATE to scoped enum Change-Id: I003785715df7e72cbf398902aabb5c3fe900a2d7 diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 47e29ad..36ef233 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -577,6 +577,10 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override; }; +enum class SwCreateDrawTable { + Dash = 1, Gradient, Hatch, Bitmap, TransGradient, Marker, Defaults +}; + class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable { css::uno::Reference < css::uno::XInterface > xDashTable; @@ -591,7 +595,7 @@ class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable public: SwXDocumentPropertyHelper(SwDoc& rDoc); virtual ~SwXDocumentPropertyHelper() override; - css::uno::Reference<css::uno::XInterface> GetDrawTable(short nWhich); + css::uno::Reference<css::uno::XInterface> GetDrawTable(SwCreateDrawTable nWhich); void Invalidate(); virtual void onChange() override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 8ea5fdf..3aa6ec2 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -167,14 +167,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::document; using ::osl::FileBase; -#define SW_CREATE_DASH_TABLE 0x01 -#define SW_CREATE_GRADIENT_TABLE 0x02 -#define SW_CREATE_HATCH_TABLE 0x03 -#define SW_CREATE_BITMAP_TABLE 0x04 -#define SW_CREATE_TRANSGRADIENT_TABLE 0x05 -#define SW_CREATE_MARKER_TABLE 0x06 -#define SW_CREATE_DRAW_DEFAULTS 0x07 - static SwPrintUIOptions * lcl_GetPrintUIOptions( SwDocShell * pDocShell, const SfxViewShell * pView ) @@ -1629,31 +1621,31 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create( } if (rServiceName == "com.sun.star.drawing.DashTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_DASH_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Dash); } if (rServiceName == "com.sun.star.drawing.GradientTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_GRADIENT_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Gradient); } if (rServiceName == "com.sun.star.drawing.HatchTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_HATCH_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Hatch); } if (rServiceName == "com.sun.star.drawing.BitmapTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_BITMAP_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Bitmap); } if (rServiceName == "com.sun.star.drawing.TransparencyGradientTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_TRANSGRADIENT_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::TransGradient); } if (rServiceName == "com.sun.star.drawing.MarkerTable") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_MARKER_TABLE); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Marker); } if (rServiceName == "com.sun.star.drawing.Defaults") { - return GetPropertyHelper()->GetDrawTable(SW_CREATE_DRAW_DEFAULTS); + return GetPropertyHelper()->GetDrawTable(SwCreateDrawTable::Defaults); } if (rServiceName == "com.sun.star.document.Settings") { @@ -4217,7 +4209,7 @@ SwXDocumentPropertyHelper::~SwXDocumentPropertyHelper() { } -Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich) +Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(SwCreateDrawTable nWhich) { Reference<XInterface> xRet; if(m_pDoc) @@ -4226,37 +4218,37 @@ Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich) { // #i52858# // assure that Draw model is created, if it doesn't exist. - case SW_CREATE_DASH_TABLE : + case SwCreateDrawTable::Dash : if(!xDashTable.is()) xDashTable = SvxUnoDashTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xDashTable; break; - case SW_CREATE_GRADIENT_TABLE : + case SwCreateDrawTable::Gradient : if(!xGradientTable.is()) xGradientTable = SvxUnoGradientTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xGradientTable; break; - case SW_CREATE_HATCH_TABLE : + case SwCreateDrawTable::Hatch : if(!xHatchTable.is()) xHatchTable = SvxUnoHatchTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xHatchTable; break; - case SW_CREATE_BITMAP_TABLE : + case SwCreateDrawTable::Bitmap : if(!xBitmapTable.is()) xBitmapTable = SvxUnoBitmapTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xBitmapTable; break; - case SW_CREATE_TRANSGRADIENT_TABLE: + case SwCreateDrawTable::TransGradient: if(!xTransGradientTable.is()) xTransGradientTable = SvxUnoTransGradientTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xTransGradientTable; break; - case SW_CREATE_MARKER_TABLE : + case SwCreateDrawTable::Marker : if(!xMarkerTable.is()) xMarkerTable = SvxUnoMarkerTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xMarkerTable; break; - case SW_CREATE_DRAW_DEFAULTS: + case SwCreateDrawTable::Defaults: if(!xDrawDefaults.is()) xDrawDefaults = static_cast<cppu::OWeakObject*>(new SwSvxUnoDrawPool(m_pDoc)); xRet = xDrawDefaults; commit 678041c48fe3f03fd4f12a92b6a66cff33d6382b Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 11:16:25 2016 +0200 convert HTML_FRM_OPTS to o3tl::typed_flags Change-Id: I3d8ac978ff626f792e3cff6e2b12a7680addf303 diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index b3e3711..eb0aaac 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -1969,7 +1969,7 @@ Writer& OutCSS1_NumBulListStyleOpt( Writer& rWrt, const SwNumRule& rNumRule, } void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat, - sal_uInt32 nFrameOpts, + HtmlFrmOpts nFrameOpts, const SdrObject *pSdrObj, const SfxItemSet *pItemSet ) { @@ -1980,7 +1980,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient(); SvxLRSpaceItem aLRItem( rFrameFormat.GetLRSpace() ); SvxULSpaceItem aULItem( rFrameFormat.GetULSpace() ); - if( nFrameOpts & HTML_FRMOPT_S_ALIGN ) + if( nFrameOpts & HtmlFrmOpts::SAlign ) { const SwFormatAnchor& rAnchor = rFrameFormat.GetAnchor(); switch( rAnchor.GetAnchorId() ) @@ -1990,7 +1990,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat if( text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() || text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() ) { - if( !(nFrameOpts & HTML_FRMOPT_ALIGN) ) + if( !(nFrameOpts & HtmlFrmOpts::Align) ) { // float const sal_Char *pStr = text::HoriOrientation::RIGHT==rHoriOri.GetHoriOrient() @@ -2082,7 +2082,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat } // width/height - if( nFrameOpts & HTML_FRMOPT_S_SIZE ) + if( nFrameOpts & HtmlFrmOpts::SSize ) { if( RES_DRAWFRMFMT == rFrameFormat.Which() ) { @@ -2093,17 +2093,17 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat if( pSdrObj ) { Size aTwipSz( pSdrObj->GetLogicRect().GetSize() ); - if( nFrameOpts & HTML_FRMOPT_S_WIDTH ) + if( nFrameOpts & HtmlFrmOpts::SWidth ) { - if( nFrameOpts & HTML_FRMOPT_S_PIXSIZE ) + if( nFrameOpts & HtmlFrmOpts::SPixSize ) OutCSS1_PixelProperty( sCSS1_P_width, aTwipSz.Width(), false ); else OutCSS1_UnitProperty( sCSS1_P_width, aTwipSz.Width() ); } - if( nFrameOpts & HTML_FRMOPT_S_HEIGHT ) + if( nFrameOpts & HtmlFrmOpts::SHeight ) { - if( nFrameOpts & HTML_FRMOPT_S_PIXSIZE ) + if( nFrameOpts & HtmlFrmOpts::SPixSize ) OutCSS1_PixelProperty( sCSS1_P_height, aTwipSz.Height(), true ); else @@ -2113,16 +2113,16 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat } else { - OSL_ENSURE( HTML_FRMOPT_ABSSIZE & nFrameOpts, + OSL_ENSURE( HtmlFrmOpts::AbsSize & nFrameOpts, "Export absolute size" ); - OSL_ENSURE( HTML_FRMOPT_ANYSIZE & nFrameOpts, + OSL_ENSURE( HtmlFrmOpts::AnySize & nFrameOpts, "Export every size" ); Css1FrameSize nMode = Css1FrameSize::NONE; - if( nFrameOpts & HTML_FRMOPT_S_WIDTH ) + if( nFrameOpts & HtmlFrmOpts::SWidth ) nMode |= Css1FrameSize::Width; - if( nFrameOpts & HTML_FRMOPT_S_HEIGHT ) + if( nFrameOpts & HtmlFrmOpts::SHeight ) nMode |= (Css1FrameSize::MinHeight|Css1FrameSize::FixHeight); - if( nFrameOpts & HTML_FRMOPT_S_PIXSIZE ) + if( nFrameOpts & HtmlFrmOpts::SPixSize ) nMode |= Css1FrameSize::Pixel; OutCSS1_SwFormatFrameSize( *this, rFrameFormat.GetFrameSize(), nMode ); @@ -2131,7 +2131,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet(); // margin-* - if( (nFrameOpts & HTML_FRMOPT_S_SPACE) && + if( (nFrameOpts & HtmlFrmOpts::SSpace) && IsHTMLMode( HTMLMODE_FLY_MARGINS) ) { const SvxLRSpaceItem *pLRItem = nullptr; @@ -2145,17 +2145,17 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat } // border - if( nFrameOpts & HTML_FRMOPT_S_BORDER ) + if( nFrameOpts & HtmlFrmOpts::SBorder ) { const SfxPoolItem* pItem; - if( nFrameOpts & HTML_FRMOPT_S_NOBORDER ) + if( nFrameOpts & HtmlFrmOpts::SNoBorder ) OutCSS1_SvxBox( *this, rFrameFormat.GetBox() ); else if( SfxItemState::SET==rItemSet.GetItemState( RES_BOX, true, &pItem ) ) OutCSS1_SvxBox( *this, *pItem ); } // background (if, then the color must be set also) - if( nFrameOpts & HTML_FRMOPT_S_BACKGROUND ) + if( nFrameOpts & HtmlFrmOpts::SBackground ) OutCSS1_FrameFormatBackground( rFrameFormat ); if( pItemSet ) diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx index 2debe01..083f6a2 100644 --- a/sw/source/filter/html/htmldrawwriter.cxx +++ b/sw/source/filter/html/htmldrawwriter.cxx @@ -55,13 +55,13 @@ using namespace css; -const sal_uInt32 HTML_FRMOPTS_MARQUEE = - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE; +const HtmlFrmOpts HTML_FRMOPTS_MARQUEE = + HtmlFrmOpts::Align | + HtmlFrmOpts::Space; -const sal_uInt32 HTML_FRMOPTS_MARQUEE_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SPACE; +const HtmlFrmOpts HTML_FRMOPTS_MARQUEE_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSpace; const SdrObject *SwHTMLWriter::GetMarqueeTextObj( const SwDrawFrameFormat& rFormat ) { @@ -283,7 +283,7 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt, rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); // und nun noch ALIGN, HSPACE und VSPACE - sal_uInt32 nFrameFlags = HTML_FRMOPTS_MARQUEE; + HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_MARQUEE; if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_DRAW ) ) nFrameFlags |= HTML_FRMOPTS_MARQUEE_CSS1; OString aEndTags = rHTMLWrt.OutFrameFormatOptions( rFormat, aEmptyOUStr, nFrameFlags ); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 22b900c..a70d868 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -65,66 +65,66 @@ using namespace css; -const sal_uLong HTML_FRMOPTS_IMG_ALL = - HTML_FRMOPT_ALT | - HTML_FRMOPT_SIZE | - HTML_FRMOPT_ANYSIZE | - HTML_FRMOPT_BORDER | - HTML_FRMOPT_NAME; -const sal_uLong HTML_FRMOPTS_IMG_CNTNR = +const HtmlFrmOpts HTML_FRMOPTS_IMG_ALL = + HtmlFrmOpts::Alt | + HtmlFrmOpts::Size | + HtmlFrmOpts::AnySize | + HtmlFrmOpts::Border | + HtmlFrmOpts::Name; +const HtmlFrmOpts HTML_FRMOPTS_IMG_CNTNR = HTML_FRMOPTS_IMG_ALL | - HTML_FRMOPT_ABSSIZE; -const sal_uLong HTML_FRMOPTS_IMG = + HtmlFrmOpts::AbsSize; +const HtmlFrmOpts HTML_FRMOPTS_IMG = HTML_FRMOPTS_IMG_ALL | - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE | - HTML_FRMOPT_BRCLEAR; -const sal_uLong HTML_FRMOPTS_IMG_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SPACE; - -const sal_uLong HTML_FRMOPTS_DIV = - HTML_FRMOPT_ID | - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SIZE | - HTML_FRMOPT_ANYSIZE | - HTML_FRMOPT_ABSSIZE | - HTML_FRMOPT_S_SPACE | - HTML_FRMOPT_S_BORDER | - HTML_FRMOPT_S_BACKGROUND | - HTML_FRMOPT_BRCLEAR | - HTML_FRMOPT_DIR; - -const sal_uLong HTML_FRMOPTS_MULTICOL = - HTML_FRMOPT_ID | - HTML_FRMOPT_WIDTH | - HTML_FRMOPT_ANYSIZE | - HTML_FRMOPT_ABSSIZE | - HTML_FRMOPT_DIR; -const sal_uLong HTML_FRMOPTS_MULTICOL_CNTNR = + HtmlFrmOpts::Align | + HtmlFrmOpts::Space | + HtmlFrmOpts::BrClear; +const HtmlFrmOpts HTML_FRMOPTS_IMG_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSpace; + +const HtmlFrmOpts HTML_FRMOPTS_DIV = + HtmlFrmOpts::Id | + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSize | + HtmlFrmOpts::AnySize | + HtmlFrmOpts::AbsSize | + HtmlFrmOpts::SSpace | + HtmlFrmOpts::SBorder | + HtmlFrmOpts::SBackground | + HtmlFrmOpts::BrClear | + HtmlFrmOpts::Dir; + +const HtmlFrmOpts HTML_FRMOPTS_MULTICOL = + HtmlFrmOpts::Id | + HtmlFrmOpts::Width | + HtmlFrmOpts::AnySize | + HtmlFrmOpts::AbsSize | + HtmlFrmOpts::Dir; +const HtmlFrmOpts HTML_FRMOPTS_MULTICOL_CNTNR = HTML_FRMOPTS_MULTICOL; -const sal_uLong HTML_FRMOPTS_MULTICOL_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SIZE | - HTML_FRMOPT_S_SPACE | - HTML_FRMOPT_S_BORDER| - HTML_FRMOPT_S_BACKGROUND; - -const sal_uLong HTML_FRMOPTS_SPACER = - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SIZE | - HTML_FRMOPT_ANYSIZE | - HTML_FRMOPT_BRCLEAR | - HTML_FRMOPT_MARGINSIZE | - HTML_FRMOPT_ABSSIZE; - -const sal_uLong HTML_FRMOPTS_CNTNR = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SPACE | - HTML_FRMOPT_S_WIDTH | - HTML_FRMOPT_ANYSIZE | - HTML_FRMOPT_ABSSIZE | - HTML_FRMOPT_S_PIXSIZE; +const HtmlFrmOpts HTML_FRMOPTS_MULTICOL_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSize | + HtmlFrmOpts::SSpace | + HtmlFrmOpts::SBorder| + HtmlFrmOpts::SBackground; + +const HtmlFrmOpts HTML_FRMOPTS_SPACER = + HtmlFrmOpts::Align | + HtmlFrmOpts::Size | + HtmlFrmOpts::AnySize | + HtmlFrmOpts::BrClear | + HtmlFrmOpts::MarginSize | + HtmlFrmOpts::AbsSize; + +const HtmlFrmOpts HTML_FRMOPTS_CNTNR = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSpace | + HtmlFrmOpts::SWidth | + HtmlFrmOpts::AnySize | + HtmlFrmOpts::AbsSize | + HtmlFrmOpts::SPixSize; static Writer& OutHTML_FrameFormatTableNode( Writer& rWrt, const SwFrameFormat& rFrameFormat ); static Writer& OutHTML_FrameFormatAsMulticol( Writer& rWrt, const SwFrameFormat& rFormat, @@ -443,14 +443,14 @@ void SwHTMLWriter::OutFrameFormat( AllHtmlFlags nMode, const SwFrameFormat& rFra Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); // Output a width for non-draw objects - sal_uLong nFrameFlags = HTML_FRMOPTS_CNTNR; + HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_CNTNR; // For frames with columns we can also output the background if( HtmlOut::MultiCol == nOutMode ) - nFrameFlags |= HTML_FRMOPT_S_BACKGROUND|HTML_FRMOPT_S_BORDER; + nFrameFlags |= HtmlFrmOpts::SBackground|HtmlFrmOpts::SBorder; if( IsHTMLMode( HTMLMODE_BORDER_NONE ) ) - nFrameFlags |= HTML_FRMOPT_S_NOBORDER; + nFrameFlags |= HtmlFrmOpts::SNoBorder; OutCSS1_FrameFormatOptions( rFrameFormat, nFrameFlags, pSdrObject ); Strm().WriteChar( '>' ); @@ -520,7 +520,7 @@ void SwHTMLWriter::OutFrameFormat( AllHtmlFlags nMode, const SwFrameFormat& rFra OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, const OUString& rAlternateText, - sal_uInt32 nFrameOpts ) + HtmlFrmOpts nFrameOpts ) { OString sRetEndTags; OStringBuffer sOut; @@ -528,11 +528,11 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet(); // Name - if( (nFrameOpts & (HTML_FRMOPT_ID|HTML_FRMOPT_NAME)) && + if( (nFrameOpts & (HtmlFrmOpts::Id|HtmlFrmOpts::Name)) && !rFrameFormat.GetName().isEmpty() ) { const sal_Char *pStr = - (nFrameOpts & HTML_FRMOPT_ID) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; + (nFrameOpts & HtmlFrmOpts::Id) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; sOut.append(' ').append(pStr). append("=\""); Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); @@ -541,7 +541,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, } // Name - if( nFrameOpts & HTML_FRMOPT_DIR ) + if( nFrameOpts & HtmlFrmOpts::Dir ) { sal_uInt16 nDir = GetHTMLDirection( rItemSet ); Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); @@ -549,7 +549,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, } // ALT - if( (nFrameOpts & HTML_FRMOPT_ALT) && !rAlternateText.isEmpty() ) + if( (nFrameOpts & HtmlFrmOpts::Alt) && !rAlternateText.isEmpty() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_alt). append("=\""); @@ -561,14 +561,14 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, // ALIGN const sal_Char *pStr = nullptr; RndStdIds eAnchorId = rFrameFormat.GetAnchor().GetAnchorId(); - if( (nFrameOpts & HTML_FRMOPT_ALIGN) && + if( (nFrameOpts & HtmlFrmOpts::Align) && ((FLY_AT_PARA == eAnchorId) || (FLY_AT_CHAR == eAnchorId)) ) { // MIB 12.3.98: Wouldn't it be more clever to left-align frames that // are anchored to a paragraph if necessary, instead of inserting them // as being anchored to characters? const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient(); - if( !(nFrameOpts & HTML_FRMOPT_S_ALIGN) || + if( !(nFrameOpts & HtmlFrmOpts::SAlign) || text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() || text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() ) { @@ -577,8 +577,8 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, : OOO_STRING_SVTOOLS_HTML_AL_left; } } - if( (nFrameOpts & HTML_FRMOPT_ALIGN) && !pStr && - ( (nFrameOpts & HTML_FRMOPT_S_ALIGN) == 0 || + if( (nFrameOpts & HtmlFrmOpts::Align) && !pStr && + ( !(nFrameOpts & HtmlFrmOpts::SAlign) || (FLY_AS_CHAR == eAnchorId) ) && SfxItemState::SET == rItemSet.GetItemState( RES_VERT_ORIENT, true, &pItem )) { @@ -604,7 +604,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, // HSPACE und VSPACE Size aTwipSpc( 0, 0 ); - if( (nFrameOpts & (HTML_FRMOPT_SPACE|HTML_FRMOPT_MARGINSIZE)) && + if( (nFrameOpts & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) && SfxItemState::SET == rItemSet.GetItemState( RES_LR_SPACE, true, &pItem )) { aTwipSpc.Width() = @@ -612,7 +612,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, static_cast<const SvxLRSpaceItem*>(pItem)->GetRight() ) / 2; m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width(); } - if( (nFrameOpts & (HTML_FRMOPT_SPACE|HTML_FRMOPT_MARGINSIZE)) && + if( (nFrameOpts & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) && SfxItemState::SET == rItemSet.GetItemState( RES_UL_SPACE, true, &pItem )) { aTwipSpc.Height() = @@ -621,7 +621,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, m_nDfltTopMargin = m_nDfltBottomMargin = (sal_uInt16)aTwipSpc.Height(); } - if( (nFrameOpts & HTML_FRMOPT_SPACE) && + if( (nFrameOpts & HtmlFrmOpts::Space) && (aTwipSpc.Width() || aTwipSpc.Height()) && Application::GetDefaultDevice() ) { @@ -648,7 +648,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, // The spacing must be considered for the size, if the corresponding flag // is set. - if( (nFrameOpts & HTML_FRMOPT_MARGINSIZE) ) + if( (nFrameOpts & HtmlFrmOpts::MarginSize) ) { aTwipSpc.Width() *= -2; aTwipSpc.Height() *= -2; @@ -659,7 +659,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, aTwipSpc.Height() = 0; } - if( !(nFrameOpts & HTML_FRMOPT_ABSSIZE) && + if( !(nFrameOpts & HtmlFrmOpts::AbsSize) && SfxItemState::SET == rItemSet.GetItemState( RES_BOX, true, &pItem )) { const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem); @@ -672,9 +672,9 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, // WIDTH and/or HEIGHT // Output ATT_VAR_SIZE/ATT_MIN_SIZE only, if ANYSIZE is set - if( (nFrameOpts & HTML_FRMOPT_SIZE) && + if( (nFrameOpts & HtmlFrmOpts::Size) && SfxItemState::SET == rItemSet.GetItemState( RES_FRM_SIZE, true, &pItem ) && - ( (nFrameOpts & HTML_FRMOPT_ANYSIZE) || + ( (nFrameOpts & HtmlFrmOpts::AnySize) || ATT_FIX_SIZE == static_cast<const SwFormatFrameSize *>(pItem)->GetHeightSizeType()) ) { const SwFormatFrameSize *pFSItem = static_cast<const SwFormatFrameSize *>(pItem); @@ -707,7 +707,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, aPixelSz.Height() = 1; } - if( (nFrameOpts & HTML_FRMOPT_WIDTH) && + if( (nFrameOpts & HtmlFrmOpts::Width) && ((nPrcWidth && nPrcWidth!=255) || aPixelSz.Width()) ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width). @@ -719,7 +719,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, sOut.append("\""); } - if( (nFrameOpts & HTML_FRMOPT_HEIGHT) && + if( (nFrameOpts & HtmlFrmOpts::Height) && ((nPrcHeight && nPrcHeight!=255) || aPixelSz.Height()) ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height). @@ -737,7 +737,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, // Insert wrap for graphics that are anchored to a paragraph as // <BR CLEAR=...> in the string - if( (nFrameOpts & HTML_FRMOPT_BRCLEAR) && + if( (nFrameOpts & HtmlFrmOpts::BrClear) && ((FLY_AT_PARA == rFrameFormat.GetAnchor().GetAnchorId()) || (FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId())) && SfxItemState::SET == rItemSet.GetItemState( RES_SURROUND, true, &pItem )) @@ -802,21 +802,21 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, return sRetEndTags; } -void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAlternateText, sal_uInt32 nFrameOptions) +void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAlternateText, HtmlFrmOpts nFrameOptions) { const SfxPoolItem* pItem; const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet(); // Name - if( (nFrameOptions & (HTML_FRMOPT_ID|HTML_FRMOPT_NAME)) && + if( (nFrameOptions & (HtmlFrmOpts::Id|HtmlFrmOpts::Name)) && !rFrameFormat.GetName().isEmpty() ) { - const sal_Char* pAttributeName = (nFrameOptions & HTML_FRMOPT_ID) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; + const sal_Char* pAttributeName = (nFrameOptions & HtmlFrmOpts::Id) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; aHtml.attribute(pAttributeName, rFrameFormat.GetName()); } // Name - if (nFrameOptions & HTML_FRMOPT_DIR) + if (nFrameOptions & HtmlFrmOpts::Dir) { sal_uInt16 nCurrentDirection = GetHTMLDirection(rItemSet); OString sDirection = convertDirection(nCurrentDirection); @@ -824,7 +824,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma } // alt - if( (nFrameOptions & HTML_FRMOPT_ALT) && !rAlternateText.isEmpty() ) + if( (nFrameOptions & HtmlFrmOpts::Alt) && !rAlternateText.isEmpty() ) { aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_alt, rAlternateText); } @@ -832,11 +832,11 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma // align const sal_Char* pAlignString = nullptr; RndStdIds eAnchorId = rFrameFormat.GetAnchor().GetAnchorId(); - if( (nFrameOptions & HTML_FRMOPT_ALIGN) && + if( (nFrameOptions & HtmlFrmOpts::Align) && ((FLY_AT_PARA == eAnchorId) || (FLY_AT_CHAR == eAnchorId)) ) { const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient(); - if( !(nFrameOptions & HTML_FRMOPT_S_ALIGN) || + if( !(nFrameOptions & HtmlFrmOpts::SAlign) || text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() || text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() ) { @@ -845,8 +845,8 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma : OOO_STRING_SVTOOLS_HTML_AL_left; } } - if( (nFrameOptions & HTML_FRMOPT_ALIGN) && !pAlignString && - ( (nFrameOptions & HTML_FRMOPT_S_ALIGN) == 0 || + if( (nFrameOptions & HtmlFrmOpts::Align) && !pAlignString && + ( !(nFrameOptions & HtmlFrmOpts::SAlign) || (FLY_AS_CHAR == eAnchorId) ) && SfxItemState::SET == rItemSet.GetItemState( RES_VERT_ORIENT, true, &pItem )) { @@ -871,7 +871,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma // hspace and vspace Size aTwipSpc( 0, 0 ); - if( (nFrameOptions & (HTML_FRMOPT_SPACE | HTML_FRMOPT_MARGINSIZE)) && + if( (nFrameOptions & (HtmlFrmOpts::Space | HtmlFrmOpts::MarginSize)) && SfxItemState::SET == rItemSet.GetItemState( RES_LR_SPACE, true, &pItem )) { aTwipSpc.Width() = @@ -879,7 +879,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma static_cast<const SvxLRSpaceItem*>(pItem)->GetRight() ) / 2; m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width(); } - if( (nFrameOptions & (HTML_FRMOPT_SPACE|HTML_FRMOPT_MARGINSIZE)) && + if( (nFrameOptions & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) && SfxItemState::SET == rItemSet.GetItemState( RES_UL_SPACE, true, &pItem )) { aTwipSpc.Height() = @@ -888,7 +888,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma m_nDfltTopMargin = m_nDfltBottomMargin = (sal_uInt16)aTwipSpc.Height(); } - if( (nFrameOptions & HTML_FRMOPT_SPACE) && + if( (nFrameOptions & HtmlFrmOpts::Space) && (aTwipSpc.Width() || aTwipSpc.Height()) && Application::GetDefaultDevice() ) { @@ -913,7 +913,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma // The spacing must be considered for the size, if the corresponding flag // is set. - if( (nFrameOptions & HTML_FRMOPT_MARGINSIZE) ) + if( (nFrameOptions & HtmlFrmOpts::MarginSize) ) { aTwipSpc.Width() *= -2; aTwipSpc.Height() *= -2; @@ -924,7 +924,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma aTwipSpc.Height() = 0; } - if( !(nFrameOptions & HTML_FRMOPT_ABSSIZE) && + if( !(nFrameOptions & HtmlFrmOpts::AbsSize) && SfxItemState::SET == rItemSet.GetItemState( RES_BOX, true, &pItem )) { const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem); @@ -937,9 +937,9 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma // "width" and/or "height" // Only output ATT_VAR_SIZE/ATT_MIN_SIZE if ANYSIZE is set - if( (nFrameOptions & HTML_FRMOPT_SIZE) && + if( (nFrameOptions & HtmlFrmOpts::Size) && SfxItemState::SET == rItemSet.GetItemState( RES_FRM_SIZE, true, &pItem ) && - ( (nFrameOptions & HTML_FRMOPT_ANYSIZE) || + ( (nFrameOptions & HtmlFrmOpts::AnySize) || ATT_FIX_SIZE == static_cast<const SwFormatFrameSize *>(pItem)->GetHeightSizeType()) ) { const SwFormatFrameSize *pFSItem = static_cast<const SwFormatFrameSize *>(pItem); @@ -972,7 +972,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma aPixelSz.Height() = 1; } - if( (nFrameOptions & HTML_FRMOPT_WIDTH) && + if( (nFrameOptions & HtmlFrmOpts::Width) && ((nPrcWidth && nPrcWidth!=255) || aPixelSz.Width()) ) { OString sWidth; @@ -983,7 +983,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_width, sWidth); } - if( (nFrameOptions & HTML_FRMOPT_HEIGHT) && + if( (nFrameOptions & HtmlFrmOpts::Height) && ((nPrcHeight && nPrcHeight!=255) || aPixelSz.Height()) ) { OString sHeight; @@ -998,7 +998,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma // Insert wrap for graphics that are anchored to a paragraph as // <BR CLEAR=...> in the string - if( (nFrameOptions & HTML_FRMOPT_BRCLEAR) && + if( (nFrameOptions & HtmlFrmOpts::BrClear) && ((FLY_AT_PARA == rFrameFormat.GetAnchor().GetAnchorId()) || (FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId())) && SfxItemState::SET == rItemSet.GetItemState( RES_SURROUND, true, &pItem )) @@ -1201,7 +1201,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, const OUString& rGraphicURL, Graphic& rGraphic, const OUString& rAlternateText, - const Size &rRealSize, sal_uInt32 nFrameOpts, + const Size &rRealSize, HtmlFrmOpts nFrameOpts, const sal_Char *pMarkType, const ImageMap *pAltImgMap ) { @@ -1294,7 +1294,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, // <font color = ...>...<img ... >...</font> sal_uInt16 nBorderWidth = 0; - if( (nFrameOpts & HTML_FRMOPT_BORDER) && + if( (nFrameOpts & HtmlFrmOpts::Border) && SfxItemState::SET == rItemSet.GetItemState( RES_BOX, true, &pItem )) { Size aTwipBorder( 0, 0 ); @@ -1394,7 +1394,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) ) rHTMLWrt.OutCSS1_FrameFormatOptions( rFrameFormat, nFrameOpts ); - if( nFrameOpts & HTML_FRMOPT_BORDER ) + if( nFrameOpts & HtmlFrmOpts::Border ) { aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_border, nBorderWidth); } @@ -1585,7 +1585,7 @@ static Writer & OutHTML_FrameFormatAsMulticol( Writer& rWrt, rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); // WIDTH - sal_uLong nFrameFlags = bInCntnr ? HTML_FRMOPTS_MULTICOL_CNTNR + HtmlFrmOpts nFrameFlags = bInCntnr ? HTML_FRMOPTS_MULTICOL_CNTNR : HTML_FRMOPTS_MULTICOL; if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr ) nFrameFlags |= HTML_FRMOPTS_MULTICOL_CSS1; @@ -1671,9 +1671,9 @@ static Writer& OutHTML_FrameFormatAsDivOrSpan( Writer& rWrt, sOut.append('<').append(pStr); rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() ); - sal_uLong nFrameFlags = HTML_FRMOPTS_DIV; + HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_DIV; if( rHTMLWrt.IsHTMLMode( HTMLMODE_BORDER_NONE ) ) - nFrameFlags |= HTML_FRMOPT_S_NOBORDER; + nFrameFlags |= HtmlFrmOpts::SNoBorder; OString aEndTags = rHTMLWrt.OutFrameFormatOptions( rFrameFormat, aEmptyOUStr, nFrameFlags ); rHTMLWrt.OutCSS1_FrameFormatOptions( rFrameFormat, nFrameFlags ); rWrt.Strm().WriteChar( '>' ); @@ -1744,7 +1744,7 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r } OutHTML_Image( rWrt, rFrameFormat, GraphicURL, aGraphic, rFrameFormat.GetName(), aSz, - HTML_FRMOPTS_GENIMG, "frame", + HtmlFrmOpts::GenImgMask, "frame", aIMap.GetIMapObjectCount() ? &aIMap : nullptr ); return rWrt; @@ -1765,7 +1765,7 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF if( !pGrfNd ) return rWrt; - sal_uLong nFrameFlags = bInCntnr ? HTML_FRMOPTS_IMG_CNTNR : HTML_FRMOPTS_IMG; + HtmlFrmOpts nFrameFlags = bInCntnr ? HTML_FRMOPTS_IMG_CNTNR : HTML_FRMOPTS_IMG; if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr ) nFrameFlags |= HTML_FRMOPTS_IMG_CSS1; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index eab6e05..897ba95 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -68,19 +68,19 @@ using namespace ::com::sun::star; -const sal_uInt32 HTML_FRMOPTS_CONTROL = - 0; -const sal_uInt32 HTML_FRMOPTS_CONTROL_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SIZE | - HTML_FRMOPT_S_SPACE | - HTML_FRMOPT_BRCLEAR; -const sal_uInt32 HTML_FRMOPTS_IMG_CONTROL = - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_BRCLEAR; -const sal_uInt32 HTML_FRMOPTS_IMG_CONTROL_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SPACE; +const HtmlFrmOpts HTML_FRMOPTS_CONTROL = + HtmlFrmOpts::NONE; +const HtmlFrmOpts HTML_FRMOPTS_CONTROL_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSize | + HtmlFrmOpts::SSpace | + HtmlFrmOpts::BrClear; +const HtmlFrmOpts HTML_FRMOPTS_IMG_CONTROL = + HtmlFrmOpts::Align | + HtmlFrmOpts::BrClear; +const HtmlFrmOpts HTML_FRMOPTS_IMG_CONTROL_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSpace; static void lcl_html_outEvents( SvStream& rStrm, const uno::Reference< form::XFormComponent >& rFormComp, @@ -718,7 +718,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, bool bEmptyValue = false; uno::Any aTmp = xPropSet->getPropertyValue( "ClassId" ); sal_Int16 nClassId = *o3tl::doAccess<sal_Int16>(aTmp); - sal_uInt32 nFrameOpts = HTML_FRMOPTS_CONTROL; + HtmlFrmOpts nFrameOpts = HTML_FRMOPTS_CONTROL; switch( nClassId ) { case form::FormComponentType::CHECKBOX: @@ -1039,7 +1039,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, : HTML_FRMOPTS_CONTROL_CSS1); } OString aEndTags; - if( nFrameOpts != 0 ) + if( nFrameOpts != HtmlFrmOpts::NONE ) aEndTags = rHTMLWrt.OutFrameFormatOptions( rFormat, aEmptyOUStr, nFrameOpts ); if( rHTMLWrt.m_bCfgOutStyles ) diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index cedeafd..1845d8a 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -71,51 +71,51 @@ using namespace com::sun::star; #define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2) -const sal_uLong HTML_FRMOPTS_EMBED_ALL = - HTML_FRMOPT_ALT | - HTML_FRMOPT_SIZE | - HTML_FRMOPT_NAME; -const sal_uLong HTML_FRMOPTS_EMBED_CNTNR = +const HtmlFrmOpts HTML_FRMOPTS_EMBED_ALL = + HtmlFrmOpts::Alt | + HtmlFrmOpts::Size | + HtmlFrmOpts::Name; +const HtmlFrmOpts HTML_FRMOPTS_EMBED_CNTNR = HTML_FRMOPTS_EMBED_ALL | - HTML_FRMOPT_ABSSIZE; -const sal_uLong HTML_FRMOPTS_EMBED = + HtmlFrmOpts::AbsSize; +const HtmlFrmOpts HTML_FRMOPTS_EMBED = HTML_FRMOPTS_EMBED_ALL | - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE | - HTML_FRMOPT_BRCLEAR | - HTML_FRMOPT_NAME; -const sal_uLong HTML_FRMOPTS_HIDDEN_EMBED = - HTML_FRMOPT_ALT | - HTML_FRMOPT_NAME; - -const sal_uLong HTML_FRMOPTS_APPLET_ALL = - HTML_FRMOPT_ALT | - HTML_FRMOPT_SIZE; -const sal_uLong HTML_FRMOPTS_APPLET_CNTNR = + HtmlFrmOpts::Align | + HtmlFrmOpts::Space | + HtmlFrmOpts::BrClear | + HtmlFrmOpts::Name; +const HtmlFrmOpts HTML_FRMOPTS_HIDDEN_EMBED = + HtmlFrmOpts::Alt | + HtmlFrmOpts::Name; + +const HtmlFrmOpts HTML_FRMOPTS_APPLET_ALL = + HtmlFrmOpts::Alt | + HtmlFrmOpts::Size; +const HtmlFrmOpts HTML_FRMOPTS_APPLET_CNTNR = HTML_FRMOPTS_APPLET_ALL | - HTML_FRMOPT_ABSSIZE; -const sal_uLong HTML_FRMOPTS_APPLET = + HtmlFrmOpts::AbsSize; +const HtmlFrmOpts HTML_FRMOPTS_APPLET = HTML_FRMOPTS_APPLET_ALL | - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE | - HTML_FRMOPT_BRCLEAR; - -const sal_uLong HTML_FRMOPTS_IFRAME_ALL = - HTML_FRMOPT_ALT | - HTML_FRMOPT_SIZE; -const sal_uLong HTML_FRMOPTS_IFRAME_CNTNR = + HtmlFrmOpts::Align | + HtmlFrmOpts::Space | + HtmlFrmOpts::BrClear; + +const HtmlFrmOpts HTML_FRMOPTS_IFRAME_ALL = + HtmlFrmOpts::Alt | + HtmlFrmOpts::Size; +const HtmlFrmOpts HTML_FRMOPTS_IFRAME_CNTNR = HTML_FRMOPTS_IFRAME_ALL | - HTML_FRMOPT_ABSSIZE; -const sal_uLong HTML_FRMOPTS_IFRAME = + HtmlFrmOpts::AbsSize; +const HtmlFrmOpts HTML_FRMOPTS_IFRAME = HTML_FRMOPTS_IFRAME_ALL | - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE | - HTML_FRMOPT_BORDER | - HTML_FRMOPT_BRCLEAR; + HtmlFrmOpts::Align | + HtmlFrmOpts::Space | + HtmlFrmOpts::Border | + HtmlFrmOpts::BrClear; -const sal_uLong HTML_FRMOPTS_OLE_CSS1 = - HTML_FRMOPT_S_ALIGN | - HTML_FRMOPT_S_SPACE; +const HtmlFrmOpts HTML_FRMOPTS_OLE_CSS1 = + HtmlFrmOpts::SAlign | + HtmlFrmOpts::SSpace; void SwHTMLParser::SetFixSize( const Size& rPixSize, const Size& rTwipDfltSize, @@ -1000,7 +1000,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor return rWrt; } - sal_uLong nFrameOpts; + HtmlFrmOpts nFrameOpts; // wenn meoglich vor dem "Objekt" einen Zeilen-Umbruch ausgeben if( rHTMLWrt.m_bLFPossible ) @@ -1323,8 +1323,8 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame URIHelper::GetMaybeFileHdl() ); } - sal_uLong nFlags = bInCntnr ? HTML_FRMOPTS_GENIMG_CNTNR - : HTML_FRMOPTS_GENIMG; + HtmlFrmOpts nFlags = bInCntnr ? HtmlFrmOpts::GenImgAllMask + : HtmlFrmOpts::GenImgMask; OutHTML_Image( rWrt, rFrameFormat, aGraphicURL, aGraphic, pOLENd->GetTitle(), pOLENd->GetTwipSize(), nFlags, "ole" ); diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index b637a61..7694b17 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -29,6 +29,7 @@ #include <i18nlangtag/lang.h> #include <comphelper/stl_types.hxx> #include <o3tl/sorted_vector.hxx> +#include <o3tl/typed_flags_set.hxx> #include "shellio.hxx" #include "wrt_fn.hxx" @@ -67,46 +68,43 @@ extern SwAttrFnTab aHTMLAttrFnTab; // BORDER geht nur bei OutHTML_Image // ANYSIZE gibt an, ob auch VAR_SIZE und MIN_SIZE angaben exportiert werden // ABSSIZE gibt an, ob Abstand und Umrandung ignoriert werden sollen -const sal_uInt32 HTML_FRMOPT_ALIGN = 1<<0; -const sal_uInt32 HTML_FRMOPT_S_ALIGN = 1<<1; - -const sal_uInt32 HTML_FRMOPT_WIDTH = 1<<2; -const sal_uInt32 HTML_FRMOPT_HEIGHT = 1<<3; -const sal_uInt32 HTML_FRMOPT_SIZE = HTML_FRMOPT_WIDTH|HTML_FRMOPT_HEIGHT; -const sal_uInt32 HTML_FRMOPT_S_WIDTH = 1<<4; -const sal_uInt32 HTML_FRMOPT_S_HEIGHT = 1<<5; -const sal_uInt32 HTML_FRMOPT_S_SIZE = HTML_FRMOPT_S_WIDTH|HTML_FRMOPT_S_HEIGHT; -const sal_uInt32 HTML_FRMOPT_ANYSIZE = 1<<6; -const sal_uInt32 HTML_FRMOPT_ABSSIZE = 1<<7; -const sal_uInt32 HTML_FRMOPT_MARGINSIZE = 1<<8; - -const sal_uInt32 HTML_FRMOPT_SPACE = 1<<9; -const sal_uInt32 HTML_FRMOPT_S_SPACE = 1<<10; - -const sal_uInt32 HTML_FRMOPT_BORDER = 1<<11; -const sal_uInt32 HTML_FRMOPT_S_BORDER = 1<<12; -const sal_uInt32 HTML_FRMOPT_S_NOBORDER = 1<<13; - -const sal_uInt32 HTML_FRMOPT_S_BACKGROUND = 1<<14; - -const sal_uInt32 HTML_FRMOPT_NAME = 1<<15; -const sal_uInt32 HTML_FRMOPT_ALT = 1<<16; -const sal_uInt32 HTML_FRMOPT_BRCLEAR = 1<<17; -const sal_uInt32 HTML_FRMOPT_S_PIXSIZE = 1<<18; -const sal_uInt32 HTML_FRMOPT_ID = 1<<19; -const sal_uInt32 HTML_FRMOPT_DIR = 1<<20; - -const sal_uInt32 HTML_FRMOPTS_GENIMG_ALL = - HTML_FRMOPT_ALT | - HTML_FRMOPT_SIZE | - HTML_FRMOPT_ABSSIZE | - HTML_FRMOPT_NAME; -const sal_uInt32 HTML_FRMOPTS_GENIMG_CNTNR = HTML_FRMOPTS_GENIMG_ALL; -const sal_uInt32 HTML_FRMOPTS_GENIMG = - HTML_FRMOPTS_GENIMG_ALL | - HTML_FRMOPT_ALIGN | - HTML_FRMOPT_SPACE | - HTML_FRMOPT_BRCLEAR; +enum class HtmlFrmOpts { + NONE = 0, + Align = 1<<0, + SAlign = 1<<1, + + Width = 1<<2, + Height = 1<<3, + Size = Width | Height, + SWidth = 1<<4, + SHeight = 1<<5, + SSize = SWidth | SHeight, + AnySize = 1<<6, + AbsSize = 1<<7, + MarginSize = 1<<8, + + Space = 1<<9, + SSpace = 1<<10, + + Border = 1<<11, + SBorder = 1<<12, + SNoBorder = 1<<13, + + SBackground = 1<<14, + + Name = 1<<15, + Alt = 1<<16, + BrClear = 1<<17, + SPixSize = 1<<18, + Id = 1<<19, + Dir = 1<<20, + + GenImgAllMask = Alt | Size | AbsSize | Name, + GenImgMask = GenImgAllMask | Align | Space | BrClear +}; +namespace o3tl { + template<> struct typed_flags<HtmlFrmOpts> : is_typed_flags<HtmlFrmOpts, ((1<<21)-1)> {}; +} #define HTMLMODE_BLOCK_SPACER 0x00010000 #define HTMLMODE_FLOAT_FRAME 0x00020000 @@ -466,16 +464,16 @@ public: // Frame-Formats ausgeben und ggf. ein <BR CLEAR=...> vorne an // rEndTags anhaengen OString OutFrameFormatOptions( const SwFrameFormat& rFrameFormat, const OUString& rAltText, - sal_uInt32 nFrameOpts ); + HtmlFrmOpts nFrameOpts ); - void writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAltText, sal_uInt32 nFrameOpts); + void writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAltText, HtmlFrmOpts nFrameOpts); void OutCSS1_TableFrameFormatOptions( const SwFrameFormat& rFrameFormat ); void OutCSS1_TableCellBorderHack(const SwFrameFormat& rFrameFormat); void OutCSS1_SectionFormatOptions( const SwFrameFormat& rFrameFormat, const SwFormatCol *pCol ); - void OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat, sal_uInt32 nFrameOpts, - const SdrObject *pSdrObj=nullptr, - const SfxItemSet *pItemSet=nullptr ); + void OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat, HtmlFrmOpts nFrameOpts, + const SdrObject *pSdrObj=nullptr, + const SfxItemSet *pItemSet=nullptr ); void OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFormat ); void ChangeParaToken( sal_uInt16 nNew ); @@ -648,7 +646,7 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrameFormat& rFrameFormat, Writer& OutHTML_Image( Writer&, const SwFrameFormat& rFormat, const OUString& rGraphicURL, Graphic& rGraphic, const OUString& rAlternateText, - const Size& rRealSize, sal_uInt32 nFrameOpts, + const Size& rRealSize, HtmlFrmOpts nFrameOpts, const sal_Char *pMarkType, const ImageMap *pGenImgMap = nullptr ); commit e027b1d1d68432149d6f1ffbe8d7469d17c19e71 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 10:59:57 2016 +0200 convert CSS1_SCRIPT to o3tl::typed_flags Change-Id: I4c721cca5eb9bc63c93888e9c214de339552a301 diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index bd0bfab..c5d9585 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -558,10 +558,10 @@ SvxBrushItem SwCSS1Parser::makePageDescBackground() const ->GetMaster().makeBackgroundBrushItem(); } -sal_uInt16 SwCSS1Parser::GetScriptFromClass( OUString& rClass, - bool bSubClassOnly ) +Css1ScriptFlags SwCSS1Parser::GetScriptFromClass( OUString& rClass, + bool bSubClassOnly ) { - sal_uInt16 nScriptFlags = CSS1_SCRIPT_ALL; + Css1ScriptFlags nScriptFlags = Css1ScriptFlags::AllMask; sal_Int32 nLen = rClass.getLength(); sal_Int32 nPos = nLen > 4 ? rClass.lastIndexOf( '-' ) : -1; @@ -582,21 +582,21 @@ sal_uInt16 SwCSS1Parser::GetScriptFromClass( OUString& rClass, case 3: if( rClass.matchIgnoreAsciiCase( "cjk", nPos ) ) { - nScriptFlags = CSS1_SCRIPT_CJK; + nScriptFlags = Css1ScriptFlags::CJK; } else if( rClass.matchIgnoreAsciiCase( "ctl", nPos ) ) { - nScriptFlags = CSS1_SCRIPT_CTL; + nScriptFlags = Css1ScriptFlags::CTL; } break; case 7: if( rClass.matchIgnoreAsciiCase( "western", nPos ) ) { - nScriptFlags = CSS1_SCRIPT_WESTERN; + nScriptFlags = Css1ScriptFlags::Western; } break; } - if( CSS1_SCRIPT_ALL != nScriptFlags ) + if( Css1ScriptFlags::AllMask != nScriptFlags ) { if( nPos ) { @@ -613,11 +613,11 @@ sal_uInt16 SwCSS1Parser::GetScriptFromClass( OUString& rClass, static CSS1SelectorType GetTokenAndClass( const CSS1Selector *pSelector, OUString& rToken, OUString& rClass, - sal_uInt16& rScriptFlags ) + Css1ScriptFlags& rScriptFlags ) { rToken = pSelector->GetString(); rClass.clear(); - rScriptFlags = CSS1_SCRIPT_ALL; + rScriptFlags = Css1ScriptFlags::AllMask; CSS1SelectorType eType = pSelector->GetType(); if( CSS1_SELTYPE_ELEM_CLASS==eType ) @@ -639,7 +639,7 @@ static CSS1SelectorType GetTokenAndClass( const CSS1Selector *pSelector, return eType; } -static void RemoveScriptItems( SfxItemSet& rItemSet, sal_uInt16 nScript, +static void RemoveScriptItems( SfxItemSet& rItemSet, Css1ScriptFlags nScript, const SfxItemSet *pParentItemSet = nullptr ) { static const sal_uInt16 aWhichIds[3][5] = @@ -655,16 +655,16 @@ static void RemoveScriptItems( SfxItemSet& rItemSet, sal_uInt16 nScript, bool aClearItems[3] = { false, false, false }; switch( nScript ) { - case CSS1_SCRIPT_WESTERN: + case Css1ScriptFlags::Western: aClearItems[1] = aClearItems[2] = true; break; - case CSS1_SCRIPT_CJK: + case Css1ScriptFlags::CJK: aClearItems[0] = aClearItems[2] = true; break; - case CSS1_SCRIPT_CTL: + case Css1ScriptFlags::CTL: aClearItems[0] = aClearItems[1] = true; break; - case CSS1_SCRIPT_ALL: + case Css1ScriptFlags::AllMask: break; default: OSL_ENSURE( aClearItems[0], "unknown script type" ); @@ -706,8 +706,8 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, else if( CSS1_SELTYPE_CLASS==eSelType && !pNext ) { OUString aClass( pSelector->GetString() ); - sal_uInt16 nScript = GetScriptFromClass( aClass ); - if( CSS1_SCRIPT_ALL != nScript ) + Css1ScriptFlags nScript = GetScriptFromClass( aClass ); + if( Css1ScriptFlags::AllMask != nScript ) { SfxItemSet aScriptItemSet( rItemSet ); RemoveScriptItems( aScriptItemSet, nScript ); @@ -742,7 +742,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, // Token und Class zu dem Selektor holen OUString aToken2; OUString aClass; - sal_uInt16 nScript; + Css1ScriptFlags nScript; eSelType = GetTokenAndClass( pSelector, aToken2, aClass, nScript ); int nToken2 = GetHTMLToken( aToken2 ); @@ -786,7 +786,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, if( bInsert ) { OUString sTmp = aToken2 + ":" + aPseudo; - if( CSS1_SCRIPT_ALL != nScript ) + if( Css1ScriptFlags::AllMask != nScript ) { SfxItemSet aScriptItemSet( rItemSet ); RemoveScriptItems( aScriptItemSet, nScript ); @@ -851,7 +851,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, nPoolFormatId = RES_POOLCHR_FOOTNOTE; if( nPoolFormatId ) { - if( CSS1_SCRIPT_ALL == nScript ) + if( Css1ScriptFlags::AllMask == nScript ) { SetCharFormatAttrs( GetCharFormatFromPool(nPoolFormatId), rItemSet ); } @@ -953,7 +953,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, { OUString sTmp = aToken2 + " " OOO_STRING_SVTOOLS_HTML_parabreak; - if( CSS1_SCRIPT_ALL == nScript ) + if( Css1ScriptFlags::AllMask == nScript ) { InsertTag( sTmp, rItemSet, rPropInfo ); } @@ -1006,7 +1006,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, pColl->GetAttrSet().GetItemState(RES_BOX,true,&pItem) ) pBoxItem = static_cast<const SvxBoxItem *>(pItem); rPropInfo.SetBoxItem( rItemSet, MIN_BORDER_DIST, pBoxItem ); - if( CSS1_SCRIPT_ALL == nScript && !pParentColl ) + if( Css1ScriptFlags::AllMask == nScript && !pParentColl ) { SetTextCollAttrs( pColl, rItemSet, rPropInfo, this ); } @@ -1025,7 +1025,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, aDrop.GetChars() = 1; // die Attribute in das DropCap-Attribut einfuegen - if( CSS1_SCRIPT_ALL == nScript ) + if( Css1ScriptFlags::AllMask == nScript ) { OUString sName(pColl->GetName()); FillDropCap( aDrop, rItemSet, &sName ); @@ -1033,21 +1033,21 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, else { SfxItemSet aScriptItemSet( rItemSet ); - if( CSS1_SCRIPT_WESTERN != nScript ) + if( Css1ScriptFlags::Western != nScript ) { aScriptItemSet.ClearItem( RES_CHRATR_FONT ); aScriptItemSet.ClearItem( RES_CHRATR_LANGUAGE ); aScriptItemSet.ClearItem( RES_CHRATR_POSTURE ); aScriptItemSet.ClearItem( RES_CHRATR_WEIGHT ); } - if( CSS1_SCRIPT_CJK != nScript ) + if( Css1ScriptFlags::CJK != nScript ) { aScriptItemSet.ClearItem( RES_CHRATR_CJK_FONT ); aScriptItemSet.ClearItem( RES_CHRATR_CJK_LANGUAGE ); aScriptItemSet.ClearItem( RES_CHRATR_CJK_POSTURE ); aScriptItemSet.ClearItem( RES_CHRATR_CJK_WEIGHT ); } - if( CSS1_SCRIPT_CTL != nScript ) + if( Css1ScriptFlags::CTL != nScript ) { aScriptItemSet.ClearItem( RES_CHRATR_CTL_FONT ); aScriptItemSet.ClearItem( RES_CHRATR_CTL_LANGUAGE ); @@ -1064,7 +1064,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, // gesucht und gesetzt. if( aDrop.GetLines() > 1 && (SVX_ADJUST_LEFT == rPropInfo.m_eFloat || - CSS1_SCRIPT_ALL == nScript) ) + Css1ScriptFlags::AllMask == nScript) ) { pColl->SetFormatAttr( aDrop ); } @@ -1097,7 +1097,7 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, } } - if( CSS1_SCRIPT_ALL == nScript && !pParentCFormat ) + if( Css1ScriptFlags::AllMask == nScript && !pParentCFormat ) { SetCharFormatAttrs( pCFormat, rItemSet ); } diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index ca43c6a..f94dabf 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -696,7 +696,7 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL, pPropInfo( nullptr ), nMinFixLineSpace( MM50/2 ), eDfltEnc( RTL_TEXTENCODING_DONTKNOW ), - nScriptFlags( CSS1_SCRIPT_ALL ), + nScriptFlags( Css1ScriptFlags::AllMask ), bIgnoreFontFamily( false ) { // Item-Ids auch initialisieren diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index 36e6a16..33d7be3 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -23,6 +23,7 @@ #include <editeng/svxenum.hxx> #include <rtl/textenc.h> #include "parcss1.hxx" +#include <o3tl/typed_flags_set.hxx> #include <memory> #include <vector> @@ -73,15 +74,20 @@ enum SvxCSS1PageBreak }; -#define CSS1_SCRIPT_WESTERN 0x01 -#define CSS1_SCRIPT_CJK 0x02 -#define CSS1_SCRIPT_CTL 0x04 -#define CSS1_SCRIPT_ALL 0x07 +enum class Css1ScriptFlags { + Western = 0x01, + CJK = 0x02, + CTL = 0x04, + AllMask = Western | CJK | CTL, +}; +namespace o3tl { + template<> struct typed_flags<Css1ScriptFlags> : is_typed_flags<Css1ScriptFlags, 0x07> {}; +} struct CSS1PropertyEnum { const sal_Char *pName; // Wert einer Property - sal_uInt16 nEnum; // und der dazugehoerige Wert eines Enums + sal_uInt16 nEnum; // und der dazugehoerige Wert eines Enums }; namespace editeng { class SvxBorderLine; } @@ -198,7 +204,7 @@ class SvxCSS1Parser : public CSS1Parser sal_uInt16 nMinFixLineSpace; // Mindest-Abstand fuer festen Zeilenabstand rtl_TextEncoding eDfltEnc; - sal_uInt16 nScriptFlags; + Css1ScriptFlags nScriptFlags; bool bIgnoreFontFamily; @@ -304,9 +310,9 @@ public: virtual void SetDfltEncoding( rtl_TextEncoding eEnc ); rtl_TextEncoding GetDfltEncoding() const { return eDfltEnc; } - bool IsSetWesternProps() const { return (nScriptFlags & CSS1_SCRIPT_WESTERN) != 0; } - bool IsSetCJKProps() const { return (nScriptFlags & CSS1_SCRIPT_CJK) != 0; } - bool IsSetCTLProps() const { return (nScriptFlags & CSS1_SCRIPT_CTL) != 0; } + bool IsSetWesternProps() const { return bool(nScriptFlags & Css1ScriptFlags::Western); } + bool IsSetCJKProps() const { return bool(nScriptFlags & Css1ScriptFlags::CJK); } + bool IsSetCTLProps() const { return bool(nScriptFlags & Css1ScriptFlags::CTL); } const OUString& GetBaseURL() const { return sBaseURL;} diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx index f79c39c..b3d8897 100644 --- a/sw/source/filter/html/swcss1.hxx +++ b/sw/source/filter/html/swcss1.hxx @@ -130,8 +130,8 @@ public: static bool MayBePositioned( const SvxCSS1PropertyInfo& rPropInfo, bool bAutoWidth=false ); - static sal_uInt16 GetScriptFromClass( OUString& rClass, - bool bSubClassOnly = true ); + static Css1ScriptFlags GetScriptFromClass( OUString& rClass, + bool bSubClassOnly = true ); bool IsBodyBGColorSet() const { return bBodyBGColorSet; } bool IsBodyBackgroundSet() const { return bBodyBackgroundSet; } commit adf1a2ba16a92ce8294a031ebf730cb3c1452d84 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 10:39:34 2016 +0200 convert SUBCOL constants to o3tl::typed_flags Change-Id: Ia772e168ac6bf286244712cebb471e869212e86e diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ba8fdc9..1509b74 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -98,6 +98,7 @@ #include <edtwin.hxx> #include <view.hxx> #include <paintfrm.hxx> +#include <o3tl/typed_flags_set.hxx> #include <vcl/BitmapTools.hxx> @@ -130,24 +131,28 @@ struct SwPaintProperties; SwViewOption::IsObjectBoundaries()) //Class declaration; here because they are only used in this file - -#define SUBCOL_PAGE 0x01 //Helplines of the page -#define SUBCOL_TAB 0x08 //Helplines inside tables -#define SUBCOL_FLY 0x10 //Helplines inside fly frames -#define SUBCOL_SECT 0x20 //Helplines inside sections +enum class SubColFlags { + Page = 0x01, //Helplines of the page + Tab = 0x08, //Helplines inside tables + Fly = 0x10, //Helplines inside fly frames + Sect = 0x20, //Helplines inside sections +}; +namespace o3tl { + template<> struct typed_flags<SubColFlags> : is_typed_flags<SubColFlags, 0x39> {}; +} // Classes collecting the border lines and help lines class SwLineRect : public SwRect { - Color aColor; - SvxBorderStyle nStyle; + Color aColor; + SvxBorderStyle nStyle; const SwTabFrame *pTab; - sal_uInt8 nSubColor; //colorize subsidiary lines - bool bPainted; //already painted? - sal_uInt8 nLock; //To distinguish the line and the hell layer. + SubColFlags nSubColor; //colorize subsidiary lines + bool bPainted; //already painted? + sal_uInt8 nLock; //To distinguish the line and the hell layer. public: SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle, - const SwTabFrame *pT , const sal_uInt8 nSCol ); + const SwTabFrame *pT , const SubColFlags nSCol ); const Color& GetColor() const { return aColor;} SvxBorderStyle GetStyle() const { return nStyle; } @@ -158,9 +163,9 @@ public: else if ( nLock ) --nLock; } - bool IsPainted() const { return bPainted; } - bool IsLocked() const { return nLock != 0; } - sal_uInt8 GetSubColor() const { return nSubColor;} + bool IsPainted() const { return bPainted; } + bool IsLocked() const { return nLock != 0; } + SubColFlags GetSubColor() const { return nSubColor;} bool MakeUnion( const SwRect &rRect, SwPaintProperties &properties ); }; @@ -194,7 +199,7 @@ public: #endif } void AddLineRect( const SwRect& rRect, const Color *pColor, const SvxBorderStyle nStyle, - const SwTabFrame *pTab, const sal_uInt8 nSCol, SwPaintProperties &properties ); + const SwTabFrame *pTab, const SubColFlags nSCol, SwPaintProperties &properties ); void ConnectEdges( OutputDevice *pOut, SwPaintProperties &properties ); void PaintLines ( OutputDevice *pOut, SwPaintProperties &properties ); void LockLines( bool bLock ); @@ -621,7 +626,7 @@ void BorderLines::AddBorderLine( } SwLineRect::SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyl, - const SwTabFrame *pT, const sal_uInt8 nSCol ) : + const SwTabFrame *pT, const SubColFlags nSCol ) : SwRect( rRect ), nStyle( nStyl ), pTab( pT ), @@ -671,7 +676,7 @@ bool SwLineRect::MakeUnion( const SwRect &rRect, SwPaintProperties& properties) } void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle, - const SwTabFrame *pTab, const sal_uInt8 nSCol, SwPaintProperties& properties ) + const SwTabFrame *pTab, const SubColFlags nSCol, SwPaintProperties& properties ) { // Loop backwards because lines which can be combined, can usually be painted // in the same context @@ -796,7 +801,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut, SwPaintProperties& propertie continue; aLineRects.push_back( SwLineRect( aIns, &rL1.GetColor(), table::BorderLineStyle::SOLID, - rL1.GetTab(), SUBCOL_TAB ) ); + rL1.GetTab(), SubColFlags::Tab ) ); if ( isFull() ) { --i; @@ -837,7 +842,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut, SwPaintProperties& propertie continue; aLineRects.push_back( SwLineRect( aIns, &rL1.GetColor(), table::BorderLineStyle::SOLID, - rL1.GetTab(), SUBCOL_TAB ) ); + rL1.GetTab(), SubColFlags::Tab ) ); if ( isFull() ) { --i; @@ -1208,10 +1213,10 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, const Color *pCol = nullptr; switch ( rLRect.GetSubColor() ) { - case SUBCOL_PAGE: pCol = &SwViewOption::GetDocBoundariesColor(); break; - case SUBCOL_FLY: pCol = &SwViewOption::GetObjectBoundariesColor(); break; - case SUBCOL_TAB: pCol = &SwViewOption::GetTableBoundariesColor(); break; - case SUBCOL_SECT: pCol = &SwViewOption::GetSectionBoundColor(); break; + case SubColFlags::Page: pCol = &SwViewOption::GetDocBoundariesColor(); break; + case SubColFlags::Fly: pCol = &SwViewOption::GetObjectBoundariesColor(); break; + case SubColFlags::Tab: pCol = &SwViewOption::GetTableBoundariesColor(); break; + case SubColFlags::Sect: pCol = &SwViewOption::GetSectionBoundColor(); break; } if (pCol && pOut->GetFillColor() != *pCol) @@ -4662,9 +4667,11 @@ void SwFrame::PaintBorderLine( const SwRect& rRect, aOut.Intersection_( rRect ); const SwTabFrame *pTab = IsCellFrame() ? FindTabFrame() : nullptr; - sal_uInt8 nSubCol = ( IsCellFrame() || IsRowFrame() ) ? SUBCOL_TAB : - ( IsInSct() ? SUBCOL_SECT : - ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) ); + SubColFlags nSubCol = ( IsCellFrame() || IsRowFrame() ) + ? SubColFlags::Tab + : ( IsInSct() + ? SubColFlags::Sect + : ( IsInFly() ? SubColFlags::Fly : SubColFlags::Page ) ); if( pColor && gProp.pSGlobalShell->GetWin() && Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) { @@ -6777,7 +6784,7 @@ static void lcl_RefreshLine( const SwLayoutFrame *pLay, const SwPageFrame *pPage, const Point &rP1, const Point &rP2, - const sal_uInt8 nSubColor, + const SubColFlags nSubColor, SwLineRects* pSubsLines ) { //In which direction do we loop? Can only be horizontal or vertical. @@ -7134,9 +7141,11 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, const Point aRB( nRight, nBottom ); const Point aLB( aOut.Left(), nBottom ); - sal_uInt8 nSubColor = ( bCell || IsRowFrame() ) ? SUBCOL_TAB : - ( IsInSct() ? SUBCOL_SECT : - ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) ); + SubColFlags nSubColor = ( bCell || IsRowFrame() ) + ? SubColFlags::Tab + : ( IsInSct() + ? SubColFlags::Sect + : ( IsInFly() ? SubColFlags::Fly : SubColFlags::Page ) ); // OD 18.11.2002 #99672# - collect body, header, footer, footnote and section // sub-lines in <pSpecSubsLine> array. commit d9c8738998cdbb11f8b2e221e8b61609ddf70811 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Nov 25 10:32:25 2016 +0200 convert HTML constants to scoped enums and typed_flags Change-Id: Iaaede23c95d08016023fc419c83725f437eda080 diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index d2aad8c..6c40de2 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2024,7 +2024,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) rHTMLWrt.ChangeParaToken( 0 ); // Output all the nodes that are anchored to a frame - rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HTML_POS_ANY ); + rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Any ); if( rHTMLWrt.m_bLFPossible ) rHTMLWrt.OutNewLine(); // paragraph tag on a new line @@ -2136,7 +2136,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) rHTMLWrt.m_bLFPossible = !rHTMLWrt.m_nLastParaToken; // Output all frames that are anchored to this node - rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HTML_POS_ANY ); + rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Any ); rHTMLWrt.m_bLFPossible = false; return rWrt; @@ -2189,13 +2189,13 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) rHTMLWrt.OutForm(); // Output the page-anchored frames that are 'anchored' to this node - bool bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HTML_POS_PREFIX ); + bool bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Prefix ); // Output all frames that are anchored to this node that are supposed to // be written before the paragraph tag. if( bFlysLeft ) { - bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HTML_POS_BEFORE ); + bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), 0, HtmlPosition::Before ); } if( rHTMLWrt.pCurPam->GetPoint()->nNode == rHTMLWrt.pCurPam->GetMark()->nNode ) @@ -2361,7 +2361,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) { aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext ); bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), - nStrPos, HTML_POS_INSIDE, + nStrPos, HtmlPosition::Inside, &aContext ); } @@ -2510,7 +2510,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) // Output the frames that are anchored to the last position if( bFlysLeft ) bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), - nEnd, HTML_POS_INSIDE ); + nEnd, HtmlPosition::Inside ); OSL_ENSURE( !bFlysLeft, "Not all frames were saved!" ); rHTMLWrt.m_bTextAttr = false; @@ -2848,7 +2848,7 @@ static Writer& OutHTML_SwFlyCnt( Writer& rWrt, const SfxPoolItem& rHt ) SwHTMLFrameType eType = (SwHTMLFrameType)rHTMLWrt.GuessFrameType( rFormat, pSdrObj ); - sal_uInt8 nMode = aHTMLOutFrameAsCharTable[eType][rHTMLWrt.m_nExportMode]; + AllHtmlFlags nMode = aHTMLOutFrameAsCharTable[eType][rHTMLWrt.m_nExportMode]; rHTMLWrt.OutFrameFormat( nMode, rFormat, pSdrObj ); return rWrt; } diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index ddabe12..14cd01e 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -37,17 +37,17 @@ using namespace css; SwHTMLPosFlyFrame::SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly, const SdrObject *pSdrObj, - sal_uInt8 nOutMode ) : + AllHtmlFlags nAllFlags ) : pFrameFormat( &rPosFly.GetFormat() ), pSdrObject( pSdrObj ), pNdIdx( new SwNodeIndex( rPosFly.GetNdIndex() ) ), nOrdNum( rPosFly.GetOrdNum() ), nContentIdx( 0 ), - nOutputMode( nOutMode ) + nAllFlags( nAllFlags ) { const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor(); if ((FLY_AT_CHAR == rAnchor.GetAnchorId()) && - HTML_POS_INSIDE == GetOutPos() ) + HtmlPosition::Inside == GetOutPos() ) { // Auto-gebundene Rahmen werden ein Zeichen weiter hinten // ausgegeben, weil dann die Positionierung mit Netscape diff --git a/sw/source/filter/html/htmlfly.hxx b/sw/source/filter/html/htmlfly.hxx index bec4aa7..8fe110c 100644 --- a/sw/source/filter/html/htmlfly.hxx +++ b/sw/source/filter/html/htmlfly.hxx @@ -22,6 +22,7 @@ #include <tools/solar.h> #include <o3tl/sorted_vector.hxx> +#include <o3tl/typed_flags_set.hxx> class SdrObject; class SwFrameFormat; @@ -48,48 +49,59 @@ enum SwHTMLFrameType HTML_FRMTYPE_END }; -#define HTML_OUT_TBLNODE 0x00 -#define HTML_OUT_GRFNODE 0x01 -#define HTML_OUT_OLENODE 0x02 -#define HTML_OUT_DIV 0x03 -#define HTML_OUT_MULTICOL 0x04 -#define HTML_OUT_SPACER 0x05 -#define HTML_OUT_CONTROL 0x06 -#define HTML_OUT_AMARQUEE 0x07 -#define HTML_OUT_MARQUEE 0x08 -#define HTML_OUT_GRFFRM 0x09 -#define HTML_OUT_OLEGRF 0x0a -#define HTML_OUT_SPAN 0x0b -#define HTML_OUT_MASK 0x0f - -#define HTML_POS_PREFIX 0x00 -#define HTML_POS_BEFORE 0x10 -#define HTML_POS_INSIDE 0x20 -#define HTML_POS_ANY 0x30 -#define HTML_POS_MASK 0x30 - -#define HTML_CNTNR_NONE 0x00 -#define HTML_CNTNR_SPAN 0x40 -#define HTML_CNTNR_DIV 0x80 -#define HTML_CNTNR_MASK 0xc0 +enum class HtmlOut { + TableNode, + GraphicNode, + OleNode, + Div, + MultiCol, + Spacer, + Control, + AMarquee, + Marquee, + GraphicFrame, + OleGraphic, + Span +}; + +enum class HtmlPosition { + Prefix, + Before, + Inside, + Any +}; + +enum class HtmlContainerFlags { + NONE = 0x00, + Span = 0x01, + Div = 0x02, +}; +namespace o3tl { + template<> struct typed_flags<HtmlContainerFlags> : is_typed_flags<HtmlContainerFlags, 0x03> {}; +} const sal_uInt16 MAX_FRMTYPES = HTML_FRMTYPE_END; const sal_uInt16 MAX_BROWSERS = 4; -extern sal_uInt8 aHTMLOutFramePageFlyTable[MAX_FRMTYPES][MAX_BROWSERS]; -extern sal_uInt8 aHTMLOutFrameParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS]; -extern sal_uInt8 aHTMLOutFrameParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS]; -extern sal_uInt8 aHTMLOutFrameParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS]; -extern sal_uInt8 aHTMLOutFrameAsCharTable[MAX_FRMTYPES][MAX_BROWSERS]; +struct AllHtmlFlags { + HtmlOut nOut; + HtmlPosition nPosition; + HtmlContainerFlags nContainer; +}; +extern AllHtmlFlags aHTMLOutFramePageFlyTable[MAX_FRMTYPES][MAX_BROWSERS]; +extern AllHtmlFlags aHTMLOutFrameParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS]; +extern AllHtmlFlags aHTMLOutFrameParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS]; +extern AllHtmlFlags aHTMLOutFrameParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS]; +extern AllHtmlFlags aHTMLOutFrameAsCharTable[MAX_FRMTYPES][MAX_BROWSERS]; class SwHTMLPosFlyFrame { - const SwFrameFormat *pFrameFormat; // der Rahmen - const SdrObject *pSdrObject; // ggf. Sdr-Objekt - SwNodeIndex *pNdIdx; // Node-Index - sal_uInt32 nOrdNum; // Aus SwPosFlyFrame - sal_Int32 nContentIdx; // seine Position im Content - sal_uInt8 nOutputMode; // Ausgabe-Infos + const SwFrameFormat *pFrameFormat; // der Rahmen + const SdrObject *pSdrObject; // ggf. Sdr-Objekt + SwNodeIndex *pNdIdx; // Node-Index + sal_uInt32 nOrdNum; // Aus SwPosFlyFrame + sal_Int32 nContentIdx; // seine Position im Content + AllHtmlFlags nAllFlags; SwHTMLPosFlyFrame(const SwHTMLPosFlyFrame&) = delete; SwHTMLPosFlyFrame& operator=(const SwHTMLPosFlyFrame&) = delete; @@ -97,24 +109,17 @@ class SwHTMLPosFlyFrame public: SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly, - const SdrObject *pSdrObj, sal_uInt8 nOutMode ); + const SdrObject *pSdrObj, AllHtmlFlags nAllFlags ); bool operator<( const SwHTMLPosFlyFrame& ) const; - const SwFrameFormat& GetFormat() const { return *pFrameFormat; } - const SdrObject *GetSdrObject() const { return pSdrObject; } - - const SwNodeIndex& GetNdIndex() const { return *pNdIdx; } - - sal_Int32 GetContentIndex() const { return nContentIdx; } - - sal_uInt8 GetOutMode() const { return nOutputMode; } - - static sal_uInt8 GetOutFn( sal_uInt8 nMode ) { return nMode & HTML_OUT_MASK; } - static sal_uInt8 GetOutCntnr( sal_uInt8 nMode ) { return nMode & HTML_CNTNR_MASK; } - - sal_uInt8 GetOutFn() const { return nOutputMode & HTML_OUT_MASK; } - sal_uInt8 GetOutPos() const { return nOutputMode & HTML_POS_MASK; } + const SwFrameFormat& GetFormat() const { return *pFrameFormat; } + const SdrObject* GetSdrObject() const { return pSdrObject; } + const SwNodeIndex& GetNdIndex() const { return *pNdIdx; } + sal_Int32 GetContentIndex() const { return nContentIdx; } + AllHtmlFlags GetOutMode() const { return nAllFlags; } + HtmlOut GetOutFn() const { return nAllFlags.nOut; } + HtmlPosition GetOutPos() const { return nAllFlags.nPosition; } }; class SwHTMLPosFlyFrames diff --git a/sw/source/filter/html/htmlflyt.cxx b/sw/source/filter/html/htmlflyt.cxx index f8b6102..a54492d 100644 --- a/sw/source/filter/html/htmlflyt.cxx +++ b/sw/source/filter/html/htmlflyt.cxx @@ -19,486 +19,486 @@ #include "htmlfly.hxx" -#define TE(t,p,c) (sal_uInt8)( HTML_OUT_##t | HTML_POS_##p | HTML_CNTNR_##c ) +#define TE(t,p,c) { HtmlOut::t, HtmlPosition::p, HtmlContainerFlags::c } -sal_uInt8 aHTMLOutFramePageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] = +AllHtmlFlags aHTMLOutFramePageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] = { { // Textrahmen mit Tabelle - TE(TBLNODE, BEFORE, NONE), // HTML 3.2 - TE(DIV, PREFIX, NONE), // IE 4 - TE(DIV, PREFIX, NONE), // SW - TE(DIV, PREFIX, NONE) // Netscape 4! + TE(TableNode, Before, NONE), // HTML 3.2 + TE(Div, Prefix, NONE), // IE 4 + TE(Div, Prefix, NONE), // SW + TE(Div, Prefix, NONE) // Netscape 4! }, { // Textrahmen mit Tabelle und Ueberschrift - TE(TBLNODE, BEFORE, NONE), // HTML 3.2 - TE(DIV, PREFIX, NONE), // IE 4 - TE(DIV, PREFIX, NONE), // SW - TE(DIV, PREFIX, NONE) // Netscape 4 + TE(TableNode, Before, NONE), // HTML 3.2 + TE(Div, Prefix, NONE), // IE 4 + TE(Div, Prefix, NONE), // SW + TE(Div, Prefix, NONE) // Netscape 4 }, { // spaltiger Rahmen - TE(GRFFRM, INSIDE, NONE), // HTML 3.2 - TE(GRFFRM, PREFIX, NONE), // IE 4 - TE(MULTICOL,PREFIX, NONE), // SW - TE(MULTICOL,PREFIX, DIV) // Netscape 4 + TE(GraphicFrame, Inside, NONE), // HTML 3.2 + TE(GraphicFrame, Prefix, NONE), // IE 4 + TE(MultiCol, Prefix, NONE), // SW + TE(MultiCol, Prefix, Div) // Netscape 4 }, { // leerer Textreahmen - TE(GRFFRM, INSIDE, NONE), // HTML 3.2 - TE(DIV, PREFIX, NONE), // IE 4 - TE(DIV, PREFIX, NONE), // SW - TE(DIV, PREFIX, NONE) // Netscape 4 + TE(GraphicFrame, Inside, NONE), // HTML 3.2 + TE(Div, Prefix, NONE), // IE 4 + TE(Div, Prefix, NONE), // SW + TE(Div, Prefix, NONE) // Netscape 4 }, { // sonstiger Textreahmen - TE(GRFFRM, INSIDE, NONE), // HTML 3.2 - TE(DIV, PREFIX, NONE), // IE 4 - TE(DIV, PREFIX, NONE), // SW - TE(DIV, PREFIX, NONE) // Netscape 4 + TE(GraphicFrame, Inside, NONE), // HTML 3.2 + TE(Div, Prefix, NONE), // IE 4 + TE(Div, Prefix, NONE), // SW + TE(Div, Prefix, NONE) // Netscape 4 }, { // Grafik-Node - TE(GRFNODE, INSIDE, NONE), // HTML 3.2 - TE(GRFNODE, PREFIX, NONE), // IE 4 - TE(GRFNODE, PREFIX, NONE), // SW - TE(GRFNODE, PREFIX, SPAN) // Netscape 4 + TE(GraphicNode, Inside, NONE), // HTML 3.2 + TE(GraphicNode, Prefix, NONE), // IE 4 + TE(GraphicNode, Prefix, NONE), // SW + TE(GraphicNode, Prefix, Span) // Netscape 4 }, { // Plugin - TE(OLENODE, INSIDE, NONE), // HTML 3.2 - TE(OLENODE, PREFIX, NONE), // IE 4 - TE(OLENODE, PREFIX, NONE), // SW - TE(OLENODE, PREFIX, SPAN) // Netscape 4 + TE(OleNode, Inside, NONE), // HTML 3.2 + TE(OleNode, Prefix, NONE), // IE 4 + TE(OleNode, Prefix, NONE), // SW + TE(OleNode, Prefix, Span) // Netscape 4 }, { // Applet - TE(OLENODE, INSIDE, NONE), // HTML 3.2 - TE(OLENODE, PREFIX, NONE), // IE 4 - TE(OLENODE, PREFIX, NONE), // SW - TE(OLENODE, PREFIX, SPAN) // Netscape 4 + TE(OleNode, Inside, NONE), // HTML 3.2 + TE(OleNode, Prefix, NONE), // IE 4 + TE(OleNode, Prefix, NONE), // SW + TE(OleNode, Prefix, Span) // Netscape 4 }, { // Floating-Frame - TE(OLEGRF, INSIDE, NONE), // HTML 3.2 - TE(OLENODE, PREFIX, NONE), // IE 4 - TE(OLENODE, PREFIX, NONE), // SW - TE(OLEGRF, PREFIX, SPAN) // Netscape 4 + TE(OleGraphic, Inside, NONE), // HTML 3.2 + TE(OleNode, Prefix, NONE), // IE 4 + TE(OleNode, Prefix, NONE), // SW + TE(OleGraphic, Prefix, Span) // Netscape 4 }, { // sonstige OLE-Objekte - TE(OLEGRF, INSIDE, NONE), // HTML 3.2 - TE(OLEGRF, PREFIX, NONE), // IE 4 - TE(OLEGRF, PREFIX, NONE), // SW - TE(OLEGRF, PREFIX, SPAN) // Netscape 4 + TE(OleGraphic, Inside, NONE), // HTML 3.2 + TE(OleGraphic, Prefix, NONE), // IE 4 + TE(OleGraphic, Prefix, NONE), // SW + TE(OleGraphic, Prefix, Span) // Netscape 4 }, { // Laufschrift - TE(GRFFRM, INSIDE, NONE), // HTML 3.2 - TE(AMARQUEE,PREFIX, NONE), // IE 4 - TE(AMARQUEE,PREFIX, NONE), // SW - TE(GRFFRM, PREFIX, SPAN) // Netscape 4 + TE(GraphicFrame, Inside, NONE), // HTML 3.2 + TE(AMarquee, Prefix, NONE), // IE 4 + TE(AMarquee, Prefix, NONE), // SW + TE(GraphicFrame, Prefix, Span) // Netscape 4 }, { // Controls - TE(CONTROL, INSIDE, NONE), // HTML 3.2 - TE(CONTROL, PREFIX, NONE), // IE 4 - TE(CONTROL, PREFIX, NONE), // SW - // Netscape schaltet FORM bei Controls in abs.-pos. SPAN aus. - TE(CONTROL, INSIDE, NONE) // Netscape 4 + TE(Control, Inside, NONE), // HTML 3.2 + TE(Control, Prefix, NONE), // IE 4 + TE(Control, Prefix, NONE), // SW + // Netscape schaltet FORM bei Controls in abs.-pos. Span aus. + TE(Control, Inside, NONE) // Netscape 4 }, { // sonstige Zeichen-Objekte - TE(GRFFRM, INSIDE, NONE), // HTML 3.2 - TE(GRFFRM, PREFIX, NONE), // IE 4 - TE(GRFFRM, PREFIX, NONE), // SW - TE(GRFFRM, PREFIX, SPAN) // Netscape 4 + TE(GraphicFrame, Inside, NONE), // HTML 3.2 + TE(GraphicFrame, Prefix, NONE), // IE 4 + TE(GraphicFrame, Prefix, NONE), // SW + TE(GraphicFrame, Prefix, Span) // Netscape 4 } }; -sal_uInt8 aHTMLOutFrameParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] = +AllHtmlFlags aHTMLOutFrameParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] = { { // Textrahmen mit Tabelle - TE(TBLNODE, BEFORE, NONE), // HTML 3.2 - TE(TBLNODE, BEFORE, NONE), // IE 4 - TE(TBLNODE, BEFORE, NONE), // SW - TE(TBLNODE, BEFORE, NONE) // Netscape 4 + TE(TableNode, Before, NONE), // HTML 3.2 + TE(TableNode, Before, NONE), // IE 4 + TE(TableNode, Before, NONE), // SW + TE(TableNode, Before, NONE) // Netscape 4 }, { // Textrahmen mit Tabelle und Ueberschrift - TE(TBLNODE, BEFORE, NONE), // HTML 3.2 - TE(DIV, BEFORE, NONE), // IE 4 - TE(DIV, BEFORE, NONE), // SW - TE(TBLNODE, BEFORE, NONE) // Netscape 4 + TE(TableNode, Before, NONE), // HTML 3.2 + TE(Div, Before, NONE), // IE 4 + TE(Div, Before, NONE), // SW + TE(TableNode, Before, NONE) // Netscape 4 }, { // spaltiger Rahmen - TE(GRFFRM, BEFORE, NONE), // HTML 3.2 - TE(GRFFRM, BEFORE, NONE), // IE 4 - TE(MULTICOL,BEFORE, NONE), // SW - TE(MULTICOL,BEFORE, DIV) // Netscape 4 + TE(GraphicFrame, Before, NONE), // HTML 3.2 + TE(GraphicFrame, Before, NONE), // IE 4 + TE(MultiCol, Before, NONE), // SW + TE(MultiCol, Before, Div) // Netscape 4 }, { // leerer Textreahmen - TE(GRFFRM, BEFORE, NONE), // HTML 3.2 - TE(DIV, BEFORE, NONE), // IE 4 - TE(SPACER, BEFORE, NONE), // SW - TE(SPACER, BEFORE, NONE) // Netscape 4 + TE(GraphicFrame, Before, NONE), // HTML 3.2 + TE(Div, Before, NONE), // IE 4 + TE(Spacer, Before, NONE), // SW + TE(Spacer, Before, NONE) // Netscape 4 }, { // sonstiger Textreahmen - TE(GRFFRM, BEFORE, NONE), // HTML 3.2 - TE(DIV, BEFORE, NONE), // IE 4 - TE(DIV, BEFORE, NONE), // SW - TE(DIV, BEFORE, NONE) // Netscape 4 + TE(GraphicFrame, Before, NONE), // HTML 3.2 + TE(Div, Before, NONE), // IE 4 + TE(Div, Before, NONE), // SW + TE(Div, Before, NONE) // Netscape 4 }, { // Grafik-Node - TE(GRFNODE, BEFORE, NONE), // HTML 3.2 - TE(GRFNODE, BEFORE, NONE), // IE 4 - TE(GRFNODE, BEFORE, NONE), // SW - TE(GRFNODE, BEFORE, NONE) // Netscape 4 + TE(GraphicNode, Before, NONE), // HTML 3.2 + TE(GraphicNode, Before, NONE), // IE 4 + TE(GraphicNode, Before, NONE), // SW + TE(GraphicNode, Before, NONE) // Netscape 4 }, { // Plugin - TE(OLENODE, BEFORE, NONE), // HTML 3.2 - TE(OLENODE, BEFORE, NONE), // IE 4 - TE(OLENODE, BEFORE, NONE), // SW - TE(OLENODE, BEFORE, NONE) // Netscape 4 + TE(OleNode, Before, NONE), // HTML 3.2 + TE(OleNode, Before, NONE), // IE 4 + TE(OleNode, Before, NONE), // SW + TE(OleNode, Before, NONE) // Netscape 4 }, { // Applet - TE(OLENODE, BEFORE, NONE), // HTML 3.2 - TE(OLENODE, BEFORE, NONE), // IE 4 - TE(OLENODE, BEFORE, NONE), // SW - TE(OLENODE, BEFORE, NONE) // Netscape 4 + TE(OleNode, Before, NONE), // HTML 3.2 + TE(OleNode, Before, NONE), // IE 4 + TE(OleNode, Before, NONE), // SW + TE(OleNode, Before, NONE) // Netscape 4 }, { // Floating-Frame - TE(OLEGRF, BEFORE, NONE), // HTML 3.2 - TE(OLENODE, BEFORE, NONE), // IE 4 - TE(OLENODE, BEFORE, NONE), // SW - TE(OLEGRF, BEFORE, NONE) // Netscape 4 + TE(OleGraphic, Before, NONE), // HTML 3.2 + TE(OleNode, Before, NONE), // IE 4 + TE(OleNode, Before, NONE), // SW + TE(OleGraphic, Before, NONE) // Netscape 4 }, { // sonstige OLE-Objekte - TE(OLEGRF, BEFORE, NONE), // HTML 3.2 - TE(OLEGRF, BEFORE, NONE), // IE 4 - TE(OLEGRF, BEFORE, NONE), // SW - TE(OLEGRF, BEFORE, NONE) // Netscape 4 + TE(OleGraphic, Before, NONE), // HTML 3.2 + TE(OleGraphic, Before, NONE), // IE 4 + TE(OleGraphic, Before, NONE), // SW + TE(OleGraphic, Before, NONE) // Netscape 4 }, { // Laufschrift (fuer Netscape 4 im Container, damit // die LAufschrift an der richtigen Stelle erscheint - TE(GRFFRM, BEFORE, NONE), // HTML 3.2 - TE(AMARQUEE,BEFORE, NONE), // IE 4 - TE(AMARQUEE,BEFORE, NONE), // SW - TE(GRFFRM, BEFORE, NONE) // Netscape 4 + TE(GraphicFrame, Before, NONE), // HTML 3.2 + TE(AMarquee, Before, NONE), // IE 4 + TE(AMarquee, Before, NONE), // SW + TE(GraphicFrame, Before, NONE) // Netscape 4 }, { // Controls - TE(CONTROL, INSIDE, NONE), // HTML 3.2 - TE(CONTROL, BEFORE, NONE), // IE 4 - TE(CONTROL, BEFORE, NONE), // SW + TE(Control, Inside, NONE), // HTML 3.2 + TE(Control, Before, NONE), // IE 4 + TE(Control, Before, NONE), // SW // hier koennte man einen Container draus machen (Import fehlt) - TE(CONTROL, BEFORE, NONE) // Netscape 4 + TE(Control, Before, NONE) // Netscape 4 }, { // sonstige Zeichen-Objekte ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits