diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-27 13:47:11 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-27 15:56:05 +0200 |
commit | c00d81612e128b74c23c95e011b482dc3918fca4 (patch) | |
tree | d41b6e7f31820532337822956000df2eb5c638f2 | |
parent | 4f33a0961d69feba72806d105da65a4dc841ca5e (diff) |
SwFlyFrm::Format: inform our custom shape about size changes if needed
This adds support for the following scenario:
- Shape has no editeng text, but a textbox
- Shape has automatic size
- User edits the fly frame (serving as the textbox of the draw shape)
and expects that both the shape and the textbox gets resized
accordingly
Note that this way we can signal our size request for the textbox, and
the custom shape takes care of resizing the shape in a way, so that
after the resize, the text area counted from the custom shape geometry
will be exactly what we requested. (I.e. just asking the shape to have
the same size as the fly would work for rectangle, but not e.g. for
triangles.)
Change-Id: I1e7efd00db52cf28481f6821ea6949f748b855e7
-rw-r--r-- | sw/source/core/layout/fly.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 306875bc1053..c87d0cb67b7b 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -41,6 +41,7 @@ #include <ndole.hxx> #include <swtable.hxx> #include <svx/svdpage.hxx> +#include <svx/svdoashp.hxx> #include "layouter.hxx" #include "pagefrm.hxx" #include "rootfrm.hxx" @@ -59,6 +60,7 @@ #include <vcl/svapp.hxx> #include "switerator.hxx" #include <IDocumentSettingAccess.hxx> +#include <textboxhelper.hxx> using namespace ::com::sun::star; @@ -1275,6 +1277,21 @@ void SwFlyFrm::Format( const SwBorderAttrs *pAttrs ) InvalidateObjRectWithSpaces(); } mbValidSize = true; + + std::map<SwFrmFmt*, SwFrmFmt*> aShapes = SwTextBoxHelper::findShapes(GetFmt()->GetDoc()); + if (aShapes.find(GetFmt()) != aShapes.end()) + { + // This fly is a textbox of a draw shape. + SdrObject* pShape = aShapes[GetFmt()]->FindSdrObject(); + if (SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pShape)) + { + // The shape is a customshape: then inform it about the calculated fly size. + Size aSize((Frm().*fnRect->fnGetWidth)(), (Frm().*fnRect->fnGetHeight)()); + pCustomShape->SuggestTextFrameSize(aSize); + // Do the calculations normally done after touching editeng text of the shape. + pCustomShape->NbcSetOutlinerParaObjectForText(0, 0); + } + } } else { |