Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
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"
15 :
16 : #include <basegfx/numeric/ftools.hxx>
17 :
18 : namespace oox {
19 : namespace drawingml {
20 :
21 :
22 :
23 0 : void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourceProps)
24 : {
25 0 : moShadowDist.assignIfUsed( rSourceProps.moShadowDist );
26 0 : moShadowDir.assignIfUsed( rSourceProps.moShadowDir );
27 0 : moShadowColor.assignIfUsed( rSourceProps.moShadowColor );
28 0 : }
29 :
30 0 : void EffectProperties::assignUsed( const EffectProperties& rSourceProps )
31 : {
32 0 : maShadow.assignUsed(rSourceProps.maShadow);
33 0 : }
34 :
35 0 : void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
36 : const GraphicHelper& rGraphicHelper ) const
37 : {
38 0 : if (maShadow.moShadowDist.has())
39 : {
40 : // Negative X or Y dist indicates left or up, respectively
41 0 : double nAngle = (maShadow.moShadowDir.get(0) / PER_DEGREE) * F_PI180;
42 0 : sal_Int32 nDist = convertEmuToHmm(maShadow.moShadowDist.get(0));
43 0 : sal_Int32 nXDist = cos(nAngle) * nDist;
44 0 : sal_Int32 nYDist = sin(nAngle) * nDist;
45 :
46 0 : rPropMap.setProperty( PROP_Shadow, sal_True );
47 0 : rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
48 0 : rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
49 0 : rPropMap.setProperty( PROP_ShadowColor, maShadow.moShadowColor.getColor(rGraphicHelper, -1 ) );
50 0 : rPropMap.setProperty( PROP_ShadowTransparence, maShadow.moShadowColor.getTransparency());
51 : }
52 0 : }
53 :
54 :
55 :
56 : } // namespace drawingml
57 0 : } // namespace oox
58 :
59 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|