sw/inc/textboxhelper.hxx | 4 ++++ sw/source/core/doc/textboxhelper.cxx | 18 ++++++++++++++++++ sw/source/core/unocore/unodraw.cxx | 7 +++++++ 3 files changed, 29 insertions(+)
New commits: commit 24d8bcc763b550d8da0e0a6b9f5c3b4113662b5c Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 30 17:42:22 2014 +0200 SwTextBoxHelper: handle size when it's set before CustomShapeGeometry E.g. the ODF import won't set an explicit size, it'll just set a Transformation property, and a CustomShapeGeometry one, which contains the textbox rectangle. Change-Id: I9ac7ab5a324dc9c7c5ce3196fee8d257b7426f41 diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index 5deb5f6..75d2fac 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -36,8 +36,12 @@ public: static void destroy(SwFrmFmt* pShape); /// Get interface of a shape's TextBox, if there is any. static css::uno::Any queryInterface(SwFrmFmt* pShape, const css::uno::Type& rType); + /// Sync property of TextBox with the one of the shape. static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any& rValue); + /// Does the same, but works on properties which lack an sw-specific WID / MemberID. + static void syncProperty(SwFrmFmt* pShape, const OUString& rPropertyName, const css::uno::Any& rValue); + /// If we have an associated TextFrame, then return that. static SwFrmFmt* findTextBox(SwFrmFmt* pShape); /// Return the textbox rectangle of a draw shape (in twips). diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 02980e3..34e9590 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -26,6 +26,7 @@ #include <svx/unopage.hxx> #include <svx/svdpage.hxx> +#include <com/sun/star/document/XActionLockable.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> @@ -212,7 +213,18 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrmFmt* pShape, bool bAbsolute) aRet.SetEmpty(); SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject()); if (pCustomShape) + { + // Need to temporarily release the lock acquired in + // SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle, + // see EnhancedCustomShapeEngine::getTextBounds(). + uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(), uno::UNO_QUERY); + sal_Int16 nLocks = 0; + if (xLockable.is()) + nLocks = xLockable->resetActionLocks(); pCustomShape->GetTextBounds(aRet); + if (nLocks) + xLockable->setActionLocks(nLocks); + } if (!bAbsolute) { @@ -228,6 +240,12 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrmFmt* pShape, bool bAbsolute) return aRet; } +void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyName, const css::uno::Any& /*rValue*/) +{ + if (rPropertyName == "CustomShapeGeometry") + syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any()); +} + void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, const css::uno::Any& rValue) { // No shape yet? Then nothing to do, initial properties are set by create(). diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index e3f787c..abb97a1 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1442,6 +1442,13 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a } else xPrSet->setPropertyValue(rPropertyName, aValue); + + if (pFmt) + { + // We have a pFmt (but no pEntry): try to sync TextBox property. + SwTextBoxHelper::syncProperty(pFmt, rPropertyName, aValue); + } + // #i31698# - restore object position, if caption point is set. if ( rPropertyName == "CaptionPoint" && getShapeType() == "com.sun.star.drawing.CaptionShape" ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits