Bump for 3.6-28
[LibreOffice.git] / extensions / source / propctrlr / formmetadata.cxx
blob509b19e3ced416b07dbd3ef70ad5bd56733f39f6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "formmetadata.hxx"
30 #include "formstrings.hxx"
31 #include "formresid.hrc"
32 #include "propctrlr.hrc"
33 #include <svtools/localresaccess.hxx>
34 #include <tools/debug.hxx>
35 #include <comphelper/extract.hxx>
36 #include <sal/macros.h>
37 #include <algorithm>
38 #include <functional>
40 //............................................................................
41 namespace pcr
43 //............................................................................
45 using namespace ::com::sun::star::uno;
47 //========================================================================
48 //= OPropertyInfoImpl
49 //========================================================================
50 struct OPropertyInfoImpl
52 String sName;
53 String sTranslation;
54 rtl::OString sHelpId;
55 sal_Int32 nId;
56 sal_uInt16 nPos;
57 sal_uInt32 nUIFlags;
59 OPropertyInfoImpl(
60 const ::rtl::OUString& rName,
61 sal_Int32 _nId,
62 const String& aTranslation,
63 sal_uInt16 nPosId,
64 const rtl::OString&,
65 sal_uInt32 _nUIFlags);
68 //------------------------------------------------------------------------
69 OPropertyInfoImpl::OPropertyInfoImpl(const ::rtl::OUString& _rName, sal_Int32 _nId,
70 const String& aString, sal_uInt16 nP, const rtl::OString& sHid, sal_uInt32 _nUIFlags)
71 :sName(_rName)
72 ,sTranslation(aString)
73 ,sHelpId(sHid)
74 ,nId(_nId)
75 ,nPos(nP)
76 ,nUIFlags(_nUIFlags)
80 //------------------------------------------------------------------------
81 // Compare PropertyInfo
82 struct PropertyInfoLessByName : public ::std::binary_function< OPropertyInfoImpl, OPropertyInfoImpl, bool >
84 bool operator()( const OPropertyInfoImpl& _rLHS, const OPropertyInfoImpl& _rRHS )
86 return _rLHS.sName.CompareTo( _rRHS.sName ) == COMPARE_LESS;
90 //========================================================================
91 //= OPropertyInfoService
92 //========================================================================
93 #define DEF_INFO( ident, uinameres, helpid, flags ) \
94 OPropertyInfoImpl( PROPERTY_##ident, PROPERTY_ID_##ident, \
95 String( PcrRes( RID_STR_##uinameres ) ), nPos++, HID_PROP_##helpid, flags )
97 #define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \
98 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 )
100 #define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \
101 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 )
103 #define DEF_INFO_3( ident, uinameres, helpid, flag1, flag2, flag3 ) \
104 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 )
106 #define DEF_INFO_4( ident, uinameres, helpid, flag1, flag2, flag3, flag4 ) \
107 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 )
109 #define DEF_INFO_5( ident, uinameres, helpid, flag1, flag2, flag3, flag4, flag5 ) \
110 DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 | PROP_FLAG_##flag5 )
112 sal_uInt16 OPropertyInfoService::s_nCount = 0;
113 OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = NULL;
114 //------------------------------------------------------------------------
115 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo()
117 if ( s_pPropertyInfos )
118 return s_pPropertyInfos;
120 PcrClient aResourceAccess;
121 // this ensures that we have our resource file loaded
123 sal_uInt16 nPos = 1;
125 static OPropertyInfoImpl aPropertyInfos[] =
128 DEF_INFO_?( propname and id, resoure id, help id, flags ),
130 DEF_INFO_3( NAME, NAME, NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
131 DEF_INFO_2( TITLE, TITLE, TITLE, FORM_VISIBLE, DIALOG_VISIBLE ),
132 DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
133 DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ),
134 DEF_INFO_3( WRITING_MODE, WRITING_MODE, WRITING_MODE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
135 DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
136 DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ),
137 DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
138 DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
139 DEF_INFO_3( LITERALMASK, LITERALMASK, LITERALMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
140 DEF_INFO_3( STRICTFORMAT, STRICTFORMAT, STRICTFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
141 DEF_INFO_3( ENABLED, ENABLED, ENABLED, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
142 DEF_INFO_3( ENABLE_VISIBLE, ENABLE_VISIBLE, ENABLE_VISIBLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
143 DEF_INFO_3( READONLY, READONLY, READONLY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
144 DEF_INFO_3( PRINTABLE, PRINTABLE, PRINTABLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
145 DEF_INFO_3( STEP, STEP, STEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
146 DEF_INFO_3( TABSTOP, TABSTOP, TABSTOP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
147 DEF_INFO_2( TABINDEX, TABINDEX, TABINDEX, FORM_VISIBLE, DIALOG_VISIBLE ),
148 DEF_INFO_3( WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, FORM_VISIBLE, ENUM, COMPOSEABLE ),
150 DEF_INFO_2( BOUND_CELL, BOUND_CELL, BOUND_CELL, FORM_VISIBLE, DATA_PROPERTY ),
151 DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ),
152 DEF_INFO_2( LIST_CELL_RANGE, LIST_CELL_RANGE, LIST_CELL_RANGE, FORM_VISIBLE, DATA_PROPERTY ),
153 DEF_INFO_3( CONTROLSOURCE, CONTROLSOURCE, CONTROLSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
154 DEF_INFO_3( EMPTY_IS_NULL, EMPTY_IS_NULL, EMPTY_IS_NULL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
155 DEF_INFO_3( INPUT_REQUIRED, INPUT_REQUIRED, INPUT_REQUIRED, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
156 DEF_INFO_3( REFVALUE, REFVALUE, REFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
157 DEF_INFO_3( UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
158 DEF_INFO_3( DATASOURCE, DATASOURCE, DATASOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
159 DEF_INFO_4( COMMANDTYPE, CURSORSOURCETYPE, CURSORSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
160 DEF_INFO_3( COMMAND, CURSORSOURCE, CURSORSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
161 DEF_INFO_3( ESCAPE_PROCESSING, ESCAPE_PROCESSING, ESCAPE_PROCESSING, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
162 DEF_INFO_3( FILTER, FILTER, FILTER, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
163 DEF_INFO_3( SORT, SORT_CRITERIA, SORT_CRITERIA, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
164 DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, FORM_VISIBLE, DATA_PROPERTY ),
165 DEF_INFO_2( DETAILFIELDS, SLAVEFIELDS, SLAVEFIELDS, FORM_VISIBLE, DATA_PROPERTY ),
166 DEF_INFO_3( ALLOWADDITIONS, ALLOW_ADDITIONS, ALLOW_ADDITIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
167 DEF_INFO_3( ALLOWEDITS, ALLOW_EDITS, ALLOW_EDITS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
168 DEF_INFO_3( ALLOWDELETIONS, ALLOW_DELETIONS, ALLOW_DELETIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
169 DEF_INFO_3( INSERTONLY, DATAENTRY, DATAENTRY, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
170 DEF_INFO_4( NAVIGATION, NAVIGATION, NAVIGATION, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
171 DEF_INFO_4( CYCLE, CYCLE, CYCLE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
172 DEF_INFO_3( FILTERPROPOSAL, FILTERPROPOSAL, FILTERPROPOSAL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
173 DEF_INFO_4( LISTSOURCETYPE, LISTSOURCETYPE, LISTSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
174 DEF_INFO_3( LISTSOURCE, LISTSOURCE, LISTSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
175 DEF_INFO_3( BOUNDCOLUMN, BOUNDCOLUMN, BOUNDCOLUMN, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
177 // <!----------------->
178 // XML node binding
179 DEF_INFO_2( LIST_BINDING, LIST_BINDING, LIST_BINDING, FORM_VISIBLE, DATA_PROPERTY ),
180 DEF_INFO_2( XML_DATA_MODEL, XML_DATA_MODEL, XML_DATA_MODEL, FORM_VISIBLE, DATA_PROPERTY ),
181 DEF_INFO_2( BINDING_NAME, BINDING_NAME, BINDING_NAME, FORM_VISIBLE, DATA_PROPERTY ),
182 DEF_INFO_2( BIND_EXPRESSION, BIND_EXPRESSION, BIND_EXPRESSION, FORM_VISIBLE, DATA_PROPERTY ),
183 DEF_INFO_2( XSD_REQUIRED, XSD_REQUIRED, XSD_REQUIRED, FORM_VISIBLE, DATA_PROPERTY ),
184 DEF_INFO_2( XSD_RELEVANT, XSD_RELEVANT, XSD_RELEVANT, FORM_VISIBLE, DATA_PROPERTY ),
185 DEF_INFO_2( XSD_READONLY, XSD_READONLY, XSD_READONLY, FORM_VISIBLE, DATA_PROPERTY ),
186 DEF_INFO_2( XSD_CONSTRAINT, XSD_CONSTRAINT, XSD_CONSTRAINT, FORM_VISIBLE, DATA_PROPERTY ),
187 DEF_INFO_2( XSD_CALCULATION, XSD_CALCULATION, XSD_CALCULATION, FORM_VISIBLE, DATA_PROPERTY ),
189 // data type
190 DEF_INFO_2( XSD_DATA_TYPE, XSD_DATA_TYPE, XSD_DATA_TYPE, FORM_VISIBLE, DATA_PROPERTY ),
191 // data types facets
192 // common
193 DEF_INFO_3( XSD_WHITESPACES, XSD_WHITESPACES, XSD_WHITESPACES, FORM_VISIBLE, DATA_PROPERTY, ENUM ),
194 DEF_INFO_2( XSD_PATTERN, XSD_PATTERN, XSD_PATTERN, FORM_VISIBLE, DATA_PROPERTY ),
195 // string
196 DEF_INFO_2( XSD_LENGTH, XSD_LENGTH, XSD_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
197 DEF_INFO_2( XSD_MIN_LENGTH, XSD_MIN_LENGTH, XSD_MIN_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
198 DEF_INFO_2( XSD_MAX_LENGTH, XSD_MAX_LENGTH, XSD_MAX_LENGTH, FORM_VISIBLE, DATA_PROPERTY ),
199 // decimal
200 DEF_INFO_2( XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, FORM_VISIBLE, DATA_PROPERTY ),
201 DEF_INFO_2( XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,FORM_VISIBLE, DATA_PROPERTY ),
202 // int value types (year, month, day)
203 DEF_INFO_2( XSD_MAX_INCLUSIVE_INT, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
204 DEF_INFO_2( XSD_MAX_EXCLUSIVE_INT, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
205 DEF_INFO_2( XSD_MIN_INCLUSIVE_INT, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
206 DEF_INFO_2( XSD_MIN_EXCLUSIVE_INT, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
207 // double value types (double, float, decimal)
208 DEF_INFO_2( XSD_MAX_INCLUSIVE_DOUBLE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
209 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DOUBLE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
210 DEF_INFO_2( XSD_MIN_INCLUSIVE_DOUBLE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
211 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DOUBLE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
212 // date value type
213 DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
214 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
215 DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
216 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
217 // time value type
218 DEF_INFO_2( XSD_MAX_INCLUSIVE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
219 DEF_INFO_2( XSD_MAX_EXCLUSIVE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
220 DEF_INFO_2( XSD_MIN_INCLUSIVE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
221 DEF_INFO_2( XSD_MIN_EXCLUSIVE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
222 // dateTime value type
223 DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
224 DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
225 DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
226 DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
227 // <!----------------->
229 DEF_INFO_2( HIDDEN_VALUE, VALUE, HIDDEN_VALUE, FORM_VISIBLE, COMPOSEABLE ),
230 DEF_INFO_2( VALUE, VALUE, VALUE, DIALOG_VISIBLE, COMPOSEABLE ),
231 DEF_INFO_3( VALUEMIN, VALUEMIN, VALUEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
232 DEF_INFO_3( VALUEMAX, VALUEMAX, VALUEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
233 DEF_INFO_3( VALUESTEP, VALUESTEP, VALUESTEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
234 DEF_INFO_2( DEFAULT_VALUE, DEFAULTVALUE, DEFAULT_LONG_VALUE,FORM_VISIBLE, COMPOSEABLE ),
235 DEF_INFO_3( DECIMAL_ACCURACY, DECIMAL_ACCURACY, DECIMAL_ACCURACY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
236 DEF_INFO_3( SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
238 DEF_INFO_3( CURRENCYSYMBOL, CURRENCYSYMBOL, CURRENCYSYMBOL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
239 DEF_INFO_3( CURRSYM_POSITION, CURRSYM_POSITION, CURRSYM_POSITION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
241 DEF_INFO_2( DATE, DATE, DATE, DIALOG_VISIBLE, COMPOSEABLE ),
242 DEF_INFO_3( DATEMIN, DATEMIN, DATEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
243 DEF_INFO_3( DATEMAX, DATEMAX, DATEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
244 DEF_INFO_4( DATEFORMAT, DATEFORMAT, DATEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
245 DEF_INFO_2( DEFAULT_DATE, DEFAULTDATE, DEFAULT_DATE, FORM_VISIBLE, COMPOSEABLE ),
247 DEF_INFO_2( TIME, TIME, TIME, DIALOG_VISIBLE, COMPOSEABLE ),
248 DEF_INFO_3( TIMEMIN, TIMEMIN, TIMEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
249 DEF_INFO_3( TIMEMAX, TIMEMAX, TIMEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
250 DEF_INFO_4( TIMEFORMAT, TIMEFORMAT, TIMEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
251 DEF_INFO_2( DEFAULT_TIME, DEFAULTTIME, DEFAULT_TIME, FORM_VISIBLE, COMPOSEABLE ),
253 DEF_INFO_1( EFFECTIVE_VALUE, VALUE, VALUE, DIALOG_VISIBLE ),
254 DEF_INFO_3( EFFECTIVE_MIN, VALUEMIN, EFFECTIVEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
255 DEF_INFO_3( EFFECTIVE_MAX, VALUEMAX, EFFECTIVEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
256 DEF_INFO_2( EFFECTIVE_DEFAULT, DEFAULTVALUE, EFFECTIVEDEFAULT, FORM_VISIBLE, COMPOSEABLE ),
257 DEF_INFO_3( FORMATKEY, FORMATKEY, FORMATKEY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
259 DEF_INFO_3( PROGRESSVALUE, PROGRESSVALUE, PROGRESSVALUE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
260 DEF_INFO_3( PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
261 DEF_INFO_3( PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
263 DEF_INFO_2( SCROLLVALUE, SCROLLVALUE, SCROLLVALUE, DIALOG_VISIBLE, COMPOSEABLE ),
264 DEF_INFO_3( SCROLLVALUE_MIN, SCROLLVALUE_MIN, SCROLLVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
265 DEF_INFO_3( SCROLLVALUE_MAX, SCROLLVALUE_MAX, SCROLLVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
266 DEF_INFO_2( DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,FORM_VISIBLE, COMPOSEABLE ),
267 DEF_INFO_3( LINEINCREMENT, LINEINCREMENT, LINEINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
268 DEF_INFO_3( BLOCKINCREMENT, BLOCKINCREMENT, BLOCKINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
270 DEF_INFO_2( SPINVALUE, VALUE, SPINVALUE, DIALOG_VISIBLE, COMPOSEABLE ),
271 DEF_INFO_3( SPINVALUE_MIN, VALUEMIN, SPINVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
272 DEF_INFO_3( SPINVALUE_MAX, VALUEMAX, SPINVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
273 DEF_INFO_2( DEFAULT_SPINVALUE,DEFAULTVALUE, DEFAULT_SPINVALUE, FORM_VISIBLE, COMPOSEABLE ),
274 DEF_INFO_3( SPININCREMENT, VALUESTEP, SPININCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
276 DEF_INFO_3( SPIN, SPIN, SPIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
277 DEF_INFO_3( REPEAT, REPEAT, REPEAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
278 DEF_INFO_3( REPEAT_DELAY, REPEAT_DELAY, REPEAT_DELAY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
279 DEF_INFO_3( VISIBLESIZE, VISIBLESIZE, VISIBLESIZE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
280 DEF_INFO_4( ORIENTATION, ORIENTATION, ORIENTATION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
281 DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
282 DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
283 DEF_INFO_3( DEFAULT_STATE, DEFAULT_STATE, DEFAULT_STATE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
285 DEF_INFO_3( TEXT_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
286 DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
287 DEF_INFO_3( POSITIONX, POSITIONX, POSITIONX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
288 DEF_INFO_3( POSITIONY, POSITIONY, POSITIONY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
289 DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
290 DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
292 DEF_INFO_1( LISTINDEX, LISTINDEX, LISTINDEX, FORM_VISIBLE ),
293 DEF_INFO_3( STRINGITEMLIST, STRINGITEMLIST, STRINGITEMLIST, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
294 DEF_INFO_2( DEFAULT_TEXT, DEFAULTTEXT, DEFAULTVALUE, FORM_VISIBLE, COMPOSEABLE ),
295 DEF_INFO_3( FONT, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
296 DEF_INFO_4( VISUALEFFECT, VISUALEFFECT, VISUALEFFECT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ),
297 DEF_INFO_4( ALIGN, ALIGN, ALIGN, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
298 DEF_INFO_3( VERTICAL_ALIGN, VERTICAL_ALIGN, VERTICAL_ALIGN, FORM_VISIBLE, ENUM, COMPOSEABLE ),
299 DEF_INFO_3( ROWHEIGHT, ROWHEIGHT, ROWHEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
300 DEF_INFO_3( BACKGROUNDCOLOR, BACKGROUNDCOLOR, BACKGROUNDCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
301 DEF_INFO_3( SYMBOLCOLOR, SYMBOLCOLOR, SYMBOLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
302 DEF_INFO_3( FILLCOLOR, FILLCOLOR, FILLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
303 DEF_INFO_3( LINECOLOR, LINECOLOR, LINECOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
304 DEF_INFO_4( BORDER, BORDER, BORDER, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
305 DEF_INFO_3( BORDERCOLOR, BORDERCOLOR, BORDERCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
306 DEF_INFO_3( ICONSIZE, ICONSIZE, ICONSIZE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
307 DEF_INFO_2( SHOW_POSITION, SHOW_POSITION, SHOW_POSITION, FORM_VISIBLE, COMPOSEABLE ),
308 DEF_INFO_2( SHOW_NAVIGATION, SHOW_NAVIGATION, SHOW_NAVIGATION, FORM_VISIBLE, COMPOSEABLE ),
309 DEF_INFO_2( SHOW_RECORDACTIONS,SHOW_RECORDACTIONS, SHOW_RECORDACTIONS,FORM_VISIBLE, COMPOSEABLE ),
310 DEF_INFO_2( SHOW_FILTERSORT, SHOW_FILTERSORT, SHOW_FILTERSORT, FORM_VISIBLE, COMPOSEABLE ),
312 DEF_INFO_3( DROPDOWN, DROPDOWN, DROPDOWN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
313 DEF_INFO_3( LINECOUNT, LINECOUNT, LINECOUNT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
314 DEF_INFO_3( AUTOCOMPLETE, AUTOCOMPLETE, AUTOCOMPLETE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
315 DEF_INFO_3( MULTILINE, MULTILINE, MULTILINE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
316 DEF_INFO_3( WORDBREAK, WORDBREAK, WORDBREAK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
317 DEF_INFO_3( TEXTTYPE, TEXTTYPE, TEXTTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
318 DEF_INFO_3( LINEEND_FORMAT, LINEEND_FORMAT, LINEEND_FORMAT, FORM_VISIBLE, ENUM_ONE, COMPOSEABLE ),
319 DEF_INFO_3( MULTISELECTION, MULTISELECTION, MULTISELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
320 DEF_INFO_4( SHOW_SCROLLBARS, SHOW_SCROLLBARS, SHOW_SCROLLBARS, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
321 DEF_INFO_3( HSCROLL, HSCROLL, HSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
322 DEF_INFO_3( VSCROLL, VSCROLL, VSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
323 DEF_INFO_3( BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
324 DEF_INFO_2( XFORMS_BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM ),
325 DEF_INFO_1( SUBMISSION_ID, SUBMISSION_ID, SUBMISSION_ID, FORM_VISIBLE ),
326 DEF_INFO_2( PUSHBUTTONTYPE, PUSHBUTTONTYPE, PUSHBUTTONTYPE, DIALOG_VISIBLE, ENUM ),
327 DEF_INFO_2( TARGET_URL, TARGET_URL, TARGET_URL, FORM_VISIBLE, COMPOSEABLE ),
328 DEF_INFO_1( TARGET_FRAME, TARGET_FRAME, TARGET_FRAME, FORM_VISIBLE ),
329 DEF_INFO_2( SUBMIT_ACTION, SUBMIT_ACTION, SUBMIT_ACTION, FORM_VISIBLE, COMPOSEABLE ),
330 DEF_INFO_2( SUBMIT_TARGET, SUBMIT_TARGET, SUBMIT_TARGET, FORM_VISIBLE, COMPOSEABLE ),
331 DEF_INFO_3( SUBMIT_ENCODING, SUBMIT_ENCODING, SUBMIT_ENCODING, FORM_VISIBLE, ENUM, COMPOSEABLE ),
332 DEF_INFO_3( SUBMIT_METHOD, SUBMIT_METHOD, SUBMIT_METHOD, FORM_VISIBLE, ENUM, COMPOSEABLE ),
333 DEF_INFO_3( STATE, STATE, STATE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
334 DEF_INFO_3( DEFAULTBUTTON, DEFAULT_BUTTON, DEFAULT_BUTTON, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
335 DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
336 DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
337 DEF_INFO_3( SCALEIMAGE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
338 DEF_INFO_4( SCALE_MODE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE, ENUM ),
339 DEF_INFO_2( DEFAULT_SELECT_SEQ,DEFAULT_SELECT_SEQ, DEFAULT_SELECT_SEQ,FORM_VISIBLE, COMPOSEABLE ),
340 DEF_INFO_2( SELECTEDITEMS, SELECTEDITEMS, SELECTEDITEMS, DIALOG_VISIBLE, COMPOSEABLE ),
341 DEF_INFO_3( ECHO_CHAR, ECHO_CHAR, ECHO_CHAR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
342 DEF_INFO_3( HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
343 DEF_INFO_3( TRISTATE, TRISTATE, TRISTATE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
344 DEF_INFO_2( HASNAVIGATION, NAVIGATION, NAVIGATIONBAR, FORM_VISIBLE, COMPOSEABLE ),
345 DEF_INFO_2( RECORDMARKER, RECORDMARKER, RECORDMARKER, FORM_VISIBLE, COMPOSEABLE ),
346 DEF_INFO_3( TAG, TAG, TAG, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
347 DEF_INFO_3( HELPTEXT, HELPTEXT, HELPTEXT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
348 DEF_INFO_3( HELPURL, HELPURL, HELPURL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
349 DEF_INFO_3( SELECTION_TYPE, SELECTION_TYPE, SELECTION_TYPE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
350 DEF_INFO_2( ROOT_DISPLAYED, ROOT_DISPLAYED, ROOT_DISPLAYED, DIALOG_VISIBLE, COMPOSEABLE ),
351 DEF_INFO_2( SHOWS_HANDLES, SHOWS_HANDLES, SHOWS_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ),
352 DEF_INFO_2( SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ),
353 DEF_INFO_2( EDITABLE, EDITABLE, EDITABLE, DIALOG_VISIBLE, COMPOSEABLE ),
354 DEF_INFO_2( INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, DIALOG_VISIBLE, COMPOSEABLE ),
355 DEF_INFO_2( DECORATION, DECORATION, DECORATION, DIALOG_VISIBLE, COMPOSEABLE ),
356 DEF_INFO_2( NOLABEL, NOLABEL, NOLABEL, DIALOG_VISIBLE, COMPOSEABLE )
359 s_pPropertyInfos = aPropertyInfos;
360 s_nCount = SAL_N_ELEMENTS(aPropertyInfos);
362 // sort
363 ::std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() );
365 #if OSL_DEBUG_LEVEL > 0
366 for ( const OPropertyInfoImpl* pCheck = s_pPropertyInfos; pCheck != s_pPropertyInfos + s_nCount - 1; ++pCheck )
368 OSL_ENSURE( pCheck->sName != ( pCheck + 1 )->sName, "OPropertyInfoService::getPropertyInfo: duplicate entry in the table!" );
370 #endif
372 return s_pPropertyInfos;
375 //------------------------------------------------------------------------
376 sal_Int32 OPropertyInfoService::getPropertyId(const String& _rName) const
378 const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName);
379 return pInfo ? pInfo->nId : -1;
382 //------------------------------------------------------------------------
383 String OPropertyInfoService::getPropertyName( sal_Int32 _nPropId )
385 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nPropId);
386 return pInfo ? pInfo->sName : String();
389 //------------------------------------------------------------------------
390 String OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const
392 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
393 return (pInfo) ? pInfo->sTranslation : String();
396 //------------------------------------------------------------------------
397 rtl::OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const
399 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
400 return (pInfo) ? pInfo->sHelpId : rtl::OString();
403 //------------------------------------------------------------------------
404 sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const
406 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
407 return (pInfo) ? pInfo->nPos : 0xFFFF;
410 //------------------------------------------------------------------------
411 sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const
413 const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
414 return (pInfo) ? pInfo->nUIFlags : 0;
417 //------------------------------------------------------------------------
418 ::std::vector< ::rtl::OUString > OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const
420 OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ),
421 "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" );
423 sal_Int16 nStringItemsResId = 0;
424 switch ( _nId )
426 case PROPERTY_ID_IMAGEPOSITION:
427 nStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION;
428 break;
429 case PROPERTY_ID_BORDER:
430 nStringItemsResId = RID_RSC_ENUM_BORDER_TYPE;
431 break;
432 case PROPERTY_ID_ICONSIZE:
433 nStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE;
434 break;
435 case PROPERTY_ID_COMMANDTYPE:
436 nStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE;
437 break;
438 case PROPERTY_ID_LISTSOURCETYPE:
439 nStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE;
440 break;
441 case PROPERTY_ID_ALIGN:
442 nStringItemsResId = RID_RSC_ENUM_ALIGNMENT;
443 break;
444 case PROPERTY_ID_VERTICAL_ALIGN:
445 nStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN;
446 break;
447 case PROPERTY_ID_BUTTONTYPE:
448 nStringItemsResId = RID_RSC_ENUM_BUTTONTYPE;
449 break;
450 case PROPERTY_ID_PUSHBUTTONTYPE:
451 nStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE;
452 break;
453 case PROPERTY_ID_SUBMIT_METHOD:
454 nStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD;
455 break;
456 case PROPERTY_ID_SUBMIT_ENCODING:
457 nStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING;
458 break;
459 case PROPERTY_ID_DATEFORMAT:
460 nStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST;
461 break;
462 case PROPERTY_ID_TIMEFORMAT:
463 nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST;
464 break;
465 case PROPERTY_ID_DEFAULT_STATE:
466 case PROPERTY_ID_STATE:
467 nStringItemsResId = RID_RSC_ENUM_CHECKED;
468 break;
469 case PROPERTY_ID_CYCLE:
470 nStringItemsResId = RID_RSC_ENUM_CYCLE;
471 break;
472 case PROPERTY_ID_NAVIGATION:
473 nStringItemsResId = RID_RSC_ENUM_NAVIGATION;
474 break;
475 case PROPERTY_ID_TARGET_FRAME:
476 nStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET;
477 break;
478 case PROPERTY_ID_ORIENTATION:
479 nStringItemsResId = RID_RSC_ENUM_ORIENTATION;
480 break;
481 case PROPERTY_ID_CELL_EXCHANGE_TYPE:
482 nStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE;
483 break;
484 case PROPERTY_ID_SHOW_SCROLLBARS:
485 nStringItemsResId = RID_RSC_ENUM_SCROLLBARS;
486 break;
487 case PROPERTY_ID_VISUALEFFECT:
488 nStringItemsResId = RID_RSC_ENUM_VISUALEFFECT;
489 break;
490 case PROPERTY_ID_TEXTTYPE:
491 nStringItemsResId = RID_RSC_ENUM_TEXTTYPE;
492 break;
493 case PROPERTY_ID_LINEEND_FORMAT:
494 nStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT;
495 break;
496 case PROPERTY_ID_XSD_WHITESPACES:
497 nStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING;
498 break;
499 case PROPERTY_ID_SELECTION_TYPE:
500 nStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE;
501 break;
502 case PROPERTY_ID_SCALE_MODE:
503 nStringItemsResId = RID_RSC_ENUM_SCALE_MODE;
504 break;
505 case PROPERTY_ID_WRITING_MODE:
506 nStringItemsResId = RID_RSC_ENUM_WRITING_MODE;
507 break;
508 case PROPERTY_ID_WHEEL_BEHAVIOR:
509 nStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR;
510 break;
511 case PROPERTY_ID_TEXT_ANCHOR_TYPE:
512 nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE;
513 break;
514 case PROPERTY_ID_SHEET_ANCHOR_TYPE:
515 nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE;
516 break;
517 default:
518 OSL_FAIL( "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" );
519 break;
522 ::std::vector< ::rtl::OUString > aReturn;
524 if ( nStringItemsResId )
526 PcrRes aResId( nStringItemsResId );
527 ::svt::OLocalResourceAccess aEnumStrings( aResId, RSC_RESOURCE );
529 sal_Int16 i = 1;
530 PcrRes aLocalId( i );
531 while ( aEnumStrings.IsAvailableRes( aLocalId.SetRT( RSC_STRING ) ) )
533 aReturn.push_back( String( aLocalId ) );
534 aLocalId = PcrRes( ++i );
538 return aReturn;
541 //------------------------------------------------------------------------
542 sal_Bool OPropertyInfoService::isComposeable( const ::rtl::OUString& _rPropertyName ) const
544 sal_Int32 nId = getPropertyId( _rPropertyName );
545 if ( nId == -1 )
546 return sal_False;
548 sal_uInt32 nFlags = getPropertyUIFlags( nId );
549 return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0;
552 //------------------------------------------------------------------------
553 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const String& _rName)
555 // Initialization
556 if(!s_pPropertyInfos)
557 getPropertyInfo();
558 OPropertyInfoImpl aSearch(_rName, 0L, String(), 0, "", 0);
560 const OPropertyInfoImpl* pInfo = ::std::lower_bound(
561 s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() );
563 if ( pInfo == s_pPropertyInfos + s_nCount )
564 return NULL;
566 if ( pInfo->sName != _rName )
567 return NULL;
569 return pInfo;
573 //------------------------------------------------------------------------
574 const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId)
576 // Initialization
577 if(!s_pPropertyInfos)
578 getPropertyInfo();
580 // TODO: a real structure which allows quick access by name as well as by id
581 for (sal_uInt16 i = 0; i < s_nCount; i++)
582 if (s_pPropertyInfos[i].nId == _nId)
583 return &s_pPropertyInfos[i];
585 return NULL;
588 //====================================================================
589 //= DefaultEnumRepresentation
590 //====================================================================
591 DBG_NAME( DefaultEnumRepresentation )
592 //--------------------------------------------------------------------
593 DefaultEnumRepresentation::DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const Type& _rType, sal_Int32 _nPropertyId )
594 :m_refCount( 0 )
595 ,m_rMetaData( _rInfo )
596 ,m_aType( _rType )
597 ,m_nPropertyId( _nPropertyId )
599 DBG_CTOR( DefaultEnumRepresentation, NULL );
602 //--------------------------------------------------------------------
603 DefaultEnumRepresentation::~DefaultEnumRepresentation()
605 DBG_DTOR( DefaultEnumRepresentation, NULL );
608 //--------------------------------------------------------------------
609 ::std::vector< ::rtl::OUString > SAL_CALL DefaultEnumRepresentation::getDescriptions() const
611 return m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
614 //--------------------------------------------------------------------
615 void SAL_CALL DefaultEnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const
617 sal_uInt32 nPropertyUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
618 ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
619 ::std::vector< ::rtl::OUString >::const_iterator pos = ::std::find( aEnumStrings.begin(), aEnumStrings.end(), _rDescription );
620 if ( pos != aEnumStrings.end() )
622 sal_Int32 nPos = pos - aEnumStrings.begin();
623 if ( ( nPropertyUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
624 // enum value starting with 1
625 ++nPos;
627 switch ( m_aType.getTypeClass() )
629 case TypeClass_ENUM:
630 _out_rValue = ::cppu::int2enum( nPos, m_aType );
631 break;
633 case TypeClass_SHORT:
634 _out_rValue <<= (sal_Int16)nPos;
635 break;
637 case TypeClass_UNSIGNED_SHORT:
638 _out_rValue <<= (sal_uInt16)nPos;
639 break;
641 case TypeClass_UNSIGNED_LONG:
642 _out_rValue <<= (sal_uInt32)nPos;
643 break;
645 default:
646 _out_rValue <<= (sal_Int32)nPos;
647 break;
650 else
652 OSL_FAIL( "DefaultEnumRepresentation::getValueFromDescription: could not translate the enum string!" );
653 _out_rValue.clear();
657 //--------------------------------------------------------------------
658 ::rtl::OUString SAL_CALL DefaultEnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const
660 ::rtl::OUString sReturn;
661 sal_Int32 nIntValue = -1;
662 OSL_VERIFY( ::cppu::enum2int( nIntValue, _rEnumValue ) );
664 sal_uInt32 nUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
665 if ( ( nUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
666 // enum value starting with 1
667 --nIntValue;
669 ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
670 if ( ( nIntValue >= 0 ) && ( nIntValue < (sal_Int32)aEnumStrings.size() ) )
672 sReturn = aEnumStrings[ nIntValue ];
674 else
676 OSL_FAIL( "DefaultEnumRepresentation::getDescriptionForValue: could not translate an enum value" );
678 return sReturn;
681 //--------------------------------------------------------------------
682 oslInterlockedCount SAL_CALL DefaultEnumRepresentation::acquire()
684 return osl_incrementInterlockedCount( &m_refCount );
687 //--------------------------------------------------------------------
688 oslInterlockedCount SAL_CALL DefaultEnumRepresentation::release()
690 if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
692 delete this;
693 return 0;
695 return m_refCount;
698 //............................................................................
699 } // namespace pcr
700 //............................................................................
702 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */