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