[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 3 06:39:31 PST 2013


 sw/qa/extras/ooxmlexport/data/mce.docx                |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx              |    6 ++++++
 sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx              |    8 ++++++++
 writerfilter/source/dmapper/GraphicImport.cxx         |   11 +++++++++--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    4 ----
 6 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 197ec9cf1b7f50e0221c12e05dbc3e0064a82352
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 3 15:19:56 2013 +0100

    DOCX drawingML groupshape import: fix relative position
    
    Change-Id: Ice07f423707b48a013a9b6325b11f88206c38e60

diff --git a/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx
new file mode 100644
index 0000000..cd853f9
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 853c316..b0903b6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1555,6 +1555,14 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape->getPosition().X);
 }
 
+DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
+{
+    uno::Reference<drawing::XShape> xShape = getShape(1);
+    // 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"));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
 {
     // The document contains a rotated bitmap
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index f1c161b..8962f39 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -360,14 +360,19 @@ public:
         PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT          ),
                 uno::makeAny(nHoriOrient));
+        xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT          ),
+                uno::makeAny(nVertOrient));
+    }
+
+    void applyRelativePosition(uno::Reference< beans::XPropertySet > xGraphicObjectProperties) const
+    {
+        PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_POSITION),
                 uno::makeAny(nLeftPosition));
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_RELATION ),
                 uno::makeAny(nHoriRelation));
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_TOGGLE ),
                 uno::makeAny(bPageToggle));
-        xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT          ),
-                uno::makeAny(nVertOrient));
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_POSITION),
                 uno::makeAny(nTopPosition));
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ),
@@ -1034,6 +1039,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
                             // Position of the groupshape should be set after children have been added.
                             m_xShape->setPosition(awt::Point(m_pImpl->nLeftPosition, m_pImpl->nTopPosition));
                         }
+                        m_pImpl->applyRelativePosition(xShapeProps);
 
                         m_pImpl->applyMargins(xShapeProps);
                         bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter();
@@ -1517,6 +1523,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 }
 
                 m_pImpl->applyPosition(xGraphicObjectProperties);
+                m_pImpl->applyRelativePosition(xGraphicObjectProperties);
                 bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter( );
                 if( !bOpaque )
                 {
commit 57450afb768c085df0ba2344aa94b5f843060178
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 3 11:59:42 2013 +0100

    DOCX import: declare wps as a supported feature
    
    This means in case we hit an mc:AlternateContent element, we will read
    the mc:Choice branch of it, in case wps is the required feature, not the
    mc:Fallback one, which contains the information in VML format (after a
    lossy conversion).
    
    Change-Id: I476156bd1a39927dda903d14540155d1e62a211e

diff --git a/sw/qa/extras/ooxmlexport/data/mce.docx b/sw/qa/extras/ooxmlexport/data/mce.docx
new file mode 100644
index 0000000..d4790de
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/mce.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0bb2359..084968c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2034,6 +2034,12 @@ DECLARE_OOXMLEXPORT_TEST(testOoxmlTriangle, "ooxml-triangle.docx")
     getShape(1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testMce, "mce.docx")
+{
+    // The shape is red in Word2007, green in Word2010. Check that our import follows the later.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x9bbb59), getProperty<sal_Int32>(getShape(1), "FillColor"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 35a6326..5cdcef4 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -186,7 +186,6 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
             break;
         case OOXML_Choice:
         {
-#if 0 // Disabled for now: enabling "wps" would introduce regressions, and SAL_N_ELEMENTS() needs at least one element.
             OUString aRequires = rAttribs->getOptionalValue(OOXML_Requires);
             static const char* aFeatures[] = {
                 "wps",
@@ -199,9 +198,6 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
                     return false;
                 }
             }
-#else
-            (void) rAttribs;
-#endif
             return true;
         }
             break;


More information about the Libreoffice-commits mailing list