Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / inc / drawingml / fillproperties.hxx
blob45f5c4b4027260630f9e07738914ea25093bc61b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_DRAWINGML_FILLPROPERTIES_HXX
21 #define INCLUDED_OOX_INC_DRAWINGML_FILLPROPERTIES_HXX
23 #include <map>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
27 #include <com/sun/star/uno/Any.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <oox/dllapi.h>
30 #include <oox/drawingml/color.hxx>
31 #include <oox/helper/helper.hxx>
32 #include <oox/ole/oleobjecthelper.hxx>
33 #include <rtl/ustring.hxx>
34 #include <sal/types.h>
36 namespace com { namespace sun { namespace star {
37 namespace graphic { class XGraphic; }
38 } } }
40 namespace oox {
41 class GraphicHelper;
44 namespace oox {
45 namespace drawingml {
47 class ShapePropertyMap;
49 struct GradientFillProperties
51 typedef ::std::multimap< double, Color > GradientStopMap;
53 GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
54 OptValue< css::geometry::IntegerRectangle2D > moFillToRect;
55 OptValue< css::geometry::IntegerRectangle2D > moTileRect;
56 OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
57 OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
58 OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
59 OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
60 OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
62 /** Overwrites all members that are explicitly set in rSourceProps. */
63 void assignUsed( const GradientFillProperties& rSourceProps );
66 struct PatternFillProperties
68 Color maPattFgColor; /// Pattern foreground color.
69 Color maPattBgColor; /// Pattern background color.
70 OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
72 /** Overwrites all members that are explicitly set in rSourceProps. */
73 void assignUsed( const PatternFillProperties& rSourceProps );
76 struct ArtisticEffectProperties
78 OUString msName;
79 std::map< OUString, css::uno::Any >
80 maAttribs;
81 ::oox::ole::OleObjectInfo mrOleObjectInfo; /// The original graphic as embedded object.
83 bool isEmpty() const;
85 /** Returns the struct as a PropertyValue with Name = msName and
86 * Value = maAttribs as a Sequence< PropertyValue >. */
87 css::beans::PropertyValue getEffect();
89 /** Overwrites all members that are explicitly set in rSourceProps. */
90 void assignUsed( const ArtisticEffectProperties& rSourceProps );
92 /** Translate effect tokens to strings. */
93 static OUString getEffectString( sal_Int32 nToken );
95 /** Translate effect strings to tokens. */
96 static sal_Int32 getEffectToken( const OUString& sName );
99 struct BlipFillProperties
101 css::uno::Reference<css::graphic::XGraphic> mxFillGraphic; /// The fill graphic.
102 OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
103 OptValue< css::geometry::IntegerRectangle2D >
104 moFillRect; /// Stretch fill offsets.
105 OptValue< css::geometry::IntegerRectangle2D >
106 moClipRect;
107 OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
108 OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
109 OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
110 OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
111 OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
112 OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
113 OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
114 // effects
115 OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
116 OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
117 OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
118 Color maColorChangeFrom; /// Start color of color transformation.
119 Color maColorChangeTo; /// Destination color of color transformation.
120 Color maDuotoneColors[2]; /// Duotone Colors
122 ArtisticEffectProperties maEffect; /// Artistic effect, not supported by core.
123 OptValue<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect.
125 /** Overwrites all members that are explicitly set in rSourceProps. */
126 void assignUsed( const BlipFillProperties& rSourceProps );
129 struct OOX_DLLPUBLIC FillProperties
131 OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
132 Color maFillColor; /// Solid fill color and transparence.
133 GradientFillProperties maGradientProps; /// Properties for gradient fills.
134 PatternFillProperties maPatternProps; /// Properties for pattern fills.
135 BlipFillProperties maBlipProps; /// Properties for bitmap fills.
137 /** Overwrites all members that are explicitly set in rSourceProps. */
138 void assignUsed( const FillProperties& rSourceProps );
140 /** Tries to resolve current settings to a solid color, e.g. returns the
141 start color of a gradient. */
142 Color getBestSolidColor() const;
144 /** Writes the properties to the passed property map. */
145 void pushToPropMap(
146 ShapePropertyMap& rPropMap,
147 const GraphicHelper& rGraphicHelper,
148 sal_Int32 nShapeRotation = 0,
149 ::Color nPhClr = API_RGB_TRANSPARENT,
150 bool bFlipH = false,
151 bool bFlipV = false ) const;
154 } // namespace drawingml
155 } // namespace oox
157 #endif
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */