xref: /trunk/main/forms/source/misc/property.cxx (revision 24acc546)
1*24acc546SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*24acc546SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*24acc546SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*24acc546SAndrew Rist  * distributed with this work for additional information
6*24acc546SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*24acc546SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*24acc546SAndrew Rist  * "License"); you may not use this file except in compliance
9*24acc546SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*24acc546SAndrew Rist  *
11*24acc546SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*24acc546SAndrew Rist  *
13*24acc546SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*24acc546SAndrew Rist  * software distributed under the License is distributed on an
15*24acc546SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*24acc546SAndrew Rist  * KIND, either express or implied.  See the License for the
17*24acc546SAndrew Rist  * specific language governing permissions and limitations
18*24acc546SAndrew Rist  * under the License.
19*24acc546SAndrew Rist  *
20*24acc546SAndrew Rist  *************************************************************/
21*24acc546SAndrew Rist 
22*24acc546SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_forms.hxx"
26cdf0e10cSrcweir #include "frm_strings.hxx"
27cdf0e10cSrcweir #include "property.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifndef _FRM_PROPERTY_HRC_
30cdf0e10cSrcweir #include "property.hrc"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx>
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <algorithm>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //... namespace frm .......................................................
39cdf0e10cSrcweir namespace frm
40cdf0e10cSrcweir {
41cdf0e10cSrcweir //.........................................................................
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //==================================================================
44cdf0e10cSrcweir //= PropertyInfoService
45cdf0e10cSrcweir //==================================================================
46cdf0e10cSrcweir PropertyInfoService::PropertyMap PropertyInfoService::s_AllKnownProperties;
47cdf0e10cSrcweir //------------------------------------------------------------------
getPropertyId(const::rtl::OUString & _rName)48cdf0e10cSrcweir sal_Int32 PropertyInfoService::getPropertyId(const ::rtl::OUString& _rName)
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	initialize();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	PropertyAssignment aCompareName(_rName, -1);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	::std::pair<PropertyMapIterator,PropertyMapIterator> aPair = equal_range(
55cdf0e10cSrcweir 		s_AllKnownProperties.begin(),
56cdf0e10cSrcweir 		s_AllKnownProperties.end(),
57cdf0e10cSrcweir 		aCompareName,
58cdf0e10cSrcweir 		PropertyAssignmentNameCompareLess());
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	sal_Int32 nHandle = -1;
61cdf0e10cSrcweir 	if (aPair.first != aPair.second)
62cdf0e10cSrcweir 	{	// we found something _and_ we have an identity
63cdf0e10cSrcweir 		nHandle = aPair.first->nHandle;
64cdf0e10cSrcweir 	}
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	return nHandle;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //------------------------------------------------------------------
getPreferedPropertyId(const::rtl::OUString & _rName)70cdf0e10cSrcweir sal_Int32 ConcreteInfoService::getPreferedPropertyId(const ::rtl::OUString& _rName)
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	return PropertyInfoService::getPropertyId(_rName);
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //------------------------------------------------------------------
76cdf0e10cSrcweir #define ADD_PROP_ASSIGNMENT(varname) \
77cdf0e10cSrcweir 	s_AllKnownProperties.push_back(PropertyAssignment(PROPERTY_##varname, PROPERTY_ID_##varname))
78cdf0e10cSrcweir //..................................................................
initialize()79cdf0e10cSrcweir void PropertyInfoService::initialize()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	if (!s_AllKnownProperties.empty())
82cdf0e10cSrcweir 		return;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	s_AllKnownProperties.reserve(220);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(NAME);
87cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TAG);
88cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TABINDEX);
89cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CLASSID);
90cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ALIGN);
91cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FETCHSIZE);
92cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VALUE);
93cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VALUEMIN);
94cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VALUEMAX);
95cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VALUESTEP);
96cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TEXT);
97cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LABEL);
98cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(NAVIGATION);
99cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CYCLE);
100cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CONTROLSOURCE);
101cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ENABLED);
102cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ENABLEVISIBLE);
103cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SPIN);
104cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(READONLY);
105cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FILTER);
106cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(WIDTH);
107cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SEARCHABLE);
108cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(MULTILINE);
109cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TARGET_URL);
110cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULTCONTROL);
111cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(MAXTEXTLEN);
112cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SIZE);
113cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATE);
114cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TIME);
115cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(STATE);
116cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TRISTATE);
117cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HIDDEN_VALUE);
118cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TARGET_FRAME);
119cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(BUTTONTYPE);
120cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(STRINGITEMLIST);
121cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_TEXT);
122cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_STATE);
123cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_DATE);
124cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_TIME);
125cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_VALUE);
126cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FORMATKEY);
127cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FORMATSSUPPLIER);
128cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SUBMIT_ACTION);
129cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SUBMIT_TARGET);
130cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SUBMIT_METHOD);
131cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SUBMIT_ENCODING);
132cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(IMAGE_URL);
133cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(GRAPHIC);
134cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EMPTY_IS_NULL);
135cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LISTSOURCETYPE);
136cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LISTSOURCE);
137cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SELECT_SEQ);
138cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VALUE_SEQ);
139cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_SELECT_SEQ);
140cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(MULTISELECTION);
141cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DECIMAL_ACCURACY);
142cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EDITMASK);
143cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISREADONLY);
144cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FIELDTYPE);
145cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DECIMALS);
146cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(REFVALUE);
147cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(STRICTFORMAT);
148cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATASOURCE);
149cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ALLOWADDITIONS);
150cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ALLOWEDITS);
151cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ALLOWDELETIONS);
152cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(MASTERFIELDS);
153cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISPASSTHROUGH);
154cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(QUERY);
155cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LITERALMASK);
156cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SHOWTHOUSANDSEP);
157cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CURRENCYSYMBOL);
158cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATEFORMAT);
159cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATEMIN);
160cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATEMAX);
161cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DATE_SHOW_CENTURY);
162cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TIMEFORMAT);
163cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TIMEMIN);
164cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TIMEMAX);
165cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LINECOUNT);
166cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(BOUNDCOLUMN);
167cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HASNAVIGATION);
168cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT);
169cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(BACKGROUNDCOLOR);
170cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FILLCOLOR);
171cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TEXTCOLOR);
172cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(LINECOLOR);
173cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(BORDER);
174cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DROPDOWN);
175cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HSCROLL);
176cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(VSCROLL);
177cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TABSTOP);
178cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(AUTOCOMPLETE);
179cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HARDLINEBREAKS);
180cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(PRINTABLE);
181cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ECHO_CHAR);
182cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ROWHEIGHT);
183cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HELPTEXT);
184cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_NAME);
185cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_STYLENAME);
186cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_FAMILY);
187cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_CHARSET);
188cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_HEIGHT);
189cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_WEIGHT);
190cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_SLANT);
191cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_UNDERLINE);
192cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_WORDLINEMODE);
193cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONT_STRIKEOUT);
194cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TEXTLINECOLOR);
195cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONTEMPHASISMARK);
196cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FONTRELIEF);
197cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HELPURL);
198cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(RECORDMARKER);
199cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(BOUNDFIELD);
200cdf0e10cSrcweir     ADD_PROP_ASSIGNMENT(INPUT_REQUIRED);
201cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TREATASNUMERIC);
202cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE);
203cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT);
204cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EFFECTIVE_MIN);
205cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(EFFECTIVE_MAX);
206cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(HIDDEN);
207cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FILTERPROPOSAL);
208cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(FIELDSOURCE);
209cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TABLENAME);
210cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CONTROLLABEL);
211cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CURRSYM_POSITION);
212cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(CURSORCOLOR);
213cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ALWAYSSHOWCURSOR);
214cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DISPLAYSYNCHRON);
215cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISMODIFIED);
216cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISNEW);
217cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(PRIVILEGES);
218cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DETAILFIELDS);
219cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(COMMAND);
220cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(COMMANDTYPE);
221cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(RESULTSET_CONCURRENCY);
222cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(INSERTONLY);
223cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(RESULTSET_TYPE);
224cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ESCAPE_PROCESSING);
225cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(APPLYFILTER);
226cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISNULLABLE);
227cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ACTIVECOMMAND);
228cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ISCURRENCY);
229cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(URL);
230cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(TITLE);
231cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(ACTIVE_CONNECTION);
232cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SCALE);
233cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SORT);
234cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(PERSISTENCE_MAXTEXTLENGTH);
235cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SCROLL_VALUE);
236cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(SPIN_VALUE);
237cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_SCROLL_VALUE);
238cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT(DEFAULT_SPIN_VALUE);
239cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT( WRITING_MODE );
240cdf0e10cSrcweir 	ADD_PROP_ASSIGNMENT( CONTEXT_WRITING_MODE );
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	// now sort the array by name
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	std::sort(
245cdf0e10cSrcweir 		s_AllKnownProperties.begin(),
246cdf0e10cSrcweir 		s_AllKnownProperties.end(),
247cdf0e10cSrcweir 		PropertyAssignmentNameCompareLess()
248cdf0e10cSrcweir 	);
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir //.........................................................................
252cdf0e10cSrcweir }
253cdf0e10cSrcweir //... namespace frm .......................................................
254cdf0e10cSrcweir 
255