fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / effectproperties.cxx
blob88638b88ab16d704ff1de2a3128c123eefb2f132
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "effectproperties.hxx"
11 #include "oox/drawingml/drawingmltypes.hxx"
12 #include "oox/drawingml/shapepropertymap.hxx"
13 #include "oox/helper/graphichelper.hxx"
14 #include "oox/token/tokens.hxx"
16 #include <basegfx/numeric/ftools.hxx>
18 namespace oox {
19 namespace drawingml {
21 void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourceProps)
23 moShadowDist.assignIfUsed( rSourceProps.moShadowDist );
24 moShadowDir.assignIfUsed( rSourceProps.moShadowDir );
25 moShadowColor.assignIfUsed( rSourceProps.moShadowColor );
28 void EffectProperties::assignUsed( const EffectProperties& rSourceProps )
30 maShadow.assignUsed(rSourceProps.maShadow);
31 if( rSourceProps.maEffects.size() > 0 )
32 maEffects = rSourceProps.maEffects;
35 void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
36 const GraphicHelper& rGraphicHelper ) const
38 for( boost::ptr_vector< Effect >::const_iterator it = maEffects.begin(); it != maEffects.end(); ++it )
39 if( it->msName == "outerShdw" )
41 sal_Int32 nAttrDir = 0, nAttrDist = 0;
42 std::map< OUString, css::uno::Any >::const_iterator attribIt = it->maAttribs.find( "dir" );
43 if( attribIt != it->maAttribs.end() )
44 attribIt->second >>= nAttrDir;
46 attribIt = it->maAttribs.find( "dist" );
47 if( attribIt != it->maAttribs.end() )
48 attribIt->second >>= nAttrDist;
50 // Negative X or Y dist indicates left or up, respectively
51 double nAngle = ( static_cast<double>(nAttrDir) / PER_DEGREE ) * F_PI180;
52 sal_Int32 nDist = convertEmuToHmm( nAttrDist );
53 sal_Int32 nXDist = cos(nAngle) * nDist;
54 sal_Int32 nYDist = sin(nAngle) * nDist;
56 rPropMap.setProperty( PROP_Shadow, true );
57 rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
58 rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
59 rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper, -1 ) );
60 rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency());
64 css::beans::PropertyValue Effect::getEffect()
66 css::beans::PropertyValue pRet;
67 if( msName.isEmpty() )
68 return pRet;
70 css::uno::Sequence< css::beans::PropertyValue > aSeq( maAttribs.size() );
71 sal_uInt32 i = 0;
72 for( std::map< OUString, css::uno::Any >::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it )
74 aSeq[i].Name = it->first;
75 aSeq[i].Value = it->second;
76 i++;
79 pRet.Name = msName;
80 pRet.Value = css::uno::Any( aSeq );
82 return pRet;
85 } // namespace drawingml
86 } // namespace oox
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */