diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-03-04 17:18:22 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-03-07 08:31:41 +0000 |
commit | 104947d1825b99503d5df59dfd85ad6e603e1407 (patch) | |
tree | 4094e41cecac762139c9edbf0f6adbd09c1f3544 | |
parent | a6f8721768eb3318245893eced3b89522fc87383 (diff) |
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@gmail.com>
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r-- | sw/qa/extras/odfimport/data/fdo56272.odt | bin | 0 -> 10522 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/layout/anchoreddrawobject.cxx | 7 |
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 Binary files differnew file mode 100644 index 000000000000..57241d3a78a6 --- /dev/null +++ b/sw/qa/extras/odfimport/data/fdo56272.odt diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 05584bfc23f0..8d86bd553771 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 b2c946006f2d..c8843ca3b42e 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 |