[Libreoffice-commits] core.git: 3 commits - oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jan 2 03:09:46 PST 2014
oox/source/export/shapes.cxx | 66 +++++++++++++++++++------------
sw/qa/extras/ooxmlexport/data/bezier.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 8 +++
3 files changed, 50 insertions(+), 24 deletions(-)
New commits:
commit 3a45a4e80257d8737df4dda0b2d85f602196a70d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jan 2 11:58:57 2014 +0100
oox: fix export of TextShapes in DOCX
This was the last shape type that unconditionally wrote XML_sp for the
shape element, which is invalid for DOCX.
Change-Id: I3a6f8e6fd8ebbe663dce9ed4453396c3ec91c38a
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 59af378..67cf3dc 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -905,14 +905,20 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
{
FSHelperPtr pFS = GetFS();
- pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
+ pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
// non visual shape properties
- pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
- WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
+ WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
+ }
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND );
- WriteNonVisualProperties( xShape );
- pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ WriteNonVisualProperties( xShape );
+ pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ }
// visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
@@ -923,7 +929,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
WriteTextBox( xShape, mnXmlNamespace );
- pFS->endElementNS( mnXmlNamespace, XML_sp );
+ pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) );
return *this;
}
diff --git a/sw/qa/extras/ooxmlexport/data/bezier.odt b/sw/qa/extras/ooxmlexport/data/bezier.odt
new file mode 100644
index 0000000..c73ed3e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bezier.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 187cf4f..54042d4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2175,6 +2175,14 @@ DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx")
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
}
+DECLARE_OOXMLEXPORT_TEST(testBezier, "bezier.odt")
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ // Check that no shape got lost: a bezier, a line and a text shape.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDraws->getCount());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
commit affcea4185ffa95385cfb74ca68fa31361d6784b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jan 2 11:56:39 2014 +0100
oox: fix export of LineShapes in DOCX
Change-Id: I7b6f4616d450d2cffa58217db2ef250f5b8d9cba
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a26da94..59af378 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -615,7 +615,7 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape )
FSHelperPtr pFS = GetFS();
- pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
+ pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape );
if( aPolyPolygon.Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2)
@@ -627,14 +627,20 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape )
}
// non visual shape properties
- pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
- pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
- XML_id, I32S( GetNewShapeID( xShape ) ),
- XML_name, IDS( Line ),
- FSEND );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
+ pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
+ XML_id, I32S( GetNewShapeID( xShape ) ),
+ XML_name, IDS( Line ),
+ FSEND );
+ }
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
- WriteNonVisualProperties( xShape );
- pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ WriteNonVisualProperties( xShape );
+ pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ }
// visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
@@ -648,7 +654,7 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape )
// write text
WriteTextBox( xShape, mnXmlNamespace );
- pFS->endElementNS( mnXmlNamespace, XML_sp );
+ pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) );
return *this;
}
commit a34341376f642402e34939aba59da0260e5c9b5d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jan 2 11:14:54 2014 +0100
oox: fix export of BezierShapes in DOCX
Change-Id: I6fce580fc68c9ab2a56e342d6c5473f46e9a7f56
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4c7af94..a26da94 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -192,7 +192,7 @@ ShapeExport& ShapeExport::WriteBezierShape( Reference< XShape > xShape, sal_Bool
DBG(printf("write open bezier shape\n"));
FSHelperPtr pFS = GetFS();
- pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
+ pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape );
Rectangle aRect( aPolyPolygon.GetBoundRect() );
@@ -203,14 +203,20 @@ ShapeExport& ShapeExport::WriteBezierShape( Reference< XShape > xShape, sal_Bool
#endif
// non visual shape properties
- pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
- pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
- XML_id, I32S( GetNewShapeID( xShape ) ),
- XML_name, IDS( Freeform ),
- FSEND );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
+ pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
+ XML_id, I32S( GetNewShapeID( xShape ) ),
+ XML_name, IDS( Freeform ),
+ FSEND );
+ }
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
- WriteNonVisualProperties( xShape );
- pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ if (GetDocumentType() != DOCUMENT_DOCX)
+ {
+ WriteNonVisualProperties( xShape );
+ pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+ }
// visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
@@ -228,7 +234,7 @@ ShapeExport& ShapeExport::WriteBezierShape( Reference< XShape > xShape, sal_Bool
// write text
WriteTextBox( xShape, mnXmlNamespace );
- pFS->endElementNS( mnXmlNamespace, XML_sp );
+ pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) );
return *this;
}
More information about the Libreoffice-commits
mailing list