[Libreoffice-commits] core.git: oox/source sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Dec 4 03:13:56 PST 2013
oox/source/drawingml/shapecontext.cxx | 1 +
oox/source/drawingml/textbodycontext.cxx | 4 ++++
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 4 ++++
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 2 ++
4 files changed, 11 insertions(+)
New commits:
commit cbeb028519d0383ae3089c48f9ceefe9ee817188
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Dec 4 11:49:33 2013 +0100
DOCX import: parse drawingML group shapes in oox only
This is similar to commit d5c934d150cb6cea5f96cbbee4fb5e8312bf027e
(n#792778 DOCX import: parse group shapes in oox only, 2012-12-14),
except that was for the VML importer.
The only difference is that in case of drawingML,
OOXMLFastContextHandlerShape::lcl_createFastChildContext() is only
called for the children of the group shape, not for the element itself,
so compare against the start token, not the current element.
Change-Id: Iddeabb20bbd5f0153e2fc4e6df463830126fdd37
diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx
index 7a1de2d..7d6971f 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -93,6 +93,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const
return new ShapeStyleContext( *this, *mpShapePtr );
case XML_txBody:
+ case XML_txbxContent:
{
TextBodyPtr xTextBody( new TextBody );
mpShapePtr->setTextBody( xTextBody );
diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx
index 80e5657..a276ca1 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -62,6 +62,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken
switch( aElementToken )
{
case A_TOKEN( r ): // "CT_RegularTextRun" Regular Text Run.
+ case OOX_TOKEN( doc, r ):
{
TextRunPtr pRun( new TextRun );
mrParagraph.addRun( pRun );
@@ -104,6 +105,7 @@ void RegularTextRunContext::onEndElement( )
switch( getCurrentElement() )
{
case A_TOKEN( t ):
+ case OOX_TOKEN( doc, t ):
{
mbIsInText = false;
break;
@@ -135,6 +137,7 @@ ContextHandlerRef RegularTextRunContext::onCreateContext( sal_Int32 aElementToke
case A_TOKEN( rPr ): // "CT_TextCharPropertyBag" The text char properties of this text run.
return new TextCharacterPropertiesContext( *this, rAttribs, mpRunPtr->getTextCharacterProperties() );
case A_TOKEN( t ): // "xsd:string" minOccurs="1" The actual text string.
+ case OOX_TOKEN( doc, t ):
mbIsInText = true;
break;
}
@@ -161,6 +164,7 @@ ContextHandlerRef TextBodyContext::onCreateContext( sal_Int32 aElementToken, con
case A_TOKEN( lstStyle ): // CT_TextListStyle
return new TextListStyleContext( *this, mrTextBody.getTextListStyle() );
case A_TOKEN( p ): // CT_TextParagraph
+ case OOX_TOKEN( doc, p ):
return new TextParagraphContext( *this, mrTextBody.addParagraph() );
}
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b0903b6..9951ef1 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1561,6 +1561,10 @@ DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
// The relativeFrom attribute was ignored for groupshapes, i.e. these were text::RelOrientation::FRAME.
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
+
+ // The 3 paragraphs on the rectangles inside the groupshape ended up in the
+ // body text, make sure we don't have multiple paragraphs there anymore.
+ CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // was 4
}
DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 5cdcef4..14787f7 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2156,6 +2156,8 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
bool bGroupShape = Element == Token_t(NS_vml | OOXML_group);
+ // drawingML version also counts as a group shape.
+ bGroupShape |= mrShapeContext->getStartToken() == Token_t(NS_wpg | OOXML_wgp);
sal_uInt32 nNamespace = Element & 0xffff0000;
switch (nNamespace)
More information about the Libreoffice-commits
mailing list