[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 2 02:40:30 PDT 2014


 sw/source/core/doc/textboxhelper.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 8007579865e48a626a186ad10e1c2dc1872757dc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 2 11:27:36 2014 +0200

    SwTextBoxHelper: take care of position after a CustomShapeGeometry change
    
    This is required by the ODF import, as that sets the CustomShapeGeometry
    after setting other properties (like Transformation, which includes the
    position/size).
    
    Change-Id: I299a1b302d55b3753a0a6b2142ea173f5f134b39

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 34e9590..e8411da 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -243,7 +243,18 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrmFmt* pShape, bool bAbsolute)
 void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyName, const css::uno::Any& /*rValue*/)
 {
     if (rPropertyName == "CustomShapeGeometry")
+    {
+        // CustomShapeGeometry changes the textbox position offset and size, so adjust both.
         syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any());
+
+        SdrObject* pObject = pShape->FindRealSdrObject();
+        if (pObject)
+        {
+            Rectangle aRectangle(pObject->GetSnapRect());
+            syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left()))));
+            syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top()))));
+        }
+    }
 }
 
 void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, const css::uno::Any& rValue)


More information about the Libreoffice-commits mailing list