Kaydet (Commit) 4ae71885 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#56272 SwAnchoredDrawObject::_SetPositioningAttr: fix position

This reverts a part of 51cfbf0c, 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
üst de45e004
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
void testPageStyleLayoutDefault(); void testPageStyleLayoutDefault();
void testPageStyleLayoutRight(); void testPageStyleLayoutRight();
void testFdo60842(); void testFdo60842();
void testFdo56272();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -63,6 +64,7 @@ void Test::run() ...@@ -63,6 +64,7 @@ void Test::run()
{"hello.odt", &Test::testPageStyleLayoutDefault}, {"hello.odt", &Test::testPageStyleLayoutDefault},
{"hello.odt", &Test::testPageStyleLayoutRight}, {"hello.odt", &Test::testPageStyleLayoutRight},
{"fdo60842.odt", &Test::testFdo60842}, {"fdo60842.odt", &Test::testFdo60842},
{"fdo56272.odt", &Test::testFdo56272},
}; };
header(); header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
...@@ -303,6 +305,15 @@ void Test::testFdo60842() ...@@ -303,6 +305,15 @@ void Test::testFdo60842()
getCell(xTable, "E1", "01/04/2012"); 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -811,15 +811,12 @@ void SwAnchoredDrawObject::_SetPositioningAttr() ...@@ -811,15 +811,12 @@ void SwAnchoredDrawObject::_SetPositioningAttr()
// --> #i71182# // --> #i71182#
// only change position - do not lose other attributes // only change position - do not lose other attributes
SwFmtHoriOrient aHori( GetFrmFmt().GetHoriOrient() ); SwFmtHoriOrient aHori( GetFrmFmt().GetHoriOrient() );
// If the object is already positioned, leave it alone. aHori.SetPos( nHoriPos );
if (!aHori.GetPos())
aHori.SetPos( nHoriPos );
GetFrmFmt().SetFmtAttr( aHori ); GetFrmFmt().SetFmtAttr( aHori );
SwFmtVertOrient aVert( GetFrmFmt().GetVertOrient() ); SwFmtVertOrient aVert( GetFrmFmt().GetVertOrient() );
if (!aVert.GetPos()) aVert.SetPos( nVertPos );
aVert.SetPos( nVertPos );
GetFrmFmt().SetFmtAttr( aVert ); GetFrmFmt().SetFmtAttr( aVert );
// --> #i36010# - set layout direction of the position // --> #i36010# - set layout direction of the position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment