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 INCLUDED_OOX_DRAWINGML_FILLPROPERTIES_HXX
21 #define INCLUDED_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/ole/oleobjecthelper.hxx>
37 class ShapePropertyMap
;
39 struct GradientFillProperties
41 typedef ::std::map
< double, Color
> GradientStopMap
;
43 GradientStopMap maGradientStops
; /// Gradient stops (colors/transparence).
44 OptValue
< ::com::sun::star::geometry::IntegerRectangle2D
> moFillToRect
;
45 OptValue
< ::com::sun::star::geometry::IntegerRectangle2D
> moTileRect
;
46 OptValue
< sal_Int32
> moGradientPath
; /// If set, gradient follows rectangle, circle, or shape.
47 OptValue
< sal_Int32
> moShadeAngle
; /// Rotation angle of linear gradients.
48 OptValue
< sal_Int32
> moShadeFlip
; /// Flip mode of gradient, if not stretched to shape.
49 OptValue
< bool > moShadeScaled
; /// True = scale gradient into shape.
50 OptValue
< bool > moRotateWithShape
; /// True = rotate gradient with shape.
52 /** Overwrites all members that are explicitly set in rSourceProps. */
53 void assignUsed( const GradientFillProperties
& rSourceProps
);
56 struct PatternFillProperties
58 Color maPattFgColor
; /// Pattern foreground color.
59 Color maPattBgColor
; /// Pattern background color.
60 OptValue
< sal_Int32
> moPattPreset
; /// Preset pattern type.
62 /** Overwrites all members that are explicitly set in rSourceProps. */
63 void assignUsed( const PatternFillProperties
& rSourceProps
);
66 struct ArtisticEffectProperties
69 std::map
< OUString
, css::uno::Any
>
71 ::oox::ole::OleObjectInfo mrOleObjectInfo
; /// The original graphic as embedded object.
75 /** Returns the struct as a PropertyValue with Name = msName and
76 * Value = maAttribs as a Sequence< PropertyValue >. */
77 css::beans::PropertyValue
getEffect();
79 /** Overwrites all members that are explicitly set in rSourceProps. */
80 void assignUsed( const ArtisticEffectProperties
& rSourceProps
);
82 /** Translate effect tokens to strings. */
83 static OUString
getEffectString( sal_Int32 nToken
);
85 /** Translate effect strings to tokens. */
86 static sal_Int32
getEffectToken( const OUString
& sName
);
89 struct BlipFillProperties
91 ::com::sun::star::uno::Reference
< ::com::sun::star::graphic::XGraphic
>
92 mxGraphic
; /// The fill graphic.
93 OptValue
< sal_Int32
> moBitmapMode
; /// Bitmap tile or stretch.
94 OptValue
< ::com::sun::star::geometry::IntegerRectangle2D
>
95 moFillRect
; /// Stretch fill offsets.
96 OptValue
< ::com::sun::star::geometry::IntegerRectangle2D
>
98 OptValue
< sal_Int32
> moTileOffsetX
; /// Width of bitmap tiles (EMUs).
99 OptValue
< sal_Int32
> moTileOffsetY
; /// Height of bitmap tiles (EMUs).
100 OptValue
< sal_Int32
> moTileScaleX
; /// Horizontal scaling of bitmap tiles (1/1000 percent).
101 OptValue
< sal_Int32
> moTileScaleY
; /// Vertical scaling of bitmap tiles (1/1000 percent).
102 OptValue
< sal_Int32
> moTileAlign
; /// Anchor point inside bitmap.
103 OptValue
< sal_Int32
> moTileFlip
; /// Flip mode of bitmap tiles.
104 OptValue
< bool > moRotateWithShape
; /// True = rotate bitmap with shape.
106 OptValue
< sal_Int32
> moColorEffect
; /// XML token for a color effect.
107 OptValue
< sal_Int32
> moBrightness
; /// Brightness in the range [-100000,100000].
108 OptValue
< sal_Int32
> moContrast
; /// Contrast in the range [-100000,100000].
109 Color maColorChangeFrom
; /// Start color of color transformation.
110 Color maColorChangeTo
; /// Destination color of color transformation.
111 Color maDuotoneColors
[2]; /// Duotone Colors
113 ArtisticEffectProperties maEffect
; /// Artistic effect, not supported by core.
115 /** Overwrites all members that are explicitly set in rSourceProps. */
116 void assignUsed( const BlipFillProperties
& rSourceProps
);
119 struct OOX_DLLPUBLIC FillProperties
121 OptValue
< sal_Int32
> moFillType
; /// Fill type (OOXML token).
122 Color maFillColor
; /// Solid fill color and transparence.
123 GradientFillProperties maGradientProps
; /// Properties for gradient fills.
124 PatternFillProperties maPatternProps
; /// Properties for pattern fills.
125 BlipFillProperties maBlipProps
; /// Properties for bitmap fills.
127 /** Overwrites all members that are explicitly set in rSourceProps. */
128 void assignUsed( const FillProperties
& rSourceProps
);
130 /** Tries to resolve current settings to a solid color, e.g. returns the
131 start color of a gradient. */
132 Color
getBestSolidColor() const;
134 /** Writes the properties to the passed property map. */
136 ShapePropertyMap
& rPropMap
,
137 const GraphicHelper
& rGraphicHelper
,
138 sal_Int32 nShapeRotation
= 0,
139 sal_Int32 nPhClr
= API_RGB_TRANSPARENT
,
141 bool bFlipV
= false ) const;
144 } // namespace drawingml
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */