Kaydet (Commit) 8791ea1d authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Fridrich Štrba

SwXShape: allow setting TextBox property to false

Change-Id: I23d79fc3f5c020c86296bfc84bb0824e1ca68228
üst 84270c71
...@@ -26,6 +26,8 @@ class SwTextBoxHelper ...@@ -26,6 +26,8 @@ class SwTextBoxHelper
public: public:
/// Create a TextBox for a shape. /// Create a TextBox for a shape.
static void create(SwFrmFmt* pShape); 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. /// Get XTextAppend of a shape's TextBox, if there is any.
static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType); static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType);
/// Sync property of TextBox with the one of the shape. /// Sync property of TextBox with the one of the shape.
......
...@@ -65,6 +65,22 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape) ...@@ -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* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
{ {
SwFrmFmt* pRet = 0; SwFrmFmt* pRet = 0;
......
...@@ -1182,9 +1182,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a ...@@ -1182,9 +1182,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
{ {
bool bValue; bool bValue;
aValue >>= bValue; aValue >>= bValue;
// If TextBox is to be enabled.
if (bValue) if (bValue)
SwTextBoxHelper::create(pFmt); SwTextBoxHelper::create(pFmt);
else
SwTextBoxHelper::destroy(pFmt);
} }
// #i28749# // #i28749#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment