Update ooo320-m1
[ooovba.git] / extensions / source / propctrlr / formmetadata.cxx
blob41260c0309f76e90cf033f1605fb93537d9df416
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formmetadata.cxx,v $
10 * $Revision: 1.50 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
33 #include "formmetadata.hxx"
34 #ifndef _EXTENSIONS_FORMCTRLR_FORMHELPID_HRC_
35 #include "formhelpid.hrc"
36 #endif
37 #include "formstrings.hxx"
38 #ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_
39 #include "formresid.hrc"
40 #endif
41 #ifndef EXTENSIONS_INC_EXTENSIO_HRC
42 #include "extensio.hrc"
43 #endif
44 #include <svtools/localresaccess.hxx>
45 #include <tools/debug.hxx>
46 #include <cppuhelper/extract.hxx>
48 #include <algorithm>
49 #include <functional>
51 //............................................................................
52 namespace pcr
54 //............................................................................
56 using namespace ::com::sun::star::uno;
58 //========================================================================
59 //= OPropertyInfoImpl
60 //========================================================================
61 struct OPropertyInfoImpl
63 String sName;
64 String sTranslation;
65 sal_uInt32 nHelpId;
66 sal_Int32 nId;
67 sal_uInt16 nPos;
68 sal_uInt32 nUIFlags;
70 OPropertyInfoImpl(
71 const ::rtl::OUString& rName,
72 sal_Int32 _nId,
73 const String& aTranslation,
74 sal_uInt16 nPosId,
75 sal_uInt32 nHelpId,
76 sal_uInt32 _nUIFlags);
79 //------------------------------------------------------------------------
80 OPropertyInfoImpl::OPropertyInfoImpl(const ::rtl::OUString& _rName, sal_Int32 _nId,
81 const String& aString, sal_uInt16 nP, sal_uInt32 nHid, sal_uInt32 _nUIFlags)
82 :sName(_rName)
83 ,sTranslation(aString)
84 ,nHelpId(nHid)
85 ,nId(_nId)
86 ,nPos(nP)
87 ,nUIFlags(_nUIFlags)
91 //------------------------------------------------------------------------
92 // Vergleichen von PropertyInfo
93 struct PropertyInfoLessByName : public ::std::binary_function< OPropertyInfoImpl, OPropertyInfoImpl, bool >
95 bool operator()( const OPropertyInfoImpl& _rLHS, const OPropertyInfoImpl& _rRHS )
97 return _rLHS.sName.CompareTo( _rRHS.sName ) == COMPARE_LESS;
101 //========================================================================
102 //= OPropertyInfoService
103 //========================================================================
104 #define DEF_INFO( ident, uinameres, helpid, flags ) \
105 OPropertyInfoImpl( PROPERTY_##ident, PROPERTY_ID_##ident, \
106 String( PcrRes( RID_STR_##uinameres ) ), nPos++, HID_PROP_##helpid, flags )
108 #define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \
109 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 )
111 #define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \
112 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 )
114 #define DEF_INFO_3( ident, uinameres, helpid, flag1, flag2, flag3 ) \
115 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 )
117 #define DEF_INFO_4( ident, uinameres, helpid, flag1, flag2, flag3, flag4 ) \
118 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 )
120 #define DEF_INFO_5( ident, uinameres, helpid, flag1, flag2, flag3, flag4, flag5 ) \
121 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 | PROP_FLAG_##flag5 )
123 sal_uInt16 OPropertyInfoService::s_nCount = 0;
124 OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = NULL;
125 //------------------------------------------------------------------------
126 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo()
128 if ( s_pPropertyInfos )
129 return s_pPropertyInfos;
131 PcrClient aResourceAccess;
132 // this ensures that we have our resource file loaded
134 sal_uInt16 nPos = 1;
136 static OPropertyInfoImpl aPropertyInfos[] =
139 DEF_INFO_?( propname and id, resoure id, help id, flags ),
141 DEF_INFO_3( NAME, NAME, NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
142 DEF_INFO_2( TITLE, TITLE, TITLE, FORM_VISIBLE, DIALOG_VISIBLE ),
143 DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
144 DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ),
145 DEF_INFO_3( WRITING_MODE, WRITING_MODE, WRITING_MODE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
146 DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
147 DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ),
148 DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
149 DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
150 DEF_INFO_3( LITERALMASK, LITERALMASK, LITERALMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
151 DEF_INFO_3( STRICTFORMAT, STRICTFORMAT, STRICTFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
152 DEF_INFO_3( ENABLED, ENABLED, ENABLED, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
153 DEF_INFO_3( ENABLE_VISIBLE, ENABLE_VISIBLE, ENABLE_VISIBLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
154 DEF_INFO_3( READONLY, READONLY, READONLY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
155 DEF_INFO_3( PRINTABLE, PRINTABLE, PRINTABLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
156 DEF_INFO_3( STEP, STEP, STEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
157 DEF_INFO_3( TABSTOP, TABSTOP, TABSTOP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
158 DEF_INFO_2( TABINDEX, TABINDEX, TABINDEX, FORM_VISIBLE, DIALOG_VISIBLE ),
159 DEF_INFO_3( WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, FORM_VISIBLE, ENUM, COMPOSEABLE ),
161 DEF_INFO_2( BOUND_CELL, BOUND_CELL, BOUND_CELL, FORM_VISIBLE, DATA_PROPERTY ),
162 DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ),
163 DEF_INFO_2( LIST_CELL_RANGE, LIST_CELL_RANGE, LIST_CELL_RANGE, FORM_VISIBLE, DATA_PROPERTY ),
164 DEF_INFO_3( CONTROLSOURCE, CONTROLSOURCE, CONTROLSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
165 DEF_INFO_3( EMPTY_IS_NULL, EMPTY_IS_NULL, EMPTY_IS_NULL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
166 DEF_INFO_3( INPUT_REQUIRED, INPUT_REQUIRED, INPUT_REQUIRED, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
167 DEF_INFO_3( REFVALUE, REFVALUE, REFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
168 DEF_INFO_3( UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
169 DEF_INFO_3( DATASOURCE, DATASOURCE, DATASOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
170 DEF_INFO_4( COMMANDTYPE, CURSORSOURCETYPE, CURSORSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
171 DEF_INFO_3( COMMAND, CURSORSOURCE, CURSORSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
172 DEF_INFO_3( ESCAPE_PROCESSING, ESCAPE_PROCESSING, ESCAPE_PROCESSING, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
173 DEF_INFO_3( FILTER, FILTER, FILTER, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
174 DEF_INFO_3( SORT, SORT_CRITERIA, SORT_CRITERIA, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
175 DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, FORM_VISIBLE, DATA_PROPERTY ),
176 DEF_INFO_2( DETAILFIELDS, SLAVEFIELDS, SLAVEFIELDS, FORM_VISIBLE, DATA_PROPERTY ),
177 DEF_INFO_3( ALLOWADDITIONS, ALLOW_ADDITIONS, ALLOW_ADDITIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
178 DEF_INFO_3( ALLOWEDITS, ALLOW_EDITS, ALLOW_EDITS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
179 DEF_INFO_3( ALLOWDELETIONS, ALLOW_DELETIONS, ALLOW_DELETIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
180 DEF_INFO_4( INSERTONLY, DATAENTRY, DATAENTRY, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE, COMPOSEABLE ),
181 DEF_INFO_4( NAVIGATION, NAVIGATION, NAVIGATION, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
182 DEF_INFO_4( CYCLE, CYCLE, CYCLE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
183 DEF_INFO_3( FILTERPROPOSAL, FILTERPROPOSAL, FILTERPROPOSAL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
184 DEF_INFO_4( LISTSOURCETYPE, LISTSOURCETYPE, LISTSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
185 DEF_INFO_3( LISTSOURCE, LISTSOURCE, LISTSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
186 DEF_INFO_3( BOUNDCOLUMN, BOUNDCOLUMN, BOUNDCOLUMN, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
188 // <!----------------->
189 // XML node binding
190 DEF_INFO_2( LIST_BINDING, LIST_BINDING, LIST_BINDING, FORM_VISIBLE, DATA_PROPERTY ),
191 DEF_INFO_2( XML_DATA_MODEL, XML_DATA_MODEL, XML_DATA_MODEL, FORM_VISIBLE, DATA_PROPERTY ),
192 DEF_INFO_2( BINDING_NAME, BINDING_NAME, BINDING_NAME, FORM_VISIBLE, DATA_PROPERTY ),
193 DEF_INFO_2( BIND_EXPRESSION, BIND_EXPRESSION, BIND_EXPRESSION, FORM_VISIBLE, DATA_PROPERTY ),
194 DEF_INFO_2( XSD_REQUIRED, XSD_REQUIRED, XSD_REQUIRED, FORM_VISIBLE, DATA_PROPERTY ),
195 DEF_INFO_2( XSD_RELEVANT, XSD_RELEVANT, XSD_RELEVANT, FORM_VISIBLE, DATA_PROPERTY ),
196 DEF_INFO_2( XSD_READONLY, XSD_READONLY, XSD_READONLY, FORM_VISIBLE, DATA_PROPERTY ),
197 DEF_INFO_2( XSD_CONSTRAINT, XSD_CONSTRAINT, XSD_CONSTRAINT, FORM_VISIBLE, DATA_PROPERTY ),
198 DEF_INFO_2( XSD_CALCULATION, XSD_CALCULATION, XSD_CALCULATION, FORM_VISIBLE, DATA_PROPERTY ),
200 // data type
201 DEF_INFO_2( XSD_DATA_TYPE, XSD_DATA_TYPE, XSD_DATA_TYPE, FORM_VISIBLE, DATA_PROPERTY ),
202 // data types facets
203 // common
204 DEF_INFO_3( XSD_WHITESPACES, XSD_WHITESPACES, XSD_WHITESPACES, FORM_VISIBLE, DATA_PROPERTY, ENUM ),
205 DEF_INFO_2( XSD_PATTERN, XSD_PATTERN, XSD_PATTERN, FORM_VISIBLE, DATA_PROPERTY ),
206 // string
207 DEF_INFO_2( XSD_LENGTH, XSD_LENGTH, XSD_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
208 DEF_INFO_2( XSD_MIN_LENGTH, XSD_MIN_LENGTH, XSD_MIN_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
209 DEF_INFO_2( XSD_MAX_LENGTH, XSD_MAX_LENGTH, XSD_MAX_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
210 // decimal
211 DEF_INFO_2( XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, FORM_VISIBLE, DATA_PROPERTY ),
212 DEF_INFO_2( XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,FORM_VISIBLE, DATA_PROPERTY ),
213 // int value types (year, month, day)
214 DEF_INFO_2( XSD_MAX_INCLUSIVE_INT, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
215 DEF_INFO_2( XSD_MAX_EXCLUSIVE_INT, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
216 DEF_INFO_2( XSD_MIN_INCLUSIVE_INT, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
217 DEF_INFO_2( XSD_MIN_EXCLUSIVE_INT, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
218 // double value types (double, float, decimal)
219 DEF_INFO_2( XSD_MAX_INCLUSIVE_DOUBLE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
220 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DOUBLE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
221 DEF_INFO_2( XSD_MIN_INCLUSIVE_DOUBLE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
222 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DOUBLE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
223 // date value type
224 DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
225 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
226 DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
227 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
228 // time value type
229 DEF_INFO_2( XSD_MAX_INCLUSIVE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
230 DEF_INFO_2( XSD_MAX_EXCLUSIVE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
231 DEF_INFO_2( XSD_MIN_INCLUSIVE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
232 DEF_INFO_2( XSD_MIN_EXCLUSIVE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
233 // dateTime value type
234 DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
235 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
236 DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
237 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
238 // <!----------------->
240 DEF_INFO_2( HIDDEN_VALUE, VALUE, HIDDEN_VALUE, FORM_VISIBLE, COMPOSEABLE ),
241 DEF_INFO_2( VALUE, VALUE, VALUE, DIALOG_VISIBLE, COMPOSEABLE ),
242 DEF_INFO_3( VALUEMIN, VALUEMIN, VALUEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
243 DEF_INFO_3( VALUEMAX, VALUEMAX, VALUEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
244 DEF_INFO_3( VALUESTEP, VALUESTEP, VALUESTEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
245 DEF_INFO_2( DEFAULT_VALUE, DEFAULTVALUE, DEFAULT_LONG_VALUE,FORM_VISIBLE, COMPOSEABLE ),
246 DEF_INFO_3( DECIMAL_ACCURACY, DECIMAL_ACCURACY, DECIMAL_ACCURACY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
247 DEF_INFO_3( SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
249 DEF_INFO_3( CURRENCYSYMBOL, CURRENCYSYMBOL, CURRENCYSYMBOL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
250 DEF_INFO_3( CURRSYM_POSITION, CURRSYM_POSITION, CURRSYM_POSITION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
252 DEF_INFO_2( DATE, DATE, DATE, DIALOG_VISIBLE, COMPOSEABLE ),
253 DEF_INFO_3( DATEMIN, DATEMIN, DATEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
254 DEF_INFO_3( DATEMAX, DATEMAX, DATEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
255 DEF_INFO_4( DATEFORMAT, DATEFORMAT, DATEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
256 DEF_INFO_2( DEFAULT_DATE, DEFAULTDATE, DEFAULT_DATE, FORM_VISIBLE, COMPOSEABLE ),
258 DEF_INFO_2( TIME, TIME, TIME, DIALOG_VISIBLE, COMPOSEABLE ),
259 DEF_INFO_3( TIMEMIN, TIMEMIN, TIMEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
260 DEF_INFO_3( TIMEMAX, TIMEMAX, TIMEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
261 DEF_INFO_4( TIMEFORMAT, TIMEFORMAT, TIMEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
262 DEF_INFO_2( DEFAULT_TIME, DEFAULTTIME, DEFAULT_TIME, FORM_VISIBLE, COMPOSEABLE ),
264 DEF_INFO_1( EFFECTIVE_VALUE, VALUE, VALUE, DIALOG_VISIBLE ),
265 DEF_INFO_3( EFFECTIVE_MIN, VALUEMIN, EFFECTIVEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
266 DEF_INFO_3( EFFECTIVE_MAX, VALUEMAX, EFFECTIVEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
267 DEF_INFO_2( EFFECTIVE_DEFAULT, DEFAULTVALUE, EFFECTIVEDEFAULT, FORM_VISIBLE, COMPOSEABLE ),
268 DEF_INFO_3( FORMATKEY, FORMATKEY, FORMATKEY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
270 DEF_INFO_3( PROGRESSVALUE, PROGRESSVALUE, PROGRESSVALUE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
271 DEF_INFO_3( PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
272 DEF_INFO_3( PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
274 DEF_INFO_2( SCROLLVALUE, SCROLLVALUE, SCROLLVALUE, DIALOG_VISIBLE, COMPOSEABLE ),
275 DEF_INFO_3( SCROLLVALUE_MIN, SCROLLVALUE_MIN, SCROLLVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
276 DEF_INFO_3( SCROLLVALUE_MAX, SCROLLVALUE_MAX, SCROLLVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
277 DEF_INFO_2( DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,FORM_VISIBLE, COMPOSEABLE ),
278 DEF_INFO_3( LINEINCREMENT, LINEINCREMENT, LINEINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
279 DEF_INFO_3( BLOCKINCREMENT, BLOCKINCREMENT, BLOCKINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
281 DEF_INFO_2( SPINVALUE, VALUE, SPINVALUE, DIALOG_VISIBLE, COMPOSEABLE ),
282 DEF_INFO_3( SPINVALUE_MIN, VALUEMIN, SPINVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
283 DEF_INFO_3( SPINVALUE_MAX, VALUEMAX, SPINVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
284 DEF_INFO_2( DEFAULT_SPINVALUE,DEFAULTVALUE, DEFAULT_SPINVALUE, FORM_VISIBLE, COMPOSEABLE ),
285 DEF_INFO_3( SPININCREMENT, VALUESTEP, SPININCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
287 DEF_INFO_3( SPIN, SPIN, SPIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
288 DEF_INFO_3( REPEAT, REPEAT, REPEAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
289 DEF_INFO_3( REPEAT_DELAY, REPEAT_DELAY, REPEAT_DELAY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
290 DEF_INFO_3( VISIBLESIZE, VISIBLESIZE, VISIBLESIZE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
291 DEF_INFO_4( ORIENTATION, ORIENTATION, ORIENTATION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
292 DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
293 DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
294 DEF_INFO_3( DEFAULT_STATE, DEFAULT_STATE, DEFAULT_STATE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
296 DEF_INFO_3( TEXT_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
297 DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
298 DEF_INFO_3( POSITIONX, POSITIONX, POSITIONX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
299 DEF_INFO_3( POSITIONY, POSITIONY, POSITIONY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
300 DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
301 DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
303 DEF_INFO_1( LISTINDEX, LISTINDEX, LISTINDEX, FORM_VISIBLE ),
304 DEF_INFO_3( STRINGITEMLIST, STRINGITEMLIST, STRINGITEMLIST, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
305 DEF_INFO_2( DEFAULT_TEXT, DEFAULTTEXT, DEFAULTVALUE, FORM_VISIBLE, COMPOSEABLE ),
306 DEF_INFO_3( FONT, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
307 DEF_INFO_4( VISUALEFFECT, VISUALEFFECT, VISUALEFFECT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ),
308 DEF_INFO_4( ALIGN, ALIGN, ALIGN, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
309 DEF_INFO_3( VERTICAL_ALIGN, VERTICAL_ALIGN, VERTICAL_ALIGN, FORM_VISIBLE, ENUM, COMPOSEABLE ),
310 DEF_INFO_3( ROWHEIGHT, ROWHEIGHT, ROWHEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
311 DEF_INFO_3( BACKGROUNDCOLOR, BACKGROUNDCOLOR, BACKGROUNDCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
312 DEF_INFO_3( SYMBOLCOLOR, SYMBOLCOLOR, SYMBOLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
313 DEF_INFO_3( FILLCOLOR, FILLCOLOR, FILLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
314 DEF_INFO_3( LINECOLOR, LINECOLOR, LINECOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
315 DEF_INFO_4( BORDER, BORDER, BORDER, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
316 DEF_INFO_3( BORDERCOLOR, BORDERCOLOR, BORDERCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
317 DEF_INFO_3( ICONSIZE, ICONSIZE, ICONSIZE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
318 DEF_INFO_2( SHOW_POSITION, SHOW_POSITION, SHOW_POSITION, FORM_VISIBLE, COMPOSEABLE ),
319 DEF_INFO_2( SHOW_NAVIGATION, SHOW_NAVIGATION, SHOW_NAVIGATION, FORM_VISIBLE, COMPOSEABLE ),
320 DEF_INFO_2( SHOW_RECORDACTIONS,SHOW_RECORDACTIONS, SHOW_RECORDACTIONS,FORM_VISIBLE, COMPOSEABLE ),
321 DEF_INFO_2( SHOW_FILTERSORT, SHOW_FILTERSORT, SHOW_FILTERSORT, FORM_VISIBLE, COMPOSEABLE ),
323 DEF_INFO_3( DROPDOWN, DROPDOWN, DROPDOWN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
324 DEF_INFO_3( LINECOUNT, LINECOUNT, LINECOUNT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
325 DEF_INFO_3( AUTOCOMPLETE, AUTOCOMPLETE, AUTOCOMPLETE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
326 DEF_INFO_3( MULTILINE, MULTILINE, MULTILINE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
327 DEF_INFO_3( WORDBREAK, WORDBREAK, WORDBREAK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
328 DEF_INFO_3( TEXTTYPE, TEXTTYPE, TEXTTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
329 DEF_INFO_3( LINEEND_FORMAT, LINEEND_FORMAT, LINEEND_FORMAT, FORM_VISIBLE, ENUM_ONE, COMPOSEABLE ),
330 DEF_INFO_3( MULTISELECTION, MULTISELECTION, MULTISELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
331 DEF_INFO_4( SHOW_SCROLLBARS, SHOW_SCROLLBARS, SHOW_SCROLLBARS, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
332 DEF_INFO_3( HSCROLL, HSCROLL, HSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
333 DEF_INFO_3( VSCROLL, VSCROLL, VSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
334 DEF_INFO_3( BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
335 DEF_INFO_2( XFORMS_BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM ),
336 DEF_INFO_1( SUBMISSION_ID, SUBMISSION_ID, SUBMISSION_ID, FORM_VISIBLE ),
337 DEF_INFO_2( PUSHBUTTONTYPE, PUSHBUTTONTYPE, PUSHBUTTONTYPE, DIALOG_VISIBLE, ENUM ),
338 DEF_INFO_2( TARGET_URL, TARGET_URL, TARGET_URL, FORM_VISIBLE, COMPOSEABLE ),
339 DEF_INFO_1( TARGET_FRAME, TARGET_FRAME, TARGET_FRAME, FORM_VISIBLE ),
340 DEF_INFO_2( SUBMIT_ACTION, SUBMIT_ACTION, SUBMIT_ACTION, FORM_VISIBLE, COMPOSEABLE ),
341 DEF_INFO_2( SUBMIT_TARGET, SUBMIT_TARGET, SUBMIT_TARGET, FORM_VISIBLE, COMPOSEABLE ),
342 DEF_INFO_3( SUBMIT_ENCODING, SUBMIT_ENCODING, SUBMIT_ENCODING, FORM_VISIBLE, ENUM, COMPOSEABLE ),
343 DEF_INFO_3( SUBMIT_METHOD, SUBMIT_METHOD, SUBMIT_METHOD, FORM_VISIBLE, ENUM, COMPOSEABLE ),
344 DEF_INFO_3( STATE, STATE, STATE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
345 DEF_INFO_3( DEFAULTBUTTON, DEFAULT_BUTTON, DEFAULT_BUTTON, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
346 DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
347 DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
348 DEF_INFO_3( SCALEIMAGE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
349 DEF_INFO_4( SCALE_MODE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE, ENUM ),
350 DEF_INFO_2( DEFAULT_SELECT_SEQ,DEFAULT_SELECT_SEQ, DEFAULT_SELECT_SEQ,FORM_VISIBLE, COMPOSEABLE ),
351 DEF_INFO_2( SELECTEDITEMS, SELECTEDITEMS, SELECTEDITEMS, DIALOG_VISIBLE, COMPOSEABLE ),
352 DEF_INFO_3( ECHO_CHAR, ECHO_CHAR, ECHO_CHAR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
353 DEF_INFO_3( HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
354 DEF_INFO_3( TRISTATE, TRISTATE, TRISTATE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
355 DEF_INFO_2( HASNAVIGATION, NAVIGATION, NAVIGATIONBAR, FORM_VISIBLE, COMPOSEABLE ),
356 DEF_INFO_2( RECORDMARKER, RECORDMARKER, RECORDMARKER, FORM_VISIBLE, COMPOSEABLE ),
357 DEF_INFO_3( TAG, TAG, TAG, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
358 DEF_INFO_3( HELPTEXT, HELPTEXT, HELPTEXT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
359 DEF_INFO_3( HELPURL, HELPURL, HELPURL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
360 DEF_INFO_3( SELECTION_TYPE, SELECTION_TYPE, SELECTION_TYPE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
361 DEF_INFO_2( ROOT_DISPLAYED, ROOT_DISPLAYED, ROOT_DISPLAYED, DIALOG_VISIBLE, COMPOSEABLE ),
362 DEF_INFO_2( SHOWS_HANDLES, SHOWS_HANDLES, SHOWS_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ),
363 DEF_INFO_2( SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ),
364 DEF_INFO_2( EDITABLE, EDITABLE, EDITABLE, DIALOG_VISIBLE, COMPOSEABLE ),
365 DEF_INFO_2( INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, DIALOG_VISIBLE, COMPOSEABLE ),
366 DEF_INFO_2( DECORATION, DECORATION, DECORATION, DIALOG_VISIBLE, COMPOSEABLE ),
367 DEF_INFO_2( NOLABEL, NOLABEL, NOLABEL, DIALOG_VISIBLE, COMPOSEABLE )
370 s_pPropertyInfos = aPropertyInfos;
371 s_nCount = sizeof(aPropertyInfos) / sizeof(OPropertyInfoImpl);
373 // sort
374 ::std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() );
376 #if OSL_DEBUG_LEVEL > 0
377 for ( const OPropertyInfoImpl* pCheck = s_pPropertyInfos; pCheck != s_pPropertyInfos + s_nCount - 1; ++pCheck )
379 OSL_ENSURE( pCheck->sName != ( pCheck + 1 )->sName, "OPropertyInfoService::getPropertyInfo: duplicate entry in the table!" );
381 #endif
383 return s_pPropertyInfos;
386 //------------------------------------------------------------------------
387 sal_Int32 OPropertyInfoService::getPropertyId(const String& _rName) const
389 const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName);
390 return pInfo ? pInfo->nId : -1;
393 //------------------------------------------------------------------------
394 String OPropertyInfoService::getPropertyName( sal_Int32 _nPropId )
396 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nPropId);
397 return pInfo ? pInfo->sName : String();
400 //------------------------------------------------------------------------
401 String OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const
403 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
404 return (pInfo) ? pInfo->sTranslation : String();
407 //------------------------------------------------------------------------
408 sal_Int32 OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const
410 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
411 return (pInfo) ? pInfo->nHelpId : 0;
414 //------------------------------------------------------------------------
415 sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const
417 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
418 return (pInfo) ? pInfo->nPos : 0xFFFF;
421 //------------------------------------------------------------------------
422 sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const
424 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
425 return (pInfo) ? pInfo->nUIFlags : 0;
428 //------------------------------------------------------------------------
429 ::std::vector< ::rtl::OUString > OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const
431 OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ),
432 "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" );
434 sal_Int16 nStringItemsResId = 0;
435 switch ( _nId )
437 case PROPERTY_ID_IMAGEPOSITION:
438 nStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION;
439 break;
440 case PROPERTY_ID_BORDER:
441 nStringItemsResId = RID_RSC_ENUM_BORDER_TYPE;
442 break;
443 case PROPERTY_ID_ICONSIZE:
444 nStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE;
445 break;
446 case PROPERTY_ID_COMMANDTYPE:
447 nStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE;
448 break;
449 case PROPERTY_ID_LISTSOURCETYPE:
450 nStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE;
451 break;
452 case PROPERTY_ID_ALIGN:
453 nStringItemsResId = RID_RSC_ENUM_ALIGNMENT;
454 break;
455 case PROPERTY_ID_VERTICAL_ALIGN:
456 nStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN;
457 break;
458 case PROPERTY_ID_BUTTONTYPE:
459 nStringItemsResId = RID_RSC_ENUM_BUTTONTYPE;
460 break;
461 case PROPERTY_ID_PUSHBUTTONTYPE:
462 nStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE;
463 break;
464 case PROPERTY_ID_SUBMIT_METHOD:
465 nStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD;
466 break;
467 case PROPERTY_ID_SUBMIT_ENCODING:
468 nStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING;
469 break;
470 case PROPERTY_ID_DATEFORMAT:
471 nStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST;
472 break;
473 case PROPERTY_ID_TIMEFORMAT:
474 nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST;
475 break;
476 case PROPERTY_ID_DEFAULT_STATE:
477 case PROPERTY_ID_STATE:
478 nStringItemsResId = RID_RSC_ENUM_CHECKED;
479 break;
480 case PROPERTY_ID_CYCLE:
481 nStringItemsResId = RID_RSC_ENUM_CYCLE;
482 break;
483 case PROPERTY_ID_NAVIGATION:
484 nStringItemsResId = RID_RSC_ENUM_NAVIGATION;
485 break;
486 case PROPERTY_ID_TARGET_FRAME:
487 nStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET;
488 break;
489 case PROPERTY_ID_ORIENTATION:
490 nStringItemsResId = RID_RSC_ENUM_ORIENTATION;
491 break;
492 case PROPERTY_ID_CELL_EXCHANGE_TYPE:
493 nStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE;
494 break;
495 case PROPERTY_ID_SHOW_SCROLLBARS:
496 nStringItemsResId = RID_RSC_ENUM_SCROLLBARS;
497 break;
498 case PROPERTY_ID_VISUALEFFECT:
499 nStringItemsResId = RID_RSC_ENUM_VISUALEFFECT;
500 break;
501 case PROPERTY_ID_TEXTTYPE:
502 nStringItemsResId = RID_RSC_ENUM_TEXTTYPE;
503 break;
504 case PROPERTY_ID_LINEEND_FORMAT:
505 nStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT;
506 break;
507 case PROPERTY_ID_XSD_WHITESPACES:
508 nStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING;
509 break;
510 case PROPERTY_ID_SELECTION_TYPE:
511 nStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE;
512 break;
513 case PROPERTY_ID_SCALE_MODE:
514 nStringItemsResId = RID_RSC_ENUM_SCALE_MODE;
515 break;
516 case PROPERTY_ID_WRITING_MODE:
517 nStringItemsResId = RID_RSC_ENUM_WRITING_MODE;
518 break;
519 case PROPERTY_ID_WHEEL_BEHAVIOR:
520 nStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR;
521 break;
522 case PROPERTY_ID_TEXT_ANCHOR_TYPE:
523 nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE;
524 break;
525 case PROPERTY_ID_SHEET_ANCHOR_TYPE:
526 nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE;
527 break;
528 default:
529 OSL_ENSURE( sal_False, "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" );
530 break;
533 ::std::vector< ::rtl::OUString > aReturn;
535 if ( nStringItemsResId )
537 PcrRes aResId( nStringItemsResId );
538 ::svt::OLocalResourceAccess aEnumStrings( aResId, RSC_RESOURCE );
540 sal_Int16 i = 1;
541 PcrRes aLocalId( i );
542 while ( aEnumStrings.IsAvailableRes( aLocalId.SetRT( RSC_STRING ) ) )
544 aReturn.push_back( String( aLocalId ) );
545 aLocalId = PcrRes( ++i );
549 return aReturn;
552 //------------------------------------------------------------------------
553 sal_Bool OPropertyInfoService::isComposeable( const ::rtl::OUString& _rPropertyName ) const
555 sal_Int32 nId = getPropertyId( _rPropertyName );
556 if ( nId == -1 )
557 return sal_False;
559 sal_uInt32 nFlags = getPropertyUIFlags( nId );
560 return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0;
563 //------------------------------------------------------------------------
564 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const String& _rName)
566 // intialisierung
567 if(!s_pPropertyInfos)
568 getPropertyInfo();
569 OPropertyInfoImpl aSearch(_rName, 0L, String(), 0, 0, 0);
571 const OPropertyInfoImpl* pInfo = ::std::lower_bound(
572 s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() );
574 if ( pInfo == s_pPropertyInfos + s_nCount )
575 return NULL;
577 if ( pInfo->sName != _rName )
578 return NULL;
580 return pInfo;
584 //------------------------------------------------------------------------
585 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId)
587 // intialisierung
588 if(!s_pPropertyInfos)
589 getPropertyInfo();
591 // TODO: a real structure which allows quick access by name as well as by id
592 for (sal_uInt16 i = 0; i < s_nCount; i++)
593 if (s_pPropertyInfos[i].nId == _nId)
594 return &s_pPropertyInfos[i];
596 return NULL;
599 //====================================================================
600 //= DefaultEnumRepresentation
601 //====================================================================
602 DBG_NAME( DefaultEnumRepresentation )
603 //--------------------------------------------------------------------
604 DefaultEnumRepresentation::DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const Type& _rType, sal_Int32 _nPropertyId )
605 :m_refCount( 0 )
606 ,m_rMetaData( _rInfo )
607 ,m_aType( _rType )
608 ,m_nPropertyId( _nPropertyId )
610 DBG_CTOR( DefaultEnumRepresentation, NULL );
613 //--------------------------------------------------------------------
614 DefaultEnumRepresentation::~DefaultEnumRepresentation()
616 DBG_DTOR( DefaultEnumRepresentation, NULL );
619 //--------------------------------------------------------------------
620 ::std::vector< ::rtl::OUString > SAL_CALL DefaultEnumRepresentation::getDescriptions() const
622 return m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
625 //--------------------------------------------------------------------
626 void SAL_CALL DefaultEnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const
628 sal_uInt32 nPropertyUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
629 ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
630 ::std::vector< ::rtl::OUString >::const_iterator pos = ::std::find( aEnumStrings.begin(), aEnumStrings.end(), _rDescription );
631 if ( pos != aEnumStrings.end() )
633 sal_Int32 nPos = pos - aEnumStrings.begin();
634 if ( ( nPropertyUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
635 // enum value starting with 1
636 ++nPos;
638 switch ( m_aType.getTypeClass() )
640 case TypeClass_ENUM:
641 _out_rValue = ::cppu::int2enum( nPos, m_aType );
642 break;
644 case TypeClass_SHORT:
645 _out_rValue <<= (sal_Int16)nPos;
646 break;
648 case TypeClass_UNSIGNED_SHORT:
649 _out_rValue <<= (sal_uInt16)nPos;
650 break;
652 case TypeClass_UNSIGNED_LONG:
653 _out_rValue <<= (sal_uInt32)nPos;
654 break;
656 default:
657 _out_rValue <<= (sal_Int32)nPos;
658 break;
661 else
663 DBG_ERROR( "DefaultEnumRepresentation::getValueFromDescription: could not translate the enum string!" );
664 _out_rValue.clear();
668 //--------------------------------------------------------------------
669 ::rtl::OUString SAL_CALL DefaultEnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const
671 ::rtl::OUString sReturn;
672 sal_Int32 nIntValue = -1;
673 OSL_VERIFY( ::cppu::enum2int( nIntValue, _rEnumValue ) );
675 sal_uInt32 nUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
676 if ( ( nUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
677 // enum value starting with 1
678 --nIntValue;
680 ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
681 if ( ( nIntValue >= 0 ) && ( nIntValue < (sal_Int32)aEnumStrings.size() ) )
683 sReturn = aEnumStrings[ nIntValue ];
685 else
687 DBG_ERROR( "DefaultEnumRepresentation::getDescriptionForValue: could not translate an enum value" );
689 return sReturn;
692 //--------------------------------------------------------------------
693 oslInterlockedCount SAL_CALL DefaultEnumRepresentation::acquire()
695 return osl_incrementInterlockedCount( &m_refCount );
698 //--------------------------------------------------------------------
699 oslInterlockedCount SAL_CALL DefaultEnumRepresentation::release()
701 if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
703 delete this;
704 return 0;
706 return m_refCount;
709 //............................................................................
710 } // namespace pcr
711 //............................................................................