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

Miklos Vajna vmiklos at suse.cz
Mon Mar 4 09:09:05 PST 2013


 sw/qa/extras/odfimport/data/fdo56272.odt     |binary
 sw/qa/extras/odfimport/odfimport.cxx         |   11 +++++++++++
 sw/source/core/layout/anchoreddrawobject.cxx |    7 ++-----
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 4ae71885ec61f87c46285150ef4ca84192627b7a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Mar 4 17:18:22 2013 +0100

    fdo#56272 SwAnchoredDrawObject::_SetPositioningAttr: fix position
    
    This reverts a part of 51cfbf0cfaec395a99a00f2c20fcba96de9a4427, that is
    no longer needed, but causes incorrect drawing objects position.
    
    The problem was that a non-zero position doesn't mean the layout in a
    later iteration doesn't change the position, but the referred commit
    didn't allow later iterations to fine-tune the position.
    
    Change-Id: Id91a4c6952d1b58e0c5bc0b1a60991a284c29ddc

diff --git a/sw/qa/extras/odfimport/data/fdo56272.odt b/sw/qa/extras/odfimport/data/fdo56272.odt
new file mode 100644
index 0000000..57241d3
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo56272.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index cfeda28b..37da317 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -43,6 +43,7 @@ public:
     void testPageStyleLayoutDefault();
     void testPageStyleLayoutRight();
     void testFdo60842();
+    void testFdo56272();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -63,6 +64,7 @@ void Test::run()
         {"hello.odt", &Test::testPageStyleLayoutDefault},
         {"hello.odt", &Test::testPageStyleLayoutRight},
         {"fdo60842.odt", &Test::testFdo60842},
+        {"fdo56272.odt", &Test::testFdo56272},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -303,6 +305,15 @@ void Test::testFdo60842()
     getCell(xTable, "E1", "01/04/2012");
 }
 
+void Test::testFdo56272()
+{
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+    // Vertical position was incorrect.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape->getPosition().Y); // Was -2371
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 6b3e5b5..574cc7c 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -811,15 +811,12 @@ void SwAnchoredDrawObject::_SetPositioningAttr()
         // --> #i71182#
         // only change position - do not lose other attributes
         SwFmtHoriOrient aHori( GetFrmFmt().GetHoriOrient() );
-        // If the object is already positioned, leave it alone.
-        if (!aHori.GetPos())
-            aHori.SetPos( nHoriPos );
+        aHori.SetPos( nHoriPos );
         GetFrmFmt().SetFmtAttr( aHori );
 
         SwFmtVertOrient aVert( GetFrmFmt().GetVertOrient() );
 
-        if (!aVert.GetPos())
-            aVert.SetPos( nVertPos );
+        aVert.SetPos( nVertPos );
         GetFrmFmt().SetFmtAttr( aVert );
 
         // --> #i36010# - set layout direction of the position


More information about the Libreoffice-commits mailing list