summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-12-12 09:44:50 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-12-12 09:52:04 +0100
commite74ddf429e39df01c751a3d2b452bf939fdc9a33 (patch)
treea35c3e17e41ad0883aae0215d5b4ff28ec194672
parent03846f032e2f13a3bbeb0a87de9959c105ff6484 (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
-rw-r--r--include/oox/export/drawingml.hxx2
-rw-r--r--oox/source/export/drawingml.cxx25
-rw-r--r--oox/source/export/shapes.cxx8
3 files changed, 19 insertions, 16 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index f5a89dd3c37f..bba93cde96a9 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -118,7 +118,7 @@ public:
void WriteTransformation( const Rectangle& rRectangle,
sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
- void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
+ void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0);
void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
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);