1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-baosic-offset: 4 -*- */
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/.
10 #include "oox/drawingml/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>
21 // ============================================================================
23 void EffectShadowProperties::assignUsed(const EffectShadowProperties
& rSourceProps
)
25 moShadowDist
.assignIfUsed( rSourceProps
.moShadowDist
);
26 moShadowDir
.assignIfUsed( rSourceProps
.moShadowDir
);
27 moShadowColor
.assignIfUsed( rSourceProps
.moShadowColor
);
30 void EffectProperties::assignUsed( const EffectProperties
& rSourceProps
)
32 maShadow
.assignUsed(rSourceProps
.maShadow
);
35 void EffectProperties::pushToPropMap( PropertyMap
& rPropMap
,
36 const GraphicHelper
& rGraphicHelper
) const
38 if (maShadow
.moShadowDist
.has())
40 // Negative X or Y dist indicates left or up, respectively
41 double nAngle
= (maShadow
.moShadowDir
.get(0) / PER_DEGREE
) * F_PI180
;
42 sal_Int32 nDist
= convertEmuToHmm(maShadow
.moShadowDist
.get(0));
43 sal_Int32 nXDist
= cos(nAngle
) * nDist
;
44 sal_Int32 nYDist
= sin(nAngle
) * nDist
;
46 rPropMap
.setProperty( PROP_Shadow
, sal_True
);
47 rPropMap
.setProperty( PROP_ShadowXDistance
, nXDist
);
48 rPropMap
.setProperty( PROP_ShadowYDistance
, nYDist
);
49 rPropMap
.setProperty( PROP_ShadowColor
, maShadow
.moShadowColor
.getColor(rGraphicHelper
, -1 ) );
50 rPropMap
.setProperty( PROP_ShadowTransparence
, maShadow
.moShadowColor
.getTransparency());
54 // ============================================================================
56 } // namespace drawingml
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */