summaryrefslogtreecommitdiff
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 17:00:14 +0200
commit0819da6b65d6fafde81fa55e3744f49ed11ad53d (patch)
tree2d2c5d438671be406422d7deb1cec8298739de57
parenta481759a903e077bc09a7160ff658f5afa9379c8 (diff)
bnc#817956 VML import of v:textpath
Word exposes this as Watermark in its UI. (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 Change-Id: I23d9b2aab2dab60a98c7f456b0592c2b74bcaf81
-rw-r--r--oox/inc/oox/vml/vmlformatting.hxx16
-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, 78 insertions, 0 deletions
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index 428e2bd1d5e4..4d80fc144d8a 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -31,6 +31,11 @@
#include "oox/helper/helper.hxx"
#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>
namespace oox {
class GraphicHelper;
@@ -213,6 +218,17 @@ struct FillModel
// ============================================================================
+/** The shadow model structure contains all shape textpath properties. */
+struct OOX_DLLPUBLIC TextpathModel
+{
+ OptValue<rtl::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 7216941198ee..e73eaa8d99a7 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -96,6 +96,7 @@ struct ShapeTypeModel
StrokeModel maStrokeModel; ///< Border line formatting.
FillModel maFillModel; ///< Shape fill formatting.
::rtl::OUString maArcsize; /// round rectangles arc size
+ 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 6d202767fb2b..63f54d607a2b 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -28,6 +28,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"
@@ -43,6 +47,7 @@ namespace vml {
// ============================================================================
using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star;
using ::oox::drawingml::Color;
using ::oox::drawingml::FillProperties;
@@ -587,6 +592,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 e61820cc33c1..1c2202472438 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -371,6 +371,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 4e21ce9b2fa8..15010db5b63c 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -339,6 +339,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory);
break;
break;
+ case VML_TOKEN( textpath ):
+ mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string));
+ break;
}
return 0;
}