convert SvxAnchorIds to scoped enum

Change-Id: I4375fa07eb6ac81b21b904e965e4c2f9600ca99a
This commit is contained in:
Noel Grandin
2016-08-24 15:06:35 +02:00
parent ce51b64947
commit 3aa7db4586
11 changed files with 47 additions and 40 deletions

View File

@@ -921,7 +921,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( vcl::Wind
// TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog // TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog
AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog( vcl::Window* pParent, AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog( vcl::Window* pParent,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes ) SvxAnchorIds nAnchorTypes )
{ {
VclPtrInstance<SvxCaptionTabDialog> pDlg( pParent, pView, nAnchorTypes ); VclPtrInstance<SvxCaptionTabDialog> pDlg( pParent, pView, nAnchorTypes );
return new AbstractSvxCaptionDialog_Impl( pDlg ); return new AbstractSvxCaptionDialog_Impl( pDlg );
@@ -1095,7 +1095,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg(
AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( vcl::Window* pParent, AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( vcl::Window* pParent,
const SfxItemSet* pAttr, const SfxItemSet* pAttr,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes ) SvxAnchorIds nAnchorTypes )
{ {
VclPtrInstance<SvxTransformTabDialog> pDlg( pParent, pAttr,pView, nAnchorTypes); VclPtrInstance<SvxTransformTabDialog> pDlg( pParent, pAttr,pView, nAnchorTypes);
return new AbstractSvxTransformTabDialog_Impl( pDlg ); return new AbstractSvxTransformTabDialog_Impl( pDlg );
@@ -1113,14 +1113,14 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( v
{ {
case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE : case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE :
{ {
pDlg.reset( VclPtr<SvxTransformTabDialog>::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE) ); pDlg.reset( VclPtr<SvxTransformTabDialog>::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SvxAnchorIds::NoProtect : SvxAnchorIds::NoProtect|SvxAnchorIds::NoResize) );
pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" ); pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" );
pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" ); pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
} }
break; break;
case RID_SCH_TransformTabDLG_SVXPAGE_SLANT: case RID_SCH_TransformTabDLG_SVXPAGE_SLANT:
{ {
pDlg.reset(VclPtr<SvxTransformTabDialog>::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE ) ); pDlg.reset(VclPtr<SvxTransformTabDialog>::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SvxAnchorIds::NoProtect : SvxAnchorIds::NoProtect|SvxAnchorIds::NoResize ) );
pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" ); pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
} }
break; break;

View File

@@ -476,7 +476,7 @@ public:
const SfxItemSet& rSet) override; const SfxItemSet& rSet) override;
virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent, virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0 ) override; SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) override;
virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(const SfxItemSet& rAttr) override; virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(const SfxItemSet& rAttr) override;
virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( vcl::Window* pParent, const OUString& rCommmand, virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( vcl::Window* pParent, const OUString& rCommmand,
const css::uno::Reference < css::embed::XStorage >& xStor, const css::uno::Reference < css::embed::XStorage >& xStor,
@@ -509,7 +509,7 @@ public:
virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent, virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent,
const SfxItemSet* pAttr, const SfxItemSet* pAttr,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0) override ; SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) override ;
virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent, virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent,
const SfxItemSet* pAttr, const SfxItemSet* pAttr,
const SdrView* pSdrView, const SdrView* pSdrView,

View File

@@ -26,6 +26,7 @@
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <svx/sxctitm.hxx> #include <svx/sxctitm.hxx>
#include <svx/sxcecitm.hxx> #include <svx/sxcecitm.hxx>
#include <svx/anchorid.hxx>
class SdrView; class SdrView;
@@ -101,7 +102,7 @@ class SvxCaptionTabDialog : public SfxTabDialog
{ {
private: private:
const SdrView* pView; const SdrView* pView;
sal_uInt16 nAnchorCtrls; SvxAnchorIds nAnchorCtrls;
sal_uInt16 m_nSwPosSizePageId; sal_uInt16 m_nSwPosSizePageId;
sal_uInt16 m_nPositionSizePageId; sal_uInt16 m_nPositionSizePageId;
sal_uInt16 m_nCaptionPageId; sal_uInt16 m_nCaptionPageId;
@@ -112,7 +113,7 @@ private:
public: public:
SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pView, SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0); SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE);
/// link for the Writer to validate positions /// link for the Writer to validate positions
void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ); void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink );

View File

@@ -31,6 +31,7 @@
struct FrmMap; struct FrmMap;
class SdrView; class SdrView;
struct SvxSwFrameValidation; struct SvxSwFrameValidation;
enum class SvxAnchorIds;
class SvxSwPosSizeTabPage : public SfxTabPage class SvxSwPosSizeTabPage : public SfxTabPage
{ {
@@ -136,7 +137,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void EnableAnchorTypes(sal_uInt16 nAnchorEnable); void EnableAnchorTypes(SvxAnchorIds nAnchorEnable);
void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink )
{m_aValidateLink = rLink;} {m_aValidateLink = rLink;}

View File

@@ -21,6 +21,7 @@
#include <svx/dlgctrl.hxx> #include <svx/dlgctrl.hxx>
#include <svx/dialcontrol.hxx> #include <svx/dialcontrol.hxx>
#include <svx/anchorid.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
@@ -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; struct SvxSwFrameValidation;
class SvxTransformTabDialog : public SfxTabDialog class SvxTransformTabDialog : public SfxTabDialog
{ {
@@ -53,7 +46,7 @@ class SvxTransformTabDialog : public SfxTabDialog
private: private:
const SdrView* pView; const SdrView* pView;
sal_uInt16 nAnchorCtrls; SvxAnchorIds nAnchorCtrls;
Link<SvxSwFrameValidation&,void> aValidateLink; Link<SvxSwFrameValidation&,void> aValidateLink;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
@@ -62,7 +55,7 @@ public:
SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0); SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE);
//link for the Writer to validate positions //link for the Writer to validate positions
void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ); void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink );

View File

@@ -507,7 +507,7 @@ void SvxCaptionTabPage::FillValueSet()
SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pSdrView, SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pSdrView,
sal_uInt16 nAnchorTypes) SvxAnchorIds nAnchorTypes)
: SfxTabDialog( pParent, "CalloutDialog", "cui/ui/calloutdialog.ui") : SfxTabDialog( pParent, "CalloutDialog", "cui/ui/calloutdialog.ui")
, pView(pSdrView) , pView(pSdrView)
, nAnchorCtrls(nAnchorTypes) , nAnchorCtrls(nAnchorTypes)
@@ -518,7 +518,7 @@ SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pS
assert(pView); //Keine gueltige View Uebergeben! assert(pView); //Keine gueltige View Uebergeben!
//different positioning page in Writer //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, m_nSwPosSizePageId = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create,
SvxSwPosSizeTabPage::GetRanges ); SvxSwPosSizeTabPage::GetRanges );
@@ -540,10 +540,10 @@ void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
{ {
static_cast<SvxPositionSizeTabPage&>( rPage ).SetView( pView ); static_cast<SvxPositionSizeTabPage&>( rPage ).SetView( pView );
static_cast<SvxPositionSizeTabPage&>( rPage ).Construct(); static_cast<SvxPositionSizeTabPage&>( rPage ).Construct();
if( nAnchorCtrls & SVX_OBJ_NORESIZE ) if( nAnchorCtrls & SvxAnchorIds::NoResize )
static_cast<SvxPositionSizeTabPage&>( rPage ).DisableResize(); static_cast<SvxPositionSizeTabPage&>( rPage ).DisableResize();
if( nAnchorCtrls & SVX_OBJ_NOPROTECT ) if( nAnchorCtrls & SvxAnchorIds::NoProtect )
static_cast<SvxPositionSizeTabPage&>( rPage ).DisableProtect(); static_cast<SvxPositionSizeTabPage&>( rPage ).DisableProtect();
} }
else if (nId == m_nSwPosSizePageId) else if (nId == m_nSwPosSizePageId)

View File

@@ -1096,11 +1096,11 @@ DeactivateRC SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage; 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(); m_pToFrameRB->Show();
if(!(nAnchorEnable & SVX_OBJ_PAGE)) if(!(nAnchorEnable & SvxAnchorIds::Page))
m_pToPageRB->Enable(false); m_pToPageRB->Enable(false);
} }

View File

@@ -88,7 +88,7 @@ const sal_uInt16 SvxSlantTabPage::pSlantRanges[] =
\************************************************************************/ \************************************************************************/
SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
const SdrView* pSdrView, sal_uInt16 nAnchorTypes ) const SdrView* pSdrView, SvxAnchorIds nAnchorTypes )
: SfxTabDialog( pParent : SfxTabDialog( pParent
,"PositionAndSizeDialog" ,"PositionAndSizeDialog"
,"cui/ui/positionsizedialog.ui" ,"cui/ui/positionsizedialog.ui"
@@ -101,7 +101,7 @@ SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxIte
DBG_ASSERT(pView, "no valid view (!)"); DBG_ASSERT(pView, "no valid view (!)");
//different positioning page in Writer //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); nSWPosSize = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges);
RemoveTabPage("RID_SVXPAGE_POSITION_SIZE"); RemoveTabPage("RID_SVXPAGE_POSITION_SIZE");
@@ -125,12 +125,12 @@ void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
rSvxPos.SetView(pView); rSvxPos.SetView(pView);
rSvxPos.Construct(); rSvxPos.Construct();
if(nAnchorCtrls & SVX_OBJ_NORESIZE) if(nAnchorCtrls & SvxAnchorIds::NoResize)
{ {
rSvxPos.DisableResize(); rSvxPos.DisableResize();
} }
if(nAnchorCtrls & SVX_OBJ_NOPROTECT) if(nAnchorCtrls & SvxAnchorIds::NoProtect)
{ {
rSvxPos.DisableProtect(); rSvxPos.DisableProtect();
rSvxPos.UpdateControlStates(); rSvxPos.UpdateControlStates();

View File

@@ -19,15 +19,26 @@
#ifndef INCLUDED_SVX_ANCHORID_HXX #ifndef INCLUDED_SVX_ANCHORID_HXX
#define INCLUDED_SVX_ANCHORID_HXX #define INCLUDED_SVX_ANCHORID_HXX
#include <o3tl/typed_flags_set.hxx>
enum SvxAnchorIds enum class SvxAnchorIds
{ {
SVX_OBJ_AT_CNTNT = 0x01, // Frame bound to paragraph NONE = 0x0000,
SVX_OBJ_IN_CNTNT = 0x02, // Frame bound to character Paragraph = 0x0001, // Frame bound to paragraph
SVX_OBJ_PAGE = 0x04, // Frame bound to page Character = 0x0002, // Frame bound to character
SVX_OBJ_AT_FLY = 0x08 // Frame bound to other frame Page = 0x0004, // Frame bound to page
// SVX_OBJ_AUTO_CNTNT = 0x10 // Automatically positioned frame bound to paragraph 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<SvxAnchorIds> : is_typed_flags<SvxAnchorIds, 0x030f> {};
}
#endif #endif

View File

@@ -20,6 +20,7 @@
#define INCLUDED_SVX_SVXDLG_HXX #define INCLUDED_SVX_SVXDLG_HXX
#include <sfx2/sfxdlg.hxx> #include <sfx2/sfxdlg.hxx>
#include <svx/anchorid.hxx>
#include <svx/zoom_def.hxx> #include <svx/zoom_def.hxx>
#include <editeng/edtdlg.hxx> #include <editeng/edtdlg.hxx>
@@ -281,7 +282,7 @@ public:
virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent, virtual AbstractSvxCaptionDialog* CreateCaptionDialog( vcl::Window* pParent,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0 ) = 0; SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) = 0;
virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog( virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(
const SfxItemSet& rAttr)= 0; const SfxItemSet& rAttr)= 0;
@@ -329,7 +330,7 @@ public:
virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent, virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( vcl::Window* pParent,
const SfxItemSet* pAttr, const SfxItemSet* pAttr,
const SdrView* pView, const SdrView* pView,
sal_uInt16 nAnchorTypes = 0) = 0; SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) = 0;
virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent, virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( vcl::Window* pParent,
const SfxItemSet* pAttr, const SfxItemSet* pAttr,
const SdrView* pSdrView, const SdrView* pSdrView,

View File

@@ -187,11 +187,11 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq)
// Allowed anchorages: // Allowed anchorages:
short nAnchor = pSh->GetAnchorId(); 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()); sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
if ( pSh->IsFlyInFly() ) if ( pSh->IsFlyInFly() )
nAllowedAnchors |= SVX_OBJ_AT_FLY; nAllowedAnchors |= SvxAnchorIds::Fly;
if (pObj->GetObjIdentifier() == OBJ_CAPTION ) if (pObj->GetObjIdentifier() == OBJ_CAPTION )
bCaption = true; bCaption = true;