diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-18 14:42:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-18 14:50:18 +0100 |
commit | 01d059c13e39f4fba75e2152b4db6b0b746bca71 (patch) | |
tree | 2019bc6e3b8193110960aa24fc0f084dea4c026b /oox/source | |
parent | 16d50ae144d4ddd86177bd35ddd0b79529fbf79e (diff) |
oox: import VML's v:shadow to Writer
Change-Id: I48ea2dcf81c91c0fe476ecff6cd074cb699af533
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 28 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 2 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 8 |
4 files changed, 39 insertions, 0 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index a252bb2efcd3..243058010841 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -414,6 +414,7 @@ SelectedItems SelectedPage Shadow ShadowColor +ShadowFormat ShadowTransparence ShadowXDistance ShadowYDistance diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 528cc06db6b6..3113d57b4dd5 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -18,6 +18,7 @@ */ #include "oox/vml/vmlformatting.hxx" +#include <com/sun/star/table/ShadowFormat.hpp> #include <rtl/strbuf.hxx> #include "oox/drawingml/color.hxx" #include "oox/drawingml/drawingmltypes.hxx" @@ -32,6 +33,7 @@ namespace vml { // ============================================================================ +using namespace ::com::sun::star; using namespace ::com::sun::star::geometry; using ::oox::drawingml::Color; @@ -712,6 +714,32 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& // ============================================================================ +void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const +{ + if (moHasShadow.has() && !moHasShadow.get()) + return; + + drawingml::Color aColor = ConversionHelper::decodeColor(rGraphicHelper, moColor, moOpacity, API_RGB_GRAY); + // nOffset* is in mm100, default value is 35 twips, see DffPropertyReader::ApplyAttributes() in msfilter. + sal_Int32 nOffsetX = 62, nOffsetY = 62; + if (moOffset.has()) + { + OUString aOffsetX, aOffsetY; + ConversionHelper::separatePair(aOffsetX, aOffsetY, moOffset.get(), ','); + if (!aOffsetX.isEmpty()) + nOffsetX = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetX, 0, false, false ); + if (!aOffsetY.isEmpty()) + nOffsetY = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetY, 0, false, false ); + } + + table::ShadowFormat aFormat; + aFormat.Color = aColor.getColor(rGraphicHelper); + aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT; + // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet(). + aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2); + rPropMap.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat)); +} + } // namespace vml } // namespace oox diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index e36d98e2b0d9..8341f1979952 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -365,6 +365,8 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con uno::Reference<lang::XServiceInfo> xSInfo(rxShape, uno::UNO_QUERY_THROW); if (xSInfo->supportsService("com.sun.star.text.TextFrame")) { + // Any other service supporting the ShadowFormat property? + maTypeModel.maShadowModel.pushToPropMap(aPropMap, rGraphicHelper); // TextFrames have BackColor, not FillColor if (aPropMap.hasProperty(PROP_FillColor)) { diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index cb3daa6dbd03..fc5ad9f44cb6 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -333,6 +333,14 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.moWrapAnchorX = rAttribs.getString(XML_anchorx); mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory); break; + case VML_TOKEN( shadow ): + { + mrTypeModel.maShadowModel.moHasShadow.assignIfUsed(lclDecodeBool(rAttribs, XML_on)); + mrTypeModel.maShadowModel.moColor.assignIfUsed(rAttribs.getString(XML_color)); + mrTypeModel.maShadowModel.moOffset.assignIfUsed(rAttribs.getString(XML_offset)); + mrTypeModel.maShadowModel.moOpacity = lclDecodePercent(rAttribs, XML_opacity, 1.0); + } + break; } return 0; } |