fdo#41109 RTF shape import: shpz has priority over dhgt

And not the other way around, how
24ee3df385 (RTF import: fix priority
handling of shpz vs dhgt, 2012-04-10) did, this time with a reproducer.

Change-Id: I9412341c6b35ca2760e4490a18f11bc6a0e0b78a
This commit is contained in:
Miklos Vajna
2013-12-29 15:21:51 +01:00
parent 4b71022581
commit ff7ac1a9b8
3 changed files with 55 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
{\rtf1
{\shp
{\*\shpinst\shpleft1898\shptop1043\shpright4598\shpbottom2123\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplid1027
{\sp
{\sn shapeType}
{\sv 1}
}
{\sp
{\sn fillColor}
{\sv 65280}
}
{\sp
{\sn fFilled}
{\sv 1}
}
{\sp
{\sn dhgt}
{\sv 5}
}
}
}
{\shp
{\*\shpinst\shpleft563\shptop518\shpright2243\shpbottom1448\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
{\sp
{\sn shapeType}
{\sv 1}
}
{\sp
{\sn fillColor}
{\sv 255}
}
{\sp
{\sn fFilled}
{\sv 1}
}
{\sp
{\sn dhgt}
{\sv 10}
}
}
}
\par
}

View File

@@ -1389,6 +1389,15 @@ DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
}
DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf")
{
// Test that shpz has priority over dhght and not the other way around.
// Drawpage is sorted by ZOrder, so first should be red (back).
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(getShape(1), "FillColor"));
// Second (front) should be green.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(getShape(2), "FillColor"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -450,9 +450,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
aViewBox.Height = i->second.toInt32();
else if ( i->first == "dhgt" )
{
resolveDhgt(xPropertySet, i->second.toInt32());
// dhgt is Word 2007, \shpz is Word 97-2003, the previous has priority.
rShape.oZ.reset();
// dhgt is Word 2007, \shpz is Word 97-2003, the later has priority.
if (!rShape.oZ)
resolveDhgt(xPropertySet, i->second.toInt32());
}
// These are in EMU, convert to mm100.
else if (i->first == "dxTextLeft")