merge the formfield patch from ooo-build
[ooovba.git] / toolkit / source / helper / property.cxx
bloba01046f26881dab1ba11f0e54c305ae7eeb96f31
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: property.cxx,v $
10 * $Revision: 1.42 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
35 #include <toolkit/helper/property.hxx>
36 #include <toolkit/helper/macros.hxx>
37 #include <osl/mutex.hxx>
39 #include <stdlib.h> // qsort/bsearch
40 #include <tools/debug.hxx>
41 #include <com/sun/star/awt/FontWeight.hpp>
42 #include <com/sun/star/awt/FontSlant.hpp>
43 #include <com/sun/star/awt/CharSet.hpp>
44 #include <com/sun/star/awt/FontDescriptor.hpp>
45 #include <com/sun/star/awt/FontWidth.hpp>
46 #include <com/sun/star/awt/FontType.hpp>
47 #include <com/sun/star/awt/FontUnderline.hpp>
48 #include <com/sun/star/awt/FontStrikeout.hpp>
49 #include <com/sun/star/awt/FontPitch.hpp>
50 #include <com/sun/star/awt/tree/XTreeDataModel.hpp>
51 #include <com/sun/star/awt/grid/XGridDataModel.hpp>
52 #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
53 #include <com/sun/star/awt/grid/ScrollBarMode.hpp>
54 #include <com/sun/star/view/SelectionType.hpp>
55 #include <com/sun/star/style/VerticalAlignment.hpp>
56 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
57 #include <com/sun/star/beans/PropertyAttribute.hpp>
58 #include <com/sun/star/graphic/XGraphic.hpp>
59 #include <com/sun/star/resource/XStringResourceResolver.hpp>
60 #include <comphelper/types.hxx>
61 #include <functional>
62 #include <algorithm>
63 #include <toolkit/helper/property.hxx>
65 using ::com::sun::star::uno::Any;
66 using ::com::sun::star::uno::Sequence;
67 using ::com::sun::star::uno::Reference;
68 using ::com::sun::star::awt::FontDescriptor;
69 using ::com::sun::star::style::VerticalAlignment;
71 struct ImplPropertyInfo
73 ::rtl::OUString aName;
74 sal_uInt16 nPropId;
75 ::com::sun::star::uno::Type aType;
76 sal_Int16 nAttribs;
77 sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX.
79 ImplPropertyInfo()
81 nPropId = 0;
82 nAttribs = 0;
83 bDependsOnOthers = sal_False;
86 ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType,
87 sal_Int16 nAttrs, sal_Bool bDepends = sal_False )
88 : aName( pName )
90 nPropId = nId;
91 aType = rType;
92 nAttribs = nAttrs;
93 bDependsOnOthers = bDepends;
98 #define DECL_PROP_1( asciiname, id, type, attrib1 ) \
99 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 )
100 #define DECL_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
101 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 )
102 #define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
103 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 )
104 #define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \
105 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 )
107 #define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \
108 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True )
109 #define DECL_DEP_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
110 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2, sal_True )
111 #define DECL_DEP_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
112 ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3, sal_True )
114 ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
116 static ImplPropertyInfo* pPropertyInfos = NULL;
117 static sal_uInt16 nElements = 0;
118 if( !pPropertyInfos )
120 ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
121 if( !pPropertyInfos )
123 static ImplPropertyInfo __FAR_DATA aImplPropertyInfos [] =
125 DECL_PROP_2 ( "AccessibleName", ACCESSIBLENAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
126 DECL_PROP_3 ( "Align", ALIGN, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
127 DECL_PROP_2 ( "Autocomplete", AUTOCOMPLETE, bool, BOUND, MAYBEDEFAULT ),
128 DECL_PROP_2 ( "AutoHScroll", AUTOHSCROLL, bool, BOUND, MAYBEDEFAULT ),
129 DECL_PROP_1 ( "AutoMnemonics", AUTOMNEMONICS, bool, BOUND ),
130 DECL_PROP_2 ( "AutoToggle", AUTOTOGGLE, bool, BOUND, MAYBEDEFAULT ),
131 DECL_PROP_2 ( "AutoVScroll", AUTOVSCROLL, bool, BOUND, MAYBEDEFAULT ),
132 DECL_PROP_3 ( "BackgroundColor", BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
133 DECL_DEP_PROP_2 ( "BlockIncrement", BLOCKINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
134 DECL_PROP_3 ( "Border", BORDER, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
135 DECL_DEP_PROP_3 ( "BorderColor", BORDERCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
136 DECL_PROP_2 ( "Closeable", CLOSEABLE, bool, BOUND, MAYBEDEFAULT ),
137 DECL_PROP_2 ( "CurrencySymbol", CURRENCYSYMBOL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
138 DECL_PROP_2 ( "CustomUnitText", CUSTOMUNITTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
139 DECL_DEP_PROP_3 ( "Date", DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
140 DECL_PROP_2 ( "DateFormat", EXTDATEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
141 DECL_PROP_2 ( "DateMax", DATEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
142 DECL_PROP_2 ( "DateMin", DATEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
143 DECL_PROP_3 ( "DateShowCentury", DATESHOWCENTURY, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
144 DECL_PROP_2 ( "DecimalAccuracy", DECIMALACCURACY, sal_Int16, BOUND, MAYBEDEFAULT ),
145 DECL_PROP_2 ( "DefaultButton", DEFAULTBUTTON, bool, BOUND, MAYBEDEFAULT ),
146 DECL_PROP_2 ( "DefaultControl", DEFAULTCONTROL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
147 DECL_PROP_2 ( "DesktopAsParent", DESKTOP_AS_PARENT, bool, BOUND, MAYBEDEFAULT ),
148 DECL_PROP_2 ( "DisplayBackgroundColor", DISPLAYBACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEVOID ),
149 DECL_PROP_2 ( "Dropdown", DROPDOWN, bool, BOUND, MAYBEDEFAULT ),
150 DECL_PROP_2 ( "EchoChar", ECHOCHAR, sal_Int16, BOUND, MAYBEDEFAULT ),
151 DECL_PROP_2 ( "EditMask", EDITMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
152 DECL_PROP_3 ( "EffectiveDefault", EFFECTIVE_DEFAULT, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
153 DECL_PROP_3 ( "EffectiveMax", EFFECTIVE_MAX, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
154 DECL_PROP_3 ( "EffectiveMin", EFFECTIVE_MIN, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
155 DECL_DEP_PROP_3 ( "EffectiveValue", EFFECTIVE_VALUE, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
156 DECL_PROP_2 ( "Enabled", ENABLED, bool, BOUND, MAYBEDEFAULT ),
157 DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ),
158 DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
159 DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ),
160 DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ),
161 DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ),
162 DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ),
164 // Teile des ::com::sun::star::awt::FontDescriptor
165 DECL_PROP_2 ( "FontName", FONTDESCRIPTORPART_NAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
166 DECL_PROP_2 ( "FontStyleName", FONTDESCRIPTORPART_STYLENAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
167 DECL_PROP_2 ( "FontFamily", FONTDESCRIPTORPART_FAMILY, sal_Int16, BOUND, MAYBEDEFAULT ),
168 DECL_PROP_2 ( "FontCharset", FONTDESCRIPTORPART_CHARSET, sal_Int16, BOUND, MAYBEDEFAULT ),
169 DECL_PROP_2 ( "FontHeight", FONTDESCRIPTORPART_HEIGHT, float, BOUND, MAYBEDEFAULT ),
170 DECL_PROP_2 ( "FontWidth", FONTDESCRIPTORPART_WIDTH, sal_Int16, BOUND, MAYBEDEFAULT ),
171 DECL_PROP_2 ( "FontPitch", FONTDESCRIPTORPART_PITCH, sal_Int16, BOUND, MAYBEDEFAULT ),
172 DECL_PROP_2 ( "FontWeight", FONTDESCRIPTORPART_WEIGHT, float, BOUND, MAYBEDEFAULT ),
173 DECL_PROP_2 ( "FontCharWidth", FONTDESCRIPTORPART_CHARWIDTH, float, BOUND, MAYBEDEFAULT ),
174 DECL_PROP_2 ( "FontOrientation", FONTDESCRIPTORPART_ORIENTATION, float, BOUND, MAYBEDEFAULT ),
175 DECL_PROP_2 ( "FontSlant", FONTDESCRIPTORPART_SLANT, sal_Int16, BOUND, MAYBEDEFAULT ),
176 DECL_PROP_2 ( "FontUnderline", FONTDESCRIPTORPART_UNDERLINE, sal_Int16, BOUND, MAYBEDEFAULT ),
177 DECL_PROP_2 ( "FontStrikeout", FONTDESCRIPTORPART_STRIKEOUT, sal_Int16, BOUND, MAYBEDEFAULT ),
178 DECL_PROP_2 ( "FontKerning", FONTDESCRIPTORPART_KERNING, bool, BOUND, MAYBEDEFAULT ),
179 DECL_PROP_2 ( "FontWordLineMode", FONTDESCRIPTORPART_WORDLINEMODE, bool, BOUND, MAYBEDEFAULT ),
180 DECL_PROP_2 ( "FontType", FONTDESCRIPTORPART_TYPE, sal_Int16, BOUND, MAYBEDEFAULT ),
182 DECL_PROP_3 ( "FormatKey", FORMATKEY, sal_Int32, BOUND, MAYBEVOID, TRANSIENT ),
183 DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
185 DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
186 DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
187 DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
188 DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
189 DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
190 DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ),
191 DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ),
192 DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
193 DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
194 DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
195 DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
196 DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
197 DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
198 DECL_PROP_2 ( "LineEndFormat", LINE_END_FORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
199 DECL_DEP_PROP_2 ( "LineIncrement", LINEINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
200 DECL_PROP_2 ( "LiteralMask", LITERALMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
201 DECL_PROP_2 ( "LiveScroll", LIVE_SCROLL, bool, BOUND, MAYBEDEFAULT ),
202 DECL_PROP_2 ( "MaxTextLen", MAXTEXTLEN, sal_Int16, BOUND, MAYBEDEFAULT ),
203 DECL_PROP_2 ( "Moveable", MOVEABLE, bool, BOUND, MAYBEDEFAULT ),
204 DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
205 DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
206 DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
207 DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
208 DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
209 DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
210 DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ),
211 DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ),
212 DECL_PROP_2 ( "PrependCurrencySymbol", CURSYM_POSITION, bool, BOUND, MAYBEDEFAULT ),
213 DECL_PROP_2 ( "Printable", PRINTABLE, bool, BOUND, MAYBEDEFAULT ),
214 DECL_DEP_PROP_3 ( "ProgressValue", PROGRESSVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
215 DECL_PROP_2 ( "ProgressValueMax", PROGRESSVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
216 DECL_PROP_2 ( "ProgressValueMin", PROGRESSVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
217 DECL_PROP_2 ( "PushButtonType", PUSHBUTTONTYPE, sal_Int16, BOUND, MAYBEDEFAULT),
218 DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ),
219 DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ),
220 DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ),
221 DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ),
222 DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
223 DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
224 DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
225 DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
226 DECL_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
227 DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
228 DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
229 DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
230 DECL_PROP_2 ( "SpinIncrement", SPININCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
231 DECL_DEP_PROP_2 ( "SpinValue", SPINVALUE, sal_Int32, BOUND, MAYBEDEFAULT ),
232 DECL_PROP_2 ( "SpinValueMax", SPINVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
233 DECL_PROP_2 ( "SpinValueMin", SPINVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
234 DECL_DEP_PROP_2 ( "State", STATE, sal_Int16, BOUND, MAYBEDEFAULT ),
235 DECL_PROP_2 ( "StrictFormat", STRICTFORMAT, bool, BOUND, MAYBEDEFAULT ),
236 DECL_PROP_2 ( "StringItemList", STRINGITEMLIST, Sequence< ::rtl::OUString >, BOUND, MAYBEDEFAULT ),
237 DECL_PROP_2 ( "VisualEffect", VISUALEFFECT, sal_Int16, BOUND, MAYBEDEFAULT ),
238 DECL_PROP_3 ( "SymbolColor", SYMBOL_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
239 DECL_PROP_3 ( "Tabstop", TABSTOP, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
240 DECL_PROP_2 ( "Text", TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
241 DECL_PROP_3 ( "TextColor", TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
242 DECL_PROP_3 ( "TextLineColor", TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
243 DECL_DEP_PROP_3 ( "Time", TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
244 DECL_PROP_2 ( "TimeFormat", EXTTIMEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
245 DECL_PROP_2 ( "TimeMax", TIMEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
246 DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
247 DECL_PROP_2 ( "Title", TITLE, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
248 DECL_PROP_2 ( "Toggle", TOGGLE, bool, BOUND, MAYBEDEFAULT ),
249 DECL_PROP_3 ( "TreatAsNumber", TREATASNUMBER, bool, BOUND, MAYBEDEFAULT,TRANSIENT ),
250 DECL_PROP_2 ( "TriState", TRISTATE, bool, BOUND, MAYBEDEFAULT ),
251 DECL_PROP_2 ( "Unit", UNIT, sal_Int16, BOUND, MAYBEDEFAULT ),
252 DECL_PROP_2 ( "VScroll", VSCROLL, bool, BOUND, MAYBEDEFAULT ),
253 DECL_DEP_PROP_3 ( "Value", VALUE_DOUBLE, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
254 DECL_PROP_2 ( "ValueMax", VALUEMAX_DOUBLE, double, BOUND, MAYBEDEFAULT ),
255 DECL_PROP_2 ( "ValueMin", VALUEMIN_DOUBLE, double, BOUND, MAYBEDEFAULT ),
256 DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ),
257 DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ),
258 DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
259 DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ),
260 DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ),
261 DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ),
263 DECL_PROP_2 ( "MouseWheelBehavior", MOUSE_WHEEL_BEHAVIOUR, sal_Int16, BOUND, MAYBEDEFAULT ),
264 DECL_PROP_2 ( "StepTime", STEP_TIME, sal_Int32, BOUND, MAYBEDEFAULT ),
265 DECL_PROP_2 ( "Decoration", DECORATION, sal_Bool, BOUND, MAYBEDEFAULT ),
267 DECL_PROP_2 ( "SelectionType", TREE_SELECTIONTYPE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT ),
268 DECL_PROP_2 ( "Editable", TREE_EDITABLE, sal_Bool, BOUND, MAYBEDEFAULT ),
269 DECL_PROP_3 ( "DataModel", TREE_DATAMODEL, Reference< ::com::sun::star::awt::tree::XTreeDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
270 DECL_PROP_2 ( "RootDisplayed", TREE_ROOTDISPLAYED, sal_Bool, BOUND, MAYBEDEFAULT ),
271 DECL_PROP_2 ( "ShowsHandles", TREE_SHOWSHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
272 DECL_PROP_2 ( "ShowsRootHandles", TREE_SHOWSROOTHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
273 DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
274 DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
275 DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
276 DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
277 DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
278 DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
279 DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
280 DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
281 DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
282 DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
283 DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
284 DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
285 DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT )
287 pPropertyInfos = aImplPropertyInfos;
288 nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
291 rElementCount = nElements;
292 return pPropertyInfos;
296 struct ImplPropertyInfoCompareFunctor : ::std::binary_function<ImplPropertyInfo,::rtl::OUString,bool>
298 inline bool operator()(const ImplPropertyInfo& lhs,const ImplPropertyInfo& rhs) const
300 return lhs.aName.compareTo(rhs.aName) < 0;
302 inline bool operator()(const ImplPropertyInfo& lhs,const ::rtl::OUString& rhs) const
304 return lhs.aName.compareTo(rhs) < 0;
306 inline bool operator()(const ::rtl::OUString& lhs,const ImplPropertyInfo& rhs) const
308 return lhs.compareTo(rhs.aName) < 0;
312 void ImplAssertValidPropertyArray()
314 static sal_Bool bSorted = sal_False;
315 if( !bSorted )
317 sal_uInt16 nElements;
318 ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
319 ::std::sort(pInfos, pInfos+nElements,ImplPropertyInfoCompareFunctor());
320 bSorted = sal_True;
324 sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName )
326 ImplAssertValidPropertyArray();
328 sal_uInt16 nElements;
329 ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
330 ImplPropertyInfo* pInf = ::std::lower_bound(pInfos,pInfos+nElements,rPropertyName,ImplPropertyInfoCompareFunctor());
332 (ImplPropertyInfo*)
333 bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
336 return ( pInf && pInf != (pInfos+nElements) && pInf->aName == rPropertyName) ? pInf->nPropId: 0;
339 const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId )
341 ImplAssertValidPropertyArray();
343 sal_uInt16 nElements;
344 ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
345 sal_uInt16 n;
346 for ( n = 0; n < nElements && pInfos[n].nPropId != nPropertyId; ++n)
349 return (n < nElements) ? &pInfos[n] : NULL;
352 sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId )
354 ImplAssertValidPropertyArray();
356 sal_uInt16 nElements;
357 ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
358 for ( sal_uInt16 n = nElements; n; )
360 if ( pInfos[--n].nPropId == nPropertyId )
361 return n;
363 return 0xFFFF;
366 const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId )
368 const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
369 DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
370 return pImplPropertyInfo->aName;
373 const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId )
375 const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
376 DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
377 return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL;
380 sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId )
382 const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
383 DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
384 return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : 0;
387 sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId )
389 const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
390 DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
391 return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False;
394 sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 )
396 return ::comphelper::compare( r1, r2 );