summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/GraphicImport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx46
1 files changed, 46 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 48cdf6cdb790..cbd59f943ebf 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
#include <cppuhelper/implbase1.hxx>
#include <rtl/ustrbuf.hxx>
@@ -220,6 +221,12 @@ public:
sal_Int32 nTopMargin;
sal_Int32 nBottomMargin;
+ bool bShadow;
+ sal_Int32 nShadowXDistance;
+ sal_Int32 nShadowYDistance;
+ sal_Int32 nShadowColor;
+ sal_Int32 nShadowTransparence;
+
sal_Int32 nContrast;
sal_Int32 nBrightness;
double fGamma;
@@ -892,6 +899,15 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
aMediaProperties[0].Name = "URL";
aMediaProperties[0].Value <<= sUrl;
+ xShapeProps->getPropertyValue("Shadow") >>= m_pImpl->bShadow;
+ if (m_pImpl->bShadow)
+ {
+ xShapeProps->getPropertyValue("ShadowXDistance") >>= m_pImpl->nShadowXDistance;
+ xShapeProps->getPropertyValue("ShadowYDistance") >>= m_pImpl->nShadowYDistance;
+ xShapeProps->getPropertyValue("ShadowColor") >>= m_pImpl->nShadowColor;
+ xShapeProps->getPropertyValue("ShadowTransparence") >>= m_pImpl->nShadowTransparence;
+ }
+
m_xGraphicObject = createGraphicObject( aMediaProperties );
bUseShape = !m_xGraphicObject.is( );
@@ -1310,6 +1326,36 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( aBorderProps[nBorder]), uno::makeAny(aBorderLine));
}
+ // setting graphic object shadow proerties
+ if (m_pImpl->bShadow)
+ {
+ // Shadow width is approximated by average of X and Y
+ table::ShadowFormat aShadow;
+ sal_Int32 nShadowColor = m_pImpl->nShadowColor;
+ sal_Int32 nShadowWidth = (abs(m_pImpl->nShadowXDistance)
+ + abs(m_pImpl->nShadowYDistance)) / 2;
+
+ aShadow.ShadowWidth = nShadowWidth;
+ aShadow.Color = nShadowColor;
+ // Distances -ve for top and right, +ve for bottom and left
+ if (m_pImpl->nShadowXDistance > 0)
+ {
+ if (m_pImpl->nShadowYDistance > 0)
+ aShadow.Location = com::sun::star::table::ShadowLocation_BOTTOM_RIGHT;
+ else
+ aShadow.Location = com::sun::star::table::ShadowLocation_TOP_RIGHT;
+ }
+ else
+ {
+ if (m_pImpl->nShadowYDistance > 0)
+ aShadow.Location = com::sun::star::table::ShadowLocation_BOTTOM_LEFT;
+ else
+ aShadow.Location = com::sun::star::table::ShadowLocation_TOP_LEFT;
+ }
+
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_SHADOW_FORMAT), uno::makeAny(aShadow));
+ }
+
// setting properties for all types
xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_DESCRIPTION ),
uno::makeAny( m_pImpl->sAlternativeText ));