SwXShape: allow setting TextBox property to false
Change-Id: I23d79fc3f5c020c86296bfc84bb0824e1ca68228
This commit is contained in:
@@ -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.
|
||||
|
@@ -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;
|
||||
|
@@ -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#
|
||||
|
Reference in New Issue
Block a user