summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/textboxhelper.cxx29
-rw-r--r--sw/source/core/draw/dcontact.cxx11
2 files changed, 40 insertions, 0 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 06bbc7fd3662..7e70b4e0f8ea 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -13,6 +13,7 @@
#include <fmtanchr.hxx>
#include <fmtcnct.hxx>
#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
#include <doc.hxx>
#include <docsh.hxx>
#include <docary.hxx>
@@ -510,6 +511,34 @@ void SwTextBoxHelper::syncFlyFrmAttr(SwFrmFmt& rShape, SfxItemSet& rSet)
aTextBoxSet.Put(aOrient);
}
break;
+ case RES_FRM_SIZE:
+ {
+ // In case the shape got resized, then we need to adjust both
+ // the position and the size of the textbox (e.g. larger
+ // rounded edges of a rectangle -> need to push right/down the
+ // textbox).
+ SwFmtVertOrient aVertOrient(rShape.GetVertOrient());
+ SwFmtHoriOrient aHoriOrient(rShape.GetHoriOrient());
+ SwFmtFrmSize aSize(pFmt->GetFrmSize());
+
+ Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
+ if (!aRect.IsEmpty())
+ {
+ aVertOrient.SetPos(aVertOrient.GetPos() + aRect.getY());
+ aTextBoxSet.Put(aVertOrient);
+
+ aHoriOrient.SetPos(aHoriOrient.GetPos() + aRect.getX());
+ aTextBoxSet.Put(aHoriOrient);
+
+ aSize.SetWidth(aRect.getWidth());
+ aSize.SetHeight(aRect.getHeight());
+ aTextBoxSet.Put(aSize);
+ }
+ }
+ break;
+ default:
+ SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrmAttr: unhandled which-id: " << nWhich);
+ break;
}
if (aIter.IsAtEnd())
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 4377594104e5..1c400daac0fc 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -41,10 +41,12 @@
#include <fmtanchr.hxx>
#include <node.hxx>
#include <fmtcntnt.hxx>
+#include <fmtfsize.hxx>
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <frmtool.hxx>
#include <flyfrm.hxx>
+#include <textboxhelper.hxx>
#include <frmfmt.hxx>
#include <dflyobj.hxx>
#include <dcontact.hxx>
@@ -1382,6 +1384,15 @@ void SwDrawContact::_Changed( const SdrObject& rObj,
pAnchorFrm->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
}
}
+
+ if (SwTextBoxHelper::findTextBox(GetFmt()))
+ {
+ // Just notify the textbox that the size has changed, the actual object size is not interesting.
+ SfxItemSet aResizeSet(GetFmt()->GetDoc()->GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE, 0);
+ SwFmtFrmSize aSize;
+ aResizeSet.Put(aSize);
+ SwTextBoxHelper::syncFlyFrmAttr(*GetFmt(), aResizeSet);
+ }
}
}
}