/src/libreoffice/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | #include "common.hxx" |
21 | | #include "exp_share.hxx" |
22 | | #include <misc.hxx> |
23 | | #include <xmlscript/xmlns.h> |
24 | | |
25 | | #include <com/sun/star/container/XNameContainer.hpp> |
26 | | #include <com/sun/star/util/XNumberFormatsSupplier.hpp> |
27 | | #include <com/sun/star/lang/XServiceInfo.hpp> |
28 | | #include <o3tl/any.hxx> |
29 | | #include <rtl/ref.hxx> |
30 | | |
31 | | using namespace ::com::sun::star; |
32 | | using namespace ::com::sun::star::uno; |
33 | | |
34 | | namespace xmlscript |
35 | | { |
36 | | |
37 | | static bool readBorderProps( |
38 | | ElementDescriptor * element, Style & style ) |
39 | 0 | { |
40 | 0 | if (element->readProp( &style._border, u"Border"_ustr )) { |
41 | 0 | if (style._border == BORDER_SIMPLE /* simple */) |
42 | 0 | { |
43 | 0 | if (element->readProp( &style._borderColor, u"BorderColor"_ustr )) |
44 | 0 | style._border = BORDER_SIMPLE_COLOR; |
45 | 0 | } |
46 | 0 | return true; |
47 | 0 | } |
48 | 0 | return false; |
49 | 0 | } |
50 | | |
51 | | static bool readFontProps( ElementDescriptor * element, Style & style ) |
52 | 0 | { |
53 | 0 | bool ret = element->readProp( |
54 | 0 | &style._descr, u"FontDescriptor"_ustr ); |
55 | 0 | ret |= element->readProp( |
56 | 0 | &style._fontEmphasisMark, u"FontEmphasisMark"_ustr ); |
57 | 0 | ret |= element->readProp( |
58 | 0 | &style._fontRelief, u"FontRelief"_ustr ); |
59 | 0 | return ret; |
60 | 0 | } |
61 | | |
62 | | void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) |
63 | 0 | { |
64 | | // collect styles |
65 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); |
66 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
67 | 0 | aStyle._set |= 0x1; |
68 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
69 | 0 | aStyle._set |= 0x2; |
70 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
71 | 0 | aStyle._set |= 0x20; |
72 | 0 | if (readFontProps( this, aStyle )) |
73 | 0 | aStyle._set |= 0x8; |
74 | 0 | if (aStyle._set) |
75 | 0 | { |
76 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr , all_styles->getStyleId( aStyle ) ); |
77 | 0 | } |
78 | | |
79 | | // collect elements |
80 | 0 | readDefaults(); |
81 | 0 | readLongAttr( u"MultiPageValue"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
82 | 0 | Any aDecorationAny( _xProps->getPropertyValue( u"Decoration"_ustr ) ); |
83 | 0 | bool bDecoration = true; |
84 | 0 | if ( (aDecorationAny >>= bDecoration) && !bDecoration ) |
85 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":withtabs"_ustr, u"false"_ustr ); |
86 | |
|
87 | 0 | readEvents(); |
88 | 0 | uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY ); |
89 | 0 | if ( xPagesContainer.is() && xPagesContainer->getElementNames().hasElements() ) |
90 | 0 | { |
91 | 0 | rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":bulletinboard"_ustr, _xDocument ); |
92 | 0 | pElem->readBullitinBoard( all_styles ); |
93 | 0 | addSubElement( pElem ); |
94 | 0 | } |
95 | 0 | } |
96 | | |
97 | | void ElementDescriptor::readFrameModel( StyleBag * all_styles ) |
98 | 0 | { |
99 | | // collect styles |
100 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); |
101 | |
|
102 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
103 | 0 | aStyle._set |= 0x2; |
104 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
105 | 0 | aStyle._set |= 0x20; |
106 | 0 | if (readFontProps( this, aStyle )) |
107 | 0 | aStyle._set |= 0x8; |
108 | 0 | if (aStyle._set) |
109 | 0 | { |
110 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
111 | 0 | } |
112 | | |
113 | | // collect elements |
114 | 0 | readDefaults(); |
115 | 0 | OUString aTitle; |
116 | |
|
117 | 0 | if ( readProp( u"Label"_ustr ) >>= aTitle) |
118 | 0 | { |
119 | 0 | rtl::Reference<ElementDescriptor> title = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":title"_ustr, _xDocument ); |
120 | 0 | title->addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value"_ustr, aTitle ); |
121 | 0 | addSubElement( title ); |
122 | 0 | } |
123 | 0 | uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); |
124 | 0 | if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() ) |
125 | 0 | { |
126 | 0 | rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":bulletinboard"_ustr, _xDocument ); |
127 | 0 | pElem->readBullitinBoard( all_styles ); |
128 | 0 | addSubElement( pElem ); |
129 | 0 | } |
130 | 0 | readEvents(); |
131 | 0 | } |
132 | | |
133 | | void ElementDescriptor::readPageModel( StyleBag * all_styles ) |
134 | 0 | { |
135 | | // collect styles |
136 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); |
137 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
138 | 0 | aStyle._set |= 0x1; |
139 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
140 | 0 | aStyle._set |= 0x2; |
141 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
142 | 0 | aStyle._set |= 0x20; |
143 | 0 | if (readFontProps( this, aStyle )) |
144 | 0 | aStyle._set |= 0x8; |
145 | 0 | if (aStyle._set) |
146 | 0 | { |
147 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
148 | 0 | } |
149 | | |
150 | | // collect elements |
151 | 0 | readDefaults(); |
152 | 0 | readStringAttr( u"Title"_ustr, u"" XMLNS_DIALOGS_PREFIX ":title"_ustr ); |
153 | 0 | uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); |
154 | 0 | if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() ) |
155 | 0 | { |
156 | 0 | rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":bulletinboard"_ustr, _xDocument ); |
157 | 0 | pElem->readBullitinBoard( all_styles ); |
158 | 0 | addSubElement( pElem ); |
159 | 0 | } |
160 | 0 | readEvents(); |
161 | 0 | } |
162 | | |
163 | | void ElementDescriptor::readButtonModel( StyleBag * all_styles ) |
164 | 0 | { |
165 | | // collect styles |
166 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); |
167 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
168 | 0 | aStyle._set |= 0x1; |
169 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
170 | 0 | aStyle._set |= 0x2; |
171 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
172 | 0 | aStyle._set |= 0x20; |
173 | 0 | if (readFontProps( this, aStyle )) |
174 | 0 | aStyle._set |= 0x8; |
175 | 0 | if (aStyle._set) |
176 | 0 | { |
177 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
178 | 0 | } |
179 | | |
180 | | // collect elements |
181 | 0 | readDefaults(); |
182 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
183 | 0 | readBoolAttr( u"DefaultButton"_ustr, u"" XMLNS_DIALOGS_PREFIX ":default"_ustr ); |
184 | 0 | readStringAttr( u"Label"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
185 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
186 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
187 | 0 | readButtonTypeAttr( u"PushButtonType"_ustr, u"" XMLNS_DIALOGS_PREFIX ":button-type"_ustr ); |
188 | 0 | readImageOrGraphicAttr(u"" XMLNS_DIALOGS_PREFIX ":image-src"_ustr); |
189 | 0 | readImagePositionAttr( u"ImagePosition"_ustr, u"" XMLNS_DIALOGS_PREFIX ":image-position"_ustr ); |
190 | 0 | readImageAlignAttr( u"ImageAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":image-align"_ustr ); |
191 | |
|
192 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
193 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
194 | |
|
195 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Toggle"_ustr ) )) |
196 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":toggled"_ustr, u"1"_ustr ); |
197 | |
|
198 | 0 | readBoolAttr( u"FocusOnClick"_ustr, u"" XMLNS_DIALOGS_PREFIX ":grab-focus"_ustr ); |
199 | 0 | readBoolAttr( u"MultiLine"_ustr,u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
200 | | |
201 | | // State |
202 | 0 | sal_Int16 nState = 0; |
203 | 0 | if (readProp( u"State"_ustr ) >>= nState) |
204 | 0 | { |
205 | 0 | switch (nState) |
206 | 0 | { |
207 | 0 | case 0: |
208 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"false"_ustr ); |
209 | 0 | break; |
210 | 0 | case 1: |
211 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"true"_ustr ); |
212 | 0 | break; |
213 | 0 | default: |
214 | 0 | OSL_FAIL( "### unexpected radio state!" ); |
215 | 0 | break; |
216 | 0 | } |
217 | 0 | } |
218 | | |
219 | 0 | readEvents(); |
220 | 0 | } |
221 | | |
222 | | void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) |
223 | 0 | { |
224 | | // collect styles |
225 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 ); |
226 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
227 | 0 | aStyle._set |= 0x1; |
228 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
229 | 0 | aStyle._set |= 0x2; |
230 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
231 | 0 | aStyle._set |= 0x20; |
232 | 0 | if (readFontProps( this, aStyle )) |
233 | 0 | aStyle._set |= 0x8; |
234 | 0 | if (readProp( u"VisualEffect"_ustr ) >>= aStyle._visualEffect) |
235 | 0 | aStyle._set |= 0x40; |
236 | 0 | if (aStyle._set) |
237 | 0 | { |
238 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
239 | 0 | } |
240 | | |
241 | | // collect elements |
242 | 0 | readDefaults(); |
243 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
244 | 0 | readStringAttr( u"Label"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
245 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
246 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
247 | 0 | readImageOrGraphicAttr(u"" XMLNS_DIALOGS_PREFIX ":image-src"_ustr); |
248 | 0 | readImagePositionAttr( u"ImagePosition"_ustr, u"" XMLNS_DIALOGS_PREFIX ":image-position"_ustr ); |
249 | 0 | readBoolAttr( u"MultiLine"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
250 | |
|
251 | 0 | bool bTriState = false; |
252 | 0 | if ((readProp( u"TriState"_ustr ) >>= bTriState) && bTriState) |
253 | 0 | { |
254 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":tristate"_ustr, u"true"_ustr ); |
255 | 0 | } |
256 | 0 | sal_Int16 nState = 0; |
257 | 0 | if (_xProps->getPropertyValue( u"State"_ustr ) >>= nState) |
258 | 0 | { |
259 | 0 | switch (nState) |
260 | 0 | { |
261 | 0 | case 0: |
262 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"false"_ustr ); |
263 | 0 | break; |
264 | 0 | case 1: |
265 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"true"_ustr ); |
266 | 0 | break; |
267 | 0 | case 2: // tristate=true exported, checked omitted => don't know! |
268 | 0 | OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" ); |
269 | 0 | break; |
270 | 0 | default: |
271 | 0 | OSL_FAIL( "### unexpected checkbox state!" ); |
272 | 0 | break; |
273 | 0 | } |
274 | 0 | } |
275 | 0 | readEvents(); |
276 | 0 | } |
277 | | |
278 | | void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) |
279 | 0 | { |
280 | | // collect styles |
281 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
282 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
283 | 0 | aStyle._set |= 0x1; |
284 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
285 | 0 | aStyle._set |= 0x2; |
286 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
287 | 0 | aStyle._set |= 0x20; |
288 | 0 | if (readBorderProps( this, aStyle )) |
289 | 0 | aStyle._set |= 0x4; |
290 | 0 | if (readFontProps( this, aStyle )) |
291 | 0 | aStyle._set |= 0x8; |
292 | 0 | if (aStyle._set) |
293 | 0 | { |
294 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
295 | 0 | } |
296 | | |
297 | | // collect elements |
298 | 0 | readDefaults(); |
299 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
300 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
301 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
302 | 0 | readBoolAttr( u"Autocomplete"_ustr, u"" XMLNS_DIALOGS_PREFIX ":autocomplete"_ustr ); |
303 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
304 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
305 | 0 | readBoolAttr( u"Dropdown"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
306 | 0 | readShortAttr( u"MaxTextLen"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxlength"_ustr ); |
307 | 0 | readShortAttr( u"LineCount"_ustr, u"" XMLNS_DIALOGS_PREFIX ":linecount"_ustr ); |
308 | | // Cell Range, Ref Cell etc. |
309 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
310 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":source-cell-range"_ustr ); |
311 | | |
312 | | // string item list |
313 | 0 | Sequence< OUString > itemValues; |
314 | 0 | if ((readProp( u"StringItemList"_ustr ) >>= itemValues) && itemValues.hasElements()) |
315 | 0 | { |
316 | 0 | rtl::Reference<ElementDescriptor> popup = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":menupopup"_ustr, _xDocument ); |
317 | |
|
318 | 0 | for (const auto& rItemValue : itemValues) |
319 | 0 | { |
320 | 0 | rtl::Reference<ElementDescriptor> item = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":menuitem"_ustr, _xDocument ); |
321 | 0 | item->addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value"_ustr, rItemValue ); |
322 | 0 | popup->addSubElement( item ); |
323 | 0 | } |
324 | |
|
325 | 0 | addSubElement( popup ); |
326 | 0 | } |
327 | 0 | readEvents(); |
328 | 0 | } |
329 | | |
330 | | void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) |
331 | 0 | { |
332 | | // collect styles |
333 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
334 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
335 | 0 | aStyle._set |= 0x1; |
336 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
337 | 0 | aStyle._set |= 0x2; |
338 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
339 | 0 | aStyle._set |= 0x20; |
340 | 0 | if (readBorderProps( this, aStyle )) |
341 | 0 | aStyle._set |= 0x4; |
342 | 0 | if (readFontProps( this, aStyle )) |
343 | 0 | aStyle._set |= 0x8; |
344 | 0 | if (aStyle._set) |
345 | 0 | { |
346 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
347 | 0 | } |
348 | | |
349 | | // collect elements |
350 | 0 | readDefaults(); |
351 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
352 | 0 | readBoolAttr( u"MultiSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiselection"_ustr ); |
353 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
354 | 0 | readBoolAttr( u"Dropdown"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
355 | 0 | readShortAttr( u"LineCount"_ustr, u"" XMLNS_DIALOGS_PREFIX ":linecount"_ustr ); |
356 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
357 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
358 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":source-cell-range"_ustr ); |
359 | | // string item list |
360 | 0 | Sequence< OUString > itemValues; |
361 | 0 | if ((readProp( u"StringItemList"_ustr ) >>= itemValues) && itemValues.hasElements()) |
362 | 0 | { |
363 | 0 | rtl::Reference<ElementDescriptor> popup = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":menupopup"_ustr, _xDocument ); |
364 | |
|
365 | 0 | for (const auto& rItemValue : itemValues) |
366 | 0 | { |
367 | 0 | rtl::Reference<ElementDescriptor> item = new ElementDescriptor(_xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":menuitem"_ustr, _xDocument ); |
368 | 0 | item->addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value"_ustr, rItemValue ); |
369 | 0 | popup->addSubElement( item ); |
370 | 0 | } |
371 | |
|
372 | 0 | Sequence< sal_Int16 > selected; |
373 | 0 | if (readProp( u"SelectedItems"_ustr ) >>= selected) |
374 | 0 | { |
375 | 0 | sal_Int16 const * pSelected = selected.getConstArray(); |
376 | 0 | for ( sal_Int32 nPos = selected.getLength(); nPos--; ) |
377 | 0 | { |
378 | 0 | ElementDescriptor * item = static_cast< ElementDescriptor * >( |
379 | 0 | popup->getSubElement( pSelected[ nPos ] ).get() ); |
380 | 0 | item->addAttribute( u"" XMLNS_DIALOGS_PREFIX ":selected"_ustr, u"true"_ustr ); |
381 | 0 | } |
382 | 0 | } |
383 | |
|
384 | 0 | addSubElement( popup ); |
385 | 0 | } |
386 | 0 | readEvents(); |
387 | 0 | } |
388 | | |
389 | | void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) |
390 | 0 | { |
391 | | // collect styles |
392 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 ); |
393 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
394 | 0 | aStyle._set |= 0x1; |
395 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
396 | 0 | aStyle._set |= 0x2; |
397 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
398 | 0 | aStyle._set |= 0x20; |
399 | 0 | if (readFontProps( this, aStyle )) |
400 | 0 | aStyle._set |= 0x8; |
401 | 0 | if (readProp( u"VisualEffect"_ustr ) >>= aStyle._visualEffect) |
402 | 0 | aStyle._set |= 0x40; |
403 | 0 | if (aStyle._set) |
404 | 0 | { |
405 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr , all_styles->getStyleId( aStyle ) ); |
406 | 0 | } |
407 | | |
408 | | // collect elements |
409 | 0 | readDefaults(); |
410 | 0 | readBoolAttr(u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
411 | 0 | readStringAttr( u"Label"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
412 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
413 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
414 | 0 | readImageOrGraphicAttr(u"" XMLNS_DIALOGS_PREFIX ":image-src"_ustr); |
415 | 0 | readImagePositionAttr( u"ImagePosition"_ustr, u"" XMLNS_DIALOGS_PREFIX ":image-position"_ustr ); |
416 | 0 | readBoolAttr( u"MultiLine"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
417 | 0 | readStringAttr( u"GroupName"_ustr, u"" XMLNS_DIALOGS_PREFIX ":group-name"_ustr ); |
418 | |
|
419 | 0 | sal_Int16 nState = 0; |
420 | 0 | if (readProp( u"State"_ustr ) >>= nState) |
421 | 0 | { |
422 | 0 | switch (nState) |
423 | 0 | { |
424 | 0 | case 0: |
425 | 0 | addAttribute(u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"false"_ustr ); |
426 | 0 | break; |
427 | 0 | case 1: |
428 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":checked"_ustr, u"true"_ustr ); |
429 | 0 | break; |
430 | 0 | default: |
431 | 0 | OSL_FAIL( "### unexpected radio state!" ); |
432 | 0 | break; |
433 | 0 | } |
434 | 0 | } |
435 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
436 | 0 | readEvents(); |
437 | 0 | } |
438 | | |
439 | | void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) |
440 | 0 | { |
441 | | // collect styles |
442 | 0 | Style aStyle( 0x2 | 0x8 | 0x20 ); |
443 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
444 | 0 | aStyle._set |= 0x2; |
445 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
446 | 0 | aStyle._set |= 0x20; |
447 | 0 | if (readFontProps( this, aStyle )) |
448 | 0 | aStyle._set |= 0x8; |
449 | 0 | if (aStyle._set) |
450 | 0 | { |
451 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
452 | 0 | } |
453 | | |
454 | | // collect elements |
455 | 0 | readDefaults(); |
456 | |
|
457 | 0 | OUString aTitle; |
458 | 0 | if (readProp( u"Label"_ustr ) >>= aTitle) |
459 | 0 | { |
460 | 0 | rtl::Reference<ElementDescriptor> title = new ElementDescriptor( _xProps, _xPropState, u"" XMLNS_DIALOGS_PREFIX ":title"_ustr, _xDocument ); |
461 | 0 | title->addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value"_ustr, aTitle ); |
462 | 0 | addSubElement( title ); |
463 | 0 | } |
464 | |
|
465 | 0 | readEvents(); |
466 | 0 | } |
467 | | |
468 | | void ElementDescriptor::readFixedTextModel( StyleBag * all_styles ) |
469 | 0 | { |
470 | | // collect styles |
471 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
472 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
473 | 0 | aStyle._set |= 0x1; |
474 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
475 | 0 | aStyle._set |= 0x2; |
476 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
477 | 0 | aStyle._set |= 0x20; |
478 | 0 | if (readBorderProps( this, aStyle )) |
479 | 0 | aStyle._set |= 0x4; |
480 | 0 | if (readFontProps( this, aStyle )) |
481 | 0 | aStyle._set |= 0x8; |
482 | 0 | if (aStyle._set) |
483 | 0 | { |
484 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
485 | 0 | } |
486 | | |
487 | | // collect elements |
488 | 0 | readDefaults(); |
489 | 0 | readStringAttr( u"Label"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
490 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
491 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
492 | 0 | readBoolAttr( u"MultiLine"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
493 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
494 | 0 | readBoolAttr( u"NoLabel"_ustr, u"" XMLNS_DIALOGS_PREFIX ":nolabel"_ustr ); |
495 | 0 | readEvents(); |
496 | 0 | } |
497 | | |
498 | | void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles ) |
499 | 0 | { |
500 | | // collect styles |
501 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
502 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
503 | 0 | aStyle._set |= 0x1; |
504 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
505 | 0 | aStyle._set |= 0x2; |
506 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
507 | 0 | aStyle._set |= 0x20; |
508 | 0 | if (readBorderProps( this, aStyle )) |
509 | 0 | aStyle._set |= 0x4; |
510 | 0 | if (readFontProps( this, aStyle )) |
511 | 0 | aStyle._set |= 0x8; |
512 | 0 | if (aStyle._set) |
513 | 0 | { |
514 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
515 | 0 | } |
516 | | |
517 | | // collect elements |
518 | 0 | readDefaults(); |
519 | 0 | readStringAttr( u"Label"_ustr,u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
520 | 0 | readStringAttr( u"URL"_ustr, u"" XMLNS_DIALOGS_PREFIX ":url"_ustr ); |
521 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
522 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
523 | 0 | readBoolAttr( u"MultiLine"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
524 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
525 | 0 | readBoolAttr( u"NoLabel"_ustr, u"" XMLNS_DIALOGS_PREFIX ":nolabel"_ustr ); |
526 | 0 | readEvents(); |
527 | 0 | } |
528 | | |
529 | | void ElementDescriptor::readEditModel( StyleBag * all_styles ) |
530 | 0 | { |
531 | | // collect styles |
532 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
533 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
534 | 0 | aStyle._set |= 0x1; |
535 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
536 | 0 | aStyle._set |= 0x2; |
537 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
538 | 0 | aStyle._set |= 0x20; |
539 | 0 | if (readBorderProps( this, aStyle )) |
540 | 0 | aStyle._set |= 0x4; |
541 | 0 | if (readFontProps( this, aStyle )) |
542 | 0 | aStyle._set |= 0x8; |
543 | 0 | if (aStyle._set) |
544 | 0 | { |
545 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
546 | 0 | } |
547 | | |
548 | | // collect elements |
549 | 0 | readDefaults(); |
550 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
551 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
552 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
553 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
554 | 0 | readBoolAttr( u"HardLineBreaks"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hard-linebreaks"_ustr ); |
555 | 0 | readBoolAttr( u"HScroll"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hscroll"_ustr ); |
556 | 0 | readBoolAttr( u"VScroll"_ustr, u"" XMLNS_DIALOGS_PREFIX ":vscroll"_ustr ); |
557 | 0 | readShortAttr( u"MaxTextLen"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxlength"_ustr ); |
558 | 0 | readBoolAttr( u"MultiLine"_ustr, u"" XMLNS_DIALOGS_PREFIX ":multiline"_ustr ); |
559 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
560 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
561 | 0 | readLineEndFormatAttr( u"LineEndFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":lineend-format"_ustr ); |
562 | 0 | sal_Int16 nEcho = 0; |
563 | 0 | if (readProp( u"EchoChar"_ustr ) >>= nEcho) |
564 | 0 | { |
565 | 0 | sal_Unicode cEcho = static_cast<sal_Unicode>(nEcho); |
566 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":echochar"_ustr, OUString( &cEcho, 1 ) ); |
567 | 0 | } |
568 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
569 | 0 | readEvents(); |
570 | 0 | } |
571 | | |
572 | | void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) |
573 | 0 | { |
574 | | // collect styles |
575 | 0 | Style aStyle( 0x1 | 0x4 ); |
576 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
577 | 0 | aStyle._set |= 0x1; |
578 | 0 | if (readBorderProps( this, aStyle )) |
579 | 0 | aStyle._set |= 0x4; |
580 | 0 | if (aStyle._set) |
581 | 0 | { |
582 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
583 | 0 | } |
584 | | |
585 | | // collect elements |
586 | 0 | readDefaults(); |
587 | 0 | readBoolAttr( u"ScaleImage"_ustr, u"" XMLNS_DIALOGS_PREFIX ":scale-image"_ustr ); |
588 | 0 | readImageScaleModeAttr( u"ScaleMode"_ustr, u"" XMLNS_DIALOGS_PREFIX ":scale-mode"_ustr ); |
589 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
590 | 0 | readImageOrGraphicAttr(u"" XMLNS_DIALOGS_PREFIX ":src"_ustr); |
591 | 0 | readEvents(); |
592 | 0 | } |
593 | | |
594 | | void ElementDescriptor::readFileControlModel( StyleBag * all_styles ) |
595 | 0 | { |
596 | | // collect styles |
597 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
598 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
599 | 0 | aStyle._set |= 0x1; |
600 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
601 | 0 | aStyle._set |= 0x2; |
602 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
603 | 0 | aStyle._set |= 0x20; |
604 | 0 | if (readBorderProps( this, aStyle )) |
605 | 0 | aStyle._set |= 0x4; |
606 | 0 | if (readFontProps( this, aStyle )) |
607 | 0 | aStyle._set |= 0x8; |
608 | 0 | if (aStyle._set) |
609 | 0 | { |
610 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
611 | 0 | } |
612 | | |
613 | | // collect elements |
614 | 0 | readDefaults(); |
615 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
616 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
617 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
618 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
619 | 0 | readEvents(); |
620 | 0 | } |
621 | | |
622 | | void ElementDescriptor::readTreeControlModel( StyleBag * all_styles ) |
623 | 0 | { |
624 | | // collect styles |
625 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
626 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
627 | 0 | aStyle._set |= 0x1; |
628 | 0 | if (readBorderProps( this, aStyle )) |
629 | 0 | aStyle._set |= 0x4; |
630 | 0 | if (aStyle._set) |
631 | 0 | { |
632 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
633 | 0 | } |
634 | | |
635 | | // collect elements |
636 | 0 | readDefaults(); |
637 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
638 | 0 | readSelectionTypeAttr( u"SelectionType"_ustr, u"" XMLNS_DIALOGS_PREFIX ":selectiontype"_ustr ); |
639 | |
|
640 | 0 | readBoolAttr( u"RootDisplayed"_ustr, u"" XMLNS_DIALOGS_PREFIX ":rootdisplayed"_ustr ); |
641 | 0 | readBoolAttr( u"ShowsHandles"_ustr, u"" XMLNS_DIALOGS_PREFIX ":showshandles"_ustr ); |
642 | 0 | readBoolAttr( u"ShowsRootHandles"_ustr, u"" XMLNS_DIALOGS_PREFIX ":showsroothandles"_ustr ); |
643 | 0 | readBoolAttr( u"Editable"_ustr, u"" XMLNS_DIALOGS_PREFIX ":editable"_ustr ); |
644 | 0 | readBoolAttr( u"InvokesStopNodeEditing"_ustr, u"" XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting"_ustr ); |
645 | 0 | readLongAttr( u"RowHeight"_ustr, u"" XMLNS_DIALOGS_PREFIX ":rowheight"_ustr ); |
646 | 0 | readEvents(); |
647 | 0 | } |
648 | | |
649 | | void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles ) |
650 | 0 | { |
651 | | // collect styles |
652 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
653 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
654 | 0 | aStyle._set |= 0x1; |
655 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
656 | 0 | aStyle._set |= 0x2; |
657 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
658 | 0 | aStyle._set |= 0x20; |
659 | 0 | if (readBorderProps( this, aStyle )) |
660 | 0 | aStyle._set |= 0x4; |
661 | 0 | if (readFontProps( this, aStyle )) |
662 | 0 | aStyle._set |= 0x8; |
663 | 0 | if (aStyle._set) |
664 | 0 | { |
665 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
666 | 0 | } |
667 | | |
668 | | // collect elements |
669 | 0 | readDefaults(); |
670 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
671 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
672 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
673 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
674 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
675 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
676 | 0 | readStringAttr( u"CurrencySymbol"_ustr, u"" XMLNS_DIALOGS_PREFIX ":currency-symbol"_ustr ); |
677 | 0 | readShortAttr( u"DecimalAccuracy"_ustr, u"" XMLNS_DIALOGS_PREFIX ":decimal-accuracy"_ustr ); |
678 | 0 | readBoolAttr( u"ShowThousandsSeparator"_ustr, u"" XMLNS_DIALOGS_PREFIX ":thousands-separator"_ustr ); |
679 | 0 | readDoubleAttr( u"Value"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
680 | 0 | readDoubleAttr( u"ValueMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
681 | 0 | readDoubleAttr( u"ValueMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
682 | 0 | readDoubleAttr( u"ValueStep"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-step"_ustr ); |
683 | 0 | readBoolAttr( u"Spin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
684 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
685 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
686 | 0 | readBoolAttr(u"PrependCurrencySymbol"_ustr, u"" XMLNS_DIALOGS_PREFIX ":prepend-symbol"_ustr ); |
687 | 0 | readBoolAttr( u"EnforceFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":enforce-format"_ustr ); |
688 | 0 | readEvents(); |
689 | 0 | } |
690 | | |
691 | | void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) |
692 | 0 | { |
693 | | // collect styles |
694 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
695 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
696 | 0 | aStyle._set |= 0x1; |
697 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
698 | 0 | aStyle._set |= 0x2; |
699 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
700 | 0 | aStyle._set |= 0x20; |
701 | 0 | if (readBorderProps( this, aStyle )) |
702 | 0 | aStyle._set |= 0x4; |
703 | 0 | if (readFontProps( this, aStyle )) |
704 | 0 | aStyle._set |= 0x8; |
705 | 0 | if (aStyle._set) |
706 | 0 | { |
707 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
708 | 0 | } |
709 | | |
710 | | // collect elements |
711 | 0 | readDefaults(); |
712 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
713 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
714 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
715 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
716 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
717 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
718 | 0 | readDateFormatAttr( u"DateFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":date-format"_ustr ); |
719 | 0 | readBoolAttr( u"DateShowCentury"_ustr, u"" XMLNS_DIALOGS_PREFIX ":show-century"_ustr ); |
720 | 0 | readDateAttr( u"Date"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
721 | 0 | readDateAttr( u"DateMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
722 | 0 | readDateAttr( u"DateMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
723 | 0 | readBoolAttr( u"Spin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
724 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
725 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
726 | 0 | readBoolAttr( u"Dropdown"_ustr, u"" XMLNS_DIALOGS_PREFIX ":dropdown"_ustr ); |
727 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":text"_ustr ); |
728 | 0 | readBoolAttr( u"EnforceFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":enforce-format"_ustr ); |
729 | 0 | readEvents(); |
730 | 0 | } |
731 | | |
732 | | void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles ) |
733 | 0 | { |
734 | | // collect styles |
735 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
736 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
737 | 0 | aStyle._set |= 0x1; |
738 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
739 | 0 | aStyle._set |= 0x2; |
740 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
741 | 0 | aStyle._set |= 0x20; |
742 | 0 | if (readBorderProps( this, aStyle )) |
743 | 0 | aStyle._set |= 0x4; |
744 | 0 | if (readFontProps( this, aStyle )) |
745 | 0 | aStyle._set |= 0x8; |
746 | 0 | if (aStyle._set) |
747 | 0 | { |
748 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
749 | 0 | } |
750 | | |
751 | | // collect elements |
752 | 0 | readDefaults(); |
753 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
754 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr ); |
755 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
756 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
757 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
758 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
759 | 0 | readShortAttr( u"DecimalAccuracy"_ustr, u"" XMLNS_DIALOGS_PREFIX ":decimal-accuracy"_ustr ); |
760 | 0 | readBoolAttr( u"ShowThousandsSeparator"_ustr, u"" XMLNS_DIALOGS_PREFIX ":thousands-separator"_ustr ); |
761 | 0 | readDoubleAttr( u"Value"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
762 | 0 | readDoubleAttr( u"ValueMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
763 | 0 | readDoubleAttr( u"ValueMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
764 | 0 | readDoubleAttr( u"ValueStep"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-step"_ustr ); |
765 | 0 | readBoolAttr( u"Spin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
766 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
767 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
768 | 0 | readBoolAttr( u"EnforceFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":enforce-format"_ustr ); |
769 | 0 | readEvents(); |
770 | 0 | } |
771 | | |
772 | | void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles ) |
773 | 0 | { |
774 | | // collect styles |
775 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
776 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
777 | 0 | aStyle._set |= 0x1; |
778 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
779 | 0 | aStyle._set |= 0x2; |
780 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
781 | 0 | aStyle._set |= 0x20; |
782 | 0 | if (readBorderProps( this, aStyle )) |
783 | 0 | aStyle._set |= 0x4; |
784 | 0 | if (readFontProps( this, aStyle )) |
785 | 0 | aStyle._set |= 0x8; |
786 | 0 | if (aStyle._set) |
787 | 0 | { |
788 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
789 | 0 | } |
790 | | |
791 | | // collect elements |
792 | 0 | readDefaults(); |
793 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr); |
794 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
795 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
796 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
797 | 0 | readTimeFormatAttr( u"TimeFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":time-format"_ustr ); |
798 | 0 | readTimeAttr( u"Time"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
799 | 0 | readTimeAttr( u"TimeMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
800 | 0 | readTimeAttr( u"TimeMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
801 | 0 | readBoolAttr( u"Spin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
802 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
803 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
804 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":text"_ustr ); |
805 | 0 | readBoolAttr( u"EnforceFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":enforce-format"_ustr ); |
806 | 0 | readEvents(); |
807 | 0 | } |
808 | | |
809 | | void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) |
810 | 0 | { |
811 | | // collect styles |
812 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
813 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
814 | 0 | aStyle._set |= 0x1; |
815 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
816 | 0 | aStyle._set |= 0x2; |
817 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
818 | 0 | aStyle._set |= 0x20; |
819 | 0 | if (readBorderProps( this, aStyle )) |
820 | 0 | aStyle._set |= 0x4; |
821 | 0 | if (readFontProps( this, aStyle )) |
822 | 0 | aStyle._set |= 0x8; |
823 | 0 | if (aStyle._set) |
824 | 0 | { |
825 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
826 | 0 | } |
827 | | |
828 | | // collect elements |
829 | 0 | readDefaults(); |
830 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
831 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
832 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr, u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
833 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
834 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
835 | 0 | readShortAttr( u"MaxTextLen"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxlength"_ustr ); |
836 | 0 | readStringAttr( u"EditMask"_ustr, u"" XMLNS_DIALOGS_PREFIX ":edit-mask"_ustr ); |
837 | 0 | readStringAttr( u"LiteralMask"_ustr, u"" XMLNS_DIALOGS_PREFIX ":literal-mask"_ustr ); |
838 | 0 | readEvents(); |
839 | 0 | } |
840 | | |
841 | | void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) |
842 | 0 | { |
843 | | // collect styles |
844 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
845 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
846 | 0 | aStyle._set |= 0x1; |
847 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
848 | 0 | aStyle._set |= 0x2; |
849 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
850 | 0 | aStyle._set |= 0x20; |
851 | 0 | if (readBorderProps( this, aStyle )) |
852 | 0 | aStyle._set |= 0x4; |
853 | 0 | if (readFontProps( this, aStyle )) |
854 | 0 | aStyle._set |= 0x8; |
855 | 0 | if (aStyle._set) |
856 | 0 | { |
857 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
858 | 0 | } |
859 | | |
860 | | // collect elements |
861 | 0 | readDefaults(); |
862 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
863 | 0 | readBoolAttr( u"ReadOnly"_ustr, u"" XMLNS_DIALOGS_PREFIX ":readonly"_ustr ); |
864 | 0 | readBoolAttr( u"HideInactiveSelection"_ustr,u"" XMLNS_DIALOGS_PREFIX ":hide-inactive-selection"_ustr ); |
865 | 0 | readBoolAttr( u"StrictFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":strict-format"_ustr ); |
866 | 0 | readStringAttr( u"Text"_ustr, u"" XMLNS_DIALOGS_PREFIX ":text"_ustr ); |
867 | 0 | readAlignAttr( u"Align"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
868 | 0 | readShortAttr( u"MaxTextLen"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxlength"_ustr ); |
869 | 0 | readBoolAttr( u"Spin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":spin"_ustr ); |
870 | 0 | if (extract_throw<bool>( _xProps->getPropertyValue( u"Repeat"_ustr ) )) |
871 | 0 | readLongAttr( u"RepeatDelay"_ustr,u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr, true /* force */ ); |
872 | |
|
873 | 0 | Any a( readProp( u"EffectiveDefault"_ustr ) ); |
874 | 0 | switch (a.getValueTypeClass()) |
875 | 0 | { |
876 | 0 | case TypeClass_DOUBLE: |
877 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value-default"_ustr, OUString::number( *o3tl::forceAccess<double>(a) ) ); |
878 | 0 | break; |
879 | 0 | case TypeClass_STRING: |
880 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":value-default"_ustr, *o3tl::forceAccess<OUString>(a) ); |
881 | 0 | break; |
882 | 0 | default: |
883 | 0 | break; |
884 | 0 | } |
885 | 0 | readDoubleAttr( u"EffectiveMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
886 | 0 | readDoubleAttr( u"EffectiveMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
887 | 0 | readDoubleAttr( u"EffectiveValue"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
888 | | |
889 | | // format spec |
890 | 0 | sal_Int32 nKey = 0; |
891 | 0 | if (readProp( u"FormatKey"_ustr ) >>= nKey) |
892 | 0 | { |
893 | 0 | Reference< util::XNumberFormatsSupplier > xSupplier; |
894 | 0 | if (readProp( u"FormatsSupplier"_ustr ) >>= xSupplier) |
895 | 0 | { |
896 | 0 | addNumberFormatAttr( |
897 | 0 | xSupplier->getNumberFormats()->getByKey( nKey ) ); |
898 | 0 | } |
899 | 0 | } |
900 | 0 | readBoolAttr( u"TreatAsNumber"_ustr, u"" XMLNS_DIALOGS_PREFIX ":treat-as-number"_ustr ); |
901 | 0 | readBoolAttr( u"EnforceFormat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":enforce-format"_ustr ); |
902 | |
|
903 | 0 | readEvents(); |
904 | 0 | } |
905 | | |
906 | | void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles ) |
907 | 0 | { |
908 | | // collect styles |
909 | 0 | Style aStyle( 0x1 | 0x4 ); |
910 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
911 | 0 | aStyle._set |= 0x1; |
912 | 0 | if (readBorderProps( this, aStyle )) |
913 | 0 | aStyle._set |= 0x4; |
914 | 0 | if (aStyle._set) |
915 | 0 | { |
916 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
917 | 0 | } |
918 | | |
919 | | // collect elements |
920 | 0 | readDefaults(); |
921 | 0 | readOrientationAttr( u"Orientation"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
922 | 0 | readLongAttr( u"SpinIncrement"_ustr, u"" XMLNS_DIALOGS_PREFIX ":increment"_ustr ); |
923 | 0 | readLongAttr( u"SpinValue"_ustr, u"" XMLNS_DIALOGS_PREFIX ":curval"_ustr ); |
924 | 0 | readLongAttr( u"SpinValueMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxval"_ustr ); |
925 | 0 | readLongAttr( u"SpinValueMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":minval"_ustr ); |
926 | 0 | readLongAttr( u"Repeat"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr ); |
927 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat-delay"_ustr ); |
928 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
929 | 0 | readHexLongAttr( u"SymbolColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":symbol-color"_ustr ); |
930 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
931 | 0 | readEvents(); |
932 | 0 | } |
933 | | |
934 | | void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) |
935 | 0 | { |
936 | | // collect styles |
937 | 0 | Style aStyle( 0x2 | 0x8 | 0x20 ); |
938 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
939 | 0 | aStyle._set |= 0x2; |
940 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
941 | 0 | aStyle._set |= 0x20; |
942 | 0 | if (readFontProps( this, aStyle )) |
943 | 0 | aStyle._set |= 0x8; |
944 | 0 | if (aStyle._set) |
945 | 0 | { |
946 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
947 | 0 | } |
948 | | |
949 | | // collect elements |
950 | 0 | readDefaults(); |
951 | 0 | readStringAttr( u"Label"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
952 | 0 | readOrientationAttr( u"Orientation"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
953 | 0 | readEvents(); |
954 | 0 | } |
955 | | |
956 | | void ElementDescriptor::readProgressBarModel( StyleBag * all_styles ) |
957 | 0 | { |
958 | | // collect styles |
959 | 0 | Style aStyle( 0x1 | 0x4 | 0x10 ); |
960 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
961 | 0 | aStyle._set |= 0x1; |
962 | 0 | if (readBorderProps( this, aStyle )) |
963 | 0 | aStyle._set |= 0x4; |
964 | 0 | if (readProp( u"FillColor"_ustr ) >>= aStyle._descr) |
965 | 0 | aStyle._set |= 0x10; |
966 | 0 | if (aStyle._set) |
967 | 0 | { |
968 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
969 | 0 | } |
970 | | |
971 | | // collect elements |
972 | 0 | readDefaults(); |
973 | 0 | readLongAttr( u"ProgressValue"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value"_ustr ); |
974 | 0 | readLongAttr( u"ProgressValueMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-min"_ustr ); |
975 | 0 | readLongAttr( u"ProgressValueMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":value-max"_ustr ); |
976 | 0 | readEvents(); |
977 | 0 | } |
978 | | |
979 | | void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) |
980 | 0 | { |
981 | | // collect styles |
982 | 0 | Style aStyle( 0x1 | 0x4 ); |
983 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
984 | 0 | aStyle._set |= 0x1; |
985 | 0 | if (readBorderProps( this, aStyle )) |
986 | 0 | aStyle._set |= 0x4; |
987 | 0 | if (aStyle._set) |
988 | 0 | { |
989 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
990 | 0 | } |
991 | | |
992 | | // collect elements |
993 | 0 | readDefaults(); |
994 | 0 | readOrientationAttr( u"Orientation"_ustr, u"" XMLNS_DIALOGS_PREFIX ":align"_ustr ); |
995 | 0 | readLongAttr( u"BlockIncrement"_ustr, u"" XMLNS_DIALOGS_PREFIX ":pageincrement"_ustr ); |
996 | 0 | readLongAttr( u"LineIncrement"_ustr, u"" XMLNS_DIALOGS_PREFIX ":increment"_ustr ); |
997 | 0 | readLongAttr( u"ScrollValue"_ustr, u"" XMLNS_DIALOGS_PREFIX ":curpos"_ustr ); |
998 | 0 | readLongAttr( u"ScrollValueMax"_ustr, u"" XMLNS_DIALOGS_PREFIX ":maxpos"_ustr ); |
999 | 0 | readLongAttr( u"ScrollValueMin"_ustr, u"" XMLNS_DIALOGS_PREFIX ":minpos"_ustr ); |
1000 | 0 | readLongAttr( u"VisibleSize"_ustr, u"" XMLNS_DIALOGS_PREFIX ":visible-size"_ustr ); |
1001 | 0 | readLongAttr( u"RepeatDelay"_ustr, u"" XMLNS_DIALOGS_PREFIX ":repeat"_ustr ); |
1002 | 0 | readBoolAttr( u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr ); |
1003 | 0 | readBoolAttr( u"LiveScroll"_ustr, u"" XMLNS_DIALOGS_PREFIX ":live-scroll"_ustr ); |
1004 | 0 | readHexLongAttr( u"SymbolColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":symbol-color"_ustr ); |
1005 | 0 | readDataAwareAttr( u"" XMLNS_DIALOGS_PREFIX ":linked-cell"_ustr ); |
1006 | 0 | readEvents(); |
1007 | 0 | } |
1008 | | |
1009 | | void ElementDescriptor::readGridControlModel( StyleBag * all_styles ) |
1010 | 0 | { |
1011 | | // collect styles |
1012 | 0 | Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); |
1013 | 0 | if (readProp(u"BackgroundColor"_ustr) >>= aStyle._backgroundColor) |
1014 | 0 | aStyle._set |= 0x1; |
1015 | 0 | if (readBorderProps( this, aStyle )) |
1016 | 0 | aStyle._set |= 0x4; |
1017 | 0 | if (readProp(u"TextColor"_ustr) >>= aStyle._textColor) |
1018 | 0 | aStyle._set |= 0x2; |
1019 | 0 | if (readProp(u"TextLineColor"_ustr) >>= aStyle._textLineColor) |
1020 | 0 | aStyle._set |= 0x20; |
1021 | 0 | if (readFontProps( this, aStyle )) |
1022 | 0 | aStyle._set |= 0x8; |
1023 | 0 | if (aStyle._set) |
1024 | 0 | { |
1025 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr,all_styles->getStyleId( aStyle ) ); |
1026 | 0 | } |
1027 | | // collect elements |
1028 | 0 | readDefaults(); |
1029 | 0 | readBoolAttr(u"Tabstop"_ustr, u"" XMLNS_DIALOGS_PREFIX ":tabstop"_ustr); |
1030 | 0 | readVerticalAlignAttr( u"VerticalAlign"_ustr, u"" XMLNS_DIALOGS_PREFIX ":valign"_ustr); |
1031 | 0 | readSelectionTypeAttr( u"SelectionModel"_ustr, u"" XMLNS_DIALOGS_PREFIX ":selectiontype"_ustr); |
1032 | 0 | readBoolAttr( u"ShowColumnHeader"_ustr, u"" XMLNS_DIALOGS_PREFIX ":showcolumnheader"_ustr); |
1033 | 0 | readBoolAttr( u"ShowRowHeader"_ustr, u"" XMLNS_DIALOGS_PREFIX ":showrowheader"_ustr); |
1034 | 0 | readHexLongAttr( u"GridLineColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":gridline-color"_ustr); |
1035 | 0 | readBoolAttr( u"UseGridLines"_ustr, u"" XMLNS_DIALOGS_PREFIX ":usegridlines"_ustr ); |
1036 | 0 | readHexLongAttr( u"HeaderBackgroundColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":headerbackground-color"_ustr); |
1037 | 0 | readHexLongAttr( u"HeaderTextColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":headertext-color"_ustr); |
1038 | 0 | readHexLongAttr( u"ActiveSelectionBackgroundColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":activeselectionbackground-color"_ustr); |
1039 | 0 | readHexLongAttr( u"ActiveSelectionTextColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":activeselectiontext-color"_ustr); |
1040 | 0 | readHexLongAttr( u"InactiveSelectionBackgroundColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":inactiveselectionbackground-color"_ustr); |
1041 | 0 | readHexLongAttr( u"InactiveSelectionTextColor"_ustr, u"" XMLNS_DIALOGS_PREFIX ":inactiveselectiontext-color"_ustr); |
1042 | 0 | readEvents(); |
1043 | 0 | } |
1044 | | |
1045 | | void ElementDescriptor::readDialogModel( StyleBag * all_styles ) |
1046 | 0 | { |
1047 | | // collect elements |
1048 | 0 | addAttribute( u"xmlns:" XMLNS_DIALOGS_PREFIX ""_ustr, XMLNS_DIALOGS_URI ); |
1049 | 0 | addAttribute( u"xmlns:" XMLNS_SCRIPT_PREFIX ""_ustr, XMLNS_SCRIPT_URI ); |
1050 | | |
1051 | | // collect styles |
1052 | 0 | Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); |
1053 | 0 | if (readProp( u"BackgroundColor"_ustr ) >>= aStyle._backgroundColor) |
1054 | 0 | aStyle._set |= 0x1; |
1055 | 0 | if (readProp( u"TextColor"_ustr ) >>= aStyle._textColor) |
1056 | 0 | aStyle._set |= 0x2; |
1057 | 0 | if (readProp( u"TextLineColor"_ustr ) >>= aStyle._textLineColor) |
1058 | 0 | aStyle._set |= 0x20; |
1059 | 0 | if (readFontProps( this, aStyle )) |
1060 | 0 | aStyle._set |= 0x8; |
1061 | 0 | if (aStyle._set) |
1062 | 0 | { |
1063 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":style-id"_ustr, all_styles->getStyleId( aStyle ) ); |
1064 | 0 | } |
1065 | | |
1066 | | // collect elements |
1067 | 0 | readDefaults( false, false ); |
1068 | 0 | readBoolAttr(u"Closeable"_ustr, u"" XMLNS_DIALOGS_PREFIX ":closeable"_ustr ); |
1069 | 0 | readBoolAttr( u"Moveable"_ustr, u"" XMLNS_DIALOGS_PREFIX ":moveable"_ustr ); |
1070 | 0 | readBoolAttr( u"Sizeable"_ustr, u"" XMLNS_DIALOGS_PREFIX ":resizeable"_ustr ); |
1071 | 0 | readStringAttr( u"Title"_ustr, u"" XMLNS_DIALOGS_PREFIX ":title"_ustr ); |
1072 | |
|
1073 | 0 | readScrollableSettings(); |
1074 | 0 | Any aDecorationAny( _xProps->getPropertyValue( u"Decoration"_ustr ) ); |
1075 | 0 | bool bDecoration = false; |
1076 | 0 | if ( (aDecorationAny >>= bDecoration) && !bDecoration ) |
1077 | 0 | addAttribute( u"" XMLNS_DIALOGS_PREFIX ":withtitlebar"_ustr, u"false"_ustr ); |
1078 | 0 | readImageOrGraphicAttr(u"" XMLNS_DIALOGS_PREFIX ":image-src"_ustr); |
1079 | 0 | readEvents(); |
1080 | 0 | } |
1081 | | |
1082 | | void ElementDescriptor::readBullitinBoard( StyleBag * all_styles ) |
1083 | 0 | { |
1084 | | // collect elements |
1085 | 0 | ::std::vector< rtl::Reference<ElementDescriptor> > all_elements; |
1086 | | // read out all props |
1087 | 0 | Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY ); |
1088 | 0 | if ( !xDialogModel.is() ) |
1089 | 0 | return; // #TODO throw??? |
1090 | 0 | const Sequence< OUString > aElements( xDialogModel->getElementNames() ); |
1091 | |
|
1092 | 0 | rtl::Reference<ElementDescriptor> pRadioGroup; |
1093 | |
|
1094 | 0 | for ( const auto& rElement : aElements ) |
1095 | 0 | { |
1096 | 0 | Any aControlModel( xDialogModel->getByName( rElement ) ); |
1097 | 0 | Reference< beans::XPropertySet > xProps; |
1098 | 0 | OSL_VERIFY( aControlModel >>= xProps ); |
1099 | 0 | if (! xProps.is()) |
1100 | 0 | continue; |
1101 | 0 | Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); |
1102 | 0 | OSL_ENSURE( xPropState.is(), "no XPropertyState!" ); |
1103 | 0 | if (! xPropState.is()) |
1104 | 0 | continue; |
1105 | 0 | Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY ); |
1106 | 0 | OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" ); |
1107 | 0 | if (! xServiceInfo.is()) |
1108 | 0 | continue; |
1109 | | |
1110 | 0 | rtl::Reference<ElementDescriptor> pElem; |
1111 | | |
1112 | | // group up radio buttons |
1113 | 0 | if ( xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlRadioButtonModel"_ustr ) ) |
1114 | 0 | { |
1115 | 0 | if (! pRadioGroup) // open radiogroup |
1116 | 0 | { |
1117 | 0 | pRadioGroup = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":radiogroup"_ustr, _xDocument ); |
1118 | 0 | all_elements.push_back( pRadioGroup ); |
1119 | 0 | } |
1120 | |
|
1121 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":radio"_ustr, _xDocument ); |
1122 | 0 | pElem->readRadioButtonModel( all_styles ); |
1123 | 0 | pRadioGroup->addSubElement( pElem ); |
1124 | 0 | } |
1125 | 0 | else // no radio |
1126 | 0 | { |
1127 | 0 | pRadioGroup = nullptr; // close radiogroup |
1128 | |
|
1129 | 0 | if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlButtonModel"_ustr ) ) |
1130 | 0 | { |
1131 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":button"_ustr, _xDocument ); |
1132 | 0 | pElem->readButtonModel( all_styles ); |
1133 | 0 | } |
1134 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlCheckBoxModel"_ustr ) ) |
1135 | 0 | { |
1136 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":checkbox"_ustr, _xDocument ); |
1137 | 0 | pElem->readCheckBoxModel( all_styles ); |
1138 | 0 | } |
1139 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlComboBoxModel"_ustr ) ) |
1140 | 0 | { |
1141 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":combobox"_ustr, _xDocument ); |
1142 | 0 | pElem->readComboBoxModel( all_styles ); |
1143 | 0 | } |
1144 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlListBoxModel"_ustr ) ) |
1145 | 0 | { |
1146 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":menulist"_ustr, _xDocument ); |
1147 | 0 | pElem->readListBoxModel( all_styles ); |
1148 | 0 | } |
1149 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlGroupBoxModel"_ustr ) ) |
1150 | 0 | { |
1151 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":titledbox"_ustr, _xDocument ); |
1152 | 0 | pElem->readGroupBoxModel( all_styles ); |
1153 | 0 | } |
1154 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoMultiPageModel"_ustr ) ) |
1155 | 0 | { |
1156 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":multipage"_ustr, _xDocument ); |
1157 | 0 | pElem->readMultiPageModel( all_styles ); |
1158 | 0 | } |
1159 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoFrameModel"_ustr ) ) |
1160 | 0 | { |
1161 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":frame"_ustr, _xDocument ); |
1162 | 0 | pElem->readFrameModel( all_styles ); |
1163 | 0 | } |
1164 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoPageModel"_ustr ) ) |
1165 | 0 | { |
1166 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":page"_ustr, _xDocument ); |
1167 | 0 | pElem->readPageModel( all_styles ); |
1168 | 0 | } |
1169 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlFixedTextModel"_ustr ) ) |
1170 | 0 | { |
1171 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":text"_ustr, _xDocument ); |
1172 | 0 | pElem->readFixedTextModel( all_styles ); |
1173 | 0 | } |
1174 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlEditModel"_ustr ) ) |
1175 | 0 | { |
1176 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":textfield"_ustr, _xDocument ); |
1177 | 0 | pElem->readEditModel( all_styles ); |
1178 | 0 | } |
1179 | | // FixedHyperLink |
1180 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlFixedHyperlinkModel"_ustr ) ) |
1181 | 0 | { |
1182 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":linklabel"_ustr, _xDocument ); |
1183 | 0 | pElem->readFixedHyperLinkModel( all_styles ); |
1184 | 0 | } |
1185 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlImageControlModel"_ustr ) ) |
1186 | 0 | { |
1187 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":img"_ustr, _xDocument ); |
1188 | 0 | pElem->readImageControlModel( all_styles ); |
1189 | 0 | } |
1190 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlFileControlModel"_ustr ) ) |
1191 | 0 | { |
1192 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":filecontrol"_ustr, _xDocument ); |
1193 | 0 | pElem->readFileControlModel( all_styles ); |
1194 | 0 | } |
1195 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.tree.TreeControlModel"_ustr ) ) |
1196 | 0 | { |
1197 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":treecontrol"_ustr, _xDocument ); |
1198 | 0 | pElem->readTreeControlModel( all_styles ); |
1199 | 0 | } |
1200 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlCurrencyFieldModel"_ustr ) ) |
1201 | 0 | { |
1202 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":currencyfield"_ustr, _xDocument ); |
1203 | 0 | pElem->readCurrencyFieldModel( all_styles ); |
1204 | 0 | } |
1205 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlDateFieldModel"_ustr ) ) |
1206 | 0 | { |
1207 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":datefield"_ustr, _xDocument ); |
1208 | 0 | pElem->readDateFieldModel( all_styles ); |
1209 | 0 | } |
1210 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlNumericFieldModel"_ustr ) ) |
1211 | 0 | { |
1212 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":numericfield"_ustr, _xDocument ); |
1213 | 0 | pElem->readNumericFieldModel( all_styles ); |
1214 | 0 | } |
1215 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlTimeFieldModel"_ustr ) ) |
1216 | 0 | { |
1217 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":timefield"_ustr, _xDocument); |
1218 | 0 | pElem->readTimeFieldModel( all_styles ); |
1219 | 0 | } |
1220 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlPatternFieldModel"_ustr ) ) |
1221 | 0 | { |
1222 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":patternfield"_ustr, _xDocument ); |
1223 | 0 | pElem->readPatternFieldModel( all_styles ); |
1224 | 0 | } |
1225 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlFormattedFieldModel"_ustr ) ) |
1226 | 0 | { |
1227 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":formattedfield"_ustr, _xDocument ); |
1228 | 0 | pElem->readFormattedFieldModel( all_styles ); |
1229 | 0 | } |
1230 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlFixedLineModel"_ustr ) ) |
1231 | 0 | { |
1232 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":fixedline"_ustr, _xDocument ); |
1233 | 0 | pElem->readFixedLineModel( all_styles ); |
1234 | 0 | } |
1235 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlScrollBarModel"_ustr ) ) |
1236 | 0 | { |
1237 | 0 | pElem = new ElementDescriptor(xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":scrollbar"_ustr, _xDocument ); |
1238 | 0 | pElem->readScrollBarModel( all_styles ); |
1239 | 0 | } |
1240 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlSpinButtonModel"_ustr ) ) |
1241 | 0 | { |
1242 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":spinbutton"_ustr, _xDocument ); |
1243 | 0 | pElem->readSpinButtonModel( all_styles ); |
1244 | 0 | } |
1245 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.UnoControlProgressBarModel"_ustr ) ) |
1246 | 0 | { |
1247 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":progressmeter"_ustr, _xDocument ); |
1248 | 0 | pElem->readProgressBarModel( all_styles ); |
1249 | 0 | } |
1250 | 0 | else if (xServiceInfo->supportsService( u"com.sun.star.awt.grid.UnoControlGridModel"_ustr ) ) |
1251 | 0 | { |
1252 | 0 | pElem = new ElementDescriptor( xProps, xPropState, u"" XMLNS_DIALOGS_PREFIX ":table"_ustr, _xDocument ); |
1253 | 0 | pElem->readGridControlModel( all_styles ); |
1254 | 0 | } |
1255 | |
|
1256 | 0 | if (pElem) |
1257 | 0 | { |
1258 | 0 | all_elements.push_back( pElem ); |
1259 | 0 | } |
1260 | 0 | else |
1261 | 0 | { |
1262 | 0 | OSL_FAIL( "unknown control type!" ); |
1263 | 0 | continue; |
1264 | 0 | } |
1265 | 0 | } |
1266 | 0 | } |
1267 | 0 | for (const rtl::Reference<ElementDescriptor> & p : all_elements) |
1268 | 0 | { |
1269 | 0 | addSubElement( p ); |
1270 | 0 | } |
1271 | 0 | } |
1272 | | |
1273 | | } |
1274 | | |
1275 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |