summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-10 15:10:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-10 16:09:26 +0100
commitd961c9273104f552a8207e63c33e33f1e265565d (patch)
treea84f51eeb5833131e0191e285dbfd8b368e3d020
parent8ac129a59b237e561b0884a2643030c2ce1175dd (diff)
split out useful code as standalone makeItemSetFromFormatAnchor
Change-Id: I385549b4841dfc715aa984bcc257d78c9f1c3ed4
-rw-r--r--sw/inc/fesh.hxx1
-rw-r--r--sw/source/core/frmedt/fefly1.cxx10
-rw-r--r--sw/source/uibase/shells/basesh.cxx16
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