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 INCLUDED_OOX_DRAWINGML_FILLPROPERTIES_HXX
21 : #define INCLUDED_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/ole/oleobjecthelper.hxx>
29 :
30 : namespace oox {
31 : class GraphicHelper;
32 : }
33 :
34 : namespace oox {
35 : namespace drawingml {
36 :
37 : class ShapePropertyMap;
38 :
39 1432364 : struct GradientFillProperties
40 : {
41 : typedef ::std::map< double, Color > GradientStopMap;
42 :
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.
51 :
52 : /** Overwrites all members that are explicitly set in rSourceProps. */
53 : void assignUsed( const GradientFillProperties& rSourceProps );
54 : };
55 :
56 196052 : struct PatternFillProperties
57 : {
58 : Color maPattFgColor; /// Pattern foreground color.
59 : Color maPattBgColor; /// Pattern background color.
60 : OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
61 :
62 : /** Overwrites all members that are explicitly set in rSourceProps. */
63 : void assignUsed( const PatternFillProperties& rSourceProps );
64 : };
65 :
66 240932 : struct ArtisticEffectProperties
67 : {
68 : OUString msName;
69 : std::map< OUString, css::uno::Any >
70 : maAttribs;
71 : ::oox::ole::OleObjectInfo mrOleObjectInfo; /// The original graphic as embedded object.
72 :
73 : bool isEmpty() const;
74 :
75 : /** Returns the struct as a PropertyValue with Name = msName and
76 : * Value = maAttribs as a Sequence< PropertyValue >. */
77 : css::beans::PropertyValue getEffect();
78 :
79 : /** Overwrites all members that are explicitly set in rSourceProps. */
80 : void assignUsed( const ArtisticEffectProperties& rSourceProps );
81 :
82 : /** Translate effect tokens to strings. */
83 : static OUString getEffectString( sal_Int32 nToken );
84 :
85 : /** Translate effect strings to tokens. */
86 : static sal_Int32 getEffectToken( const OUString& sName );
87 : };
88 :
89 240932 : struct BlipFillProperties
90 : {
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 >
97 : moClipRect;
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.
105 : // effects
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
112 :
113 : ArtisticEffectProperties maEffect; /// Artistic effect, not supported by core.
114 :
115 : /** Overwrites all members that are explicitly set in rSourceProps. */
116 : void assignUsed( const BlipFillProperties& rSourceProps );
117 : };
118 :
119 196052 : struct OOX_DLLPUBLIC FillProperties
120 : {
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.
126 :
127 : /** Overwrites all members that are explicitly set in rSourceProps. */
128 : void assignUsed( const FillProperties& rSourceProps );
129 :
130 : /** Tries to resolve current settings to a solid color, e.g. returns the
131 : start color of a gradient. */
132 : Color getBestSolidColor() const;
133 :
134 : /** Writes the properties to the passed property map. */
135 : void pushToPropMap(
136 : ShapePropertyMap& rPropMap,
137 : const GraphicHelper& rGraphicHelper,
138 : sal_Int32 nShapeRotation = 0,
139 : sal_Int32 nPhClr = API_RGB_TRANSPARENT,
140 : bool bFlipH = false,
141 : bool bFlipV = false ) const;
142 : };
143 :
144 : } // namespace drawingml
145 : } // namespace oox
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|