Kaydet (Commit) 3aa7db45 authored tarafından Noel Grandin's avatar Noel Grandin

convert SvxAnchorIds to scoped enum

Change-Id: I4375fa07eb6ac81b21b904e965e4c2f9600ca99a
üst ce51b649
......@@ -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<SvxCaptionTabDialog> 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<SvxTransformTabDialog> 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<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_SLANT" );
}
break;
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" );
}
break;
......
......@@ -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,
......
......@@ -26,6 +26,7 @@
#include <sfx2/tabdlg.hxx>
#include <svx/sxctitm.hxx>
#include <svx/sxcecitm.hxx>
#include <svx/anchorid.hxx>
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<SvxSwFrameValidation&,void>& rLink );
......
......@@ -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<SvxSwFrameValidation&,void>& rLink )
{m_aValidateLink = rLink;}
......
......@@ -21,6 +21,7 @@
#include <svx/dlgctrl.hxx>
#include <svx/dialcontrol.hxx>
#include <svx/anchorid.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;
class SvxTransformTabDialog : public SfxTabDialog
{
......@@ -53,7 +46,7 @@ class SvxTransformTabDialog : public SfxTabDialog
private:
const SdrView* pView;
sal_uInt16 nAnchorCtrls;
SvxAnchorIds nAnchorCtrls;
Link<SvxSwFrameValidation&,void> 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<SvxSwFrameValidation&,void>& rLink );
......
......@@ -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<SvxPositionSizeTabPage&>( rPage ).SetView( pView );
static_cast<SvxPositionSizeTabPage&>( rPage ).Construct();
if( nAnchorCtrls & SVX_OBJ_NORESIZE )
if( nAnchorCtrls & SvxAnchorIds::NoResize )
static_cast<SvxPositionSizeTabPage&>( rPage ).DisableResize();
if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
if( nAnchorCtrls & SvxAnchorIds::NoProtect )
static_cast<SvxPositionSizeTabPage&>( rPage ).DisableProtect();
}
else if (nId == m_nSwPosSizePageId)
......
......@@ -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);
}
......
......@@ -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();
......
......@@ -19,15 +19,26 @@
#ifndef 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
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<SvxAnchorIds> : is_typed_flags<SvxAnchorIds, 0x030f> {};
}
#endif
......
......@@ -20,6 +20,7 @@
#define INCLUDED_SVX_SVXDLG_HXX
#include <sfx2/sfxdlg.hxx>
#include <svx/anchorid.hxx>
#include <svx/zoom_def.hxx>
#include <editeng/edtdlg.hxx>
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment