summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-02-25 12:26:19 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-25 12:43:32 +0100
commitd618ea6b86711470b7f5ace94b95f15a4ba87325 (patch)
treee8edc471c272b63f51f99ef964a94f6fb9a8a5ea
parentaaf1e86408758ff332bb071e329187b7369be1b2 (diff)
xmloff: import/export loext:rel-width/height-rel for Writer shapes
Change-Id: Ie6e4367a235038479287530bd08b0a89c6bb498b
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx10
-rw-r--r--sw/source/core/unocore/unodraw.cxx4
-rw-r--r--xmloff/source/text/txtprmap.cxx4
3 files changed, 16 insertions, 2 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 3d2450f4cb92..e6aaa409cfcb 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -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
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index a9377da72c39..d3f53e67967c 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -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();
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 90cb26e56869..b96a433defb7 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -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()
};