summaryrefslogtreecommitdiffstats
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-02 15:59:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-02 18:21:32 +0200
commitc7c14abfd870d3849e74d379057503f16728a392 (patch)
tree58986def8c1a31eaaa7204d9b671621e4315c833 /xmloff
parentcoverity#704885 Unchecked dynamic_cast (diff)
downloadcore-c7c14abfd870d3849e74d379057503f16728a392.tar.gz
core-c7c14abfd870d3849e74d379057503f16728a392.zip
xmloff: fix import of tables inside textboxes inside shapes
We already had the concept of having a XML_TEXT_TYPE_SHAPE type (for editeng-based text) and a XML_TEXT_TYPE_TEXTBOX (for Writer-based text), but in case of draw:custom-shape, the previous was always assumed, implicitly. Check if the shape is marked as having a textbox, and if so, use the XML_TEXT_TYPE_TEXTBOX handler, which makes e.g. the table import work. Change-Id: I45f28b36df1836eeba89e9eef44c7abd87fcbd56
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/ximpshap.cxx13
-rw-r--r--xmloff/source/draw/ximpshap.hxx1
2 files changed, 13 insertions, 1 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3e34f2ec41de..9a17bd220d33 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -158,6 +158,7 @@ SdXMLShapeContext::SdXMLShapeContext(
, mbVisible(true)
, mbPrintable(true)
, mbHaveXmlId(false)
+ , mbTextBox(false)
{
}
@@ -220,6 +221,15 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
if( mxCursor.is() )
{
xTxtImport->SetCursor( mxCursor );
+
+ // Check if this shape has a TextBox, so we can pass the right context type.
+ uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
+ if (xPropertySet.is())
+ {
+ uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ if (xPropertySetInfo->hasPropertyByName("TextBox"))
+ xPropertySet->getPropertyValue("TextBox") >>= mbTextBox;
+ }
}
// remember old list item and block (#91964#) and reset them
@@ -233,7 +243,8 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
if( mxCursor.is() )
{
pContext = GetImport().GetTextImport()->CreateTextChildContext(
- GetImport(), p_nPrefix, rLocalName, xAttrList );
+ GetImport(), p_nPrefix, rLocalName, xAttrList,
+ ( mbTextBox ? XML_TEXT_TYPE_TEXTBOX : XML_TEXT_TYPE_SHAPE ) );
}
}
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index f3d4f90e38b3..4f987af9a545 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -81,6 +81,7 @@ protected:
bool mbVisible;
bool mbPrintable;
bool mbHaveXmlId;
+ bool mbTextBox; ///< If the text of this shape is handled by a Writer TextFrame.
/** if bSupportsStyle is false, auto styles will be set but not a style */
void SetStyle( bool bSupportsStyle = true );