diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-05-28 17:44:25 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-05-29 15:56:50 +0200 |
commit | 290695c785ef831abb6e78cd3675bc071f05f643 (patch) | |
tree | ed4bc0426237236b565ba738fe76103af10613a7 /oox/source/vml | |
parent | 4eaabc45f76aefe82558b283975ab9df3aea7fce (diff) |
bnc#817956 VML import of v:textpath
Word exposes this as Watermark in its UI.
Change-Id: I23d9b2aab2dab60a98c7f456b0592c2b74bcaf81
Diffstat (limited to 'oox/source/vml')
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 55 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 2 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 3 |
3 files changed, 60 insertions, 0 deletions
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 7932acd1d2c6..9be2c6881cee 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -18,7 +18,11 @@ */ #include "oox/vml/vmlformatting.hxx" +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> #include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/text/XTextRange.hpp> #include <rtl/strbuf.hxx> #include "oox/drawingml/color.hxx" #include "oox/drawingml/drawingmltypes.hxx" @@ -828,6 +832,57 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& rPropMap.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat)); } +TextpathModel::TextpathModel() +{ +} + +beans::PropertyValue lcl_createTextpathProps() +{ + uno::Sequence<beans::PropertyValue> aTextpathPropSeq(4); + aTextpathPropSeq[0].Name = "TextPath"; + aTextpathPropSeq[0].Value <<= sal_True; + aTextpathPropSeq[1].Name = "TextPathMode"; + aTextpathPropSeq[1].Value <<= drawing::EnhancedCustomShapeTextPathMode_SHAPE; + aTextpathPropSeq[2].Name = "ScaleX"; + aTextpathPropSeq[2].Value <<= sal_False; + aTextpathPropSeq[3].Name = "SameLetterHeights"; + aTextpathPropSeq[3].Value <<= sal_False; + + beans::PropertyValue aRet; + aRet.Name = "TextPath"; + aRet.Value <<= aTextpathPropSeq; + return aRet; +} + +void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, uno::Reference<drawing::XShape> xShape) const +{ + if (moString.has()) + { + uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY); + xTextRange->setString(moString.get()); + + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >(); + bool bFound = false; + for (int i = 0; i < aGeomPropSeq.getLength(); ++i) + { + beans::PropertyValue& rProp = aGeomPropSeq[i]; + if (rProp.Name == "TextPath") + { + bFound = true; + rProp = lcl_createTextpathProps(); + } + } + if (!bFound) + { + sal_Int32 nSize = aGeomPropSeq.getLength(); + aGeomPropSeq.realloc(nSize+1); + aGeomPropSeq[nSize] = lcl_createTextpathProps(); + } + rPropMap.setAnyProperty(PROP_CustomShapeGeometry, uno::makeAny(aGeomPropSeq)); + } +} + } // namespace vml } // namespace oox diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 2aa3bac1f83d..8e5e2a9524f6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -394,6 +394,8 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con aPropMap.erase(PROP_LineColor); } } + else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape")) + maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape); PropertySet( rxShape ).setProperties( aPropMap ); } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 658215a27cb7..efa6e3888cbe 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -372,6 +372,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.maShadowModel.moOpacity = lclDecodePercent(rAttribs, XML_opacity, 1.0); } break; + case VML_TOKEN( textpath ): + mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string)); + break; } return 0; } |