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