diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-25 11:47:32 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-25 12:11:41 +0100 |
commit | 4da81e4a0bda96c3d25aa22341f94b58e584cefb (patch) | |
tree | 749c25bfda9ef2a6ba42e5b2f18a3ba700c92046 /xmloff/source | |
parent | ooxml: extend roundtrip test with w14:textOutline (diff) | |
download | core-4da81e4a0bda96c3d25aa22341f94b58e584cefb.tar.gz core-4da81e4a0bda96c3d25aa22341f94b58e584cefb.zip |
xmloff: import style:rel-width/height for drawinglayer shapes
In case the underlying UNO object supports that, which is the case for
Writer. Export was already working before.
Change-Id: I4676c8349ebe1959da004d6e1a024a342da45049
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 26 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.hxx | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index d9c95a03b671..8ba56a37d23b 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -151,6 +151,8 @@ SdXMLShapeContext::SdXMLShapeContext( , mbIsUserTransformed(sal_False) , mnZOrder(-1) , maSize(1, 1) + , mnRelWidth(0) + , mnRelHeight(0) , maPosition(0, 0) , maUsedTransformation() , mbVisible(true) @@ -454,6 +456,16 @@ void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape) xImp->shapeWithZIndexAdded( xShape, mnZOrder ); } + if (mnRelWidth || mnRelHeight) + { + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); + if (mnRelWidth && xPropertySetInfo->hasPropertyByName("RelativeWidth")) + xPropertySet->setPropertyValue("RelativeWidth", uno::makeAny(mnRelWidth)); + if (mnRelHeight && xPropertySetInfo->hasPropertyByName("RelativeHeight")) + xPropertySet->setPropertyValue("RelativeHeight", uno::makeAny(mnRelHeight)); + } + if( !maShapeId.isEmpty() ) { uno::Reference< uno::XInterface > xRef( static_cast<uno::XInterface *>(xShape.get()) ); @@ -888,6 +900,20 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rL maShapeDescription = rValue; } } + else if (nPrefix == XML_NAMESPACE_STYLE) + { + sal_Int32 nTmp; + if (IsXMLToken(rLocalName, XML_REL_WIDTH)) + { + if (sax::Converter::convertPercent(nTmp, rValue)) + mnRelWidth = static_cast<sal_Int16>(nTmp); + } + else if (IsXMLToken(rLocalName, XML_REL_HEIGHT)) + { + if (sax::Converter::convertPercent(nTmp, rValue)) + mnRelHeight = static_cast<sal_Int16>(nTmp); + } + } else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) ) { if( IsXMLToken( rLocalName, XML_ID ) ) diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx index a4b8786840b8..6ddb83b12b79 100644 --- a/xmloff/source/draw/ximpshap.hxx +++ b/xmloff/source/draw/ximpshap.hxx @@ -73,6 +73,8 @@ protected: SdXMLImExTransform2D mnTransform; com::sun::star::awt::Size maSize; + sal_Int16 mnRelWidth; + sal_Int16 mnRelHeight; com::sun::star::awt::Point maPosition; basegfx::B2DHomMatrix maUsedTransformation; |