Kaydet (Commit) c7c14abf authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst eea173ed
...@@ -158,6 +158,7 @@ SdXMLShapeContext::SdXMLShapeContext( ...@@ -158,6 +158,7 @@ SdXMLShapeContext::SdXMLShapeContext(
, mbVisible(true) , mbVisible(true)
, mbPrintable(true) , mbPrintable(true)
, mbHaveXmlId(false) , mbHaveXmlId(false)
, mbTextBox(false)
{ {
} }
...@@ -220,6 +221,15 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, ...@@ -220,6 +221,15 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
if( mxCursor.is() ) if( mxCursor.is() )
{ {
xTxtImport->SetCursor( mxCursor ); 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 // remember old list item and block (#91964#) and reset them
...@@ -233,7 +243,8 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, ...@@ -233,7 +243,8 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
if( mxCursor.is() ) if( mxCursor.is() )
{ {
pContext = GetImport().GetTextImport()->CreateTextChildContext( pContext = GetImport().GetTextImport()->CreateTextChildContext(
GetImport(), p_nPrefix, rLocalName, xAttrList ); GetImport(), p_nPrefix, rLocalName, xAttrList,
( mbTextBox ? XML_TEXT_TYPE_TEXTBOX : XML_TEXT_TYPE_SHAPE ) );
} }
} }
......
...@@ -81,6 +81,7 @@ protected: ...@@ -81,6 +81,7 @@ protected:
bool mbVisible; bool mbVisible;
bool mbPrintable; bool mbPrintable;
bool mbHaveXmlId; 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 */ /** if bSupportsStyle is false, auto styles will be set but not a style */
void SetStyle( bool bSupportsStyle = true ); void SetStyle( bool bSupportsStyle = true );
......
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