summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx3
-rw-r--r--sw/source/core/doc/textboxhelper.cxx60
-rw-r--r--sw/source/core/frmedt/fefly1.cxx4
3 files changed, 54 insertions, 13 deletions
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index 57f8af08920b..a582fddaa1cb 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -471,7 +471,8 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
boxAnchor.SetType(RndStdIds::FLY_AT_CHAR);
}
// presumably these anchors are supported though not sure
- assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId());
+ assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId()
+ || boxAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE);
SwFrameFormat* pDestTextBox = CopyLayoutFormat(*pSourceTextBox,
boxAnchor, bSetTextFlyAtt, bMakeFrames);
SwAttrSet aSet(pDest->GetAttrSet());
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index fb1a9f4bf764..d80440c916f5 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -141,6 +141,36 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
text::WritingMode eMode;
if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= eMode)
syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
+
+ const SwFormatAnchor& rAnch = pShape->GetAnchor();
+ if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() != 0)
+ || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA
+ || rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
+ && rAnch.GetContentAnchor()))
+ {
+ SfxItemSet aTxFrmSet(pFormat->GetDoc()->GetAttrPool(), aFrameFormatSetRange);
+ SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+
+ if (pShape->GetAnchor().GetContentAnchor())
+ aNewAnch.SetAnchor(pShape->GetAnchor().GetContentAnchor());
+ if (pShape->GetAnchor().GetPageNum() > 0)
+ aNewAnch.SetPageNum(pShape->GetAnchor().GetPageNum());
+
+ aNewAnch.SetType(pShape->GetAnchor().GetAnchorId());
+ aTxFrmSet.Put(aNewAnch);
+
+ SwFormatVertOrient aVOri(pFormat->GetVertOrient());
+ SwFormatHoriOrient aHOri(pFormat->GetHoriOrient());
+ aVOri.SetVertOrient(pShape->GetVertOrient().GetVertOrient());
+ aHOri.SetHoriOrient(pShape->GetHoriOrient().GetHoriOrient());
+ aVOri.SetRelationOrient(pShape->GetVertOrient().GetRelationOrient());
+ aHOri.SetRelationOrient(pShape->GetHoriOrient().GetRelationOrient());
+ aTxFrmSet.Put(aVOri);
+ aTxFrmSet.Put(aHOri);
+
+ if (aTxFrmSet.Count())
+ pFormat->SetFormatAttr(aTxFrmSet);
+ }
}
void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
@@ -695,14 +725,22 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
SfxItemIter aIter(rSet);
const SfxPoolItem* pItem = aIter.GetCurItem();
+
+ const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
+ if ((aAnchId == RndStdIds::FLY_AT_PAGE && rShape.GetAnchor().GetPageNum() != 0)
+ || ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == RndStdIds::FLY_AT_CHAR)
+ && rShape.GetAnchor().GetContentAnchor()))
+ {
+ SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+ if (rShape.GetAnchor().GetContentAnchor())
+ aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
+ if (rShape.GetAnchor().GetPageNum() > 0)
+ aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
+ aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
+ aTextBoxSet.Put(aNewAnch);
+ }
do
{
- if (rShape.GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
- {
- const SwFormatAnchor& rShapeAnch = rShape.GetAnchor();
- aTextBoxSet.Put(rShapeAnch);
- }
-
switch (pItem->Which())
{
case RES_VERT_ORIENT:
@@ -714,10 +752,9 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
if (!aRect.IsEmpty())
aOrient.SetPos(aOrient.GetPos() + aRect.getY());
- if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE)
- {
+ if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
+ && rShape.GetAnchor().GetPageNum() != 0)
aOrient.SetRelationOrient(rShape.GetVertOrient().GetRelationOrient());
- }
aTextBoxSet.Put(aOrient);
// restore height (shrunk for extending beyond the page bottom - tdf#91260)
@@ -738,10 +775,9 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
if (!aRect.IsEmpty())
aOrient.SetPos(aOrient.GetPos() + aRect.getX());
- if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE)
- {
+ if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
+ && rShape.GetAnchor().GetPageNum() != 0)
aOrient.SetRelationOrient(rShape.GetHoriOrient().GetRelationOrient());
- }
aTextBoxSet.Put(aOrient);
}
break;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index c671a7a26b35..24da5bbb72c6 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -610,6 +610,10 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt )
new SwHandleAnchorNodeChg( *pFlyFrameFormat, aAnch ));
}
rFormat.GetDoc()->SetAttr( aAnch, rFormat );
+ if (SwTextBoxHelper::getOtherTextBoxFormat(&rFormat, RES_DRAWFRMFMT))
+ {
+ SwTextBoxHelper::syncFlyFrameAttr(rFormat, rFormat.GetAttrSet());
+ }
}
// #i28701# - no call of method
// <CheckCharRectAndTopOfLine()> for to-character anchored