Kaydet (Commit) 5ef0f1dc authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#55493 fix RTF import of specific PNG image

The image was special in that the resulting Graphic's
GetPrefMapMode().GetMapUnit() wasn't MAP_PIXEL.

Change-Id: I681e344a042721b99f6cb2e599f9c65156d219a4
üst 1d1d1b46
This diff is collapsed.
......@@ -109,6 +109,7 @@ public:
void testFdo52389();
void testFdo49655();
void testFdo52475();
void testFdo55493();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -161,6 +162,7 @@ public:
CPPUNIT_TEST(testFdo52389);
CPPUNIT_TEST(testFdo49655);
CPPUNIT_TEST(testFdo52475);
CPPUNIT_TEST(testFdo55493);
#endif
CPPUNIT_TEST_SUITE_END();
......@@ -852,6 +854,16 @@ void Test::testFdo52475()
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
}
void Test::testFdo55493()
{
// The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
load("fdo55493.rtf");
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);
CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -653,7 +653,10 @@ int RTFDocumentImpl::resolvePict(bool bInline)
Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
Size aSize(aGraphic.GetPrefSize());
MapMode aMap(MAP_100TH_MM);
aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, aMap );
if (aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL)
aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap);
else
aSize = OutputDevice::LogicToLogic(aSize, aGraphic.GetPrefMapMode(), aMap);
m_aStates.top().aPicture.nWidth = aSize.Width();
m_aStates.top().aPicture.nHeight = aSize.Height();
}
......
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