From c7c14abfd870d3849e74d379057503f16728a392 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 2 Jun 2014 15:59:08 +0200 Subject: 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 --- xmloff/source/draw/ximpshap.cxx | 13 ++++++++++++- xmloff/source/draw/ximpshap.hxx | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'xmloff') 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 xPropertySet(mxShape, uno::UNO_QUERY); + if (xPropertySet.is()) + { + uno::Reference 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 ); -- cgit