summaryrefslogtreecommitdiff
path: root/oox/inc/oox/drawingml/shape3dproperties.hxx
blob: 9b6dfabe4a5cc1bac679d0dbc00e39cc81528218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX

#include <map>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/color.hxx"
#include "oox/helper/helper.hxx"

namespace oox { class PropertyMap; }
namespace oox { class PropertySet; }
namespace oox { namespace core { class ModelObjectContainer; } }

namespace oox {
namespace drawingml {

// ============================================================================

struct Shape3DPropertyNames
{
    ::rtl::OUString     maFillStyle;
    ::rtl::OUString     maFillColor;
    ::rtl::OUString     maFillTransparence;
    ::rtl::OUString     maFillGradient;
    ::rtl::OUString     maFillBitmap;
    ::rtl::OUString     maFillBitmapMode;
    ::rtl::OUString     maFillBitmapTile;
    ::rtl::OUString     maFillBitmapStretch;
    ::rtl::OUString     maFillBitmapLogicalSize;
    ::rtl::OUString     maFillBitmapSizeX;
    ::rtl::OUString     maFillBitmapSizeY;
    ::rtl::OUString     maFillBitmapOffsetX;
    ::rtl::OUString     maFillBitmapOffsetY;
    ::rtl::OUString     maFillBitmapRectanglePoint;
    bool                mbNamedFillGradient;
    bool                mbNamedFillBitmap;
    bool                mbTransformGraphic;

    Shape3DPropertyNames();
};

// ============================================================================

struct Shape3DProperties
{
    typedef ::std::map< double, Color > GradientStopMap;

    OptValue< sal_Int32 > moFillType;           /// Fill type (OOXML token).
    OptValue< bool >    moRotateWithShape;      /// True = rotate gradient/bitmap with shape.
    Color               maFillColor;            /// Solid fill color and transparence.
    GradientStopMap     maGradientStops;        /// Gradient stops (colors/transparence).
    OptValue< sal_Int32 > moGradientPath;       /// If set, gradient follows rectangle, circle, or shape.
    OptValue< sal_Int32 > moShadeAngle;         /// Rotation angle of linear gradients.
    OptValue< bool >    moShadeScaled;
    OptValue< sal_Int32 > moFlipModeToken;
    OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
    OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
    OptValue< sal_Int32 > moPattPreset;         /// Preset pattern type.
    Color               maPattFgColor;          /// Pattern foreground color.
    Color               maPattBgColor;          /// Pattern background color.
    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
    Color               maColorChangeFrom;      /// Start color of color transformation.
    Color               maColorChangeTo;        /// Destination color of color transformation.
    OptValue< sal_Int32 > moBitmapMode;         /// Bitmap tile or stretch.
    OptValue< sal_Int32 > moTileX;              /// Width of bitmap tiles.
    OptValue< sal_Int32 > moTileY;              /// Height of bitmap tiles.
    OptValue< sal_Int32 > moTileSX;
    OptValue< sal_Int32 > moTileSY;
    OptValue< sal_Int32 > moTileAlign;          /// Anchor point inside bitmap.

    static Shape3DPropertyNames DEFAULTNAMES;      /// Default fill property names for shape fill.
    static Shape3DPropertyNames DEFAULTPICNAMES;   /// Default fill property names for pictures.

    /** Overwrites all members that are explicitly set in rSourceProps. */
    void                assignUsed( const Shape3DProperties& rSourceProps );

    /** Tries to resolve current settings to a solid color, e.g. returns the
        start color of a gradient. */
    Color               getBestSolidColor() const;

    /** Writes the properties to the passed property map. */
    void                pushToPropMap(
                            PropertyMap& rPropMap,
                            const Shape3DPropertyNames& rPropNames,
                            const ::oox::core::XmlFilterBase& rFilter,
                            ::oox::core::ModelObjectContainer& rObjContainer,
                            sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;

    /** Writes the properties to the passed property set. */
    void                pushToPropSet(
                            PropertySet& rPropSet,
                            const Shape3DPropertyNames& rPropNames,
                            const ::oox::core::XmlFilterBase& rFilter,
                            ::oox::core::ModelObjectContainer& rObjContainer,
                            sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
};

// ============================================================================

} // namespace drawingml
} // namespace oox

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */