sw/inc/swabstdlg.hxx | 3 sw/inc/swmodule.hxx | 13 - sw/source/core/access/accmap.cxx | 23 -- sw/source/core/access/accpara.cxx | 2 sw/source/core/crsr/callnk.cxx | 2 sw/source/core/doc/DocumentDeviceManager.cxx | 2 sw/source/core/doc/DocumentSettingManager.cxx | 4 sw/source/core/doc/lineinfo.cxx | 4 sw/source/core/doc/notxtfrm.cxx | 2 sw/source/core/docnode/node2lay.cxx | 2 sw/source/core/fields/reffld.cxx | 6 sw/source/core/frmedt/fews.cxx | 22 - sw/source/core/frmedt/tblsel.cxx | 4 sw/source/core/inc/SwXMLTextBlocks.hxx | 2 sw/source/core/inc/ascharanchoredobjectposition.hxx | 49 ++-- sw/source/core/inc/frame.hxx | 108 +++++---- sw/source/core/inc/frmtool.hxx | 4 sw/source/core/inc/ftnboss.hxx | 13 - sw/source/core/inc/hffrm.hxx | 6 sw/source/core/inc/layfrm.hxx | 4 sw/source/core/inc/rootfrm.hxx | 26 +- sw/source/core/inc/sectfrm.hxx | 9 sw/source/core/inc/swblocks.hxx | 16 - sw/source/core/layout/atrfrm.cxx | 8 sw/source/core/layout/calcmove.cxx | 6 sw/source/core/layout/colfrm.cxx | 2 sw/source/core/layout/dbg_lay.cxx | 10 sw/source/core/layout/dumpfilter.cxx | 2 sw/source/core/layout/flowfrm.cxx | 2 sw/source/core/layout/fly.cxx | 4 sw/source/core/layout/flylay.cxx | 15 - sw/source/core/layout/frmtool.cxx | 28 +- sw/source/core/layout/ftnfrm.cxx | 30 +- sw/source/core/layout/hffrm.cxx | 2 sw/source/core/layout/layouter.cxx | 2 sw/source/core/layout/newfrm.cxx | 2 sw/source/core/layout/pagechg.cxx | 11 sw/source/core/layout/pagedesc.cxx | 4 sw/source/core/layout/paintfrm.cxx | 2 sw/source/core/layout/sectfrm.cxx | 18 - sw/source/core/layout/tabfrm.cxx | 8 sw/source/core/layout/trvlfrm.cxx | 9 sw/source/core/layout/wsfrm.cxx | 114 +++++----- sw/source/core/objectpositioning/anchoredobjectposition.cxx | 4 sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx | 20 - sw/source/core/swg/SwXMLTextBlocks.cxx | 4 sw/source/core/swg/swblocks.cxx | 23 +- sw/source/core/text/EnhancedPDFExportHelper.cxx | 24 +- sw/source/core/text/itrform2.cxx | 22 - sw/source/core/text/porfly.cxx | 12 - sw/source/core/text/porfly.hxx | 6 sw/source/core/text/porrst.cxx | 4 sw/source/core/text/txtfly.cxx | 2 sw/source/core/text/txtfrm.cxx | 2 sw/source/core/text/txtftn.cxx | 2 sw/source/core/text/xmldump.cxx | 34 +- sw/source/core/view/viewsh.cxx | 24 +- sw/source/ui/chrdlg/chardlg.cxx | 8 sw/source/ui/dialog/swdlgfact.cxx | 2 sw/source/ui/dialog/swdlgfact.hxx | 2 sw/source/ui/envelp/envfmt.cxx | 2 sw/source/uibase/app/appopt.cxx | 2 sw/source/uibase/app/swmodul1.cxx | 8 sw/source/uibase/docvw/PostItMgr.cxx | 2 sw/source/uibase/inc/chrdlg.hxx | 12 - sw/source/uibase/inc/chrdlgmodes.hxx | 7 sw/source/uibase/inc/numberingtypelistbox.hxx | 20 + sw/source/uibase/misc/numberingtypelistbox.cxx | 16 - sw/source/uibase/shells/annotsh.cxx | 2 sw/source/uibase/shells/drwtxtex.cxx | 2 sw/source/uibase/shells/textsh1.cxx | 2 sw/source/uibase/uiview/view0.cxx | 2 sw/source/uibase/uno/unomod.cxx | 6 73 files changed, 463 insertions(+), 420 deletions(-)
New commits: commit 3d7ac24d2f2ffbd2f5919916534601c140aa82e8 Author: Noel Grandin <noelgran...@gmail.com> Date: Thu Mar 31 09:22:57 2016 +0200 tdf#84938 convert DLG_CHAR_ constants to scoped enum Change-Id: Ia58860f3f106d332596d2a682638edae6a270213 diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index e0ae207..12f00c8 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -73,6 +73,7 @@ struct SfxChildWinInfo; class SwTOXMark; struct SwDocStat; enum class SwBorderModes; +enum class SwCharDlgMode; #include <cnttab.hxx> namespace com{namespace sun{namespace star{ @@ -336,7 +337,7 @@ public: virtual AbstractSwBreakDlg * CreateSwBreakDlg(vcl::Window *pParent, SwWrtShell &rSh) = 0; virtual VclAbstractDialog * CreateSwChangeDBDlg(SwView& rVw) = 0; virtual SfxAbstractTabDialog * CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, - sal_uInt8 nDialogMode, const OUString* pFormatStr = nullptr) = 0; + SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) = 0; virtual AbstractSwConvertTableDlg* CreateSwConvertTableDlg(SwView& rView, bool bToTable) = 0; virtual VclAbstractDialog * CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV,int nResId) = 0; diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index fa8a26a..9ebfad1 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -60,7 +60,7 @@ using namespace ::com::sun::star::uno; using namespace ::sfx2; SwCharDlg::SwCharDlg(vcl::Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet, - sal_uInt8 nDialogMode, const OUString* pStr) + SwCharDlgMode nDialogMode, const OUString* pStr) : SfxTabDialog(pParent, "CharacterPropertiesDialog", "modules/swriter/ui/characterproperties.ui", &rCoreSet, pStr != nullptr) , m_rView(rVw) @@ -81,7 +81,7 @@ SwCharDlg::SwCharDlg(vcl::Window* pParent, SwView& rVw, const SfxItemSet& rCoreS m_nCharBrdId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr ); SvtCJKOptions aCJKOptions; - if(m_nDialogMode == DLG_CHAR_DRAW || m_nDialogMode == DLG_CHAR_ANN) + if(m_nDialogMode == SwCharDlgMode::Draw || m_nDialogMode == SwCharDlgMode::Ann) { RemoveTabPage(m_nCharUrlId); RemoveTabPage(m_nCharBgdId); @@ -90,7 +90,7 @@ SwCharDlg::SwCharDlg(vcl::Window* pParent, SwView& rVw, const SfxItemSet& rCoreS else if(!aCJKOptions.IsDoubleLinesEnabled()) RemoveTabPage(m_nCharTwoId); - if(m_nDialogMode != DLG_CHAR_STD) + if(m_nDialogMode != SwCharDlgMode::Std) RemoveTabPage(m_nCharBrdId); } @@ -107,7 +107,7 @@ void SwCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>( ( m_rView.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) ) ); aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST)); - if(m_nDialogMode != DLG_CHAR_DRAW && m_nDialogMode != DLG_CHAR_ANN) + if(m_nDialogMode != SwCharDlgMode::Draw && m_nDialogMode != SwCharDlgMode::Ann) aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); rPage.PageCreated(aSet); } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 9a1888f..d810c71 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -707,7 +707,7 @@ VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwView& } SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, - const SfxItemSet& rCoreSet, sal_uInt8 nDialogMode, const OUString* pFormatStr) + const SfxItemSet& rCoreSet, SwCharDlgMode nDialogMode, const OUString* pFormatStr) { VclPtr<SfxTabDialog> pDlg = VclPtr<SwCharDlg>::Create(pParent, pVw, rCoreSet, nDialogMode, pFormatStr); return new AbstractTabDialog_Impl(pDlg); diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index eedba05..62d0ccb 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -382,7 +382,7 @@ public: virtual AbstractSwBreakDlg * CreateSwBreakDlg(vcl::Window *pParent, SwWrtShell &rSh) override; virtual VclAbstractDialog * CreateSwChangeDBDlg(SwView& rVw) override; virtual SfxAbstractTabDialog * CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, - sal_uInt8 nDialogMode, const OUString* pFormatStr = nullptr) override; + SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) override; virtual AbstractSwConvertTableDlg* CreateSwConvertTableDlg(SwView& rView, bool bToTable) override; virtual VclAbstractDialog * CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV,int nResId) override; diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 7d3bbb9..a7183f1 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -283,7 +283,7 @@ IMPL_LINK_TYPED( SwEnvFormatPage, EditHdl, MenuButton *, pButton, void ) OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); const OUString sFormatStr = pColl->GetName(); - std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_CHAR_ENV, &sFormatStr)); + std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); OSL_ENSURE(pDlg, "Dialog creation failed!"); if (pDlg->Execute() == RET_OK) { diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index f37e525..36acfa2 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1437,7 +1437,7 @@ void SwPostItMgr::ExecuteFormatAllDialog(SwView& rView) SfxItemSet aDlgAttr(*pPool, EE_ITEMS_START, EE_ITEMS_END); aDlgAttr.Put(aEditAttr); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(rView.GetWindow(), rView, aDlgAttr, DLG_CHAR_ANN)); + std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(rView.GetWindow(), rView, aDlgAttr, SwCharDlgMode::Ann)); sal_uInt16 nRet = pDlg->Execute(); if (RET_OK == nRet) { diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx index dbe8743..5f14828 100644 --- a/sw/source/uibase/inc/chrdlg.hxx +++ b/sw/source/uibase/inc/chrdlg.hxx @@ -18,19 +18,15 @@ */ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLG_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLG_HXX -#include <sfx2/tabdlg.hxx> +#include <sfx2/tabdlg.hxx> #include <vcl/group.hxx> - #include <vcl/fixed.hxx> - #include <vcl/edit.hxx> - #include <vcl/combobox.hxx> - #include <vcl/button.hxx> - #include <vcl/lstbox.hxx> +#include <chrdlgmodes.hxx> class SwView; class SvxMacroItem; @@ -38,7 +34,7 @@ class SvxMacroItem; class SwCharDlg: public SfxTabDialog { SwView& m_rView; - sal_uInt8 m_nDialogMode; + SwCharDlgMode m_nDialogMode; sal_uInt16 m_nCharStdId; sal_uInt16 m_nCharExtId; @@ -50,7 +46,7 @@ class SwCharDlg: public SfxTabDialog public: SwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, - sal_uInt8 nDialogMode, const OUString* pFormatStr = nullptr); + SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr); virtual ~SwCharDlg(); diff --git a/sw/source/uibase/inc/chrdlgmodes.hxx b/sw/source/uibase/inc/chrdlgmodes.hxx index e4b9fb3..cddb6a9 100644 --- a/sw/source/uibase/inc/chrdlgmodes.hxx +++ b/sw/source/uibase/inc/chrdlgmodes.hxx @@ -11,10 +11,9 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLGMODES_HXX // DialogModes for SwCharDlg -#define DLG_CHAR_STD 0 -#define DLG_CHAR_DRAW 1 -#define DLG_CHAR_ENV 2 -#define DLG_CHAR_ANN 3 +enum class SwCharDlgMode { + Std, Draw, Env, Ann +}; #endif // INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLGMODES_HXX diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 2876d0b..0470216 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -490,7 +490,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR_ANN)); + std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, SwCharDlgMode::Ann)); OSL_ENSURE(pDlg, "Dialog creation failed!"); if (nSlot == SID_CHAR_DLG_EFFECT) { diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 00b10a5..4bbd6a9 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -345,7 +345,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "SwAbstractDialogFactory fail!"); - std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR_DRAW)); + std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, SwCharDlgMode::Draw)); assert(pDlg && "Dialog creation failed!"); if (nSlot == SID_CHAR_DLG_EFFECT) { diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 70ddbcf..c61f88a 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -173,7 +173,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR_STD)); + pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, SwCharDlgMode::Std)); OSL_ENSURE(pDlg, "Dialog creation failed!"); if( FN_INSERT_HYPERLINK == nSlot ) pDlg->SetCurPageId("hyperlink"); commit 2cc5877a0cd08560478fe1f4206d7904e61e0557 Author: Noel Grandin <noelgran...@gmail.com> Date: Thu Mar 31 09:13:28 2016 +0200 tdf#84938 convert INSERT_NUM_ constants to scoped enum Change-Id: If5880558bb04a71ebc4ef76aa4f5aac3d10040f9 diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx index ce553db..965e32e 100644 --- a/sw/source/uibase/inc/numberingtypelistbox.hxx +++ b/sw/source/uibase/inc/numberingtypelistbox.hxx @@ -21,12 +21,20 @@ #include <vcl/lstbox.hxx> #include "swdllapi.h" +#include <o3tl/typed_flags_set.hxx> -#define INSERT_NUM_TYPE_NO_NUMBERING 0x01 -#define INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING 0x02 -#define INSERT_NUM_TYPE_BITMAP 0x04 -#define INSERT_NUM_TYPE_BULLET 0x08 -#define INSERT_NUM_EXTENDED_TYPES 0x10 +enum class SwInsertNumTypes +{ + NoNumbering = 0x01, + PageStyleNumbering = 0x02, + Bitmap = 0x04, + Bullet = 0x08, + Extended = 0x10 +}; + +namespace o3tl { + template<> struct typed_flags<SwInsertNumTypes> : is_typed_flags<SwInsertNumTypes, 0x1f> {}; +}; struct SwNumberingTypeListBox_Impl; @@ -41,7 +49,7 @@ public: virtual bool set_property(const OString &rKey, const OString &rValue) override; - void Reload(sal_uInt16 nTypeFlags); + void Reload(SwInsertNumTypes nTypeFlags); sal_Int16 GetSelectedNumberingType(); bool SelectNumberingType(sal_Int16 nType); diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index faf6f32..a0eeb51 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -49,7 +49,7 @@ SwNumberingTypeListBox::SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyl bool SwNumberingTypeListBox::set_property(const OString &rKey, const OString &rValue) { if (rKey == "type") - Reload(rValue.toInt32()); + Reload(static_cast<SwInsertNumTypes>(rValue.toInt32())); else return ListBox::set_property(rKey, rValue); return true; @@ -74,12 +74,12 @@ void SwNumberingTypeListBox::dispose() ListBox::dispose(); } -void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) +void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags) { Clear(); uno::Sequence<sal_Int16> aTypes; const sal_Int16* pTypes = nullptr; - if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) ) + if(nTypeFlags & SwInsertNumTypes::Extended) { if(pImpl->xInfo.is()) { @@ -97,20 +97,20 @@ void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) switch(nValue) { case style::NumberingType::NUMBER_NONE: - bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_NO_NUMBERING); + bInsert = bool(nTypeFlags & SwInsertNumTypes::NoNumbering); nPos = 0; break; case style::NumberingType::CHAR_SPECIAL: - bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BULLET); + bInsert = bool(nTypeFlags & SwInsertNumTypes::Bullet); break; case style::NumberingType::PAGE_DESCRIPTOR: - bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING); + bInsert = bool(nTypeFlags & SwInsertNumTypes::PageStyleNumbering); break; case style::NumberingType::BITMAP: - bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BITMAP ); + bInsert = bool(nTypeFlags & SwInsertNumTypes::Bitmap ); break; default: @@ -137,7 +137,7 @@ void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) SetEntryData( nEntry, reinterpret_cast<void*>(nValue) ); } } - if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) ) + if(nTypeFlags & SwInsertNumTypes::Extended) { if(pTypes) { commit 81fbf1386a36972be7d3eff3f7a0c6bab80be764 Author: Noel Grandin <noelgran...@gmail.com> Date: Thu Mar 31 09:06:20 2016 +0200 tdf#84938 convert VIEWOPT_ constants to scoped enum Change-Id: I7d72ed66ea2cf920a0a03a2aa71b5de079f0cf6e diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 4dedce7..05b74ee 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -54,10 +54,13 @@ class SvtCTLOptions; class SvtUserOptions; struct SwDBData; -#define VIEWOPT_DEST_VIEW 0 -#define VIEWOPT_DEST_TEXT 1 -#define VIEWOPT_DEST_WEB 2 -#define VIEWOPT_DEST_VIEW_ONLY 3 //ViewOptions are set only at View, not at the appl. + +enum class SvViewOpt { + DestView, + DestText, + DestWeb, + DestViewOnly //ViewOptions are set only at View, not at the appl. +}; namespace com{ namespace sun{ namespace star{ namespace scanner{ class XScannerManager2; @@ -145,7 +148,7 @@ public: const SwMasterUsrPref *GetUsrPref(bool bWeb) const; const SwViewOption* GetViewOption(bool bWeb); void ApplyUsrPref(const SwViewOption &, SwView*, - sal_uInt16 nDest = VIEWOPT_DEST_VIEW ); + SvViewOpt nDest = SvViewOpt::DestView ); void ApplyUserMetric( FieldUnit eMetric, bool bWeb ); void ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb ); void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 51ca86c..f4f31a2 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -414,7 +414,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) aViewOpt.SetIgnoreProtectedArea(static_cast<const SfxBoolItem*>(pItem)->GetValue()); // set elements for the current view and shell - ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); + ApplyUsrPref( aViewOpt, pAppView, bTextDialog? SvViewOpt::DestText : SvViewOpt::DestWeb); } VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index ad02fe8..c30b361 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -136,18 +136,18 @@ SwView* SwModule::GetNextView(SwView* pView) // New Master for the settings is set; this affects the current view and all following. void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView, - sal_uInt16 nDest ) + SvViewOpt nDest ) { SwView* pCurrView = pActView; SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : nullptr; SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref( - nDest == VIEWOPT_DEST_WEB - || (nDest != VIEWOPT_DEST_TEXT + nDest == SvViewOpt::DestWeb + || (nDest != SvViewOpt::DestText && pCurrView && dynamic_cast< const SwWebView *>( pCurrView ) != nullptr) )); // with Uno, only sdbcx::View, but not the Module should be changed - bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest; + bool bViewOnly = SvViewOpt::DestViewOnly == nDest; // fob Preview off SwPagePreview* pPPView; if( !pCurrView && nullptr != (pPPView = dynamic_cast<SwPagePreview*>( SfxViewShell::Current())) ) diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 37631c6..297189b 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -591,7 +591,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) if( !bModified ) rSh.ResetModified(); - pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); + pModule->ApplyUsrPref( *pOpt, this, bWebView ? SvViewOpt::DestWeb : SvViewOpt::DestText ); // #i6193# let postits know about new spellcheck setting if ( nSlot == SID_AUTOSPELL_CHECK ) diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 195dfce..1d5e87b 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -810,9 +810,9 @@ void SwXViewSettings::_postSetValues() SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, bWeb ); } - SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY - : bWeb ? VIEWOPT_DEST_WEB - : VIEWOPT_DEST_TEXT ); + SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? SvViewOpt::DestViewOnly + : bWeb ? SvViewOpt::DestWeb + : SvViewOpt::DestText ); delete mpViewOption; mpViewOption = nullptr; commit 77c494de9bf9191a66fb6f90cc2148f60c25c088 Author: Noel Grandin <noelgran...@gmail.com> Date: Thu Mar 31 07:30:25 2016 +0200 tdf#84938 convert AS_CHAR_ constants to scoped enum Change-Id: I8800c0ae0b028d2c4c4eb4609c44190928a2de9e diff --git a/sw/source/core/inc/ascharanchoredobjectposition.hxx b/sw/source/core/inc/ascharanchoredobjectposition.hxx index 207130b..2f802e6 100644 --- a/sw/source/core/inc/ascharanchoredobjectposition.hxx +++ b/sw/source/core/inc/ascharanchoredobjectposition.hxx @@ -24,22 +24,27 @@ #include <sal/types.h> #include <swtypes.hxx> #include <swrect.hxx> +#include <o3tl/typed_flags_set.hxx> class SwTextFrame; class SwFormatVertOrient; +// flags for positioning algorithm of as-character-anchored objects +enum class AsCharFlags { + None = 0x00, + Quick = 0x01, + UlSpace = 0x02, + Init = 0x04, + Rotate = 0x08, + Reverse = 0x10, + Bidi = 0x20, +}; +namespace o3tl { + template<> struct typed_flags<AsCharFlags> : is_typed_flags<AsCharFlags, 0x3f> {}; +}; + namespace objectpositioning { - // flags for positioning algorithm of as-character-anchored objects - typedef sal_uInt8 AsCharFlags; - #define AS_CHAR_NOFLAG 0 - #define AS_CHAR_QUICK 1 - #define AS_CHAR_ULSPACE 2 - #define AS_CHAR_INIT 4 - #define AS_CHAR_ROTATE 8 - #define AS_CHAR_REVERSE 16 - #define AS_CHAR_BIDI 32 - class SwAsCharAnchoredObjectPosition : public SwAnchoredObjectPosition { private: @@ -48,12 +53,12 @@ namespace objectpositioning // of the object position. const Point& mrProposedAnchorPos; // flags that influences the calculation of the anchor position - // AS_CHAR_QUICK : quick formatting - calculated position not set at object - // AS_CHAR_ULSPACE : consider upper/lower spacing - adjustment of anchor position - // AS_CHAR_INIT : initial calculation - // AS_CHAR_ROTATE : object is rotated by 90 degrees - // AS_CHAR_REVERSE : object is reversed (rotated by 270 degrees) - // AS_CHAR_BIDI : object belongs to a BIDI-multi-portion + // AsCharFlags::Quick : quick formatting - calculated position not set at object + // AsCharFlags::UlSpace : consider upper/lower spacing - adjustment of anchor position + // AsCharFlags::Init : initial calculation + // AsCharFlags::Rotate : object is rotated by 90 degrees + // AsCharFlags::Reverse : object is reversed (rotated by 270 degrees) + // AsCharFlags::Bidi : object belongs to a BIDI-multi-portion const AsCharFlags mnFlags; // needed line values for the different alignments. const SwTwips mnLineAscent; @@ -99,12 +104,12 @@ namespace objectpositioning @param _nFlags flags that influences the calculation of the anchor position - AS_CHAR_QUICK : quick formatting - calculated position not set at object - AS_CHAR_ULSPACE : consider upper/lower spacing - adjustment of anchor position - AS_CHAR_INIT : initial calculation - AS_CHAR_ROTATE : object is rotated by 90 degrees - AS_CHAR_REVERSE : object is reversed (rotated by 270 degrees) - AS_CHAR_BIDI : object belongs to a BIDI-multi-portion + AsCharFlags::Quick : quick formatting - calculated position not set at object + AsCharFlags::UlSpace : consider upper/lower spacing - adjustment of anchor position + AsCharFlags::Init : initial calculation + AsCharFlags::Rotate : object is rotated by 90 degrees + AsCharFlags::Reverse : object is reversed (rotated by 270 degrees) + AsCharFlags::Bidi : object belongs to a BIDI-multi-portion @param _nLineAscent, _nLineDescent, _nLineAscentInclObjs, _nLineDescentInclObjs - needed line values for the different diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx index 3082bb5..412b460 100644 --- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx @@ -129,7 +129,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() // consider left and upper spacing by adjusting anchor position. // left spacing is only considered, if requested. - if( mnFlags & AS_CHAR_ULSPACE ) + if( mnFlags & AsCharFlags::UlSpace ) { aAnchorPos.X() += nLRSpaceLeft; } @@ -146,7 +146,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() rAnchorFrame.SwitchVerticalToHorizontal( aSnapRect ); } - if( mnFlags & AS_CHAR_ULSPACE ) + if( mnFlags & AsCharFlags::UlSpace ) { aAnchorPos.X() += aSnapRect.Left() - aObjBoundRect.Left(); } @@ -161,7 +161,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() // calculate relative position to given base line. const SwFormatVertOrient& rVert = rFrameFormat.GetVertOrient(); - const SwTwips nObjBoundHeight = ( mnFlags & AS_CHAR_ROTATE ) + const SwTwips nObjBoundHeight = ( mnFlags & AsCharFlags::Rotate ) ? aObjBoundRect.Width() : aObjBoundRect.Height(); const SwTwips nRelPos = _GetRelPosToBase( nObjBoundHeight, rVert ); @@ -171,25 +171,25 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() // calculated relative position to base line and current maximal line ascent. // Note: In the following line formatting the base line will be adjusted // by the same difference. - if( mnFlags & AS_CHAR_INIT && nRelPos < 0 && mnLineAscentInclObjs < -nRelPos ) + if( mnFlags & AsCharFlags::Init && nRelPos < 0 && mnLineAscentInclObjs < -nRelPos ) { - if( mnFlags & AS_CHAR_ROTATE ) + if( mnFlags & AsCharFlags::Rotate ) aAnchorPos.X() -= mnLineAscentInclObjs + nRelPos; else aAnchorPos.Y() -= mnLineAscentInclObjs + nRelPos; } // consider BIDI-multiportion by adjusting proposed anchor position - if( mnFlags & AS_CHAR_BIDI ) + if( mnFlags & AsCharFlags::Bidi ) aAnchorPos.X() -= aObjBoundRect.Width(); // calculate relative position considering rotation and inside rotation // reverse direction. Point aRelPos; { - if( mnFlags & AS_CHAR_ROTATE ) + if( mnFlags & AsCharFlags::Rotate ) { - if( mnFlags & AS_CHAR_REVERSE ) + if( mnFlags & AsCharFlags::Reverse ) aRelPos.X() = -nRelPos - aObjBoundRect.Width(); else { @@ -203,7 +203,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() if( !IsObjFly() ) { - if( !( mnFlags & AS_CHAR_QUICK ) ) + if( !( mnFlags & AsCharFlags::Quick ) ) { // save calculated Y-position value for 'automatic' vertical positioning, // in order to avoid a switch to 'manual' vertical positioning in @@ -297,7 +297,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong anchored object." ); const SwFlyInContentFrame& rFlyInContentFrame = static_cast<const SwFlyInContentFrame&>(GetAnchoredObj()); - if ( !(mnFlags & AS_CHAR_QUICK) && + if ( !(mnFlags & AsCharFlags::Quick) && ( aAnchorPos != rFlyInContentFrame.GetRefPoint() || aRelAttr != rFlyInContentFrame.GetCurrRelPos() ) ) { diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 185fd64..db36bf6 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2034,16 +2034,16 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight(); sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height(); - objectpositioning::AsCharFlags nFlags = AS_CHAR_ULSPACE; + AsCharFlags nFlags = AsCharFlags::UlSpace; if( GetMulti() ) { aTmpInf.SetDirection( GetMulti()->GetDirection() ); if( GetMulti()->HasRotation() ) { - nFlags |= AS_CHAR_ROTATE; + nFlags |= AsCharFlags::Rotate; if( GetMulti()->IsRevers() ) { - nFlags |= AS_CHAR_REVERSE; + nFlags |= AsCharFlags::Reverse; aTmpInf.X( aTmpInf.X() - nAscent ); } else @@ -2052,7 +2052,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, else { if ( GetMulti()->IsBidi() ) - nFlags |= AS_CHAR_BIDI; + nFlags |= AsCharFlags::Bidi; aTmpInf.Y( aTmpInf.Y() + nAscent ); } } @@ -2140,12 +2140,12 @@ void SwTextFormatter::AlignFlyInCntBase( long nBaseLine ) const return; SwLinePortion *pFirst = m_pCurr->GetFirstPortion(); SwLinePortion *pPos = pFirst; - objectpositioning::AsCharFlags nFlags = AS_CHAR_NOFLAG; + AsCharFlags nFlags = AsCharFlags::None; if( GetMulti() && GetMulti()->HasRotation() ) { - nFlags |= AS_CHAR_ROTATE; + nFlags |= AsCharFlags::Rotate; if( GetMulti()->IsRevers() ) - nFlags |= AS_CHAR_REVERSE; + nFlags |= AsCharFlags::Reverse; } long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; @@ -2523,12 +2523,12 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, nFlyAsc = nAscent; Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent ); - objectpositioning::AsCharFlags nMode = IsQuick() ? AS_CHAR_QUICK : 0; + AsCharFlags nMode = IsQuick() ? AsCharFlags::Quick : AsCharFlags::None; if( GetMulti() && GetMulti()->HasRotation() ) { - nMode |= AS_CHAR_ROTATE; + nMode |= AsCharFlags::Rotate; if( GetMulti()->IsRevers() ) - nMode |= AS_CHAR_REVERSE; + nMode |= AsCharFlags::Reverse; } Point aTmpBase( aBase ); @@ -2548,7 +2548,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, if( pRet->GetAscent() > nAscent ) { aBase.Y() = Y() + pRet->GetAscent(); - nMode |= AS_CHAR_ULSPACE; + nMode |= AsCharFlags::UlSpace; if( !rInf.IsTest() ) { aTmpBase = aBase; diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index d48d10a..0e2788e 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -262,7 +262,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTextFrame& rFrame, SwFlyInContentFrame *pFly, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAsc, long nFlyDesc, - objectpositioning::AsCharFlags nFlags ) : + AsCharFlags nFlags ) : pContact( pFly ), bDraw( false ), bMax( false ), @@ -270,7 +270,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTextFrame& rFrame, { OSL_ENSURE( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInContentFrame!" ); nLineLength = 1; - nFlags |= AS_CHAR_ULSPACE | AS_CHAR_INIT; + nFlags |= AsCharFlags::UlSpace | AsCharFlags::Init; SetBase( rFrame, rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags ); SetWhichPor( POR_FLYCNT ); } @@ -279,7 +279,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTextFrame& rFrame, SwDrawContact *pDrawContact, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAsc, long nFlyDesc, - objectpositioning::AsCharFlags nFlags ) : + AsCharFlags nFlags ) : pContact( pDrawContact ), bDraw( true ), bMax( false ), @@ -295,7 +295,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTextFrame& rFrame, pDrawContact->MoveObjToVisibleLayer( pDrawContact->GetMaster() ); } nLineLength = 1; - nFlags |= AS_CHAR_ULSPACE | AS_CHAR_INIT; + nFlags |= AsCharFlags::UlSpace | AsCharFlags::Init; SetBase( rFrame, rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags ); @@ -311,7 +311,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTextFrame& rFrame, void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAsc, long nFlyDesc, - objectpositioning::AsCharFlags nFlags ) + AsCharFlags nFlags ) { // Use new class to position object // Determine drawing object @@ -386,7 +386,7 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase, SetAlign( aObjPositioning.GetLineAlignment() ); aRef = aObjPositioning.GetAnchorPos(); - if( nFlags & AS_CHAR_ROTATE ) + if( nFlags & AsCharFlags::Rotate ) SvXSize( aObjPositioning.GetObjBoundRectInclSpacing().SSize() ); else SvLSize( aObjPositioning.GetObjBoundRectInclSpacing().SSize() ); diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx index f78765f..b51efd9 100644 --- a/sw/source/core/text/porfly.hxx +++ b/sw/source/core/text/porfly.hxx @@ -56,12 +56,12 @@ public: SwFlyCntPortion( const SwTextFrame& rFrame, SwFlyInContentFrame *pFly, const Point &rBase, long nAscent, long nDescent, long nFlyAsc, long nFlyDesc, - objectpositioning::AsCharFlags nFlags ); + AsCharFlags nFlags ); // Use new datatype for parameter <nFlags> SwFlyCntPortion( const SwTextFrame& rFrame, SwDrawContact *pDrawContact, const Point &rBase, long nAscent, long nDescent, long nFlyAsc, long nFlyDesc, - objectpositioning::AsCharFlags nFlags ); + AsCharFlags nFlags ); inline const Point& GetRefPoint() const { return aRef; } inline SwFlyInContentFrame *GetFlyFrame() { return static_cast<SwFlyInContentFrame*>(pContact); } inline const SwFlyInContentFrame *GetFlyFrame() const @@ -78,7 +78,7 @@ public: void SetBase( const SwTextFrame& rFrame, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAscent, long nFlyDescent, - objectpositioning::AsCharFlags nFlags ); + AsCharFlags nFlags ); sal_Int32 GetFlyCursorOfst( const sal_uInt16 nOfst, const Point &rPoint, SwPosition *pPos, SwCursorMoveState* pCMS ) const; virtual bool Format( SwTextFormatInfo &rInf ) override; commit e15299b327734a622cab29bd682803a86b5a8c9e Author: Noel Grandin <noelgran...@gmail.com> Date: Wed Mar 30 22:25:26 2016 +0200 tdf#84938 convert FRM_ constants to scoped enum Change-Id: I785d154a5df9a33b7d513dee1d3d859e5e800e7a diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index abeb69f..fb8f434 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1884,19 +1884,19 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, SwAccessibleContext *pAcc = nullptr; switch( pFrame->GetType() ) { - case FRM_TXT: + case SwFrameType::Txt: pAcc = new SwAccessibleParagraph( this, static_cast< const SwTextFrame& >( *pFrame ) ); break; - case FRM_HEADER: + case SwFrameType::Header: pAcc = new SwAccessibleHeaderFooter( this, static_cast< const SwHeaderFrame *>( pFrame ) ); break; - case FRM_FOOTER: + case SwFrameType::Footer: pAcc = new SwAccessibleHeaderFooter( this, static_cast< const SwFooterFrame *>( pFrame ) ); break; - case FRM_FTN: + case SwFrameType::Ftn: { const SwFootnoteFrame *pFootnoteFrame = static_cast < const SwFootnoteFrame * >( pFrame ); @@ -1907,7 +1907,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, pFootnoteFrame ); } break; - case FRM_FLY: + case SwFrameType::Fly: { const SwFlyFrame *pFlyFrame = static_cast < const SwFlyFrame * >( pFrame ); @@ -1925,19 +1925,20 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, } } break; - case FRM_CELL: + case SwFrameType::Cell: pAcc = new SwAccessibleCell( this, static_cast< const SwCellFrame *>( pFrame ) ); break; - case FRM_TAB: + case SwFrameType::Tab: pAcc = new SwAccessibleTable( this, static_cast< const SwTabFrame *>( pFrame ) ); break; - case FRM_PAGE: + case SwFrameType::Page: OSL_ENSURE( GetShell()->IsPreview(), "accessible page frames only in PagePreview" ); pAcc = new SwAccessiblePage( this, pFrame ); break; + default: break; } xAcc = pAcc; @@ -2467,16 +2468,14 @@ so run here: save the parent's SwFrame not the accessible object parent, bool bIsTextParent = false; if (aFrameOrObj.GetSwFrame()) { - int nType = pFrame->GetType(); - if ( FRM_FLY == nType ) + if (SwFrameType::Fly == pFrame->GetType()) { bIsValidFrame =true; } } else if(pObj) { - int nType = pParent->GetType(); - if (FRM_TXT == nType) + if (SwFrameType::Txt == pParent->GetType()) { bIsTextParent =true; } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 70ee4cc..c825638 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1836,7 +1836,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( while ( pUpperFrame ) { if ( pUpperFrame->GetType() & - ( FRM_PAGE | FRM_FLY | FRM_SECTION | FRM_TAB | FRM_CELL ) ) + ( SwFrameType::Page | SwFrameType::Fly | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Cell ) ) { if ( pUpperFrame->IsVertical() ) { diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index e93a6c9..de9853b 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -93,7 +93,7 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell& rShell) { for (SwFrame *pContent = pCell->GetLower(); pContent; pContent = pContent->GetNext()) { - if (pContent->GetType() == FRM_TAB) + if (pContent->GetType() == SwFrameType::Tab) { SwFormatFrameSize pSize = pLine->GetFrameFormat()->GetFrameSize(); pRow->ModifyNotification(nullptr, &pSize); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 19d7a79..86a555ee 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -152,7 +152,7 @@ SwNoTextFrame::SwNoTextFrame(SwNoTextNode * const pNode, SwFrame* pSib ) /// Initialization: Currently add the Frame to the Cache void SwNoTextFrame::InitCtor() { - mnFrameType = FRM_NOTXT; + mnFrameType = SwFrameType::NoTxt; } SwContentFrame *SwNoTextNode::MakeFrame( SwFrame* pSib ) diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index f326ccb..d330f25 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -415,7 +415,7 @@ SwFrame* SwNode2LayImpl::GetFrame( const Point* pDocPos, const SwPosition *pPos ) const { // test if change of member pIter -> pMod broke anything - return pMod ? ::GetFrameOfModify( nullptr, *pMod, USHRT_MAX, pDocPos, pPos ) : nullptr; + return pMod ? ::GetFrameOfModify( nullptr, *pMod, FRM_ALL, pDocPos, pPos ) : nullptr; } SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ) diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 3f65157..ada742b 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -138,8 +138,8 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, // different frames, check their Y-/X-position bool bRefIsLower = false; - if( ( FRM_COLUMN | FRM_CELL ) & pFieldFrame->GetType() || - ( FRM_COLUMN | FRM_CELL ) & pRefFrame->GetType() ) + if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() || + ( SwFrameType::Column | SwFrameType::Cell ) & pRefFrame->GetType() ) { if( pFieldFrame->GetType() == pRefFrame->GetType() ) { @@ -165,7 +165,7 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, pRefFrame->Frame().Top() < pFieldFrame->Frame().Top() ); pRefFrame = nullptr; } - else if( ( FRM_COLUMN | FRM_CELL ) & pFieldFrame->GetType() ) + else if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() ) pFieldFrame = aArr[ nCnt - 1 ]; else pRefFrame = aRefArr[ nRefCnt - 1 ]; diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 35bf7b5..d3cbf43 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -226,7 +226,7 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons { switch ( pFrame->GetType() ) { - case FRM_COLUMN: if( pFrame->GetUpper()->IsSctFrame() ) + case SwFrameType::Column: if( pFrame->GetUpper()->IsSctFrame() ) { // Check, if isn't not only a single column // from a section with footnotes at the end. @@ -238,17 +238,17 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons else // only pages and frame columns nReturn |= FrameTypeFlags::COLUMN; break; - case FRM_PAGE: nReturn |= FrameTypeFlags::PAGE; + case SwFrameType::Page: nReturn |= FrameTypeFlags::PAGE; if( static_cast<const SwPageFrame*>(pFrame)->IsFootnotePage() ) nReturn |= FrameTypeFlags::FTNPAGE; break; - case FRM_HEADER: nReturn |= FrameTypeFlags::HEADER; break; - case FRM_FOOTER: nReturn |= FrameTypeFlags::FOOTER; break; - case FRM_BODY: if( pFrame->GetUpper()->IsPageFrame() ) // not for ColumnFrames + case SwFrameType::Header: nReturn |= FrameTypeFlags::HEADER; break; + case SwFrameType::Footer: nReturn |= FrameTypeFlags::FOOTER; break; + case SwFrameType::Body: if( pFrame->GetUpper()->IsPageFrame() ) // not for ColumnFrames nReturn |= FrameTypeFlags::BODY; break; - case FRM_FTN: nReturn |= FrameTypeFlags::FOOTNOTE; break; - case FRM_FLY: if( static_cast<const SwFlyFrame*>(pFrame)->IsFlyLayFrame() ) + case SwFrameType::Ftn: nReturn |= FrameTypeFlags::FOOTNOTE; break; + case SwFrameType::Fly: if( static_cast<const SwFlyFrame*>(pFrame)->IsFlyLayFrame() ) nReturn |= FrameTypeFlags::FLY_FREE; else if ( static_cast<const SwFlyFrame*>(pFrame)->IsFlyAtContentFrame() ) nReturn |= FrameTypeFlags::FLY_ATCNT; @@ -262,9 +262,9 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons if( bStopAtFly ) return nReturn; break; - case FRM_TAB: - case FRM_ROW: - case FRM_CELL: nReturn |= FrameTypeFlags::TABLE; break; + case SwFrameType::Tab: + case SwFrameType::Row: + case SwFrameType::Cell: nReturn |= FrameTypeFlags::TABLE; break; default: /* do nothing */ break; } if ( pFrame->IsFlyFrame() ) @@ -613,7 +613,7 @@ sal_uInt16 SwFEShell::_GetCurColNum( const SwFrame *pFrame, pFrame = pCurFrame->GetUpper(); while( pFrame ) { - if( ( FRM_PAGE | FRM_FLY | FRM_SECTION ) & pFrame->GetType() ) + if( ( SwFrameType::Page | SwFrameType::Fly | SwFrameType::Section ) & pFrame->GetType() ) { pPara->pFrameFormat = static_cast<const SwLayoutFrame*>(pFrame)->GetFormat(); pPara->pPrtRect = &pFrame->Prt(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index fdebdc7..7d55fc0 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1527,12 +1527,12 @@ static void lcl_FindStartEndRow( const SwLayoutFrame *&rpStart, std::deque<const SwLayoutFrame *> aSttArr, aEndArr; const SwLayoutFrame *pTmp; - for( pTmp = rpStart; (FRM_CELL|FRM_ROW) & pTmp->GetType(); + for( pTmp = rpStart; (SwFrameType::Cell|SwFrameType::Row) & pTmp->GetType(); pTmp = pTmp->GetUpper() ) { aSttArr.push_front( pTmp ); } - for( pTmp = rpEnd; (FRM_CELL|FRM_ROW) & pTmp->GetType(); + for( pTmp = rpEnd; (SwFrameType::Cell|SwFrameType::Row) & pTmp->GetType(); pTmp = pTmp->GetUpper() ) { aEndArr.push_front( pTmp ); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 05abbf6..57a48b9 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -28,6 +28,7 @@ #include "swrect.hxx" #include "calbck.hxx" #include <svl/SfxBroadcaster.hxx> +#include <o3tl/typed_flags_set.hxx> #include "IDocumentDrawModelAccess.hxx" #include <com/sun/star/style/TabStop.hpp> @@ -66,33 +67,42 @@ typedef struct _xmlTextWriter *xmlTextWriterPtr; // which kind of FrameType an instance is _and_ from what classes it was derived. // Each frame has in its base class a member that must be set by the // constructors accordingly. -#define FRM_ROOT 0x0001 -#define FRM_PAGE 0x0002 -#define FRM_COLUMN 0x0004 -#define FRM_HEADER 0x0008 -#define FRM_FOOTER 0x0010 -#define FRM_FTNCONT 0x0020 -#define FRM_FTN 0x0040 -#define FRM_BODY 0x0080 -#define FRM_FLY 0x0100 -#define FRM_SECTION 0x0200 -#define FRM_UNUSED 0x0400 -#define FRM_TAB 0x0800 -#define FRM_ROW 0x1000 -#define FRM_CELL 0x2000 -#define FRM_TXT 0x4000 -#define FRM_NOTXT 0x8000 +enum class SwFrameType +{ + None = 0x0000, + Root = 0x0001, + Page = 0x0002, + Column = 0x0004, + Header = 0x0008, + Footer = 0x0010, + FtnCont = 0x0020, + Ftn = 0x0040, + Body = 0x0080, + Fly = 0x0100, + Section = 0x0200, +// UNUSED 0x0400 + Tab = 0x0800, + Row = 0x1000, + Cell = 0x2000, + Txt = 0x4000, + NoTxt = 0x8000, +}; -// for internal use some common combinations -#define FRM_LAYOUT 0x3FFF -#define FRM_CNTNT 0xC000 -#define FRM_FTNBOSS 0x0006 -#define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE) +namespace o3tl +{ + template<> struct typed_flags<SwFrameType> : is_typed_flags<SwFrameType, 0xfbff> {}; +}; -#define FRM_NEIGHBOUR 0x2004 -#define FRM_NOTE_VERT 0x7a60 -#define FRM_HEADFOOT 0x0018 -#define FRM_BODYFTNC 0x00a0 +// for internal use some common combinations +#define FRM_LAYOUT SwFrameType(0x3bFF) +#define FRM_ALL SwFrameType(0xfbff) +#define FRM_CNTNT (SwFrameType::Txt | SwFrameType::NoTxt) +#define FRM_FTNBOSS (SwFrameType::Page | SwFrameType::Column) +#define FRM_ACCESSIBLE (SwFrameType::Root | SwFrameType::Page | SwFrameType::Header | SwFrameType::Footer | SwFrameType::Ftn | SwFrameType::Fly | SwFrameType::Tab | SwFrameType::Cell | SwFrameType::Txt) +#define FRM_NEIGHBOUR (SwFrameType::Column | SwFrameType::Cell) +#define FRM_NOTE_VERT (SwFrameType::FtnCont | SwFrameType::Ftn | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | SwFrameType::Txt) +#define FRM_HEADFOOT (SwFrameType::Header | SwFrameType::Footer) +#define FRM_BODYFTNC (SwFrameType::FtnCont | SwFrameType::Body) // for GetNextLeaf/GetPrevLeaf. enum MakePageType @@ -224,7 +234,7 @@ protected: SwRect maFrame; // absolute position in document and size of the Frame SwRect maPrt; // position relatively to Frame and size of PrtArea - sal_uInt16 mnFrameType; //Who am I? + SwFrameType mnFrameType; //Who am I? bool mbReverse : 1; // Next line above/at the right side instead // under/at the left side of the previous line @@ -326,7 +336,7 @@ public: } - sal_uInt16 GetType() const { return mnFrameType; } + SwFrameType GetType() const { return mnFrameType; } static SwCache &GetCache() { return *mpCache; } static SwCache *GetCachePtr() { return mpCache; } @@ -729,7 +739,7 @@ public: void MakeLeftPos( const SwFrame*, const SwFrame*, bool ); void MakeRightPos( const SwFrame*, const SwFrame*, bool ); inline bool IsNeighbourFrame() const - { return (GetType() & FRM_NEIGHBOUR) != 0; } + { return bool(GetType() & FRM_NEIGHBOUR); } // #i65250# inline sal_uInt32 GetFrameId() const { return mnFrameId; } @@ -969,87 +979,87 @@ inline const SwFrame *SwFrame::FindPrev() const inline bool SwFrame::IsLayoutFrame() const { - return (GetType() & FRM_LAYOUT) != 0; + return bool(GetType() & FRM_LAYOUT); } inline bool SwFrame::IsRootFrame() const { - return mnFrameType == FRM_ROOT; + return mnFrameType == SwFrameType::Root; } inline bool SwFrame::IsPageFrame() const { - return mnFrameType == FRM_PAGE; + return mnFrameType == SwFrameType::Page; } inline bool SwFrame::IsColumnFrame() const { - return mnFrameType == FRM_COLUMN; + return mnFrameType == SwFrameType::Column; } inline bool SwFrame::IsFootnoteBossFrame() const { - return (GetType() & FRM_FTNBOSS) != 0; + return bool(GetType() & FRM_FTNBOSS); } inline bool SwFrame::IsHeaderFrame() const { - return mnFrameType == FRM_HEADER; + return mnFrameType == SwFrameType::Header; } inline bool SwFrame::IsFooterFrame() const { - return mnFrameType == FRM_FOOTER; + return mnFrameType == SwFrameType::Footer; } inline bool SwFrame::IsFootnoteContFrame() const { - return mnFrameType == FRM_FTNCONT; + return mnFrameType == SwFrameType::FtnCont; } inline bool SwFrame::IsFootnoteFrame() const { - return mnFrameType == FRM_FTN; + return mnFrameType == SwFrameType::Ftn; } inline bool SwFrame::IsBodyFrame() const { - return mnFrameType == FRM_BODY; + return mnFrameType == SwFrameType::Body; } inline bool SwFrame::IsFlyFrame() const { - return mnFrameType == FRM_FLY; + return mnFrameType == SwFrameType::Fly; } inline bool SwFrame::IsSctFrame() const { - return mnFrameType == FRM_SECTION; + return mnFrameType == SwFrameType::Section; } inline bool SwFrame::IsTabFrame() const { - return mnFrameType == FRM_TAB; + return mnFrameType == SwFrameType::Tab; } inline bool SwFrame::IsRowFrame() const { - return mnFrameType == FRM_ROW; + return mnFrameType == SwFrameType::Row; } inline bool SwFrame::IsCellFrame() const { - return mnFrameType == FRM_CELL; + return mnFrameType == SwFrameType::Cell; } inline bool SwFrame::IsContentFrame() const { - return (GetType() & FRM_CNTNT) != 0; + return bool(GetType() & FRM_CNTNT); } inline bool SwFrame::IsTextFrame() const { - return mnFrameType == FRM_TXT; + return mnFrameType == SwFrameType::Txt; } inline bool SwFrame::IsNoTextFrame() const { - return mnFrameType == FRM_NOTXT; + return mnFrameType == SwFrameType::NoTxt; } inline bool SwFrame::IsFlowFrame() const { - return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION)) != 0; + return bool(GetType() & (FRM_CNTNT|SwFrameType::Tab|SwFrameType::Section)); } inline bool SwFrame::IsRetoucheFrame() const { - return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION|FRM_FTN)) != 0; + return bool(GetType() & (FRM_CNTNT|SwFrameType::Tab|SwFrameType::Section|SwFrameType::Ftn)); } inline bool SwFrame::IsAccessibleFrame() const { - return (GetType() & FRM_ACCESSIBLE) != 0; + return bool(GetType() & FRM_ACCESSIBLE); } //use this to protect a SwFrame for a given scope from getting deleted diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 49fe707..b4fb47e 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -146,7 +146,7 @@ const SwFrame* GetVirtualUpper( const SwFrame* pFrame, const Point& rPos ); bool Is_Lower_Of( const SwFrame *pCurrFrame, const SdrObject* pObj ); // FIXME: EasyHack (refactoring): rename method and parameter name in all files -const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalKontextTyp ); +const SwFrame *FindKontext( const SwFrame *pFrame, SwFrameType nAdditionalKontextTyp ); bool IsFrameInSameKontext( const SwFrame *pInnerFrame, const SwFrame *pFrame ); @@ -155,7 +155,7 @@ const SwFrame * FindPage( const SwRect &rRect, const SwFrame *pPage ); // used by SwContentNode::GetFrame and SwFlyFrame::GetFrame SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const&, - sal_uInt16 const nFrameType, + SwFrameType const nFrameType, const Point* = nullptr, const SwPosition *pPos = nullptr, const bool bCalcFrame = false ); diff --git a/sw/source/core/inc/hffrm.hxx b/sw/source/core/inc/hffrm.hxx index 9986df1..5a82372 100644 --- a/sw/source/core/inc/hffrm.hxx +++ b/sw/source/core/inc/hffrm.hxx @@ -31,7 +31,7 @@ protected: inline bool GetEatSpacing() const; // in hffrm.cxx public: - SwHeadFootFrame(SwFrameFormat * pFrame, SwFrame*, sal_uInt16 aType); + SwHeadFootFrame(SwFrameFormat * pFrame, SwFrame*, SwFrameType aType); virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override; virtual SwTwips GrowFrame( SwTwips, bool bTst = false, bool bInfo = false ) override; @@ -44,7 +44,7 @@ public: class SwHeaderFrame: public SwHeadFootFrame { public: - SwHeaderFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, FRM_HEADER) {}; + SwHeaderFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, SwFrameType::Header) {}; DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrame) }; @@ -53,7 +53,7 @@ public: class SwFooterFrame: public SwHeadFootFrame { public: - SwFooterFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, FRM_FOOTER) {}; + SwFooterFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, SwFrameType::Footer) {}; DECL_FIXEDMEMPOOL_NEWDEL(SwFooterFrame) }; diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 64e91e4..ffcc820 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -213,12 +213,12 @@ inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForS */ inline bool SwFrame::IsColBodyFrame() const { - return mnFrameType == FRM_BODY && GetUpper()->IsColumnFrame(); + return mnFrameType == SwFrameType::Body && GetUpper()->IsColumnFrame(); } inline bool SwFrame::IsPageBodyFrame() const { - return mnFrameType == FRM_BODY && GetUpper()->IsPageFrame(); + return mnFrameType == SwFrameType::Body && GetUpper()->IsPageFrame(); } inline SwFrame* SwLayoutFrame::GetLastLower() diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index eec52b9..8ca9b78 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2684,7 +2684,7 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint, } else { - const sal_uInt16 nFrameType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; + const SwFrameType nFrameType = RES_FLYFRMFMT == Which() ? SwFrameType::Fly : FRM_ALL; pFrame = ::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), nFrameType, pPoint, nullptr, bCalcFrame ); } @@ -2717,7 +2717,7 @@ SdrObject* SwFrameFormat::FindRealSdrObject() if( RES_FLYFRMFMT == Which() ) { Point aNullPt; - SwFlyFrame* pFly = static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, FRM_FLY, + SwFlyFrame* pFly = static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly, &aNullPt )); return pFly ? pFly->GetVirtDrawObj() : nullptr; } @@ -3037,7 +3037,7 @@ void SwFlyFrameFormat::MakeFrames() SwFlyFrame* SwFlyFrameFormat::GetFrame( const Point* pPoint, const bool bCalcFrame ) const { - return static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_FLY, + return static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), SwFrameType::Fly, pPoint, nullptr, bCalcFrame )); } @@ -3463,7 +3463,7 @@ bool IsFlyFrameFormatInHeader(const SwFrameFormat& rFormat) } SwPageFrame* pPageFrame = pFlyFrame->FindPageFrameOfAnchor(); SwFrame* pHeader = pPageFrame->Lower(); - if (pHeader->GetType() == FRM_HEADER) + if (pHeader->GetType() == SwFrameType::Header) { const SwFrame* pFrame = pFlyFrame->GetAnchorFrame(); while (pFrame) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a5fd16c..a69cb4a 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -491,7 +491,7 @@ void SwFrame::MakePos() } pPrv = lcl_Prev( this, false ); - const sal_uInt16 nMyType = GetType(); + const SwFrameType nMyType = GetType(); SWRECTFN( ( IsCellFrame() && GetUpper() ? GetUpper() : this ) ) if ( !bUseUpper && pPrv ) { @@ -507,7 +507,7 @@ void SwFrame::MakePos() (pPrv->Frame().*fnRect->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && FRM_CELL & nMyType && !mbReverse ) + if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } else if( bVert && FRM_NOTE_VERT & nMyType ) @@ -561,7 +561,7 @@ void SwFrame::MakePos() (pPrv->Frame().*fnRect->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && FRM_CELL & nMyType && !mbReverse ) + if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } else if( bVert && FRM_NOTE_VERT & nMyType ) diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index a583a1a..bbd5366 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -35,7 +35,7 @@ SwColumnFrame::SwColumnFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwFootnoteBossFrame( pFormat, pSib ) { - mnFrameType = FRM_COLUMN; + mnFrameType = SwFrameType::Column; SwBodyFrame* pColBody = new SwBodyFrame( pFormat->GetDoc()->GetDfltFrameFormat(), pSib ); pColBody->InsertBehind( this, nullptr ); // ColumnFrames now with BodyFrame SetMaxFootnoteHeight( LONG_MAX ); diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 6036fa9..7b52501 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -51,7 +51,7 @@ * is null - no method calls are logged. * 2. The SwImplProtocol class contains a filter for frame types, only method * call of frame types which are defined there are logged. - * The member nTypes can be set to values like FRM_PAGE or FRM_SECTION and + * The member nTypes can be set to values like SwFrameType::Page or SwFrameType::Section and * may be combined using binary OR. The default values is 0xFFFF - meaning * all frame types. * 3. The SwImplProtocol class contains an ArrayPointer to FrameIds which need to be @@ -124,7 +124,7 @@ class SwImplProtocol std::set<sal_uInt16> *pFrameIds; // which FrameIds shall be logged ( NULL == all) std::vector<long> aVars; // variables OStringBuffer aLayer; // indentation of output (" " per start/end) - sal_uInt16 nTypes; // which types shall be logged + SwFrameType nTypes; // which types shall be logged sal_uInt16 nLineCount; // printed lines sal_uInt16 nMaxLines; // max lines to be printed sal_uInt8 nInitFile; // range (FrameId,FrameType,Record) during reading of the INI file @@ -255,7 +255,7 @@ void SwProtocol::Stop() } SwImplProtocol::SwImplProtocol() - : pStream( nullptr ), pFrameIds( nullptr ), nTypes( 0xffff ), + : pStream( nullptr ), pFrameIds( nullptr ), nTypes( FRM_ALL ), nLineCount( 0 ), nMaxLines( USHRT_MAX ), nTestMode( 0 ) { NewStream(); @@ -306,7 +306,7 @@ void SwImplProtocol::CheckLine( OString& rLine ) else if (aTmp == "[frmtype")// section types { nInitFile = 2; - nTypes = USHRT_MAX; // default: log all frame types + nTypes = FRM_ALL; // default: log all frame types } else if (aTmp == "[record")// section functions { @@ -352,7 +352,7 @@ void SwImplProtocol::CheckLine( OString& rLine ) case 1: InsertFrame( sal_uInt16( nVal ) ); // add FrameId break; case 2: { - sal_uInt16 nNew = (sal_uInt16)nVal; + SwFrameType nNew = static_cast<SwFrameType>(nVal); if( bNo ) nTypes &= ~nNew; // remove type else diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 603c3f4..beaec42 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -80,7 +80,7 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch m_bLockDeleteContent( false ), m_bValidContentPos( false ) { - mnFrameType = FRM_FLY; + mnFrameType = SwFrameType::Fly; m_bInvalid = m_bNotifyBack = true; m_bLocked = m_bMinHeight = @@ -587,7 +587,7 @@ SwFlyFrame *SwFlyFrame::FindChainNeighbour( SwFrameFormat &rChain, SwFrame *pAnc // FindFooterOrHeader is not appropriate here, as we may not have a // connection to the Anchor yet. pLay = pAnch->GetUpper(); - while ( pLay && !(pLay->GetType() & (FRM_HEADER|FRM_FOOTER)) ) + while ( pLay && !(pLay->GetType() & (SwFrameType::Header|SwFrameType::Footer)) ) pLay = pLay->GetUpper(); } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index ddee9c7..c88e49c 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -1032,10 +1032,11 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) SWRECTFN( pClip ) const SwLayoutFrame *pUp = pClip->GetUpper(); const SwFrame *pCell = pUp->IsCellFrame() ? pUp : nullptr; - const sal_uInt16 nType = bMove ? FRM_ROOT | FRM_FLY | FRM_HEADER | - FRM_FOOTER | FRM_FTN - : FRM_BODY | FRM_FLY | FRM_HEADER | - FRM_FOOTER | FRM_CELL| FRM_FTN; + const SwFrameType nType = bMove + ? SwFrameType::Root | SwFrameType::Fly | SwFrameType::Header | + SwFrameType::Footer | SwFrameType::Ftn + : SwFrameType::Body | SwFrameType::Fly | SwFrameType::Header | + SwFrameType::Footer | SwFrameType::Cell| SwFrameType::Ftn; while ( !(pUp->GetType() & nType) || pUp->IsColBodyFrame() ) { @@ -1054,7 +1055,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } if ( pUp ) { - if ( pUp->GetType() & FRM_BODY ) + if ( pUp->GetType() & SwFrameType::Body ) { const SwPageFrame *pPg; if ( pUp->GetUpper() != (pPg = pFly->FindPageFrame()) ) @@ -1068,7 +1069,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } else { - if( ( pUp->GetType() & (FRM_FLY | FRM_FTN ) ) && + if( ( pUp->GetType() & (SwFrameType::Fly | SwFrameType::Ftn ) ) && !pUp->Frame().IsInside( pFly->Frame().Pos() ) ) { if( pUp->IsFlyFrame() ) @@ -1096,7 +1097,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } rRect = pUp->Prt(); rRect.Pos() += pUp->Frame().Pos(); - if ( pUp->GetType() & (FRM_HEADER | FRM_FOOTER) ) + if ( pUp->GetType() & (SwFrameType::Header | SwFrameType::Footer) ) { rRect.Left ( pUp->GetUpper()->Frame().Left() ); rRect.Width( pUp->GetUpper()->Frame().Width()); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 25ef901..1a76ede 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -548,7 +548,7 @@ SwLayNotify::~SwLayNotify() { const SwViewShell *pSh = pLay->getRootFrame()->GetCurrShell(); if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) || - !(pLay->GetType() & (FRM_BODY | FRM_PAGE)) ) + !(pLay->GetType() & (SwFrameType::Body | SwFrameType::Page)) ) //Thereby the subordinates are retouched clean. //Example problem: Take the Flys with the handles and downsize. //Not for body and page, otherwise it flickers when loading HTML. @@ -580,10 +580,10 @@ SwLayNotify::~SwLayNotify() pLay->InvalidateNextPos(); } if ( !IsLowersComplete() && - !(pLay->GetType()&(FRM_FLY|FRM_SECTION) && + !(pLay->GetType()&(SwFrameType::Fly|SwFrameType::Section) && pLay->Lower() && pLay->Lower()->IsColumnFrame()) && (bPos || bNotify) && - !(pLay->GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + !(pLay->GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) { // #i44016# - force unlock of position of lower objects. // #i43913# - no unlock of position of objects, @@ -1862,7 +1862,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) m_bCachedJoinedWithPrev = false; m_bCachedJoinedWithNext = false; - m_bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL)); + m_bBorderDist = bool(pConstructor->GetType() & SwFrameType::Cell); } SwBorderAttrs::~SwBorderAttrs() @@ -3127,11 +3127,11 @@ bool Is_Lower_Of(const SwFrame *pCurrFrame, const SdrObject* pObj) } /// provides the area of a frame in that no Fly from another area can overlap -const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalContextType ) +const SwFrame *FindKontext( const SwFrame *pFrame, SwFrameType nAdditionalContextType ) { - const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT | - FRM_FTN | FRM_FLY | - FRM_TAB | FRM_ROW | FRM_CELL | + const SwFrameType nTyp = SwFrameType::Root | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont | + SwFrameType::Ftn | SwFrameType::Fly | + SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | nAdditionalContextType; do { if ( pFrame->GetType() & nTyp ) @@ -3143,11 +3143,11 @@ const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalContext bool IsFrameInSameKontext( const SwFrame *pInnerFrame, const SwFrame *pFrame ) { - const SwFrame *pKontext = FindKontext( pInnerFrame, 0 ); + const SwFrame *pKontext = FindKontext( pInnerFrame, SwFrameType::None ); - const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT | - FRM_FTN | FRM_FLY | - FRM_TAB | FRM_ROW | FRM_CELL; + const SwFrameType nTyp = SwFrameType::Root | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont | + SwFrameType::Ftn | SwFrameType::Fly | + SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell; do { if ( pFrame->GetType() & nTyp ) { @@ -3271,7 +3271,7 @@ void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } -SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, sal_uInt16 const nFrameType, +SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwFrameType const nFrameType, const Point* pPoint, const SwPosition *pPos, const bool bCalcFrame ) { SwFrame *pMinFrame = nullptr, *pTmpFrame; @@ -3327,7 +3327,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, sal } // for Flys go via the parent if the Fly is not yet "formatted" - if( !bCalcFrame && pTmpFrame->GetType() & FRM_FLY && + if( !bCalcFrame && pTmpFrame->GetType() & SwFrameType::Fly && static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame() && FAR_AWAY == pTmpFrame->Frame().Pos().getX() && FAR_AWAY == pTmpFrame->Frame().Pos().getY() ) diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index ca12b24..05b993b 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -145,7 +145,7 @@ static sal_uInt16 lcl_ColumnNum( const SwFrame* pBoss ) SwFootnoteContFrame::SwFootnoteContFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwLayoutFrame( pFormat, pSib ) { - mnFrameType = FRM_FTNCONT; + mnFrameType = SwFrameType::FtnCont; } @@ -427,7 +427,7 @@ SwFootnoteFrame::SwFootnoteFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwConte // #i49383# mbUnlockPosOfLowerObjs( true ) { - mnFrameType = FRM_FTN; + mnFrameType = SwFrameType::Ftn; } void SwFootnoteFrame::InvalidateNxtFootnoteCnts( SwPageFrame *pPage ) diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 55ab391..0caa0f3 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -94,7 +94,7 @@ static void lcl_LayoutFrameEnsureMinHeight(SwLayoutFrame & rFrame, } } -SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, sal_uInt16 nTypeIn) +SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, SwFrameType nTypeIn) : SwLayoutFrame( pFormat, pSib ) { mnFrameType = nTypeIn; diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 3798480..ce1fccb 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -457,7 +457,7 @@ SwRootFrame::SwRootFrame( SwFrameFormat *pFormat, SwViewShell * pSh ) : mnPhyPageNums( 0 ), mnAccessibleShells( 0 ) { - mnFrameType = FRM_ROOT; + mnFrameType = SwFrameType::Root; setRootFrame( this ); } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 9f2c94c..eedaf7c 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -63,7 +63,7 @@ using namespace ::com::sun::star; SwBodyFrame::SwBodyFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwLayoutFrame( pFormat, pSib ) { - mnFrameType = FRM_BODY; + mnFrameType = SwFrameType::Body; } void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs * ) @@ -172,7 +172,7 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg m_bHasGrid = false; SetMaxFootnoteHeight( pPgDsc->GetFootnoteInfo().GetHeight() ? pPgDsc->GetFootnoteInfo().GetHeight() : LONG_MAX ); - mnFrameType = FRM_PAGE; + mnFrameType = SwFrameType::Page; m_bInvalidLayout = m_bInvalidContent = m_bInvalidSpelling = m_bInvalidSmartTags = m_bInvalidAutoCmplWrds = m_bInvalidWordCount = true; m_bInvalidFlyLayout = m_bInvalidFlyContent = m_bInvalidFlyInCnt = m_bFootnotePage = m_bEndNotePage = false; @@ -350,7 +350,10 @@ static void lcl_FormatLay( SwLayoutFrame *pLay ) // first the low-level ones while ( pTmp ) { - if ( pTmp->GetType() & 0x00FF ) + const SwFrameType nTypes = SwFrameType::Root | SwFrameType::Page | SwFrameType::Column + | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont + | SwFrameType::Ftn | SwFrameType::Body; + if ( pTmp->GetType() & nTypes ) ::lcl_FormatLay( static_cast<SwLayoutFrame*>(pTmp) ); pTmp = pTmp->GetNext(); } @@ -470,7 +473,7 @@ void SwPageFrame::PreparePage( bool bFootnote ) SwLayoutFrame *pLow = static_cast<SwLayoutFrame*>(Lower()); while ( pLow ) { - if ( pLow->GetType() & (FRM_HEADER|FRM_FOOTER) ) + if ( pLow->GetType() & (SwFrameType::Header|SwFrameType::Footer) ) { SwContentFrame *pContent = pLow->ContainsContent(); while ( pContent && pLow->IsAnLower( pContent ) ) diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index fecbd0a..05d0de2 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -234,7 +234,7 @@ void SwPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd ) { const SwModify* pMod; - sal_uInt16 nFrameType = FRM_CNTNT; + SwFrameType nFrameType = FRM_CNTNT; if( rNd.IsContentNode() ) { @@ -243,7 +243,7 @@ static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd ) else if( rNd.IsTableNode() ) { pMod = static_cast<const SwTableNode&>(rNd).GetTable().GetFrameFormat(); - nFrameType = FRM_TAB; + nFrameType = SwFrameType::Tab; } else pMod = nullptr; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 03c0c6a..36ab161 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5431,7 +5431,7 @@ void SwFrame::PaintBorder( const SwRect& rRect, const SwPageFrame *pPage, const SwBorderAttrs &rAttrs ) const { // There's nothing (Row,Body,Footnote,Root,Column,NoText) need to do here - if ((GetType() & (FRM_NOTXT|FRM_ROW|FRM_BODY|FRM_FTN|FRM_COLUMN|FRM_ROOT))) + if ((GetType() & (SwFrameType::NoTxt|SwFrameType::Row|SwFrameType::Body|SwFrameType::Ftn|SwFrameType::Column|SwFrameType::Root))) return; if (IsCellFrame() && !gProp.pSGlobalShell->GetViewOptions()->IsTable()) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index e22c23d..26f76be 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -50,7 +50,7 @@ SwSectionFrame::SwSectionFrame( SwSection &rSect, SwFrame* pSib ) , m_bOwnFootnoteNum(false) , m_bFootnoteLock(false) { - mnFrameType = FRM_SECTION; + mnFrameType = SwFrameType::Section; CalcFootnoteAtEndFlag(); CalcEndAtEndFlag(); @@ -66,7 +66,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) : m_bOwnFootnoteNum( false ), m_bFootnoteLock( false ) { - mnFrameType = FRM_SECTION; + mnFrameType = SwFrameType::Section; PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index e185feac..adf1fee 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -78,7 +78,7 @@ SwTabFrame::SwTabFrame( SwTable &rTab, SwFrame* pSib ) , m_bInRecalcLowerRow(false) { mbFixSize = false; //Don't fall for import filter again. - mnFrameType = FRM_TAB; + mnFrameType = SwFrameType::Tab; //Create the lines and insert them. const SwTableLines &rLines = rTab.GetTabLines(); @@ -116,7 +116,7 @@ SwTabFrame::SwTabFrame( SwTabFrame &rTab ) , m_bInRecalcLowerRow(false) { mbFixSize = false; //Don't fall for import filter again. - mnFrameType = FRM_TAB; + mnFrameType = SwFrameType::Tab; SetFollow( rTab.GetFollow() ); rTab.SetFollow( this ); @@ -3561,7 +3561,7 @@ SwRowFrame::SwRowFrame(const SwTableLine &rLine, SwFrame* pSib, bool bInsertCont , m_bIsRepeatedHeadline( false ) , m_bIsRowSpanLine( false ) { - mnFrameType = FRM_ROW; + mnFrameType = SwFrameType::Row; //Create the boxes and insert them. const SwTableBoxes &rBoxes = rLine.GetTabBoxes(); @@ -4444,7 +4444,7 @@ SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertCont : SwLayoutFrame( rBox.GetFrameFormat(), pSib ) , m_pTabBox( &rBox ) { - mnFrameType = FRM_CELL; + mnFrameType = SwFrameType::Cell; if ( !bInsertContent ) return; diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index c8f4911..c46247f 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2065,7 +2065,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) // allowed (header/footer/table-headline) for two pages. do { // middle check loop const SwLayoutFrame* pSttLFrame = pStartFrame->GetUpper(); - const sal_uInt16 cHdFtTableHd = FRM_HEADER | FRM_FOOTER | FRM_TAB; + const SwFrameType cHdFtTableHd = SwFrameType::Header | SwFrameType::Footer | SwFrameType::Tab; while( pSttLFrame && ! (cHdFtTableHd & pSttLFrame->GetType() )) pSttLFrame = pSttLFrame->GetUpper(); @@ -2082,8 +2082,8 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) "Selection over different content" ); switch( pSttLFrame->GetType() ) { - case FRM_HEADER: - case FRM_FOOTER: + case SwFrameType::Header: + case SwFrameType::Footer: // On different pages? Then always on the start-page if( pEndLFrame->FindPageFrame() != pSttLFrame->FindPageFrame() ) { @@ -2094,7 +2094,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) pStartFrame = pEndFrame; } break; - case FRM_TAB: + case SwFrameType::Tab: // On different pages? Then check for table-headline { const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pSttLFrame); @@ -2113,6 +2113,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) } } break; + default: break; } } while( false ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 530d78d..599bef6 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -63,7 +63,7 @@ SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib ) : mpNext(nullptr), mpPrev(nullptr), mpDrawObjs(nullptr), - mnFrameType(0), + mnFrameType(SwFrameType::None), mbInfBody( false ), mbInfTab ( false ), mbInfFly ( false ), @@ -1631,7 +1631,7 @@ void SwFrame::ReinitializeFrameSizeAttrFlags() ATT_MIN_SIZE == rFormatSize.GetHeightSizeType()) { mbFixSize = false; - if ( GetType() & (FRM_HEADER | FRM_FOOTER | FRM_ROW) ) + if ( GetType() & (SwFrameType::Header | SwFrameType::Footer | SwFrameType::Row) ) { SwFrame *pFrame = static_cast<SwLayoutFrame*>(this)->Lower(); while ( pFrame ) @@ -1718,7 +1718,9 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() ) { if ( !bTst ) @@ -2200,7 +2202,9 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2331,7 +2335,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) _InvalidateAll(); InvalidatePage( pPage ); } - if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + if (!(GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) NotifyLowerObjs(); if( IsCellFrame() ) @@ -2360,7 +2364,9 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) { const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse by Body. + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden()) { @@ -2518,7 +2524,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SetCompletePaint(); } - if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + if (!(GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) NotifyLowerObjs(); if( IsCellFrame() ) @@ -2716,15 +2722,15 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) // In vertical layout these are neighbour frames (cell and column frames), // header frames and footer frames. // In horizontal layout these are all frames, which aren't neighbour frames. - const sal_uInt16 nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT) - : ~FRM_NEIGHBOUR; + const SwFrameType nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT) + : ~SwFrameType(FRM_NEIGHBOUR); // Declare const unsigned short <nFixHeight> and init it this frame types // which has fixed height in vertical respectively horizontal layout. // In vertical layout these are all frames, which aren't neighbour frames, // header frames, footer frames, body frames or foot note container frames. // In horizontal layout these are neighbour frames. - const sal_uInt16 nFixHeight= bVert ? ~(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC) + const SwFrameType nFixHeight = bVert ? ~SwFrameType(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC) : FRM_NEIGHBOUR; // Travel through all lowers using <GetNext()> @@ -2742,8 +2748,8 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) { // If lower isn't a table, row, cell or section frame, adjust its // frame size. - const sal_uInt16 nLowerType = pLowerFrame->GetType(); - if ( !(nLowerType & (FRM_TAB|FRM_ROW|FRM_CELL|FRM_SECTION)) ) + const SwFrameType nLowerType = pLowerFrame->GetType(); + if ( !(nLowerType & (SwFrameType::Tab|SwFrameType::Row|SwFrameType::Cell|SwFrameType::Section)) ) { if ( bWidthChgd ) { diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 3807f8f..e690385 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -911,7 +911,7 @@ SwTwips SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside( const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum(); const SwPageFrame* pObjPage = rFlyAtContentFrame.FindPageFrame(); - const SwFrame* pObjContext = ::FindKontext( &rAnchorTextFrame, FRM_COLUMN ); + const SwFrame* pObjContext = ::FindKontext( &rAnchorTextFrame, SwFrameType::Column ); sal_uLong nObjIndex = rAnchorTextFrame.GetTextNode()->GetIndex(); SwOrderIter aIter( pObjPage ); const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Bottom())->GetFlyFrame(); @@ -1020,7 +1020,7 @@ bool SwAnchoredObjectPosition::_DrawAsideFly( const SwFlyFrame* _pFly, if ( _pFly->IsFlyAtContentFrame() && (_pFly->Frame().*fnRect->fnBottomDist)( (_rObjRect.*fnRect->fnGetTop)() ) < 0 && (_rObjRect.*fnRect->fnBottomDist)( (_pFly->Frame().*fnRect->fnGetTop)() ) < 0 && - ::FindKontext( _pFly->GetAnchorFrame(), FRM_COLUMN ) == _pObjContext ) + ::FindKontext( _pFly->GetAnchorFrame(), SwFrameType::Column ) == _pObjContext ) { sal_uLong nOtherIndex = static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNode()->GetIndex(); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index c20cb75..48f574b 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -985,7 +985,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * GROUPING ELEMENTS */ - case FRM_PAGE : + case SwFrameType::Page : // Document: Document @@ -993,15 +993,15 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aDocumentString; break; - case FRM_HEADER : - case FRM_FOOTER : + case SwFrameType::Header : + case SwFrameType::Footer : // Header, Footer: NonStructElement nPDFType = vcl::PDFWriter::NonStructElement; break; - case FRM_FTNCONT : + case SwFrameType::FtnCont : // Footnote container: Division @@ -1009,7 +1009,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aDivString; break; - case FRM_FTN : + case SwFrameType::Ftn : // Footnote frame: Note @@ -1019,7 +1019,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aNoteString; break; - case FRM_SECTION : + case SwFrameType::Section : // Section: TOX, Index, or Sect @@ -1055,7 +1055,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * BLOCK-LEVEL STRUCTURE ELEMENTS */ - case FRM_TXT : + case SwFrameType::Txt : { const SwTextNode* pTextNd = static_cast<const SwTextFrame*>(pFrame)->GetTextNode(); @@ -1161,7 +1161,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } break; - case FRM_TAB : + case SwFrameType::Tab : // TabFrame: Table @@ -1213,7 +1213,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * TABLE ELEMENTS */ - case FRM_ROW : + case SwFrameType::Row : // RowFrame: TR @@ -1228,7 +1228,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } break; - case FRM_CELL : + case SwFrameType::Cell : // CellFrame: TH, TD @@ -1251,7 +1251,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * ILLUSTRATION */ - case FRM_FLY : + case SwFrameType::Fly : // FlyFrame: Figure, Formula, Control // fly in content or fly at page @@ -1290,6 +1290,8 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } } break; + + default: break; } if ( USHRT_MAX != nPDFType ) diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 5c3f8a0..a84f757 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -349,10 +349,10 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) { const SwFrame *pFrame = this; rRegDiff = 0; - while( !( ( FRM_BODY | FRM_FLY ) + while( !( ( SwFrameType::Body | SwFrameType::Fly ) & pFrame->GetType() ) && pFrame->GetUpper() ) pFrame = pFrame->GetUpper(); - if( ( FRM_BODY| FRM_FLY ) & pFrame->GetType() ) + if( ( SwFrameType::Body| SwFrameType::Fly ) & pFrame->GetType() ) { SWRECTFN( pFrame ) rRegStart = (pFrame->*fnRect->fnGetPrtTop)(); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 58d931a..91c6d8d 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -799,7 +799,7 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, const IDocumentSettingAccess* pIDSA = pCurrFrame->GetTextNode()->getIDocumentSettingAccess(); if ( ( pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) || !pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ) && - ::FindKontext( pTmp, 0 ) == ::FindKontext( pCurrFrame, 0 ) ) + ::FindKontext( pTmp, SwFrameType::None ) == ::FindKontext( pCurrFrame, SwFrameType::None ) ) { return true; } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 14dab78..49028e0 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -372,7 +372,7 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib ) , mbIsSwapped( false ) , mbFollowFormatAllowed( true ) { - mnFrameType = FRM_TXT; + mnFrameType = SwFrameType::Txt; } void SwTextFrame::DestroyImpl() diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index ab5028e..bfb5615 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -238,54 +238,52 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const switch ( GetType( ) ) { - case FRM_ROOT: + case SwFrameType::Root: name = "root"; break; - case FRM_PAGE: + case SwFrameType::Page: name = "page"; break; - case FRM_COLUMN: + case SwFrameType::Column: name = "column"; break; - case FRM_HEADER: + case SwFrameType::Header: name = "header"; break; - case FRM_FOOTER: + case SwFrameType::Footer: name = "footer"; break; - case FRM_FTNCONT: + case SwFrameType::FtnCont: name = "ftncont"; break; - case FRM_FTN: + case SwFrameType::Ftn: name = "ftn"; break; - case FRM_BODY: + case SwFrameType::Body: name = "body"; break; - case FRM_FLY: + case SwFrameType::Fly: name = "fly"; break; - case FRM_SECTION: + case SwFrameType::Section: name = "section"; break; - case FRM_UNUSED: - name = "unused"; - break; - case FRM_TAB: + case SwFrameType::Tab: name = "tab"; break; - case FRM_ROW: + case SwFrameType::Row: name = "row"; break; - case FRM_CELL: + case SwFrameType::Cell: name = "cell"; break; - case FRM_TXT: + case SwFrameType::Txt: name = "txt"; break; - case FRM_NOTXT: + case SwFrameType::NoTxt: name = "notxt"; break; + default: break; }; if ( name != nullptr ) commit 77a5c97418112127ce8adb5aa902b7c5b7d8c3c3 Author: Noel Grandin <noelgran...@gmail.com> Date: Wed Mar 30 20:53:08 2016 +0200 tdf#84938 convert NA_ constants to scoped enum Change-Id: Id348f202483d17b63c0762a60f8ddc5f01b8e01f diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx index 2a61219..9afe1a6 100644 --- a/sw/source/core/inc/ftnboss.hxx +++ b/sw/source/core/inc/ftnboss.hxx @@ -39,10 +39,9 @@ public: ~SwSaveFootnoteHeight(); }; -#define NA_ONLY_ADJUST 0 -#define NA_GROW_SHRINK 1 -#define NA_GROW_ADJUST 2 -#define NA_ADJUST_GROW 3 +enum class SwNeighbourAdjust { + OnlyAdjust, GrowShrink, GrowAdjust, AdjustGrow +}; typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames; @@ -58,7 +57,7 @@ class SwFootnoteBossFrame: public SwLayoutFrame SwFootnoteContFrame *MakeFootnoteCont(); SwFootnoteFrame *FindFirstFootnote(); - sal_uInt8 _NeighbourhoodAdjustment( const SwFrame* pFrame ) const; + SwNeighbourAdjust _NeighbourhoodAdjustment( const SwFrame* pFrame ) const; protected: void InsertFootnote( SwFootnoteFrame * ); @@ -119,8 +118,8 @@ public: SwTextFootnote *pAttr ); // should AdjustNeighbourhood be called (or Grow/Shrink)? - sal_uInt8 NeighbourhoodAdjustment( const SwFrame* pFrame ) const - { return IsPageFrame() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrame ); } + SwNeighbourAdjust NeighbourhoodAdjustment( const SwFrame* pFrame ) const + { return IsPageFrame() ? SwNeighbourAdjust::OnlyAdjust : _NeighbourhoodAdjustment( pFrame ); } }; inline const SwLayoutFrame *SwFootnoteBossFrame::FindBodyCont() const diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 0a88a25..ca12b24 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -336,12 +336,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) nReal = 0; if ( nGrow > 0 ) { - sal_uInt8 nAdjust = pBoss->NeighbourhoodAdjustment( this ); - if( NA_ONLY_ADJUST == nAdjust ) + SwNeighbourAdjust nAdjust = pBoss->NeighbourhoodAdjustment( this ); + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) nReal = AdjustNeighbourhood( nGrow, bTst ); else { - if( NA_GROW_ADJUST == nAdjust ) + if( SwNeighbourAdjust::GrowAdjust == nAdjust ) { SwFrame* pFootnote = Lower(); if( pFootnote ) @@ -351,12 +351,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) if( static_cast<SwFootnoteFrame*>(pFootnote)->GetAttr()->GetFootnote().IsEndNote() ) { nReal = AdjustNeighbourhood( nGrow, bTst ); - nAdjust = NA_GROW_SHRINK; // no more AdjustNeighbourhood + nAdjust = SwNeighbourAdjust::GrowShrink; // no more AdjustNeighbourhood } } } nReal += pBoss->Grow( nGrow - nReal, bTst ); - if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust ) + if( ( SwNeighbourAdjust::GrowAdjust == nAdjust || SwNeighbourAdjust::AdjustGrow == nAdjust ) && nReal < nGrow ) nReal += AdjustNeighbourhood( nGrow - nReal, bTst ); } @@ -2495,27 +2495,27 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const * @see Grow() * @see Shrink() */ -sal_uInt8 SwFootnoteBossFrame::_NeighbourhoodAdjustment( const SwFrame* ) const +SwNeighbourAdjust SwFootnoteBossFrame::_NeighbourhoodAdjustment( const SwFrame* ) const { - sal_uInt8 nRet = NA_ONLY_ADJUST; + SwNeighbourAdjust nRet = SwNeighbourAdjust::OnlyAdjust; if( GetUpper() && !GetUpper()->IsPageBodyFrame() ) { // column sections need grow/shrink if( GetUpper()->IsFlyFrame() ) - nRet = NA_GROW_SHRINK; + nRet = SwNeighbourAdjust::GrowShrink; else ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits