sw/inc/textboxhelper.hxx | 2 ++ sw/source/core/doc/textboxhelper.cxx | 16 ++++++++++++++++ sw/source/core/unocore/unodraw.cxx | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-)
New commits: commit f5731a1e78896bf32fe5e7fd36b38cc21553db5a Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed May 14 17:03:45 2014 +0200 SwXShape: allow setting TextBox property to false Change-Id: I3b501d6928cded0f4684817c24674423c1d6c2da diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index 93a459d..0c992dc 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -26,6 +26,8 @@ class SwTextBoxHelper public: /// Create a TextBox for a shape. static void create(SwFrmFmt* pShape); + /// Destroy a TextBox for a shape. + static void destroy(SwFrmFmt* pShape); /// Get XTextAppend of a shape's TextBox, if there is any. static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType); /// Sync property of TextBox with the one of the shape. diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 9937778..faadb5f 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -65,6 +65,22 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape) } } +void SwTextBoxHelper::destroy(SwFrmFmt* pShape) +{ + // If a TextBox was enabled previously + if (pShape->GetAttrSet().HasItem(RES_CNTNT)) + { + SwFrmFmt* pFmt = findTextBox(pShape); + + // Unlink the TextBox's text range from the original shape. + pShape->ResetFmtAttr(RES_CNTNT); + + // Delete the associated TextFrame. + if (pFmt) + pShape->GetDoc()->DelLayoutFmt(pFmt); + } +} + SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape) { SwFrmFmt* pRet = 0; diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 5ece513..6a3261b 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1182,9 +1182,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a { bool bValue; aValue >>= bValue; - // If TextBox is to be enabled. if (bValue) SwTextBoxHelper::create(pFmt); + else + SwTextBoxHelper::destroy(pFmt); } // #i28749# _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits