[Libreoffice-commits] core.git: sw/qa sw/source xmloff/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Feb 25 03:44:02 PST 2014


 sw/qa/extras/odfexport/odfexport.cxx |   10 ++++++++--
 sw/source/core/unocore/unodraw.cxx   |    4 ++++
 xmloff/source/text/txtprmap.cxx      |    4 ++++
 3 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit d618ea6b86711470b7f5ace94b95f15a4ba87325
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 25 12:26:19 2014 +0100

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

diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 3d2450f..e6aaa40 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 a9377da..d3f53e6 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 90cb26e..b96a433 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()
 };
 


More information about the Libreoffice-commits mailing list