diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-28 15:35:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-28 15:57:11 +0200 |
commit | 31c4c834b84d3cadcba43eeaa9a6da7debb63de0 (patch) | |
tree | ce5461cf4f684fdcbc4cfffd7ab746fb7e1a3513 | |
parent | 5ed755ed8fa8edb27f43eb2c9d1efedd004e95b3 (diff) |
SwTextBoxHelper: extract getTextRectangle() from syncProperty()
Change-Id: I6265247593571ffba4cbda7f87bdde1e943aff51
-rw-r--r-- | sw/inc/textboxhelper.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 17 |
2 files changed, 15 insertions, 5 deletions
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index 28f8d71125ed..747e729762ef 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -19,6 +19,7 @@ class SdrPage; class SwFrmFmt; class SwDoc; +class Rectangle; /** * A TextBox is a TextFrame, that is tied to a drawinglayer shape. @@ -39,6 +40,8 @@ public: static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, 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 (absolute values, in twips). + static Rectangle getTextRectangle(SwFrmFmt* pShape); /// Look up TextFrames in a document, which are in fact TextBoxes. static std::list<SwFrmFmt*> findTextBoxes(const SwDoc* pDoc); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 3e64261c4e06..7735de51a36d 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -192,6 +192,16 @@ uno::Any SwTextBoxHelper::queryInterface(SwFrmFmt* pShape, const uno::Type& rTyp return aRet; } +Rectangle SwTextBoxHelper::getTextRectangle(SwFrmFmt* pShape) +{ + Rectangle aRet; + aRet.SetEmpty(); + SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject()); + if (pCustomShape) + pCustomShape->GetTextBounds(aRet); + return aRet; +} + void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, const OUString& rPropertyName, const css::uno::Any& rValue) { // No shape yet? Then nothing to do, initial properties are set by create(). @@ -260,12 +270,9 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 // Position/size should be the text position/size, not the shape one as-is. if (bAdjustX || bAdjustY || bAdjustSize) { - SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject()); - if (pCustomShape) + Rectangle aRect = getTextRectangle(pShape); + if (!aRect.IsEmpty()) { - Rectangle aRect; - pCustomShape->GetTextBounds(aRect); - if (bAdjustX || bAdjustY) { sal_Int32 nValue; |