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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef OOX_DRAWINGML_FILLPROPERTIES_HXX
21 : #define OOX_DRAWINGML_FILLPROPERTIES_HXX
22 :
23 : #include <map>
24 : #include <com/sun/star/graphic/XGraphic.hpp>
25 : #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
26 : #include "oox/drawingml/color.hxx"
27 : #include "oox/helper/helper.hxx"
28 : #include "oox/drawingml/embeddedwavaudiofile.hxx"
29 :
30 : namespace oox {
31 : class GraphicHelper;
32 : class PropertyMap;
33 : class PropertySet;
34 : }
35 :
36 : namespace oox {
37 : namespace drawingml {
38 :
39 : class ShapePropertyMap;
40 :
41 : // ============================================================================
42 :
43 1538 : struct GradientFillProperties
44 : {
45 : typedef ::std::map< double, Color > GradientStopMap;
46 :
47 : GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
48 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
49 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect;
50 : OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
51 : OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
52 : OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
53 : OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
54 : OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
55 :
56 : /** Overwrites all members that are explicitly set in rSourceProps. */
57 : void assignUsed( const GradientFillProperties& rSourceProps );
58 : };
59 :
60 : // ============================================================================
61 :
62 1538 : struct PatternFillProperties
63 : {
64 : Color maPattFgColor; /// Pattern foreground color.
65 : Color maPattBgColor; /// Pattern background color.
66 : OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
67 :
68 : /** Overwrites all members that are explicitly set in rSourceProps. */
69 : void assignUsed( const PatternFillProperties& rSourceProps );
70 : };
71 :
72 : // ============================================================================
73 :
74 2064 : struct BlipFillProperties
75 : {
76 : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
77 : mxGraphic; /// The fill graphic.
78 : OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
79 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
80 : moFillRect; /// Stretch fill offsets.
81 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
82 : moClipRect;
83 : OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
84 : OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
85 : OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
86 : OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
87 : OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
88 : OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
89 : OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
90 : // effects
91 : OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
92 : OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
93 : OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
94 : Color maColorChangeFrom; /// Start color of color transformation.
95 : Color maColorChangeTo; /// Destination color of color transformation.
96 :
97 : /** Overwrites all members that are explicitly set in rSourceProps. */
98 : void assignUsed( const BlipFillProperties& rSourceProps );
99 : };
100 :
101 : // ============================================================================
102 :
103 1538 : struct OOX_DLLPUBLIC FillProperties
104 : {
105 : OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
106 : Color maFillColor; /// Solid fill color and transparence.
107 : GradientFillProperties maGradientProps; /// Properties for gradient fills.
108 : PatternFillProperties maPatternProps; /// Properties for pattern fills.
109 : BlipFillProperties maBlipProps; /// Properties for bitmap fills.
110 :
111 : /** Overwrites all members that are explicitly set in rSourceProps. */
112 : void assignUsed( const FillProperties& rSourceProps );
113 :
114 : /** Tries to resolve current settings to a solid color, e.g. returns the
115 : start color of a gradient. */
116 : Color getBestSolidColor() const;
117 :
118 : /** Writes the properties to the passed property map. */
119 : void pushToPropMap(
120 : ShapePropertyMap& rPropMap,
121 : const GraphicHelper& rGraphicHelper,
122 : sal_Int32 nShapeRotation = 0,
123 : sal_Int32 nPhClr = API_RGB_TRANSPARENT,
124 : bool bFlipH = false,
125 : bool bFlipV = false ) const;
126 : };
127 :
128 : // ============================================================================
129 :
130 526 : struct GraphicProperties
131 : {
132 : BlipFillProperties maBlipProps; /// Properties for the graphic.
133 : EmbeddedWAVAudioFile maAudio; /// Audio file details
134 :
135 : /** Overwrites all members that are explicitly set in rSourceProps. */
136 : void assignUsed( const GraphicProperties& rSourceProps );
137 :
138 : /** Writes the properties to the passed property map. */
139 : void pushToPropMap(
140 : PropertyMap& rPropMap,
141 : const GraphicHelper& rGraphicHelper,
142 : sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
143 : };
144 :
145 : // ============================================================================
146 :
147 : } // namespace drawingml
148 : } // namespace oox
149 :
150 : #endif
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|