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