summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-05-28 17:44:25 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-05-30 15:54:14 +0200
commitbf32dfeffb79fc7c06189f9040f7a8db3ce56700 (patch)
tree001cee68a7b7d89379634de972f828a07485001d /oox
parentd2e061be5c8788865e524bf7e7b355f65892a79e (diff)
bnc#817956 VML import of v:textpath
Word exposes this as Watermark in its UI. Change-Id: I23d9b2aab2dab60a98c7f456b0592c2b74bcaf81 (cherry picked from commit 290695c785ef831abb6e78cd3675bc071f05f643) Conflicts: oox/inc/oox/vml/vmlformatting.hxx oox/inc/oox/vml/vmlshape.hxx oox/source/vml/vmlformatting.cxx oox/source/vml/vmlshapecontext.cxx
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/vml/vmlformatting.hxx12
-rw-r--r--oox/inc/oox/vml/vmlshape.hxx1
-rw-r--r--oox/source/vml/vmlformatting.cxx56
-rw-r--r--oox/source/vml/vmlshape.cxx2
-rw-r--r--oox/source/vml/vmlshapecontext.cxx3
5 files changed, 74 insertions, 0 deletions
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index 277b35837af0..7ead90eba55c 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -24,6 +24,7 @@
#include "oox/dllapi.h"
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <vector>
@@ -225,6 +226,17 @@ struct FillModel
// ============================================================================
+/** The shadow model structure contains all shape textpath properties. */
+struct OOX_DLLPUBLIC TextpathModel
+{
+ OptValue<OUString> moString; ///< Specifies the string of the textpath.
+
+ TextpathModel();
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const;
+};
+
} // namespace vml
} // namespace oox
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 1c289b2f7092..ce8c325b616a 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -87,6 +87,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel
StrokeModel maStrokeModel; ///< Border line formatting.
FillModel maFillModel; ///< Shape fill formatting.
+ TextpathModel maTextpathModel; ///< Shape textpath formatting.
OptValue< ::rtl::OUString > moGraphicPath; ///< Path to a graphic for this shape.
OptValue< ::rtl::OUString > moGraphicTitle; ///< Title of the graphic.
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index ed6355b45921..02559d4b4018 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -18,6 +18,10 @@
*/
#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/text/XTextRange.hpp>
#include <rtl/strbuf.hxx>
#include "oox/drawingml/color.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
@@ -33,6 +37,7 @@ namespace vml {
// ============================================================================
using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star;
using ::oox::drawingml::Color;
using ::oox::drawingml::FillProperties;
@@ -713,6 +718,57 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper&
// ============================================================================
+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 5a4a1657666a..3861ee19f3e3 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -369,6 +369,8 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
aPropMap.setProperty(PROP_BackColor, aPropMap[PROP_FillColor]);
aPropMap.erase(PROP_FillColor);
}
+ 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 6a53f17e7c93..7757c8bdaff0 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -335,6 +335,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
mrTypeModel.moWrapType = rAttribs.getString(XML_type);
mrTypeModel.moWrapSide = rAttribs.getString(XML_side);
break;
+ case VML_TOKEN( textpath ):
+ mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string));
+ break;
}
return 0;
}