diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-09-10 15:10:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-10 16:09:26 +0100 |
commit | d961c9273104f552a8207e63c33e33f1e265565d (patch) | |
tree | a84f51eeb5833131e0191e285dbfd8b368e3d020 | |
parent | 8ac129a59b237e561b0884a2643030c2ce1175dd (diff) |
split out useful code as standalone makeItemSetFromFormatAnchor
Change-Id: I385549b4841dfc715aa984bcc257d78c9f1c3ed4
-rw-r--r-- | sw/inc/fesh.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 16 |
3 files changed, 17 insertions, 10 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 317b2f80ab41..6e66129623b7 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -380,6 +380,7 @@ public: bool IsFrmSelected() const; bool GetFlyFrmAttr( SfxItemSet &rSet ) const; bool SetFlyFrmAttr( SfxItemSet &rSet ); + SfxItemSet makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) const; bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 ); const SwFrameFormat *NewFlyFrm( const SfxItemSet &rSet, bool bAnchValid = false, SwFrameFormat *pParent = 0 ); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index d814cfdd5df8..3f126fbad84f 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1053,6 +1053,16 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet ) return bRet; } +SfxItemSet SwFEShell::makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) const +{ + // The set also includes VERT/HORI_ORIENT, because the align + // shall be changed in FEShell::SetFlyFrmAttr/SetFlyFrmAnchor, + // possibly as a result of the anchor change. + SfxItemSet aSet(rPool, RES_VERT_ORIENT, RES_ANCHOR); + aSet.Put(rAnchor); + return aSet; +} + bool SwFEShell::SetDrawingAttr( SfxItemSet& rSet ) { bool bRet = false; diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 66a50728f047..07eb9eed9e0e 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1008,16 +1008,12 @@ void SwBaseShell::Execute(SfxRequest &rReq) ? FLY_AS_CHAR : FLY_AT_CHAR; rSh.StartUndo(); - if( rSh.IsObjSelected() ) - rSh.ChgAnchor( eSet ); - else if( rSh.IsFrmSelected() ) - { - // The set also includes VERT/HORI_ORIENT, because the align - // shall be changed in FEShell::SetFlyFrmAttr/SetFlyFrmAnchor, - // possibly as a result of the anchor change. - SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR ); - SwFormatAnchor aAnc( eSet, rSh.GetPhyPageNum() ); - aSet.Put( aAnc ); + if (rSh.IsObjSelected()) + rSh.ChgAnchor(eSet); + else if (rSh.IsFrmSelected()) + { + SwFormatAnchor aAnc(eSet, rSh.GetPhyPageNum()); + SfxItemSet aSet(rSh.makeItemSetFromFormatAnchor(GetPool(), aAnc)); rSh.SetFlyFrmAttr(aSet); } // if new anchor is 'as char' and it is a Math object and the usual |