From 3aa7db4586c53a0815b74cc514ff8a6541dc7e01 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 24 Aug 2016 15:06:35 +0200 Subject: convert SvxAnchorIds to scoped enum Change-Id: I4375fa07eb6ac81b21b904e965e4c2f9600ca99a --- cui/source/factory/dlgfact.cxx | 8 ++++---- cui/source/factory/dlgfact.hxx | 4 ++-- cui/source/inc/labdlg.hxx | 5 +++-- cui/source/inc/swpossizetabpage.hxx | 3 ++- cui/source/inc/transfrm.hxx | 13 +++---------- cui/source/tabpages/labdlg.cxx | 8 ++++---- cui/source/tabpages/swpossizetabpage.cxx | 6 +++--- cui/source/tabpages/transfrm.cxx | 8 ++++---- include/svx/anchorid.hxx | 23 +++++++++++++++++------ include/svx/svxdlg.hxx | 5 +++-- sw/source/uibase/shells/drwbassh.cxx | 4 ++-- 11 files changed, 47 insertions(+), 40 deletions(-) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index c1f3644801b2..39ec6d2ab749 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -921,7 +921,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( vcl::Wind // TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog( vcl::Window* pParent, const SdrView* pView, - sal_uInt16 nAnchorTypes ) + SvxAnchorIds nAnchorTypes ) { VclPtrInstance pDlg( pParent, pView, nAnchorTypes ); return new AbstractSvxCaptionDialog_Impl( pDlg ); @@ -1095,7 +1095,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, - sal_uInt16 nAnchorTypes ) + SvxAnchorIds nAnchorTypes ) { VclPtrInstance pDlg( pParent, pAttr,pView, nAnchorTypes); return new AbstractSvxTransformTabDialog_Impl( pDlg ); @@ -1113,14 +1113,14 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( v { case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE : { - pDlg.reset( VclPtr::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE) ); + pDlg.reset( VclPtr::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SvxAnchorIds::NoProtect : SvxAnchorIds::NoProtect|SvxAnchorIds::NoResize) ); pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" ); pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" ); } break; case RID_SCH_TransformTabDLG_SVXPAGE_SLANT: { - pDlg.reset(VclPtr::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE ) ); + pDlg.reset(VclPtr::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SvxAnchorIds::NoProtect : SvxAnchorIds::NoProtect|SvxAnchorIds::NoResize ) ); pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" ); } break; diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 1196aa3556dc..4790b8054400 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -476,7 +476,7 @@ public: const SfxItemSet& rSet) override; virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0 ) override; + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) override; virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(const SfxItemSet& rAttr) override; virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( vcl::Window* pParent, const OUString& rCommmand, const css::uno::Reference < css::embed::XStorage >& xStor, @@ -509,7 +509,7 @@ public: virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0) override ; + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) override ; virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pSdrView, diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx index a7b10648b434..e431abb0065f 100644 --- a/cui/source/inc/labdlg.hxx +++ b/cui/source/inc/labdlg.hxx @@ -26,6 +26,7 @@ #include #include #include +#include class SdrView; @@ -101,7 +102,7 @@ class SvxCaptionTabDialog : public SfxTabDialog { private: const SdrView* pView; - sal_uInt16 nAnchorCtrls; + SvxAnchorIds nAnchorCtrls; sal_uInt16 m_nSwPosSizePageId; sal_uInt16 m_nPositionSizePageId; sal_uInt16 m_nCaptionPageId; @@ -112,7 +113,7 @@ private: public: SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0); + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE); /// link for the Writer to validate positions void SetValidateFramePosLink( const Link& rLink ); diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx index 611ebc01003d..5142d6dfaeaf 100644 --- a/cui/source/inc/swpossizetabpage.hxx +++ b/cui/source/inc/swpossizetabpage.hxx @@ -31,6 +31,7 @@ struct FrmMap; class SdrView; struct SvxSwFrameValidation; +enum class SvxAnchorIds; class SvxSwPosSizeTabPage : public SfxTabPage { @@ -136,7 +137,7 @@ public: virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; - void EnableAnchorTypes(sal_uInt16 nAnchorEnable); + void EnableAnchorTypes(SvxAnchorIds nAnchorEnable); void SetValidateFramePosLink( const Link& rLink ) {m_aValidateLink = rLink;} diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx index 2857e451cc76..7e9077758e54 100644 --- a/cui/source/inc/transfrm.hxx +++ b/cui/source/inc/transfrm.hxx @@ -21,6 +21,7 @@ #include #include +#include #include @@ -35,14 +36,6 @@ class SdrView; |* \************************************************************************/ -/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor - to disable the size controls */ -const sal_uInt16 SVX_OBJ_NORESIZE = 0x0100; - -/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor - to disable the protect controls */ -const sal_uInt16 SVX_OBJ_NOPROTECT = 0x0200; - struct SvxSwFrameValidation; class SvxTransformTabDialog : public SfxTabDialog { @@ -53,7 +46,7 @@ class SvxTransformTabDialog : public SfxTabDialog private: const SdrView* pView; - sal_uInt16 nAnchorCtrls; + SvxAnchorIds nAnchorCtrls; Link aValidateLink; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; @@ -62,7 +55,7 @@ public: SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0); + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE); //link for the Writer to validate positions void SetValidateFramePosLink( const Link& rLink ); diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index 2c01f5381630..3c2d3e9c0fdf 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -507,7 +507,7 @@ void SvxCaptionTabPage::FillValueSet() SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pSdrView, - sal_uInt16 nAnchorTypes) + SvxAnchorIds nAnchorTypes) : SfxTabDialog( pParent, "CalloutDialog", "cui/ui/calloutdialog.ui") , pView(pSdrView) , nAnchorCtrls(nAnchorTypes) @@ -518,7 +518,7 @@ SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pS assert(pView); //Keine gueltige View Uebergeben! //different positioning page in Writer - if (nAnchorCtrls & 0x00ff) + if (nAnchorCtrls & (SvxAnchorIds::Paragraph | SvxAnchorIds::Character | SvxAnchorIds::Page | SvxAnchorIds::Fly)) { m_nSwPosSizePageId = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges ); @@ -540,10 +540,10 @@ void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { static_cast( rPage ).SetView( pView ); static_cast( rPage ).Construct(); - if( nAnchorCtrls & SVX_OBJ_NORESIZE ) + if( nAnchorCtrls & SvxAnchorIds::NoResize ) static_cast( rPage ).DisableResize(); - if( nAnchorCtrls & SVX_OBJ_NOPROTECT ) + if( nAnchorCtrls & SvxAnchorIds::NoProtect ) static_cast( rPage ).DisableProtect(); } else if (nId == m_nSwPosSizePageId) diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 6fcd7cc97238..053495cccca3 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -1096,11 +1096,11 @@ DeactivateRC SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) return DeactivateRC::LeavePage; } -void SvxSwPosSizeTabPage::EnableAnchorTypes(sal_uInt16 nAnchorEnable) +void SvxSwPosSizeTabPage::EnableAnchorTypes(SvxAnchorIds nAnchorEnable) { - if((nAnchorEnable & SVX_OBJ_AT_FLY)) + if((nAnchorEnable & SvxAnchorIds::Fly)) m_pToFrameRB->Show(); - if(!(nAnchorEnable & SVX_OBJ_PAGE)) + if(!(nAnchorEnable & SvxAnchorIds::Page)) m_pToPageRB->Enable(false); } diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index b570a604206e..90cede794f54 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -88,7 +88,7 @@ const sal_uInt16 SvxSlantTabPage::pSlantRanges[] = \************************************************************************/ SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, - const SdrView* pSdrView, sal_uInt16 nAnchorTypes ) + const SdrView* pSdrView, SvxAnchorIds nAnchorTypes ) : SfxTabDialog( pParent ,"PositionAndSizeDialog" ,"cui/ui/positionsizedialog.ui" @@ -101,7 +101,7 @@ SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxIte DBG_ASSERT(pView, "no valid view (!)"); //different positioning page in Writer - if(nAnchorCtrls & 0x00ff) + if(nAnchorCtrls & (SvxAnchorIds::Paragraph | SvxAnchorIds::Character | SvxAnchorIds::Page | SvxAnchorIds::Fly)) { nSWPosSize = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges); RemoveTabPage("RID_SVXPAGE_POSITION_SIZE"); @@ -125,12 +125,12 @@ void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) rSvxPos.SetView(pView); rSvxPos.Construct(); - if(nAnchorCtrls & SVX_OBJ_NORESIZE) + if(nAnchorCtrls & SvxAnchorIds::NoResize) { rSvxPos.DisableResize(); } - if(nAnchorCtrls & SVX_OBJ_NOPROTECT) + if(nAnchorCtrls & SvxAnchorIds::NoProtect) { rSvxPos.DisableProtect(); rSvxPos.UpdateControlStates(); diff --git a/include/svx/anchorid.hxx b/include/svx/anchorid.hxx index 921769cd5ecc..da73870109e5 100644 --- a/include/svx/anchorid.hxx +++ b/include/svx/anchorid.hxx @@ -19,15 +19,26 @@ #ifndef INCLUDED_SVX_ANCHORID_HXX #define INCLUDED_SVX_ANCHORID_HXX +#include -enum SvxAnchorIds +enum class SvxAnchorIds { - SVX_OBJ_AT_CNTNT = 0x01, // Frame bound to paragraph - SVX_OBJ_IN_CNTNT = 0x02, // Frame bound to character - SVX_OBJ_PAGE = 0x04, // Frame bound to page - SVX_OBJ_AT_FLY = 0x08 // Frame bound to other frame -// SVX_OBJ_AUTO_CNTNT = 0x10 // Automatically positioned frame bound to paragraph + NONE = 0x0000, + Paragraph = 0x0001, // Frame bound to paragraph + Character = 0x0002, // Frame bound to character + Page = 0x0004, // Frame bound to page + Fly = 0x0008, // Frame bound to other frame + /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor + to disable the size controls */ + NoResize = 0x0100, + /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor + to disable the protect controls */ + NoProtect = 0x0200 }; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} #endif diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 2224c3342b6d..f3a21ca0f8d9 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SVX_SVXDLG_HXX #include +#include #include #include @@ -281,7 +282,7 @@ public: virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0 ) = 0; + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) = 0; virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog( const SfxItemSet& rAttr)= 0; @@ -329,7 +330,7 @@ public: virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0) = 0; + SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) = 0; virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrView* pSdrView, diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 34f379d20ccb..141a75700eee 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -187,11 +187,11 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) // Allowed anchorages: short nAnchor = pSh->GetAnchorId(); - sal_uInt16 nAllowedAnchors = SVX_OBJ_AT_CNTNT | SVX_OBJ_IN_CNTNT | SVX_OBJ_PAGE; + SvxAnchorIds nAllowedAnchors = SvxAnchorIds::Paragraph | SvxAnchorIds::Character | SvxAnchorIds::Page; sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell()); if ( pSh->IsFlyInFly() ) - nAllowedAnchors |= SVX_OBJ_AT_FLY; + nAllowedAnchors |= SvxAnchorIds::Fly; if (pObj->GetObjIdentifier() == OBJ_CAPTION ) bCaption = true; -- cgit