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/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 0 : struct GradientFillProperties
42 : {
43 : typedef ::std::map< double, Color > GradientStopMap;
44 :
45 : GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
46 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
47 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect;
48 : OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
49 : OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
50 : OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
51 : OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
52 : OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
53 :
54 : /** Overwrites all members that are explicitly set in rSourceProps. */
55 : void assignUsed( const GradientFillProperties& rSourceProps );
56 : };
57 :
58 0 : struct PatternFillProperties
59 : {
60 : Color maPattFgColor; /// Pattern foreground color.
61 : Color maPattBgColor; /// Pattern background color.
62 : OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
63 :
64 : /** Overwrites all members that are explicitly set in rSourceProps. */
65 : void assignUsed( const PatternFillProperties& rSourceProps );
66 : };
67 :
68 0 : struct BlipFillProperties
69 : {
70 : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
71 : mxGraphic; /// The fill graphic.
72 : OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
73 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
74 : moFillRect; /// Stretch fill offsets.
75 : OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
76 : moClipRect;
77 : OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
78 : OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
79 : OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
80 : OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
81 : OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
82 : OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
83 : OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
84 : // effects
85 : OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
86 : OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
87 : OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
88 : Color maColorChangeFrom; /// Start color of color transformation.
89 : Color maColorChangeTo; /// Destination color of color transformation.
90 : Color maDuotoneColors[2]; /// Duotone Colors
91 :
92 : /** Overwrites all members that are explicitly set in rSourceProps. */
93 : void assignUsed( const BlipFillProperties& rSourceProps );
94 : };
95 :
96 0 : struct OOX_DLLPUBLIC FillProperties
97 : {
98 : OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
99 : Color maFillColor; /// Solid fill color and transparence.
100 : GradientFillProperties maGradientProps; /// Properties for gradient fills.
101 : PatternFillProperties maPatternProps; /// Properties for pattern fills.
102 : BlipFillProperties maBlipProps; /// Properties for bitmap fills.
103 :
104 : /** Overwrites all members that are explicitly set in rSourceProps. */
105 : void assignUsed( const FillProperties& rSourceProps );
106 :
107 : /** Tries to resolve current settings to a solid color, e.g. returns the
108 : start color of a gradient. */
109 : Color getBestSolidColor() const;
110 :
111 : /** Writes the properties to the passed property map. */
112 : void pushToPropMap(
113 : ShapePropertyMap& rPropMap,
114 : const GraphicHelper& rGraphicHelper,
115 : sal_Int32 nShapeRotation = 0,
116 : sal_Int32 nPhClr = API_RGB_TRANSPARENT,
117 : bool bFlipH = false,
118 : bool bFlipV = false ) const;
119 : };
120 :
121 0 : struct GraphicProperties
122 : {
123 : BlipFillProperties maBlipProps; /// Properties for the graphic.
124 : EmbeddedWAVAudioFile maAudio; /// Audio file details
125 :
126 : /** Overwrites all members that are explicitly set in rSourceProps. */
127 : void assignUsed( const GraphicProperties& rSourceProps );
128 :
129 : /** Writes the properties to the passed property map. */
130 : void pushToPropMap(
131 : PropertyMap& rPropMap,
132 : const GraphicHelper& rGraphicHelper,
133 : sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
134 : };
135 :
136 : } // namespace drawingml
137 : } // namespace oox
138 :
139 : #endif
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|