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

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 6 06:26:05 PST 2013


 sw/qa/extras/ooxmlimport/ooxmlimport.cxx      |    2 ++
 writerfilter/source/dmapper/GraphicImport.cxx |    9 +++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 51a61bd4aca15c860d301b687d582a39193089e2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 6 12:00:29 2013 +0100

    DOCX import: fix relativeFrom=page, align=right handling
    
    Change-Id: I9c1df594457a8ccbbebf4ede61cc3a637ecc7023

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 24ffb76..a1a0d43 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1561,6 +1561,8 @@ DECLARE_OOXMLIMPORT_TEST(testWpgNested, "wpg-nested.docx")
     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(0), uno::UNO_QUERY);
     // This was a com.sun.star.drawing.CustomShape, due to lack of handling of groupshapes inside groupshapes.
     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
+    // This was text::RelOrientation::PAGE_FRAME, effectively placing the group shape on the left side of the page instead of the right one.
+    CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_RIGHT, getProperty<sal_Int16>(xGroup, "HoriOrientRelation"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 3f7e0cb..fab8788 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1303,6 +1303,15 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
                     m_pImpl->nHoriRelation = pHandler->relation();
                     m_pImpl->nHoriOrient = pHandler->orientation();
                     m_pImpl->nLeftPosition = pHandler->position();
+                    if (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME && m_pImpl->nHoriOrient == text::HoriOrientation::RIGHT)
+                    {
+                        // If the shape is relative from page and aligned to
+                        // right, then set the relation to right and clear the
+                        // orientation, that provides the same visual result as
+                        // Word.
+                        m_pImpl->nHoriRelation = text::RelOrientation::PAGE_RIGHT;
+                        m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
+                    }
                 }
             }
         }


More information about the Libreoffice-commits mailing list