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_SHAPE3DPROPERTIES_HXX
21 #define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
24 #include <com/sun/star/graphic/XGraphic.hpp>
25 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
26 #include "oox/core/xmlfilterbase.hxx"
27 #include "oox/drawingml/color.hxx"
28 #include "oox/helper/helper.hxx"
30 namespace oox
{ class PropertyMap
; }
31 namespace oox
{ class PropertySet
; }
32 namespace oox
{ namespace core
{ class ModelObjectContainer
; } }
37 // ============================================================================
39 struct Shape3DPropertyNames
43 OUString maFillTransparence
;
44 OUString maFillGradient
;
45 OUString maFillBitmap
;
46 OUString maFillBitmapMode
;
47 OUString maFillBitmapTile
;
48 OUString maFillBitmapStretch
;
49 OUString maFillBitmapLogicalSize
;
50 OUString maFillBitmapSizeX
;
51 OUString maFillBitmapSizeY
;
52 OUString maFillBitmapOffsetX
;
53 OUString maFillBitmapOffsetY
;
54 OUString maFillBitmapRectanglePoint
;
55 bool mbNamedFillGradient
;
56 bool mbNamedFillBitmap
;
57 bool mbTransformGraphic
;
59 Shape3DPropertyNames();
62 // ============================================================================
64 struct Shape3DProperties
66 typedef ::std::map
< double, Color
> GradientStopMap
;
68 OptValue
< sal_Int32
> moFillType
; /// Fill type (OOXML token).
69 OptValue
< bool > moRotateWithShape
; /// True = rotate gradient/bitmap with shape.
70 Color maFillColor
; /// Solid fill color and transparence.
71 GradientStopMap maGradientStops
; /// Gradient stops (colors/transparence).
72 OptValue
< sal_Int32
> moGradientPath
; /// If set, gradient follows rectangle, circle, or shape.
73 OptValue
< sal_Int32
> moShadeAngle
; /// Rotation angle of linear gradients.
74 OptValue
< bool > moShadeScaled
;
75 OptValue
< sal_Int32
> moFlipModeToken
;
76 OptValue
< com::sun::star::geometry::IntegerRectangle2D
> moFillToRect
;
77 OptValue
< com::sun::star::geometry::IntegerRectangle2D
> moTileRect
;
78 OptValue
< sal_Int32
> moPattPreset
; /// Preset pattern type.
79 Color maPattFgColor
; /// Pattern foreground color.
80 Color maPattBgColor
; /// Pattern background color.
81 ::com::sun::star::uno::Reference
< ::com::sun::star::graphic::XGraphic
> mxGraphic
;
82 Color maColorChangeFrom
; /// Start color of color transformation.
83 Color maColorChangeTo
; /// Destination color of color transformation.
84 OptValue
< sal_Int32
> moBitmapMode
; /// Bitmap tile or stretch.
85 OptValue
< sal_Int32
> moTileX
; /// Width of bitmap tiles.
86 OptValue
< sal_Int32
> moTileY
; /// Height of bitmap tiles.
87 OptValue
< sal_Int32
> moTileSX
;
88 OptValue
< sal_Int32
> moTileSY
;
89 OptValue
< sal_Int32
> moTileAlign
; /// Anchor point inside bitmap.
91 static Shape3DPropertyNames DEFAULTNAMES
; /// Default fill property names for shape fill.
92 static Shape3DPropertyNames DEFAULTPICNAMES
; /// Default fill property names for pictures.
94 /** Overwrites all members that are explicitly set in rSourceProps. */
95 void assignUsed( const Shape3DProperties
& rSourceProps
);
97 /** Tries to resolve current settings to a solid color, e.g. returns the
98 start color of a gradient. */
99 Color
getBestSolidColor() const;
101 /** Writes the properties to the passed property map. */
103 PropertyMap
& rPropMap
,
104 const Shape3DPropertyNames
& rPropNames
,
105 const ::oox::core::XmlFilterBase
& rFilter
,
106 ::oox::core::ModelObjectContainer
& rObjContainer
,
107 sal_Int32 nShapeRotation
, sal_Int32 nPhClr
) const;
109 /** Writes the properties to the passed property set. */
111 PropertySet
& rPropSet
,
112 const Shape3DPropertyNames
& rPropNames
,
113 const ::oox::core::XmlFilterBase
& rFilter
,
114 ::oox::core::ModelObjectContainer
& rObjContainer
,
115 sal_Int32 nShapeRotation
, sal_Int32 nPhClr
) const;
118 // ============================================================================
120 } // namespace drawingml
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */