Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / tools / FillProperties.cxx
blobd0c888d748f2bcf847207dd072dee15e7137de54
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 #include <FillProperties.hxx>
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <com/sun/star/drawing/BitmapMode.hpp>
23 #include <com/sun/star/drawing/FillStyle.hpp>
24 #include <com/sun/star/drawing/RectanglePoint.hpp>
26 using namespace ::com::sun::star;
28 using ::com::sun::star::beans::Property;
30 namespace chart
33 namespace
36 void lcl_AddPropertiesToVector_without_BitmapProperties( std::vector< css::beans::Property > & rOutProperties )
38 rOutProperties.emplace_back( "FillStyle",
39 FillProperties::PROP_FILL_STYLE,
40 cppu::UnoType<drawing::FillStyle>::get(),
41 beans::PropertyAttribute::BOUND
42 | beans::PropertyAttribute::MAYBEDEFAULT );
44 rOutProperties.emplace_back( "FillColor",
45 FillProperties::PROP_FILL_COLOR,
46 cppu::UnoType<sal_Int32>::get(),
47 beans::PropertyAttribute::BOUND
48 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
49 | beans::PropertyAttribute::MAYBEDEFAULT );
51 rOutProperties.emplace_back( "FillTransparence",
52 FillProperties::PROP_FILL_TRANSPARENCE,
53 cppu::UnoType<sal_Int16>::get(),
54 beans::PropertyAttribute::BOUND
55 | beans::PropertyAttribute::MAYBEDEFAULT );
57 rOutProperties.emplace_back( "FillTransparenceGradientName",
58 FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME,
59 cppu::UnoType<OUString>::get(),
60 beans::PropertyAttribute::BOUND
61 | beans::PropertyAttribute::MAYBEVOID
62 | beans::PropertyAttribute::MAYBEDEFAULT );
64 rOutProperties.emplace_back( "FillGradientName",
65 FillProperties::PROP_FILL_GRADIENT_NAME,
66 cppu::UnoType<OUString>::get(),
67 beans::PropertyAttribute::BOUND
68 | beans::PropertyAttribute::MAYBEVOID
69 | beans::PropertyAttribute::MAYBEDEFAULT );
71 rOutProperties.emplace_back( "FillGradientStepCount",
72 FillProperties::PROP_FILL_GRADIENT_STEPCOUNT,
73 cppu::UnoType<sal_Int16>::get(),
74 beans::PropertyAttribute::BOUND
75 | beans::PropertyAttribute::MAYBEVOID );
77 rOutProperties.emplace_back( "FillHatchName",
78 FillProperties::PROP_FILL_HATCH_NAME,
79 cppu::UnoType<OUString>::get(),
80 beans::PropertyAttribute::BOUND
81 | beans::PropertyAttribute::MAYBEVOID
82 | beans::PropertyAttribute::MAYBEDEFAULT );
84 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
86 rOutProperties.emplace_back( "FillBackground",
87 FillProperties::PROP_FILL_BACKGROUND,
88 cppu::UnoType<sal_Bool>::get(),
89 beans::PropertyAttribute::BOUND
90 | beans::PropertyAttribute::MAYBEDEFAULT );
93 void lcl_AddPropertiesToVector_only_BitmapProperties( std::vector< css::beans::Property > & rOutProperties )
95 rOutProperties.emplace_back( "FillBitmapName",
96 FillProperties::PROP_FILL_BITMAP_NAME,
97 cppu::UnoType<OUString>::get(),
98 beans::PropertyAttribute::BOUND
99 | beans::PropertyAttribute::MAYBEVOID
100 | beans::PropertyAttribute::MAYBEDEFAULT );
102 rOutProperties.emplace_back( "FillBitmapOffsetX",
103 FillProperties::PROP_FILL_BITMAP_OFFSETX,
104 cppu::UnoType<sal_Int16>::get(),
105 beans::PropertyAttribute::BOUND
106 | beans::PropertyAttribute::MAYBEDEFAULT );
108 rOutProperties.emplace_back( "FillBitmapOffsetY",
109 FillProperties::PROP_FILL_BITMAP_OFFSETY,
110 cppu::UnoType<sal_Int16>::get(),
111 beans::PropertyAttribute::BOUND
112 | beans::PropertyAttribute::MAYBEDEFAULT );
114 rOutProperties.emplace_back( "FillBitmapPositionOffsetX",
115 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
116 cppu::UnoType<sal_Int16>::get(),
117 beans::PropertyAttribute::BOUND
118 | beans::PropertyAttribute::MAYBEDEFAULT );
120 rOutProperties.emplace_back( "FillBitmapPositionOffsetY",
121 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
122 cppu::UnoType<sal_Int16>::get(),
123 beans::PropertyAttribute::BOUND
124 | beans::PropertyAttribute::MAYBEDEFAULT );
126 rOutProperties.emplace_back( "FillBitmapRectanglePoint",
127 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
128 cppu::UnoType<drawing::RectanglePoint>::get(),
129 beans::PropertyAttribute::BOUND
130 | beans::PropertyAttribute::MAYBEDEFAULT );
132 rOutProperties.emplace_back( "FillBitmapLogicalSize",
133 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
134 cppu::UnoType<sal_Bool>::get(),
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT );
138 rOutProperties.emplace_back( "FillBitmapSizeX",
139 FillProperties::PROP_FILL_BITMAP_SIZEX,
140 cppu::UnoType<sal_Int32>::get(),
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::MAYBEDEFAULT );
144 rOutProperties.emplace_back( "FillBitmapSizeY",
145 FillProperties::PROP_FILL_BITMAP_SIZEY,
146 cppu::UnoType<sal_Int32>::get(),
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::MAYBEDEFAULT );
150 rOutProperties.emplace_back( "FillBitmapMode",
151 FillProperties::PROP_FILL_BITMAP_MODE,
152 cppu::UnoType<drawing::BitmapMode>::get(),
153 beans::PropertyAttribute::BOUND
154 | beans::PropertyAttribute::MAYBEDEFAULT );
157 void lcl_AddDefaultsToMap_without_BitmapProperties(
158 ::chart::tPropertyValueMap & rOutMap )
160 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID );
161 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85
162 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 );
163 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false );
166 void lcl_AddDefaultsToMap_only_BitmapProperties(
167 ::chart::tPropertyValueMap & rOutMap )
169 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
170 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
171 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
172 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
174 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
175 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
176 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
177 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
178 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
181 }//end anonymous namespace
183 void FillProperties::AddPropertiesToVector(
184 std::vector< Property > & rOutProperties )
186 // Fill Properties see service drawing::FillProperties
187 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties );
188 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties );
191 void FillProperties::AddDefaultsToMap(
192 ::chart::tPropertyValueMap & rOutMap )
194 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap );
195 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap );
198 } // namespace chart
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */