update dev300-m58
[ooovba.git] / forms / source / misc / property.cxx
blob6ccc8aae6d0c92575239bed7c2873bf8a8040765
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: property.cxx,v $
10 * $Revision: 1.18 $
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_forms.hxx"
33 #include "frm_strings.hxx"
34 #include "property.hxx"
36 #ifndef _FRM_PROPERTY_HRC_
37 #include "property.hrc"
38 #endif
39 #include <cppuhelper/queryinterface.hxx>
40 #include <tools/debug.hxx>
41 #include <com/sun/star/beans/PropertyAttribute.hpp>
43 #include <algorithm>
45 //... namespace frm .......................................................
46 namespace frm
48 //.........................................................................
50 //==================================================================
51 //= PropertyInfoService
52 //==================================================================
53 PropertyInfoService::PropertyMap PropertyInfoService::s_AllKnownProperties;
54 //------------------------------------------------------------------
55 sal_Int32 PropertyInfoService::getPropertyId(const ::rtl::OUString& _rName)
57 initialize();
59 PropertyAssignment aCompareName(_rName, -1);
61 ::std::pair<PropertyMapIterator,PropertyMapIterator> aPair = equal_range(
62 s_AllKnownProperties.begin(),
63 s_AllKnownProperties.end(),
64 aCompareName,
65 PropertyAssignmentNameCompareLess());
67 sal_Int32 nHandle = -1;
68 if (aPair.first != aPair.second)
69 { // we found something _and_ we have an identity
70 nHandle = aPair.first->nHandle;
73 return nHandle;
76 //------------------------------------------------------------------
77 sal_Int32 ConcreteInfoService::getPreferedPropertyId(const ::rtl::OUString& _rName)
79 return PropertyInfoService::getPropertyId(_rName);
82 //------------------------------------------------------------------
83 #define ADD_PROP_ASSIGNMENT(varname) \
84 s_AllKnownProperties.push_back(PropertyAssignment(PROPERTY_##varname, PROPERTY_ID_##varname))
85 //..................................................................
86 void PropertyInfoService::initialize()
88 if (!s_AllKnownProperties.empty())
89 return;
91 s_AllKnownProperties.reserve(220);
93 ADD_PROP_ASSIGNMENT(NAME);
94 ADD_PROP_ASSIGNMENT(TAG);
95 ADD_PROP_ASSIGNMENT(TABINDEX);
96 ADD_PROP_ASSIGNMENT(CLASSID);
97 ADD_PROP_ASSIGNMENT(ALIGN);
98 ADD_PROP_ASSIGNMENT(FETCHSIZE);
99 ADD_PROP_ASSIGNMENT(VALUE);
100 ADD_PROP_ASSIGNMENT(VALUEMIN);
101 ADD_PROP_ASSIGNMENT(VALUEMAX);
102 ADD_PROP_ASSIGNMENT(VALUESTEP);
103 ADD_PROP_ASSIGNMENT(TEXT);
104 ADD_PROP_ASSIGNMENT(LABEL);
105 ADD_PROP_ASSIGNMENT(NAVIGATION);
106 ADD_PROP_ASSIGNMENT(CYCLE);
107 ADD_PROP_ASSIGNMENT(CONTROLSOURCE);
108 ADD_PROP_ASSIGNMENT(ENABLED);
109 ADD_PROP_ASSIGNMENT(ENABLEVISIBLE);
110 ADD_PROP_ASSIGNMENT(SPIN);
111 ADD_PROP_ASSIGNMENT(READONLY);
112 ADD_PROP_ASSIGNMENT(FILTER);
113 ADD_PROP_ASSIGNMENT(WIDTH);
114 ADD_PROP_ASSIGNMENT(SEARCHABLE);
115 ADD_PROP_ASSIGNMENT(MULTILINE);
116 ADD_PROP_ASSIGNMENT(TARGET_URL);
117 ADD_PROP_ASSIGNMENT(DEFAULTCONTROL);
118 ADD_PROP_ASSIGNMENT(MAXTEXTLEN);
119 ADD_PROP_ASSIGNMENT(SIZE);
120 ADD_PROP_ASSIGNMENT(DATE);
121 ADD_PROP_ASSIGNMENT(TIME);
122 ADD_PROP_ASSIGNMENT(STATE);
123 ADD_PROP_ASSIGNMENT(TRISTATE);
124 ADD_PROP_ASSIGNMENT(HIDDEN_VALUE);
125 ADD_PROP_ASSIGNMENT(TARGET_FRAME);
126 ADD_PROP_ASSIGNMENT(BUTTONTYPE);
127 ADD_PROP_ASSIGNMENT(STRINGITEMLIST);
128 ADD_PROP_ASSIGNMENT(DEFAULT_TEXT);
129 ADD_PROP_ASSIGNMENT(DEFAULT_STATE);
130 ADD_PROP_ASSIGNMENT(DEFAULT_DATE);
131 ADD_PROP_ASSIGNMENT(DEFAULT_TIME);
132 ADD_PROP_ASSIGNMENT(DEFAULT_VALUE);
133 ADD_PROP_ASSIGNMENT(FORMATKEY);
134 ADD_PROP_ASSIGNMENT(FORMATSSUPPLIER);
135 ADD_PROP_ASSIGNMENT(SUBMIT_ACTION);
136 ADD_PROP_ASSIGNMENT(SUBMIT_TARGET);
137 ADD_PROP_ASSIGNMENT(SUBMIT_METHOD);
138 ADD_PROP_ASSIGNMENT(SUBMIT_ENCODING);
139 ADD_PROP_ASSIGNMENT(IMAGE_URL);
140 ADD_PROP_ASSIGNMENT(EMPTY_IS_NULL);
141 ADD_PROP_ASSIGNMENT(LISTSOURCETYPE);
142 ADD_PROP_ASSIGNMENT(LISTSOURCE);
143 ADD_PROP_ASSIGNMENT(SELECT_SEQ);
144 ADD_PROP_ASSIGNMENT(VALUE_SEQ);
145 ADD_PROP_ASSIGNMENT(DEFAULT_SELECT_SEQ);
146 ADD_PROP_ASSIGNMENT(MULTISELECTION);
147 ADD_PROP_ASSIGNMENT(DECIMAL_ACCURACY);
148 ADD_PROP_ASSIGNMENT(EDITMASK);
149 ADD_PROP_ASSIGNMENT(ISREADONLY);
150 ADD_PROP_ASSIGNMENT(FIELDTYPE);
151 ADD_PROP_ASSIGNMENT(DECIMALS);
152 ADD_PROP_ASSIGNMENT(REFVALUE);
153 ADD_PROP_ASSIGNMENT(STRICTFORMAT);
154 ADD_PROP_ASSIGNMENT(DATASOURCE);
155 ADD_PROP_ASSIGNMENT(ALLOWADDITIONS);
156 ADD_PROP_ASSIGNMENT(ALLOWEDITS);
157 ADD_PROP_ASSIGNMENT(ALLOWDELETIONS);
158 ADD_PROP_ASSIGNMENT(MASTERFIELDS);
159 ADD_PROP_ASSIGNMENT(ISPASSTHROUGH);
160 ADD_PROP_ASSIGNMENT(QUERY);
161 ADD_PROP_ASSIGNMENT(LITERALMASK);
162 ADD_PROP_ASSIGNMENT(SHOWTHOUSANDSEP);
163 ADD_PROP_ASSIGNMENT(CURRENCYSYMBOL);
164 ADD_PROP_ASSIGNMENT(DATEFORMAT);
165 ADD_PROP_ASSIGNMENT(DATEMIN);
166 ADD_PROP_ASSIGNMENT(DATEMAX);
167 ADD_PROP_ASSIGNMENT(DATE_SHOW_CENTURY);
168 ADD_PROP_ASSIGNMENT(TIMEFORMAT);
169 ADD_PROP_ASSIGNMENT(TIMEMIN);
170 ADD_PROP_ASSIGNMENT(TIMEMAX);
171 ADD_PROP_ASSIGNMENT(LINECOUNT);
172 ADD_PROP_ASSIGNMENT(BOUNDCOLUMN);
173 ADD_PROP_ASSIGNMENT(HASNAVIGATION);
174 ADD_PROP_ASSIGNMENT(FONT);
175 ADD_PROP_ASSIGNMENT(BACKGROUNDCOLOR);
176 ADD_PROP_ASSIGNMENT(FILLCOLOR);
177 ADD_PROP_ASSIGNMENT(TEXTCOLOR);
178 ADD_PROP_ASSIGNMENT(LINECOLOR);
179 ADD_PROP_ASSIGNMENT(BORDER);
180 ADD_PROP_ASSIGNMENT(DROPDOWN);
181 ADD_PROP_ASSIGNMENT(HSCROLL);
182 ADD_PROP_ASSIGNMENT(VSCROLL);
183 ADD_PROP_ASSIGNMENT(TABSTOP);
184 ADD_PROP_ASSIGNMENT(AUTOCOMPLETE);
185 ADD_PROP_ASSIGNMENT(HARDLINEBREAKS);
186 ADD_PROP_ASSIGNMENT(PRINTABLE);
187 ADD_PROP_ASSIGNMENT(ECHO_CHAR);
188 ADD_PROP_ASSIGNMENT(ROWHEIGHT);
189 ADD_PROP_ASSIGNMENT(HELPTEXT);
190 ADD_PROP_ASSIGNMENT(FONT_NAME);
191 ADD_PROP_ASSIGNMENT(FONT_STYLENAME);
192 ADD_PROP_ASSIGNMENT(FONT_FAMILY);
193 ADD_PROP_ASSIGNMENT(FONT_CHARSET);
194 ADD_PROP_ASSIGNMENT(FONT_HEIGHT);
195 ADD_PROP_ASSIGNMENT(FONT_WEIGHT);
196 ADD_PROP_ASSIGNMENT(FONT_SLANT);
197 ADD_PROP_ASSIGNMENT(FONT_UNDERLINE);
198 ADD_PROP_ASSIGNMENT(FONT_WORDLINEMODE);
199 ADD_PROP_ASSIGNMENT(FONT_STRIKEOUT);
200 ADD_PROP_ASSIGNMENT(TEXTLINECOLOR);
201 ADD_PROP_ASSIGNMENT(FONTEMPHASISMARK);
202 ADD_PROP_ASSIGNMENT(FONTRELIEF);
203 ADD_PROP_ASSIGNMENT(HELPURL);
204 ADD_PROP_ASSIGNMENT(RECORDMARKER);
205 ADD_PROP_ASSIGNMENT(BOUNDFIELD);
206 ADD_PROP_ASSIGNMENT(INPUT_REQUIRED);
207 ADD_PROP_ASSIGNMENT(TREATASNUMERIC);
208 ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE);
209 ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT);
210 ADD_PROP_ASSIGNMENT(EFFECTIVE_MIN);
211 ADD_PROP_ASSIGNMENT(EFFECTIVE_MAX);
212 ADD_PROP_ASSIGNMENT(HIDDEN);
213 ADD_PROP_ASSIGNMENT(FILTERPROPOSAL);
214 ADD_PROP_ASSIGNMENT(FIELDSOURCE);
215 ADD_PROP_ASSIGNMENT(TABLENAME);
216 ADD_PROP_ASSIGNMENT(CONTROLLABEL);
217 ADD_PROP_ASSIGNMENT(CURRSYM_POSITION);
218 ADD_PROP_ASSIGNMENT(CURSORCOLOR);
219 ADD_PROP_ASSIGNMENT(ALWAYSSHOWCURSOR);
220 ADD_PROP_ASSIGNMENT(DISPLAYSYNCHRON);
221 ADD_PROP_ASSIGNMENT(ISMODIFIED);
222 ADD_PROP_ASSIGNMENT(ISNEW);
223 ADD_PROP_ASSIGNMENT(PRIVILEGES);
224 ADD_PROP_ASSIGNMENT(DETAILFIELDS);
225 ADD_PROP_ASSIGNMENT(COMMAND);
226 ADD_PROP_ASSIGNMENT(COMMANDTYPE);
227 ADD_PROP_ASSIGNMENT(RESULTSET_CONCURRENCY);
228 ADD_PROP_ASSIGNMENT(INSERTONLY);
229 ADD_PROP_ASSIGNMENT(RESULTSET_TYPE);
230 ADD_PROP_ASSIGNMENT(ESCAPE_PROCESSING);
231 ADD_PROP_ASSIGNMENT(APPLYFILTER);
232 ADD_PROP_ASSIGNMENT(ISNULLABLE);
233 ADD_PROP_ASSIGNMENT(ACTIVECOMMAND);
234 ADD_PROP_ASSIGNMENT(ISCURRENCY);
235 ADD_PROP_ASSIGNMENT(URL);
236 ADD_PROP_ASSIGNMENT(TITLE);
237 ADD_PROP_ASSIGNMENT(ACTIVE_CONNECTION);
238 ADD_PROP_ASSIGNMENT(SCALE);
239 ADD_PROP_ASSIGNMENT(SORT);
240 ADD_PROP_ASSIGNMENT(PERSISTENCE_MAXTEXTLENGTH);
241 ADD_PROP_ASSIGNMENT(SCROLL_VALUE);
242 ADD_PROP_ASSIGNMENT(SPIN_VALUE);
243 ADD_PROP_ASSIGNMENT(DEFAULT_SCROLL_VALUE);
244 ADD_PROP_ASSIGNMENT(DEFAULT_SPIN_VALUE);
245 ADD_PROP_ASSIGNMENT( WRITING_MODE );
246 ADD_PROP_ASSIGNMENT( CONTEXT_WRITING_MODE );
248 // now sort the array by name
250 std::sort(
251 s_AllKnownProperties.begin(),
252 s_AllKnownProperties.end(),
253 PropertyAssignmentNameCompareLess()
257 //.........................................................................
259 //... namespace frm .......................................................