[Libreoffice-commits] core.git: include/oox oox/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Dec 12 00:52:25 PST 2013
include/oox/export/drawingml.hxx | 2 +-
oox/source/export/drawingml.cxx | 25 +++++++++++++------------
oox/source/export/shapes.cxx | 8 +++++---
3 files changed, 19 insertions(+), 16 deletions(-)
New commits:
commit e74ddf429e39df01c751a3d2b452bf939fdc9a33
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Dec 12 09:44:50 2013 +0100
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
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index f5a89dd..bba93cd 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 7526741..5109309 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 3616c4e..2c69810 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);
More information about the Libreoffice-commits
mailing list