diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-12 09:44:50 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-12 09:52:04 +0100 |
commit | e74ddf429e39df01c751a3d2b452bf939fdc9a33 (patch) | |
tree | a35c3e17e41ad0883aae0215d5b4ff28ec194672 /oox | |
parent | 03846f032e2f13a3bbeb0a87de9959c105ff6484 (diff) |
oox: fix ShapeExport::WriteTextBox() for DOCX when shape has text
This is still not perfect (oox needs to call back to sw to do the real
export of the text), but content down to the wps:txbx element is now
fine.
Change-Id: I355178ab6492d65099397874ff50818fa1f35949
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 25 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 8 |
2 files changed, 18 insertions, 15 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 752674188822..510930987946 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1242,7 +1242,7 @@ void DrawingML::WriteParagraph( Reference< XTextContent > rParagraph ) mpFS->endElementNS( XML_a, XML_p ); } -void DrawingML::WriteText( Reference< XInterface > rXIface ) +void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace ) { Reference< XText > xXText( rXIface, UNO_QUERY ); Reference< XPropertySet > rXPropSet( rXIface, UNO_QUERY ); @@ -1325,19 +1325,20 @@ void DrawingML::WriteText( Reference< XInterface > rXIface ) bHasWrap = sal_True; } - mpFS->singleElementNS( XML_a, XML_bodyPr, - XML_wrap, bHasWrap && !bWrap ? "none" : NULL, - XML_lIns, (nLeft != DEFLRINS) ? IS( MM100toEMU( nLeft ) ) : NULL, - XML_rIns, (nRight != DEFLRINS) ? IS( MM100toEMU( nRight ) ) : NULL, - XML_tIns, (nTop != DEFTBINS) ? IS( MM100toEMU( nTop ) ) : NULL, - XML_bIns, (nBottom != DEFTBINS) ? IS( MM100toEMU( nBottom ) ) : NULL, - XML_anchor, sVerticalAlignment, - XML_anchorCtr, bHorizontalCenter ? "1" : NULL, - XML_vert, sWritingMode, - FSEND ); + if (bBodyPr) + mpFS->singleElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr, + XML_wrap, bHasWrap && !bWrap ? "none" : NULL, + XML_lIns, (nLeft != DEFLRINS) ? IS( MM100toEMU( nLeft ) ) : NULL, + XML_rIns, (nRight != DEFLRINS) ? IS( MM100toEMU( nRight ) ) : NULL, + XML_tIns, (nTop != DEFTBINS) ? IS( MM100toEMU( nTop ) ) : NULL, + XML_bIns, (nBottom != DEFTBINS) ? IS( MM100toEMU( nBottom ) ) : NULL, + XML_anchor, sVerticalAlignment, + XML_anchorCtr, bHorizontalCenter ? "1" : NULL, + XML_vert, sWritingMode, + FSEND ); Reference< XEnumerationAccess > access( xXText, UNO_QUERY ); - if( !access.is() ) + if( !access.is() || !bText ) return; Reference< XEnumeration > enumeration( access->createEnumeration() ); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 3616c4ef4777..2c6981080b50 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -738,9 +738,11 @@ ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int3 { FSHelperPtr pFS = GetFS(); - pFS->startElementNS( nXmlNamespace, XML_txBody, FSEND ); - WriteText( xIface ); - pFS->endElementNS( nXmlNamespace, XML_txBody ); + pFS->startElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx), FSEND ); + WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX), /*bText=*/true ); + pFS->endElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx) ); + if (GetDocumentType() == DOCUMENT_DOCX) + WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace ); } else if (GetDocumentType() == DOCUMENT_DOCX) mpFS->singleElementNS(nXmlNamespace, XML_bodyPr, FSEND); |