summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-12-20 10:23:56 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-12-20 10:30:38 +0100
commit361bad18d8ab8df1fe852d60d97ca8ce976d1de4 (patch)
treec4e0f686faf02af2efbcb33c331025f76fe2767c /oox
parent5f7d39a07e108385b34c00e95dfdf734ad8f1f56 (diff)
oox: import textframe shadow from drawingml
CppunitTest_sw_ooxmlexport's testTextFrameBorders is a reproducer for this problem. Change-Id: I5e164c6c151caca62e5b4464e7ed3708f59ada82
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index a28b1b4c1b1e..1406567184f3 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -642,6 +643,56 @@ Reference< XShape > Shape::createAndInsert(
}
aShapeProps.erase(PROP_LineColor);
}
+
+ // TextFrames have ShadowFormat, not individual shadow properties.
+ boost::optional<sal_Int32> oShadowDistance;
+ if (aShapeProps.hasProperty(PROP_ShadowXDistance))
+ {
+ oShadowDistance = aShapeProps[PROP_ShadowXDistance].get<sal_Int32>();
+ aShapeProps.erase(PROP_ShadowXDistance);
+ }
+ if (aShapeProps.hasProperty(PROP_ShadowYDistance))
+ {
+ // There is a single 'dist' attribute, so no need to count the avg of x and y.
+ aShapeProps.erase(PROP_ShadowYDistance);
+ }
+ boost::optional<sal_Int32> oShadowColor;
+ if (aShapeProps.hasProperty(PROP_ShadowColor))
+ {
+ oShadowColor = aShapeProps[PROP_ShadowColor].get<sal_Int32>();
+ aShapeProps.erase(PROP_ShadowColor);
+ }
+ if (aShapeProps.hasProperty(PROP_Shadow))
+ aShapeProps.erase(PROP_Shadow);
+
+ if (oShadowDistance || oShadowColor || aEffectProperties.maShadow.moShadowDir.has())
+ {
+ css::table::ShadowFormat aFormat;
+ if (oShadowColor)
+ aFormat.Color = *oShadowColor;
+ if (aEffectProperties.maShadow.moShadowDir.has())
+ {
+ css::table::ShadowLocation nLocation = css::table::ShadowLocation_NONE;
+ switch (aEffectProperties.maShadow.moShadowDir.get())
+ {
+ case 13500000:
+ nLocation = css::table::ShadowLocation_TOP_LEFT;
+ break;
+ case 18900000:
+ nLocation = css::table::ShadowLocation_TOP_RIGHT;
+ break;
+ case 8100000:
+ nLocation = css::table::ShadowLocation_BOTTOM_LEFT;
+ break;
+ case 2700000:
+ nLocation = css::table::ShadowLocation_BOTTOM_RIGHT;
+ break;
+ }
+ aFormat.Location = nLocation;
+ }
+ aFormat.ShadowWidth = *oShadowDistance;
+ aShapeProps.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat));
+ }
}
PropertySet( xSet ).setProperties( aShapeProps );