[PATCH libreoffice-4-0] fdo#56272 SwAnchoredDrawObject::_SetPositioningAttr: fix pos...

Miklos Vajna (via Code Review) gerrit at gerrit.libreoffice.org
Mon Mar 4 10:48:43 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2547

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/2547/1

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
---
A sw/qa/extras/odfimport/data/fdo56272.odt
M sw/qa/extras/odfimport/odfimport.cxx
M sw/source/core/layout/anchoreddrawobject.cxx
3 files changed, 13 insertions(+), 5 deletions(-)



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
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/fdo56272.odt
Binary files 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 @@
     void testEmptySvgFamilyName();
     void testHideAllSections();
     void testOdtBorders();
+    void testFdo56272();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -56,6 +57,7 @@
         {"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 @@
     } 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 @@
         // --> #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

-- 
To view, visit https://gerrit.libreoffice.org/2547
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id91a4c6952d1b58e0c5bc0b1a60991a284c29ddc
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>



More information about the LibreOffice mailing list