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

drawingML export: fix <a:srcRect> if graphic's map mode is pixels

Change-Id: Idbe399648c60e39c61e2be09a77b0648f57d3347
üst 9defb89e
...@@ -1063,7 +1063,13 @@ void DrawingML::WritePattFill( Reference< XPropertySet > rXPropSet ) ...@@ -1063,7 +1063,13 @@ void DrawingML::WritePattFill( Reference< XPropertySet > rXPropSet )
void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const OUString& rURL ) void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const OUString& rURL )
{ {
Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL ).GetPrefSize() ); GraphicObject aGraphicObject = GraphicObject::CreateGraphicObjectFromURL(rURL);
Size aOriginalSize = aGraphicObject.GetPrefSize();
const MapMode& rMapMode = aGraphicObject.GetPrefMapMode();
// GraphicCrop is in mm100, so in case the original size is in pixels, convert it over.
if (rMapMode.GetMapUnit() == MAP_PIXEL)
aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, MapMode(MAP_100TH_MM));
if ( GetProperty( rXPropSet, "GraphicCrop" ) ) if ( GetProperty( rXPropSet, "GraphicCrop" ) )
{ {
......
...@@ -435,6 +435,16 @@ DECLARE_OOXMLEXPORT_TEST(testTextboxTable, "textbox-table.docx") ...@@ -435,6 +435,16 @@ DECLARE_OOXMLEXPORT_TEST(testTextboxTable, "textbox-table.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
} }
DECLARE_OOXMLEXPORT_TEST(testCropPixel, "crop-pixel.docx")
{
// If map mode of the graphic is in pixels, then we used to handle original
// size of the graphic as mm100, but it was in pixels.
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
// This is 17667 in the original document (i.e. should be < 20000), but
// was 504666, so the image become invisible.
assertXPath(pXmlDoc, "//a:srcRect", "l", "19072");
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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