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