1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef OOX_DRAWINGML_FILLPROPERTIES_HXX
21 #define OOX_DRAWINGML_FILLPROPERTIES_HXX
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"
39 class ShapePropertyMap
;
41 // ============================================================================
43 struct GradientFillProperties
45 typedef ::std::map
< double, Color
> GradientStopMap
;
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.
56 /** Overwrites all members that are explicitly set in rSourceProps. */
57 void assignUsed( const GradientFillProperties
& rSourceProps
);
60 // ============================================================================
62 struct PatternFillProperties
64 Color maPattFgColor
; /// Pattern foreground color.
65 Color maPattBgColor
; /// Pattern background color.
66 OptValue
< sal_Int32
> moPattPreset
; /// Preset pattern type.
68 /** Overwrites all members that are explicitly set in rSourceProps. */
69 void assignUsed( const PatternFillProperties
& rSourceProps
);
72 // ============================================================================
74 struct BlipFillProperties
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
>
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.
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.
97 /** Overwrites all members that are explicitly set in rSourceProps. */
98 void assignUsed( const BlipFillProperties
& rSourceProps
);
101 // ============================================================================
103 struct OOX_DLLPUBLIC FillProperties
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.
111 /** Overwrites all members that are explicitly set in rSourceProps. */
112 void assignUsed( const FillProperties
& rSourceProps
);
114 /** Tries to resolve current settings to a solid color, e.g. returns the
115 start color of a gradient. */
116 Color
getBestSolidColor() const;
118 /** Writes the properties to the passed property map. */
120 ShapePropertyMap
& rPropMap
,
121 const GraphicHelper
& rGraphicHelper
,
122 sal_Int32 nShapeRotation
= 0,
123 sal_Int32 nPhClr
= API_RGB_TRANSPARENT
,
125 bool bFlipV
= false ) const;
128 // ============================================================================
130 struct GraphicProperties
132 BlipFillProperties maBlipProps
; /// Properties for the graphic.
133 EmbeddedWAVAudioFile maAudio
; /// Audio file details
135 /** Overwrites all members that are explicitly set in rSourceProps. */
136 void assignUsed( const GraphicProperties
& rSourceProps
);
138 /** Writes the properties to the passed property map. */
140 PropertyMap
& rPropMap
,
141 const GraphicHelper
& rGraphicHelper
,
142 sal_Int32 nPhClr
= API_RGB_TRANSPARENT
) const;
145 // ============================================================================
147 } // namespace drawingml
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */