[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/qa sw/source

Miklos Vajna vmiklos at suse.cz
Thu Mar 7 00:32:02 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 104947d1825b99503d5df59dfd85ad6e603e1407
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.
    
    (cherry picked from commit 4ae71885ec61f87c46285150ef4ca84192627b7a)
    
    Conflicts:
    	sw/qa/extras/odfimport/odfimport.cxx
    
    Change-Id: Id91a4c6952d1b58e0c5bc0b1a60991a284c29ddc
    Reviewed-on: https://gerrit.libreoffice.org/2547
    Reviewed-by: Muthu Subramanian K <muthusuba at gmail.com>
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

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 05584bf..8d86bd5 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -39,6 +39,7 @@ public:
     void testEmptySvgFamilyName();
     void testHideAllSections();
     void testOdtBorders();
+    void testFdo56272();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -56,6 +57,7 @@ void Test::run()
         {"empty-svg-family-name.odt", &Test::testEmptySvgFamilyName},
         {"fdo53210.odt", &Test::testHideAllSections},
         {"borders_ooo33.odt", &Test::testOdtBorders},
+        {"fdo56272.odt", &Test::testFdo56272},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -270,6 +272,15 @@ void Test::testOdtBorders()
     } while(xParaEnum->hasMoreElements());
 }
 
+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 b2c9460..c8843ca 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -812,15 +812,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