1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_extensions.hxx"
26 #include "formmetadata.hxx"
27 #ifndef _EXTENSIONS_FORMCTRLR_FORMHELPID_HRC_
28 #include "propctrlr.hrc"
29 #endif
30 #include "formstrings.hxx"
31 #ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_
32 #include "formresid.hrc"
33 #endif
34 #include "propctrlr.hrc"
35 #include <svtools/localresaccess.hxx>
36 #include <tools/debug.hxx>
37 #include <comphelper/extract.hxx>
38 
39 #include <algorithm>
40 #include <functional>
41 
42 //............................................................................
43 namespace pcr
44 {
45 //............................................................................
46 
47 	using namespace ::com::sun::star::uno;
48 
49 	//========================================================================
50 	//= OPropertyInfoImpl
51 	//========================================================================
52 	struct OPropertyInfoImpl
53 	{
54 		String			sName;
55 		String			sTranslation;
56 		rtl::OString    sHelpId;
57 		sal_Int32       nId;
58 		sal_uInt16      nPos;
59         sal_uInt32      nUIFlags;
60 
61 		OPropertyInfoImpl(
62 						const ::rtl::OUString&		rName,
63 						sal_Int32					_nId,
64 						const String&				aTranslation,
65 						sal_uInt16					nPosId,
66                         const rtl::OString&,
67                         sal_uInt32                  _nUIFlags);
68 	};
69 
70 	//------------------------------------------------------------------------
OPropertyInfoImpl(const::rtl::OUString & _rName,sal_Int32 _nId,const String & aString,sal_uInt16 nP,const rtl::OString & sHid,sal_uInt32 _nUIFlags)71 	OPropertyInfoImpl::OPropertyInfoImpl(const ::rtl::OUString& _rName, sal_Int32 _nId,
72 								   const String& aString, sal_uInt16 nP, const rtl::OString& sHid, sal_uInt32 _nUIFlags)
73 	   :sName(_rName)
74 	   ,sTranslation(aString)
75 	   ,sHelpId(sHid)
76 	   ,nId(_nId)
77 	   ,nPos(nP)
78        ,nUIFlags(_nUIFlags)
79 	{
80 	}
81 
82 	//------------------------------------------------------------------------
83 	// Vergleichen von PropertyInfo
84     struct PropertyInfoLessByName : public ::std::binary_function< OPropertyInfoImpl, OPropertyInfoImpl, bool >
85     {
operator ()pcr::PropertyInfoLessByName86         bool operator()( const OPropertyInfoImpl& _rLHS, const OPropertyInfoImpl& _rRHS )
87         {
88             return _rLHS.sName.CompareTo( _rRHS.sName ) == COMPARE_LESS;
89         }
90     };
91 
92 	//========================================================================
93 	//= OPropertyInfoService
94 	//========================================================================
95 #define DEF_INFO( ident, uinameres, helpid, flags )   \
96     OPropertyInfoImpl( PROPERTY_##ident, PROPERTY_ID_##ident, \
97             String( PcrRes( RID_STR_##uinameres ) ), nPos++, HID_PROP_##helpid, flags )
98 
99 #define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \
100     DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 )
101 
102 #define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \
103     DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 )
104 
105 #define DEF_INFO_3( ident, uinameres, helpid, flag1, flag2, flag3 ) \
106     DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 )
107 
108 #define DEF_INFO_4( ident, uinameres, helpid, flag1, flag2, flag3, flag4 ) \
109     DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 )
110 
111 #define DEF_INFO_5( ident, uinameres, helpid, flag1, flag2, flag3, flag4, flag5 ) \
112     DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 | PROP_FLAG_##flag5 )
113 
114     sal_uInt16				OPropertyInfoService::s_nCount = 0;
115 	OPropertyInfoImpl*		OPropertyInfoService::s_pPropertyInfos = NULL;
116 	//------------------------------------------------------------------------
getPropertyInfo()117 	const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo()
118 	{
119 		if ( s_pPropertyInfos )
120             return s_pPropertyInfos;
121 
122 		PcrClient aResourceAccess;
123 		// this ensures that we have our resource file loaded
124 
125 		sal_uInt16 nPos = 1;
126 
127         static OPropertyInfoImpl aPropertyInfos[] =
128 		{
129         /*
130         DEF_INFO_?( propname and id,   resoure id,         help id,           flags ),
131         */
132         DEF_INFO_3( NAME,              NAME,               NAME,              FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
133         DEF_INFO_2( TITLE,             TITLE,              TITLE,             FORM_VISIBLE, DIALOG_VISIBLE ),
134         DEF_INFO_3( LABEL,             LABEL,              LABEL,             FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
135         DEF_INFO_2( CONTROLLABEL,      LABELCONTROL,       CONTROLLABEL,      FORM_VISIBLE, COMPOSEABLE ),
136         DEF_INFO_3( WRITING_MODE,      WRITING_MODE,       WRITING_MODE,      FORM_VISIBLE, ENUM, COMPOSEABLE ),
137         DEF_INFO_2( TEXT,              TEXT,               TEXT,              DIALOG_VISIBLE, COMPOSEABLE ),
138         DEF_INFO_3( MAXTEXTLEN,        MAXTEXTLEN,         MAXTEXTLEN,        FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
139         DEF_INFO_3( EDITMASK,          EDITMASK,           EDITMASK,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
140         DEF_INFO_3( LITERALMASK,       LITERALMASK,        LITERALMASK,       FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
141         DEF_INFO_3( STRICTFORMAT,      STRICTFORMAT,       STRICTFORMAT,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
142         DEF_INFO_3( ENABLED,           ENABLED,            ENABLED,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
143         DEF_INFO_3( ENABLE_VISIBLE,    ENABLE_VISIBLE,     ENABLE_VISIBLE,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
144         DEF_INFO_3( READONLY,          READONLY,           READONLY,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
145         DEF_INFO_3( PRINTABLE,         PRINTABLE,          PRINTABLE,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
146         DEF_INFO_3( STEP,              STEP,               STEP,              FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
147         DEF_INFO_3( TABSTOP,           TABSTOP,            TABSTOP,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
148         DEF_INFO_2( TABINDEX,          TABINDEX,           TABINDEX,          FORM_VISIBLE, DIALOG_VISIBLE ),
149         DEF_INFO_3( WHEEL_BEHAVIOR,    WHEEL_BEHAVIOR,     WHEEL_BEHAVIOR,    FORM_VISIBLE, ENUM, COMPOSEABLE ),
150 
151         DEF_INFO_2( BOUND_CELL,        BOUND_CELL,         BOUND_CELL,        FORM_VISIBLE, DATA_PROPERTY ),
152         DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ),
153         DEF_INFO_2( LIST_CELL_RANGE,   LIST_CELL_RANGE,    LIST_CELL_RANGE,   FORM_VISIBLE, DATA_PROPERTY ),
154         DEF_INFO_3( CONTROLSOURCE,     CONTROLSOURCE,      CONTROLSOURCE,     FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
155         DEF_INFO_3( EMPTY_IS_NULL,     EMPTY_IS_NULL,      EMPTY_IS_NULL,     FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
156         DEF_INFO_3( INPUT_REQUIRED,    INPUT_REQUIRED,     INPUT_REQUIRED,    FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
157         DEF_INFO_3( REFVALUE,          REFVALUE,           REFVALUE,          FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
158         DEF_INFO_3( UNCHECKEDREFVALUE, UNCHECKEDREFVALUE,  UNCHECKEDREFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
159         DEF_INFO_3( DATASOURCE,        DATASOURCE,         DATASOURCE,        FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
160         DEF_INFO_4( COMMANDTYPE,       CURSORSOURCETYPE,   CURSORSOURCETYPE,  FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
161         DEF_INFO_3( COMMAND,           CURSORSOURCE,       CURSORSOURCE,      FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
162         DEF_INFO_3( ESCAPE_PROCESSING, ESCAPE_PROCESSING,  ESCAPE_PROCESSING, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
163         DEF_INFO_3( FILTER,            FILTER,             FILTER,            FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
164         DEF_INFO_3( SORT,              SORT_CRITERIA,      SORT_CRITERIA,     FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
165         DEF_INFO_2( MASTERFIELDS,      MASTERFIELDS,       MASTERFIELDS,      FORM_VISIBLE, DATA_PROPERTY ),
166         DEF_INFO_2( DETAILFIELDS,      SLAVEFIELDS,        SLAVEFIELDS,       FORM_VISIBLE, DATA_PROPERTY ),
167         DEF_INFO_3( ALLOWADDITIONS,    ALLOW_ADDITIONS,    ALLOW_ADDITIONS,   FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
168         DEF_INFO_3( ALLOWEDITS,        ALLOW_EDITS,        ALLOW_EDITS,       FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
169         DEF_INFO_3( ALLOWDELETIONS,    ALLOW_DELETIONS,    ALLOW_DELETIONS,   FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
170         DEF_INFO_4( INSERTONLY,        DATAENTRY,          DATAENTRY,         FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE, COMPOSEABLE ),
171         DEF_INFO_4( NAVIGATION,        NAVIGATION,         NAVIGATION,        FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
172         DEF_INFO_4( CYCLE,             CYCLE,              CYCLE,             FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
173         DEF_INFO_3( FILTERPROPOSAL,    FILTERPROPOSAL,     FILTERPROPOSAL,    FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
174         DEF_INFO_4( LISTSOURCETYPE,    LISTSOURCETYPE,     LISTSOURCETYPE,    FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
175         DEF_INFO_3( LISTSOURCE,        LISTSOURCE,         LISTSOURCE,        FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
176         DEF_INFO_3( BOUNDCOLUMN,       BOUNDCOLUMN,        BOUNDCOLUMN,       FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
177 
178         // <!----------------->
179         // XML node binding
180         DEF_INFO_2( LIST_BINDING,      LIST_BINDING,       LIST_BINDING,      FORM_VISIBLE, DATA_PROPERTY ),
181         DEF_INFO_2( XML_DATA_MODEL,    XML_DATA_MODEL,     XML_DATA_MODEL,    FORM_VISIBLE, DATA_PROPERTY ),
182         DEF_INFO_2( BINDING_NAME,      BINDING_NAME,       BINDING_NAME,      FORM_VISIBLE, DATA_PROPERTY ),
183         DEF_INFO_2( BIND_EXPRESSION,   BIND_EXPRESSION,    BIND_EXPRESSION,   FORM_VISIBLE, DATA_PROPERTY ),
184         DEF_INFO_2( XSD_REQUIRED,      XSD_REQUIRED,       XSD_REQUIRED,      FORM_VISIBLE, DATA_PROPERTY ),
185         DEF_INFO_2( XSD_RELEVANT,      XSD_RELEVANT,       XSD_RELEVANT,      FORM_VISIBLE, DATA_PROPERTY ),
186         DEF_INFO_2( XSD_READONLY,      XSD_READONLY,       XSD_READONLY,      FORM_VISIBLE, DATA_PROPERTY ),
187         DEF_INFO_2( XSD_CONSTRAINT,    XSD_CONSTRAINT,     XSD_CONSTRAINT,    FORM_VISIBLE, DATA_PROPERTY ),
188         DEF_INFO_2( XSD_CALCULATION,   XSD_CALCULATION,    XSD_CALCULATION,   FORM_VISIBLE, DATA_PROPERTY ),
189 
190         // data type
191         DEF_INFO_2( XSD_DATA_TYPE,     XSD_DATA_TYPE,      XSD_DATA_TYPE,     FORM_VISIBLE, DATA_PROPERTY ),
192         // data types facets
193         //  common
194         DEF_INFO_3( XSD_WHITESPACES,   XSD_WHITESPACES,    XSD_WHITESPACES,   FORM_VISIBLE, DATA_PROPERTY, ENUM ),
195         DEF_INFO_2( XSD_PATTERN,       XSD_PATTERN,        XSD_PATTERN,       FORM_VISIBLE, DATA_PROPERTY ),
196         //  string
197         DEF_INFO_2( XSD_LENGTH,        XSD_LENGTH,         XSD_LENGTH,        FORM_VISIBLE, DATA_PROPERTY ),
198         DEF_INFO_2( XSD_MIN_LENGTH,    XSD_MIN_LENGTH,     XSD_MIN_LENGTH,    FORM_VISIBLE, DATA_PROPERTY ),
199         DEF_INFO_2( XSD_MAX_LENGTH,    XSD_MAX_LENGTH,     XSD_MAX_LENGTH,    FORM_VISIBLE, DATA_PROPERTY ),
200         //  decimal
201         DEF_INFO_2( XSD_TOTAL_DIGITS,   XSD_TOTAL_DIGITS,   XSD_TOTAL_DIGITS,   FORM_VISIBLE, DATA_PROPERTY ),
202         DEF_INFO_2( XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,FORM_VISIBLE, DATA_PROPERTY ),
203         //  int value types (year, month, day)
204         DEF_INFO_2( XSD_MAX_INCLUSIVE_INT, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
205         DEF_INFO_2( XSD_MAX_EXCLUSIVE_INT, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
206         DEF_INFO_2( XSD_MIN_INCLUSIVE_INT, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
207         DEF_INFO_2( XSD_MIN_EXCLUSIVE_INT, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
208         //  double value types (double, float, decimal)
209         DEF_INFO_2( XSD_MAX_INCLUSIVE_DOUBLE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
210         DEF_INFO_2( XSD_MAX_EXCLUSIVE_DOUBLE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
211         DEF_INFO_2( XSD_MIN_INCLUSIVE_DOUBLE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
212         DEF_INFO_2( XSD_MIN_EXCLUSIVE_DOUBLE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
213         // date value type
214         DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
215         DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
216         DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
217         DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
218         // time value type
219         DEF_INFO_2( XSD_MAX_INCLUSIVE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
220         DEF_INFO_2( XSD_MAX_EXCLUSIVE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
221         DEF_INFO_2( XSD_MIN_INCLUSIVE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
222         DEF_INFO_2( XSD_MIN_EXCLUSIVE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
223         // dateTime value type
224         DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
225         DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
226         DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
227         DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ),
228         // <!----------------->
229 
230         DEF_INFO_2( HIDDEN_VALUE,      VALUE,              HIDDEN_VALUE,      FORM_VISIBLE, COMPOSEABLE ),
231         DEF_INFO_2( VALUE,             VALUE,              VALUE,             DIALOG_VISIBLE, COMPOSEABLE ),
232         DEF_INFO_3( VALUEMIN,          VALUEMIN,           VALUEMIN,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
233         DEF_INFO_3( VALUEMAX,          VALUEMAX,           VALUEMAX,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
234         DEF_INFO_3( VALUESTEP,         VALUESTEP,          VALUESTEP,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
235         DEF_INFO_2( DEFAULT_VALUE,     DEFAULTVALUE,       DEFAULT_LONG_VALUE,FORM_VISIBLE, COMPOSEABLE ),
236         DEF_INFO_3( DECIMAL_ACCURACY,  DECIMAL_ACCURACY,   DECIMAL_ACCURACY,  FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
237         DEF_INFO_3( SHOWTHOUSANDSEP,   SHOWTHOUSANDSEP,    SHOWTHOUSANDSEP,   FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
238 
239         DEF_INFO_3( CURRENCYSYMBOL,    CURRENCYSYMBOL,     CURRENCYSYMBOL,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
240         DEF_INFO_3( CURRSYM_POSITION,  CURRSYM_POSITION,   CURRSYM_POSITION,  FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
241 
242         DEF_INFO_2( DATE,              DATE,               DATE,              DIALOG_VISIBLE, COMPOSEABLE ),
243         DEF_INFO_3( DATEMIN,           DATEMIN,            DATEMIN,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
244         DEF_INFO_3( DATEMAX,           DATEMAX,            DATEMAX,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
245         DEF_INFO_4( DATEFORMAT,        DATEFORMAT,         DATEFORMAT,        FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
246         DEF_INFO_2( DEFAULT_DATE,      DEFAULTDATE,        DEFAULT_DATE,      FORM_VISIBLE, COMPOSEABLE ),
247 
248         DEF_INFO_2( TIME,              TIME,               TIME,              DIALOG_VISIBLE, COMPOSEABLE ),
249         DEF_INFO_3( TIMEMIN,           TIMEMIN,            TIMEMIN,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
250         DEF_INFO_3( TIMEMAX,           TIMEMAX,            TIMEMAX,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
251         DEF_INFO_4( TIMEFORMAT,        TIMEFORMAT,         TIMEFORMAT,        FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
252         DEF_INFO_2( DEFAULT_TIME,      DEFAULTTIME,        DEFAULT_TIME,      FORM_VISIBLE, COMPOSEABLE ),
253 
254         DEF_INFO_1( EFFECTIVE_VALUE,   VALUE,              VALUE,             DIALOG_VISIBLE ),
255         DEF_INFO_3( EFFECTIVE_MIN,     VALUEMIN,           EFFECTIVEMIN,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
256         DEF_INFO_3( EFFECTIVE_MAX,     VALUEMAX,           EFFECTIVEMAX,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
257         DEF_INFO_2( EFFECTIVE_DEFAULT, DEFAULTVALUE,       EFFECTIVEDEFAULT,  FORM_VISIBLE, COMPOSEABLE ),
258         DEF_INFO_3( FORMATKEY,         FORMATKEY,          FORMATKEY,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
259 
260         DEF_INFO_3( PROGRESSVALUE,     PROGRESSVALUE,      PROGRESSVALUE,     FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
261         DEF_INFO_3( PROGRESSVALUE_MIN, PROGRESSVALUE_MIN,  PROGRESSVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
262         DEF_INFO_3( PROGRESSVALUE_MAX, PROGRESSVALUE_MAX,  PROGRESSVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
263 
264         DEF_INFO_2( SCROLLVALUE,       SCROLLVALUE,        SCROLLVALUE,       DIALOG_VISIBLE, COMPOSEABLE ),
265         DEF_INFO_3( SCROLLVALUE_MIN,   SCROLLVALUE_MIN,    SCROLLVALUE_MIN,   FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
266         DEF_INFO_3( SCROLLVALUE_MAX,   SCROLLVALUE_MAX,    SCROLLVALUE_MAX,   FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
267         DEF_INFO_2( DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,FORM_VISIBLE, COMPOSEABLE ),
268         DEF_INFO_3( LINEINCREMENT,     LINEINCREMENT,      LINEINCREMENT,     FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
269         DEF_INFO_3( BLOCKINCREMENT,    BLOCKINCREMENT,     BLOCKINCREMENT,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
270 
271         DEF_INFO_2( SPINVALUE,        VALUE,               SPINVALUE,         DIALOG_VISIBLE, COMPOSEABLE ),
272         DEF_INFO_3( SPINVALUE_MIN,    VALUEMIN,            SPINVALUE_MIN,     FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
273         DEF_INFO_3( SPINVALUE_MAX,    VALUEMAX,            SPINVALUE_MAX,     FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
274         DEF_INFO_2( DEFAULT_SPINVALUE,DEFAULTVALUE,        DEFAULT_SPINVALUE, FORM_VISIBLE, COMPOSEABLE ),
275         DEF_INFO_3( SPININCREMENT,    VALUESTEP,           SPININCREMENT,     FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
276 
277         DEF_INFO_3( SPIN,              SPIN,               SPIN,              FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
278         DEF_INFO_3( REPEAT,            REPEAT,             REPEAT,            FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
279         DEF_INFO_3( REPEAT_DELAY,      REPEAT_DELAY,       REPEAT_DELAY,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
280         DEF_INFO_3( VISIBLESIZE,       VISIBLESIZE,        VISIBLESIZE,       FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
281         DEF_INFO_4( ORIENTATION,       ORIENTATION,        ORIENTATION,       FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
282         DEF_INFO_3( FOCUSONCLICK,      FOCUSONCLICK,       FOCUSONCLICK,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
283         DEF_INFO_3( TOGGLE,            TOGGLE,             TOGGLE,            FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
284         DEF_INFO_3( DEFAULT_STATE,     DEFAULT_STATE,      DEFAULT_STATE,     FORM_VISIBLE, ENUM, COMPOSEABLE ),
285 
286         DEF_INFO_3( TEXT_ANCHOR_TYPE,  ANCHOR_TYPE,        ANCHOR_TYPE,       FORM_VISIBLE, ENUM, COMPOSEABLE ),
287         DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE,        ANCHOR_TYPE,       FORM_VISIBLE, ENUM, COMPOSEABLE ),
288         DEF_INFO_3( POSITIONX,         POSITIONX,          POSITIONX,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
289         DEF_INFO_3( POSITIONY,         POSITIONY,          POSITIONY,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
290         DEF_INFO_3( WIDTH,             WIDTH,              WIDTH,             FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
291         DEF_INFO_3( HEIGHT,            HEIGHT,             HEIGHT,            FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
292 
293         DEF_INFO_1( LISTINDEX,         LISTINDEX,          LISTINDEX,         FORM_VISIBLE ),
294         DEF_INFO_3( STRINGITEMLIST,    STRINGITEMLIST,     STRINGITEMLIST,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
295         DEF_INFO_2( DEFAULT_TEXT,      DEFAULTTEXT,        DEFAULTVALUE,      FORM_VISIBLE, COMPOSEABLE ),
296         DEF_INFO_3( FONT,              FONT,               FONT,              FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
297         DEF_INFO_4( VISUALEFFECT,      VISUALEFFECT,       VISUALEFFECT,      FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ),
298         DEF_INFO_4( ALIGN,             ALIGN,              ALIGN,             FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
299         DEF_INFO_4( VERTICAL_ALIGN,    VERTICAL_ALIGN,     VERTICAL_ALIGN,    FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
300         DEF_INFO_3( ROWHEIGHT,         ROWHEIGHT,          ROWHEIGHT,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
301         DEF_INFO_3( BACKGROUNDCOLOR,   BACKGROUNDCOLOR,    BACKGROUNDCOLOR,   FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
302         DEF_INFO_3( SYMBOLCOLOR,       SYMBOLCOLOR,        SYMBOLCOLOR,       FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
303         DEF_INFO_3( FILLCOLOR,         FILLCOLOR,          FILLCOLOR,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
304         DEF_INFO_3( LINECOLOR,         LINECOLOR,          LINECOLOR,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
305         DEF_INFO_4( BORDER,            BORDER,             BORDER,            FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
306         DEF_INFO_3( BORDERCOLOR,       BORDERCOLOR,        BORDERCOLOR,       FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
307         DEF_INFO_3( ICONSIZE,          ICONSIZE,           ICONSIZE,          FORM_VISIBLE, ENUM, COMPOSEABLE ),
308         DEF_INFO_2( SHOW_POSITION,     SHOW_POSITION,      SHOW_POSITION,     FORM_VISIBLE, COMPOSEABLE ),
309         DEF_INFO_2( SHOW_NAVIGATION,   SHOW_NAVIGATION,    SHOW_NAVIGATION,   FORM_VISIBLE, COMPOSEABLE ),
310         DEF_INFO_2( SHOW_RECORDACTIONS,SHOW_RECORDACTIONS, SHOW_RECORDACTIONS,FORM_VISIBLE, COMPOSEABLE ),
311         DEF_INFO_2( SHOW_FILTERSORT,   SHOW_FILTERSORT,    SHOW_FILTERSORT,   FORM_VISIBLE, COMPOSEABLE ),
312 
313         DEF_INFO_3( DROPDOWN,          DROPDOWN,           DROPDOWN,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
314         DEF_INFO_3( LINECOUNT,         LINECOUNT,          LINECOUNT,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
315         DEF_INFO_3( AUTOCOMPLETE,      AUTOCOMPLETE,       AUTOCOMPLETE,      FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
316         DEF_INFO_3( MULTILINE,         MULTILINE,          MULTILINE,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
317         DEF_INFO_3( WORDBREAK,         WORDBREAK,          WORDBREAK,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
318         DEF_INFO_3( TEXTTYPE,          TEXTTYPE,           TEXTTYPE,          FORM_VISIBLE, ENUM, COMPOSEABLE ),
319         DEF_INFO_3( LINEEND_FORMAT,    LINEEND_FORMAT,     LINEEND_FORMAT,    FORM_VISIBLE, ENUM_ONE, COMPOSEABLE ),
320         DEF_INFO_3( MULTISELECTION,    MULTISELECTION,     MULTISELECTION,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
321         DEF_INFO_4( SHOW_SCROLLBARS,   SHOW_SCROLLBARS,    SHOW_SCROLLBARS,   FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
322         DEF_INFO_3( HSCROLL,           HSCROLL,            HSCROLL,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
323         DEF_INFO_3( VSCROLL,           VSCROLL,            VSCROLL,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
324         DEF_INFO_3( BUTTONTYPE,        BUTTONTYPE,         BUTTONTYPE,        FORM_VISIBLE, ENUM, COMPOSEABLE ),
325         DEF_INFO_2( XFORMS_BUTTONTYPE, BUTTONTYPE,         BUTTONTYPE,        FORM_VISIBLE, ENUM ),
326         DEF_INFO_1( SUBMISSION_ID,     SUBMISSION_ID,      SUBMISSION_ID,     FORM_VISIBLE ),
327         DEF_INFO_2( PUSHBUTTONTYPE,    PUSHBUTTONTYPE,     PUSHBUTTONTYPE,    DIALOG_VISIBLE, ENUM ),
328         DEF_INFO_2( TARGET_URL,        TARGET_URL,         TARGET_URL,        FORM_VISIBLE, COMPOSEABLE ),
329         DEF_INFO_1( TARGET_FRAME,      TARGET_FRAME,       TARGET_FRAME,      FORM_VISIBLE ),
330         DEF_INFO_2( SUBMIT_ACTION,     SUBMIT_ACTION,      SUBMIT_ACTION,     FORM_VISIBLE, COMPOSEABLE ),
331         DEF_INFO_2( SUBMIT_TARGET,     SUBMIT_TARGET,      SUBMIT_TARGET,     FORM_VISIBLE, COMPOSEABLE ),
332         DEF_INFO_3( SUBMIT_ENCODING,   SUBMIT_ENCODING,    SUBMIT_ENCODING,   FORM_VISIBLE, ENUM, COMPOSEABLE ),
333         DEF_INFO_3( SUBMIT_METHOD,     SUBMIT_METHOD,      SUBMIT_METHOD,     FORM_VISIBLE, ENUM, COMPOSEABLE ),
334         DEF_INFO_3( STATE,             STATE,              STATE,             DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
335         DEF_INFO_3( DEFAULTBUTTON,     DEFAULT_BUTTON,     DEFAULT_BUTTON,    FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
336         DEF_INFO_3( IMAGE_URL,         IMAGE_URL,          IMAGE_URL,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
337         DEF_INFO_4( IMAGEPOSITION,     IMAGEPOSITION,      IMAGEPOSITION,     FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
338         DEF_INFO_3( SCALEIMAGE,        SCALEIMAGE,         SCALEIMAGE,        FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
339         DEF_INFO_4( SCALE_MODE,        SCALEIMAGE,         SCALEIMAGE,        FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE, ENUM ),
340         DEF_INFO_2( DEFAULT_SELECT_SEQ,DEFAULT_SELECT_SEQ, DEFAULT_SELECT_SEQ,FORM_VISIBLE, COMPOSEABLE ),
341         DEF_INFO_2( SELECTEDITEMS,     SELECTEDITEMS,      SELECTEDITEMS,     DIALOG_VISIBLE, COMPOSEABLE ),
342         DEF_INFO_3( ECHO_CHAR,         ECHO_CHAR,          ECHO_CHAR,         FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
343         DEF_INFO_3( HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
344         DEF_INFO_3( TRISTATE,          TRISTATE,           TRISTATE,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
345         DEF_INFO_2( HASNAVIGATION,     NAVIGATION,         NAVIGATIONBAR,     FORM_VISIBLE, COMPOSEABLE ),
346         DEF_INFO_2( RECORDMARKER,      RECORDMARKER,       RECORDMARKER,      FORM_VISIBLE, COMPOSEABLE ),
347         DEF_INFO_3( TAG,               TAG,                TAG,               FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
348         DEF_INFO_3( HELPTEXT,          HELPTEXT,           HELPTEXT,          FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
349         DEF_INFO_3( HELPURL,           HELPURL,            HELPURL,           FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
350 		DEF_INFO_3( SELECTION_TYPE,    SELECTION_TYPE,     SELECTION_TYPE,                  DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
351 		DEF_INFO_2( ROOT_DISPLAYED,    ROOT_DISPLAYED,     ROOT_DISPLAYED,                  DIALOG_VISIBLE, COMPOSEABLE ),
352 		DEF_INFO_2( SHOWS_HANDLES,     SHOWS_HANDLES,      SHOWS_HANDLES,					DIALOG_VISIBLE, COMPOSEABLE ),
353 		DEF_INFO_2( SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES,				DIALOG_VISIBLE, COMPOSEABLE ),
354 		DEF_INFO_2( EDITABLE,          EDITABLE,           EDITABLE,						DIALOG_VISIBLE, COMPOSEABLE ),
355 		DEF_INFO_2( INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, DIALOG_VISIBLE, COMPOSEABLE ),
356         DEF_INFO_2( DECORATION,        DECORATION,         DECORATION,                      DIALOG_VISIBLE, COMPOSEABLE ),
357 		DEF_INFO_2( NOLABEL,           NOLABEL,            NOLABEL,                         DIALOG_VISIBLE, COMPOSEABLE )
358 		};
359 
360 		s_pPropertyInfos = aPropertyInfos;
361 		s_nCount = sizeof(aPropertyInfos) / sizeof(OPropertyInfoImpl);
362 
363 		// sort
364         ::std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() );
365 
366 #if OSL_DEBUG_LEVEL > 0
367         for ( const OPropertyInfoImpl* pCheck = s_pPropertyInfos; pCheck != s_pPropertyInfos + s_nCount - 1; ++pCheck )
368         {
369             OSL_ENSURE( pCheck->sName != ( pCheck + 1 )->sName, "OPropertyInfoService::getPropertyInfo: duplicate entry in the table!" );
370         }
371 #endif
372 
373         return s_pPropertyInfos;
374 	}
375 
376 	//------------------------------------------------------------------------
getPropertyId(const String & _rName) const377 	sal_Int32 OPropertyInfoService::getPropertyId(const String& _rName) const
378 	{
379 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName);
380 		return pInfo ? pInfo->nId : -1;
381 	}
382 
383 	//------------------------------------------------------------------------
getPropertyName(sal_Int32 _nPropId)384 	String OPropertyInfoService::getPropertyName( sal_Int32 _nPropId )
385     {
386 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_nPropId);
387 		return pInfo ? pInfo->sName : String();
388     }
389 
390 	//------------------------------------------------------------------------
getPropertyTranslation(sal_Int32 _nId) const391 	String OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const
392 	{
393 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
394 		return (pInfo) ? pInfo->sTranslation : String();
395 	}
396 
397 	//------------------------------------------------------------------------
getPropertyHelpId(sal_Int32 _nId) const398 	rtl::OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const
399 	{
400 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
401 		return (pInfo) ? pInfo->sHelpId : rtl::OString();
402 	}
403 
404 	//------------------------------------------------------------------------
getPropertyPos(sal_Int32 _nId) const405 	sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const
406 	{
407 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
408 		return (pInfo) ? pInfo->nPos : 0xFFFF;
409 	}
410 
411 	//------------------------------------------------------------------------
getPropertyUIFlags(sal_Int32 _nId) const412 	sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const
413 	{
414 		const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
415 		return (pInfo) ? pInfo->nUIFlags : 0;
416 	}
417 
418 	//------------------------------------------------------------------------
getPropertyEnumRepresentations(sal_Int32 _nId) const419     ::std::vector< ::rtl::OUString > OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const
420 	{
421         OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ),
422             "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" );
423 
424         sal_Int16 nStringItemsResId = 0;
425         switch ( _nId )
426 		{
427             case PROPERTY_ID_IMAGEPOSITION:
428 				nStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION;
429 				break;
430 			case PROPERTY_ID_BORDER:
431 				nStringItemsResId = RID_RSC_ENUM_BORDER_TYPE;
432 				break;
433 			case PROPERTY_ID_ICONSIZE:
434 				nStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE;
435 				break;
436 			case PROPERTY_ID_COMMANDTYPE:
437 				nStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE;
438 				break;
439 			case PROPERTY_ID_LISTSOURCETYPE:
440 				nStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE;
441 				break;
442 			case PROPERTY_ID_ALIGN:
443 				nStringItemsResId = RID_RSC_ENUM_ALIGNMENT;
444 				break;
445             case PROPERTY_ID_VERTICAL_ALIGN:
446 				nStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN;
447                 break;
448 			case PROPERTY_ID_BUTTONTYPE:
449 				nStringItemsResId = RID_RSC_ENUM_BUTTONTYPE;
450 				break;
451 			case PROPERTY_ID_PUSHBUTTONTYPE:
452 				nStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE;
453 				break;
454             case PROPERTY_ID_SUBMIT_METHOD:
455 				nStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD;
456 				break;
457 			case PROPERTY_ID_SUBMIT_ENCODING:
458 				nStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING;
459 				break;
460 			case PROPERTY_ID_DATEFORMAT:
461 				nStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST;
462 				break;
463 			case PROPERTY_ID_TIMEFORMAT:
464 				nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST;
465 				break;
466 			case PROPERTY_ID_DEFAULT_STATE:
467 			case PROPERTY_ID_STATE:
468                 nStringItemsResId = RID_RSC_ENUM_CHECKED;
469 				break;
470 			case PROPERTY_ID_CYCLE:
471 				nStringItemsResId = RID_RSC_ENUM_CYCLE;
472 				break;
473 			case PROPERTY_ID_NAVIGATION:
474 				nStringItemsResId = RID_RSC_ENUM_NAVIGATION;
475 				break;
476 			case PROPERTY_ID_TARGET_FRAME:
477 				nStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET;
478 				break;
479 			case PROPERTY_ID_ORIENTATION:
480 				nStringItemsResId = RID_RSC_ENUM_ORIENTATION;
481 				break;
482             case PROPERTY_ID_CELL_EXCHANGE_TYPE:
483 				nStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE;
484 				break;
485             case PROPERTY_ID_SHOW_SCROLLBARS:
486                 nStringItemsResId = RID_RSC_ENUM_SCROLLBARS;
487                 break;
488             case PROPERTY_ID_VISUALEFFECT:
489                 nStringItemsResId = RID_RSC_ENUM_VISUALEFFECT;
490                 break;
491             case PROPERTY_ID_TEXTTYPE:
492 				nStringItemsResId = RID_RSC_ENUM_TEXTTYPE;
493                 break;
494             case PROPERTY_ID_LINEEND_FORMAT:
495 				nStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT;
496 				break;
497             case PROPERTY_ID_XSD_WHITESPACES:
498                 nStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING;
499                 break;
500             case PROPERTY_ID_SELECTION_TYPE:
501                 nStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE;
502                 break;
503             case PROPERTY_ID_SCALE_MODE:
504                 nStringItemsResId = RID_RSC_ENUM_SCALE_MODE;
505                 break;
506             case PROPERTY_ID_WRITING_MODE:
507 				nStringItemsResId = RID_RSC_ENUM_WRITING_MODE;
508                 break;
509             case PROPERTY_ID_WHEEL_BEHAVIOR:
510 				nStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR;
511                 break;
512             case PROPERTY_ID_TEXT_ANCHOR_TYPE:
513 				nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE;
514                 break;
515             case PROPERTY_ID_SHEET_ANCHOR_TYPE:
516 				nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE;
517                 break;
518             default:
519                 OSL_ENSURE( sal_False, "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" );
520                 break;
521 		}
522 
523         ::std::vector< ::rtl::OUString > aReturn;
524 
525         if ( nStringItemsResId )
526         {
527             PcrRes aResId( nStringItemsResId );
528             ::svt::OLocalResourceAccess aEnumStrings( aResId, RSC_RESOURCE );
529 
530             sal_Int16 i = 1;
531             PcrRes aLocalId( i );
532             while ( aEnumStrings.IsAvailableRes( aLocalId.SetRT( RSC_STRING ) ) )
533             {
534                 aReturn.push_back( String( aLocalId ) );
535                 aLocalId = PcrRes( ++i );
536             }
537         }
538 
539 		return aReturn;
540 	}
541 
542 	//------------------------------------------------------------------------
isComposeable(const::rtl::OUString & _rPropertyName) const543     sal_Bool OPropertyInfoService::isComposeable( const ::rtl::OUString& _rPropertyName ) const
544     {
545         sal_Int32 nId = getPropertyId( _rPropertyName );
546         if ( nId == -1 )
547             return sal_False;
548 
549         sal_uInt32 nFlags = getPropertyUIFlags( nId );
550         return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0;
551     }
552 
553 	//------------------------------------------------------------------------
getPropertyInfo(const String & _rName)554 	const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const String& _rName)
555 	{
556 		// intialisierung
557 		if(!s_pPropertyInfos)
558 			getPropertyInfo();
559 		OPropertyInfoImpl  aSearch(_rName, 0L, String(), 0, "", 0);
560 
561         const OPropertyInfoImpl* pInfo = ::std::lower_bound(
562             s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() );
563 
564         if ( pInfo == s_pPropertyInfos + s_nCount )
565             return NULL;
566 
567         if ( pInfo->sName != _rName )
568             return NULL;
569 
570 		return pInfo;
571 	}
572 
573 
574 	//------------------------------------------------------------------------
getPropertyInfo(sal_Int32 _nId)575 	const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId)
576 	{
577 		// intialisierung
578 		if(!s_pPropertyInfos)
579 			getPropertyInfo();
580 
581 		// TODO: a real structure which allows quick access by name as well as by id
582 		for (sal_uInt16 i = 0; i < s_nCount; i++)
583 			if (s_pPropertyInfos[i].nId == _nId)
584 				return &s_pPropertyInfos[i];
585 
586 		return NULL;
587 	}
588 
589 	//====================================================================
590 	//= DefaultEnumRepresentation
591 	//====================================================================
DBG_NAME(DefaultEnumRepresentation)592     DBG_NAME( DefaultEnumRepresentation )
593     //--------------------------------------------------------------------
594     DefaultEnumRepresentation::DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const Type& _rType, sal_Int32 _nPropertyId )
595         :m_refCount( 0 )
596         ,m_rMetaData( _rInfo )
597         ,m_aType( _rType )
598         ,m_nPropertyId( _nPropertyId )
599     {
600         DBG_CTOR( DefaultEnumRepresentation, NULL );
601     }
602 
603     //--------------------------------------------------------------------
~DefaultEnumRepresentation()604     DefaultEnumRepresentation::~DefaultEnumRepresentation()
605     {
606         DBG_DTOR( DefaultEnumRepresentation, NULL );
607     }
608 
609     //--------------------------------------------------------------------
getDescriptions() const610     ::std::vector< ::rtl::OUString > SAL_CALL DefaultEnumRepresentation::getDescriptions() const
611     {
612         return m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
613     }
614 
615     //--------------------------------------------------------------------
getValueFromDescription(const::rtl::OUString & _rDescription,Any & _out_rValue) const616     void SAL_CALL DefaultEnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const
617     {
618         sal_uInt32  nPropertyUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
619         ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
620         ::std::vector< ::rtl::OUString >::const_iterator pos = ::std::find( aEnumStrings.begin(), aEnumStrings.end(), _rDescription );
621         if ( pos != aEnumStrings.end() )
622         {
623             sal_Int32 nPos = pos - aEnumStrings.begin();
624             if ( ( nPropertyUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
625                 // enum value starting with 1
626                 ++nPos;
627 
628             switch ( m_aType.getTypeClass() )
629             {
630                 case TypeClass_ENUM:
631                     _out_rValue = ::cppu::int2enum( nPos, m_aType );
632                     break;
633 
634                 case TypeClass_SHORT:
635                     _out_rValue <<= (sal_Int16)nPos;
636                     break;
637 
638                 case TypeClass_UNSIGNED_SHORT:
639                     _out_rValue <<= (sal_uInt16)nPos;
640                     break;
641 
642                 case TypeClass_UNSIGNED_LONG:
643                     _out_rValue <<= (sal_uInt32)nPos;
644                     break;
645 
646                 default:
647                     _out_rValue <<= (sal_Int32)nPos;
648                     break;
649             }
650         }
651         else
652         {
653             DBG_ERROR( "DefaultEnumRepresentation::getValueFromDescription: could not translate the enum string!" );
654             _out_rValue.clear();
655         }
656     }
657 
658     //--------------------------------------------------------------------
getDescriptionForValue(const Any & _rEnumValue) const659     ::rtl::OUString SAL_CALL DefaultEnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const
660     {
661         ::rtl::OUString sReturn;
662 		sal_Int32 nIntValue = -1;
663 		OSL_VERIFY( ::cppu::enum2int( nIntValue, _rEnumValue ) );
664 
665         sal_uInt32 nUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId );
666         if ( ( nUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE )
667             // enum value starting with 1
668             --nIntValue;
669 
670         ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId );
671 		if ( ( nIntValue >= 0 ) && ( nIntValue < (sal_Int32)aEnumStrings.size() ) )
672 		{
673 			sReturn = aEnumStrings[ nIntValue ];
674 		}
675 		else
676 		{
677 			DBG_ERROR( "DefaultEnumRepresentation::getDescriptionForValue: could not translate an enum value" );
678 		}
679         return sReturn;
680     }
681 
682     //--------------------------------------------------------------------
acquire()683     oslInterlockedCount SAL_CALL DefaultEnumRepresentation::acquire()
684     {
685         return osl_incrementInterlockedCount( &m_refCount );
686     }
687 
688     //--------------------------------------------------------------------
release()689     oslInterlockedCount SAL_CALL DefaultEnumRepresentation::release()
690     {
691         if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
692         {
693            delete this;
694            return 0;
695         }
696         return m_refCount;
697     }
698 
699 //............................................................................
700 } // namespace pcr
701 //............................................................................
702 
703