xmloff: import/export loext:rel-width/height-rel for Writer shapes

Change-Id: Ie6e4367a235038479287530bd08b0a89c6bb498b
This commit is contained in:
Miklos Vajna
2014-02-25 12:26:19 +01:00
parent aaf1e86408
commit d618ea6b86
3 changed files with 16 additions and 2 deletions

View File

@@ -353,9 +353,15 @@ DECLARE_ODFEXPORT_TEST(testTextFrameVertAdjust, "textframe-vertadjust.odt")
DECLARE_ODFEXPORT_TEST(testShapeRelsize, "shape-relsize.odt")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
// These were all 0, as style:rel-width/height was ignored on import for shapes.
CPPUNIT_ASSERT_EQUAL(sal_Int16(40), getProperty<sal_Int16>(getShape(1), "RelativeWidth"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(getShape(1), "RelativeHeight"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(40), getProperty<sal_Int16>(xShape, "RelativeWidth"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(xShape, "RelativeHeight"));
// Relation was "page" for both width and height, should be "paragraph" for width.
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
// And make sure that height stays "page".
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
}
#endif

View File

@@ -1797,6 +1797,10 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates(
pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
else if(bGroupMember)
pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
else if (pEntry->nWID == RES_FRM_SIZE &&
(pEntry->nMemberId == MID_FRMSIZE_REL_HEIGHT_RELATION ||
pEntry->nMemberId == MID_FRMSIZE_REL_WIDTH_RELATION))
pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
else if(pFmt)
{
const SwAttrSet& rSet = pFmt->GetAttrSet();

View File

@@ -829,6 +829,10 @@ XMLPropertyMapEntry aXMLShapePropMap[] =
// RES_FOLLOW_TEXT_FLOW (#i26791#)
MG_ED( "IsFollowingTextFlow", STYLE, FLOW_WITH_TEXT, XML_TYPE_BOOL, 0 ),
// RES_FRM_SIZE
MAP_EXT("RelativeWidthRelation", XML_NAMESPACE_LO_EXT, XML_REL_WIDTH_REL, XML_TYPE_TEXT_HORIZONTAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELWIDTHREL),
MAP_EXT("RelativeHeightRelation", XML_NAMESPACE_LO_EXT, XML_REL_HEIGHT_REL, XML_TYPE_TEXT_VERTICAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELHEIGHTREL),
M_END()
};