xref: /aoo41x/main/forms/source/misc/services.cxx (revision 24c56ab9)
124acc546SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
324acc546SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
424acc546SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
524acc546SAndrew Rist  * distributed with this work for additional information
624acc546SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
724acc546SAndrew Rist  * to you under the Apache License, Version 2.0 (the
824acc546SAndrew Rist  * "License"); you may not use this file except in compliance
924acc546SAndrew Rist  * with the License.  You may obtain a copy of the License at
1024acc546SAndrew Rist  *
1124acc546SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1224acc546SAndrew Rist  *
1324acc546SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1424acc546SAndrew Rist  * software distributed under the License is distributed on an
1524acc546SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1624acc546SAndrew Rist  * KIND, either express or implied.  See the License for the
1724acc546SAndrew Rist  * specific language governing permissions and limitations
1824acc546SAndrew Rist  * under the License.
1924acc546SAndrew Rist  *
2024acc546SAndrew Rist  *************************************************************/
2124acc546SAndrew Rist 
2224acc546SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_forms.hxx"
26cdf0e10cSrcweir #include "services.hxx"
27cdf0e10cSrcweir #include "frm_module.hxx"
28cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
29cdf0e10cSrcweir #include <uno/lbnames.h>
30cdf0e10cSrcweir #include <osl/diagnose.h>
31cdf0e10cSrcweir #include <uno/mapping.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::com::sun::star::uno;
34cdf0e10cSrcweir using namespace ::com::sun::star::lang;
35cdf0e10cSrcweir using namespace ::com::sun::star::registry;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //---------------------------------------------------------------------------------------
38cdf0e10cSrcweir //.......................................................................................
39cdf0e10cSrcweir #define DECLARE_SERVICE_INFO(classImplName) \
40cdf0e10cSrcweir 	namespace frm { \
41cdf0e10cSrcweir 		extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL classImplName##_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) throw (::com::sun::star::uno::RuntimeException); \
42cdf0e10cSrcweir 	}
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //---------------------------------------------------------------------------------------
45cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFixedTextModel)
46cdf0e10cSrcweir DECLARE_SERVICE_INFO(ORadioButtonModel)
47cdf0e10cSrcweir DECLARE_SERVICE_INFO(ORadioButtonControl)
48cdf0e10cSrcweir DECLARE_SERVICE_INFO(OCheckBoxModel)
49cdf0e10cSrcweir DECLARE_SERVICE_INFO(OCheckBoxControl)
50cdf0e10cSrcweir DECLARE_SERVICE_INFO(OHiddenModel)
51cdf0e10cSrcweir DECLARE_SERVICE_INFO(OGroupBoxModel)
52cdf0e10cSrcweir DECLARE_SERVICE_INFO(OGroupBoxControl)
53cdf0e10cSrcweir DECLARE_SERVICE_INFO(OListBoxControl)
54cdf0e10cSrcweir DECLARE_SERVICE_INFO(OListBoxModel)
55cdf0e10cSrcweir DECLARE_SERVICE_INFO(OComboBoxControl)
56cdf0e10cSrcweir DECLARE_SERVICE_INFO(OComboBoxModel)
57cdf0e10cSrcweir DECLARE_SERVICE_INFO(OEditControl)
58cdf0e10cSrcweir DECLARE_SERVICE_INFO(OEditModel)
59cdf0e10cSrcweir DECLARE_SERVICE_INFO(ONumericControl)
60cdf0e10cSrcweir DECLARE_SERVICE_INFO(ONumericModel)
61cdf0e10cSrcweir DECLARE_SERVICE_INFO(OPatternControl)
62cdf0e10cSrcweir DECLARE_SERVICE_INFO(OPatternModel)
63cdf0e10cSrcweir DECLARE_SERVICE_INFO(OCurrencyControl)
64cdf0e10cSrcweir DECLARE_SERVICE_INFO(OCurrencyModel)
65cdf0e10cSrcweir DECLARE_SERVICE_INFO(ODateControl)
66cdf0e10cSrcweir DECLARE_SERVICE_INFO(ODateModel)
67cdf0e10cSrcweir DECLARE_SERVICE_INFO(OTimeControl)
68cdf0e10cSrcweir DECLARE_SERVICE_INFO(OTimeModel)
69cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFormattedControl)
70cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFormattedModel)
71cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFileControlModel)
72cdf0e10cSrcweir DECLARE_SERVICE_INFO(OButtonControl)
73cdf0e10cSrcweir DECLARE_SERVICE_INFO(OButtonModel)
74cdf0e10cSrcweir DECLARE_SERVICE_INFO(OImageButtonControl)
75cdf0e10cSrcweir DECLARE_SERVICE_INFO(OImageButtonModel)
76cdf0e10cSrcweir 
77cdf0e10cSrcweir DECLARE_SERVICE_INFO(OImageControlControl)
78cdf0e10cSrcweir DECLARE_SERVICE_INFO(OImageControlModel)
79cdf0e10cSrcweir DECLARE_SERVICE_INFO(OGridControlModel)
80cdf0e10cSrcweir 
81cdf0e10cSrcweir // XForms objects
82cdf0e10cSrcweir DECLARE_SERVICE_INFO(Binding)
83cdf0e10cSrcweir DECLARE_SERVICE_INFO(Model)
84cdf0e10cSrcweir DECLARE_SERVICE_INFO(XForms)
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // some special handling for the FormattedFieldWrapper which can act as FormattedModel or as EditModel
87cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFormattedFieldWrapper)
88cdf0e10cSrcweir 	// this is for a service, which is instantiated through the EditModel service name
89cdf0e10cSrcweir 	// and which acts mostly as Edit (mostly means : if somebody uses XPersistObject::read immediately after
90cdf0e10cSrcweir 	// the object was instantiated and the stream contains a FormattedModel, it switches permanently to
91cdf0e10cSrcweir 	// formatted.)
92cdf0e10cSrcweir namespace frm { \
93cdf0e10cSrcweir 	extern Reference< XInterface > SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException); \
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir DECLARE_SERVICE_INFO(OFormsCollection)
97cdf0e10cSrcweir DECLARE_SERVICE_INFO(ImageProducer)
98cdf0e10cSrcweir 
99cdf0e10cSrcweir //---------------------------------------------------------------------------------------
100cdf0e10cSrcweir 
101cdf0e10cSrcweir static Sequence< ::rtl::OUString >						s_aClassImplementationNames;
102cdf0e10cSrcweir static Sequence<Sequence< ::rtl::OUString > >	s_aClassServiceNames;
103cdf0e10cSrcweir static Sequence<sal_Int64>								s_aFactories;
104cdf0e10cSrcweir 	// need to use sal_Int64 instead of ComponentInstantiation, as ComponentInstantiation has no cppuType, so
105cdf0e10cSrcweir 	// it can't be used with sequences
106cdf0e10cSrcweir 
107cdf0e10cSrcweir //---------------------------------------------------------------------------------------
registerClassInfo(::rtl::OUString _rClassImplName,const Sequence<::rtl::OUString> & _rServiceNames,::cppu::ComponentInstantiation _pCreateFunction)108cdf0e10cSrcweir void registerClassInfo(
109cdf0e10cSrcweir 		::rtl::OUString _rClassImplName,								// the ImplName of the class
110cdf0e10cSrcweir 		const Sequence< ::rtl::OUString >& _rServiceNames,		// the services supported by this class
111cdf0e10cSrcweir 		::cppu::ComponentInstantiation _pCreateFunction					// the method for instantiating such a class
112cdf0e10cSrcweir 		)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	sal_Int32 nCurrentLength = s_aClassImplementationNames.getLength();
115cdf0e10cSrcweir 	OSL_ENSURE((nCurrentLength == s_aClassServiceNames.getLength())
116cdf0e10cSrcweir 		&& (nCurrentLength == s_aFactories.getLength()),
117cdf0e10cSrcweir 		"forms::registerClassInfo : invalid class infos !");
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	s_aClassImplementationNames.realloc(nCurrentLength + 1);
120cdf0e10cSrcweir 	s_aClassServiceNames.realloc(nCurrentLength + 1);
121cdf0e10cSrcweir 	s_aFactories.realloc(nCurrentLength + 1);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	s_aClassImplementationNames.getArray()[nCurrentLength] = _rClassImplName;
124cdf0e10cSrcweir 	s_aClassServiceNames.getArray()[nCurrentLength] = _rServiceNames;
125cdf0e10cSrcweir 	s_aFactories.getArray()[nCurrentLength] = reinterpret_cast<sal_Int64>(_pCreateFunction);
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir //---------------------------------------------------------------------------------------
129cdf0e10cSrcweir //.......................................................................................
130cdf0e10cSrcweir #define REGISTER_CLASS_CORE(classImplName) \
131cdf0e10cSrcweir 	registerClassInfo( \
132cdf0e10cSrcweir 		::rtl::OUString::createFromAscii("com.sun.star.form.") + ::rtl::OUString::createFromAscii(#classImplName), \
133cdf0e10cSrcweir 		aServices, \
134cdf0e10cSrcweir 		frm::classImplName##_CreateInstance)
135cdf0e10cSrcweir 
136cdf0e10cSrcweir //.......................................................................................
137cdf0e10cSrcweir #define REGISTER_CLASS1(classImplName, service1) \
138cdf0e10cSrcweir 	aServices.realloc(1); \
139cdf0e10cSrcweir 	aServices.getArray()[0] = frm::service1; \
140cdf0e10cSrcweir 	REGISTER_CLASS_CORE(classImplName)
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //.......................................................................................
143cdf0e10cSrcweir #define REGISTER_CLASS2(classImplName, service1, service2) \
144cdf0e10cSrcweir 	aServices.realloc(2); \
145cdf0e10cSrcweir 	aServices.getArray()[0] = frm::service1; \
146cdf0e10cSrcweir 	aServices.getArray()[1] = frm::service2; \
147cdf0e10cSrcweir 	REGISTER_CLASS_CORE(classImplName)
148cdf0e10cSrcweir 
149cdf0e10cSrcweir //.......................................................................................
150cdf0e10cSrcweir #define REGISTER_CLASS3(classImplName, service1, service2, service3) \
151cdf0e10cSrcweir 	aServices.realloc(3); \
152cdf0e10cSrcweir 	aServices.getArray()[0] = frm::service1; \
153cdf0e10cSrcweir 	aServices.getArray()[1] = frm::service2; \
154cdf0e10cSrcweir 	aServices.getArray()[2] = frm::service3; \
155cdf0e10cSrcweir 	REGISTER_CLASS_CORE(classImplName)
156cdf0e10cSrcweir 
157cdf0e10cSrcweir //.......................................................................................
158cdf0e10cSrcweir #define REGISTER_CLASS4(classImplName, service1, service2, service3, service4) \
159cdf0e10cSrcweir 	aServices.realloc(4); \
160cdf0e10cSrcweir 	aServices.getArray()[0] = frm::service1; \
161cdf0e10cSrcweir 	aServices.getArray()[1] = frm::service2; \
162cdf0e10cSrcweir 	aServices.getArray()[2] = frm::service3; \
163cdf0e10cSrcweir 	aServices.getArray()[3] = frm::service4; \
164cdf0e10cSrcweir 	REGISTER_CLASS_CORE(classImplName)
165cdf0e10cSrcweir 
166cdf0e10cSrcweir //---------------------------------------------------------------------------------------
ensureClassInfos()167cdf0e10cSrcweir void ensureClassInfos()
168cdf0e10cSrcweir {
169cdf0e10cSrcweir 	if (s_aClassImplementationNames.getLength())
170cdf0e10cSrcweir 		// nothing to do
171cdf0e10cSrcweir 		return;
172cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aServices;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	// ========================================================================
175cdf0e10cSrcweir 	// = ControlModels
176cdf0e10cSrcweir 	// ------------------------------------------------------------------------
177cdf0e10cSrcweir 	// - FixedText
178cdf0e10cSrcweir 	REGISTER_CLASS2(OFixedTextModel, FRM_COMPONENT_FIXEDTEXT, FRM_SUN_COMPONENT_FIXEDTEXT);
179cdf0e10cSrcweir 	// - Hidden
180cdf0e10cSrcweir 	REGISTER_CLASS3(OHiddenModel, FRM_COMPONENT_HIDDENCONTROL, FRM_SUN_COMPONENT_HIDDENCONTROL, FRM_COMPONENT_HIDDEN);
181cdf0e10cSrcweir 	// - FileControl
182cdf0e10cSrcweir 	REGISTER_CLASS2(OFileControlModel, FRM_COMPONENT_FILECONTROL, FRM_SUN_COMPONENT_FILECONTROL);
183cdf0e10cSrcweir 	// - ImageButton
184cdf0e10cSrcweir 	REGISTER_CLASS2(OImageButtonModel, FRM_COMPONENT_IMAGEBUTTON, FRM_SUN_COMPONENT_IMAGEBUTTON);
185cdf0e10cSrcweir 	// - GridControl
186cdf0e10cSrcweir 	REGISTER_CLASS3(OGridControlModel, FRM_COMPONENT_GRID /* compatibility */, FRM_COMPONENT_GRIDCONTROL, FRM_SUN_COMPONENT_GRIDCONTROL);
187cdf0e10cSrcweir 	// - GroupBox
188cdf0e10cSrcweir 	REGISTER_CLASS2(OGroupBoxModel, FRM_COMPONENT_GROUPBOX, FRM_SUN_COMPONENT_GROUPBOX);
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	// - RadioButton
191cdf0e10cSrcweir 	REGISTER_CLASS4( ORadioButtonModel, FRM_COMPONENT_RADIOBUTTON, FRM_SUN_COMPONENT_RADIOBUTTON, FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON, BINDABLE_DATABASE_RADIO_BUTTON );
192cdf0e10cSrcweir 	// - CheckBox
193cdf0e10cSrcweir 	REGISTER_CLASS4( OCheckBoxModel, FRM_COMPONENT_CHECKBOX, FRM_SUN_COMPONENT_CHECKBOX, FRM_SUN_COMPONENT_DATABASE_CHECKBOX, BINDABLE_DATABASE_CHECK_BOX );
194cdf0e10cSrcweir 	// - ListBox
195cdf0e10cSrcweir 	REGISTER_CLASS4( OListBoxModel, FRM_COMPONENT_LISTBOX, FRM_SUN_COMPONENT_LISTBOX, FRM_SUN_COMPONENT_DATABASE_LISTBOX, BINDABLE_DATABASE_LIST_BOX );
196cdf0e10cSrcweir 	// - ComboBox
197cdf0e10cSrcweir 	REGISTER_CLASS4( OComboBoxModel, FRM_COMPONENT_COMBOBOX, FRM_SUN_COMPONENT_COMBOBOX, FRM_SUN_COMPONENT_DATABASE_COMBOBOX, BINDABLE_DATABASE_COMBO_BOX );
198cdf0e10cSrcweir 	// - EditControl
199cdf0e10cSrcweir 	REGISTER_CLASS4( OEditModel, FRM_COMPONENT_TEXTFIELD, FRM_SUN_COMPONENT_TEXTFIELD, FRM_SUN_COMPONENT_DATABASE_TEXTFIELD, BINDABLE_DATABASE_TEXT_FIELD );
200cdf0e10cSrcweir 	// - DateControl
201cdf0e10cSrcweir 	REGISTER_CLASS3( ODateModel, FRM_COMPONENT_DATEFIELD, FRM_SUN_COMPONENT_DATEFIELD, FRM_SUN_COMPONENT_DATABASE_DATEFIELD );
202cdf0e10cSrcweir 	// - TimeControl
203cdf0e10cSrcweir 	REGISTER_CLASS3( OTimeModel, FRM_COMPONENT_TIMEFIELD, FRM_SUN_COMPONENT_TIMEFIELD, FRM_SUN_COMPONENT_DATABASE_TIMEFIELD );
204cdf0e10cSrcweir 	// - NumericField
205cdf0e10cSrcweir 	REGISTER_CLASS4( ONumericModel, FRM_COMPONENT_NUMERICFIELD, FRM_SUN_COMPONENT_NUMERICFIELD, FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD, BINDABLE_DATABASE_NUMERIC_FIELD );
206cdf0e10cSrcweir 	// - CurrencyField
207cdf0e10cSrcweir 	REGISTER_CLASS3( OCurrencyModel, FRM_COMPONENT_CURRENCYFIELD, FRM_SUN_COMPONENT_CURRENCYFIELD, FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD );
208cdf0e10cSrcweir 	// - PatternField
209cdf0e10cSrcweir 	REGISTER_CLASS3( OPatternModel, FRM_COMPONENT_PATTERNFIELD, FRM_SUN_COMPONENT_PATTERNFIELD, FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD );
210cdf0e10cSrcweir 	// - Button
211cdf0e10cSrcweir 	REGISTER_CLASS2( OButtonModel, FRM_COMPONENT_COMMANDBUTTON, FRM_SUN_COMPONENT_COMMANDBUTTON );
212cdf0e10cSrcweir 	// - ImageControl
213cdf0e10cSrcweir 	REGISTER_CLASS2( OImageControlModel, FRM_COMPONENT_IMAGECONTROL, FRM_SUN_COMPONENT_IMAGECONTROL );
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	// - FormattedField
216cdf0e10cSrcweir 	REGISTER_CLASS1(OFormattedFieldWrapper, FRM_COMPONENT_EDIT);
217cdf0e10cSrcweir 		// since SRC568 both OFormattedModel and OEditModel use FRM_COMPONENT_EDIT for persistence,
218cdf0e10cSrcweir 		// and while reading a wrapper determines which kind of model it is
219cdf0e10cSrcweir 	// register the wrapper for the FormattedField, as it handles the XPersistObject::write
220cdf0e10cSrcweir 	// so that version <= 5.1 are able to read it
221cdf0e10cSrcweir 	aServices.realloc(4);
222cdf0e10cSrcweir 	aServices.getArray()[0] = frm::FRM_COMPONENT_FORMATTEDFIELD;
223cdf0e10cSrcweir 	aServices.getArray()[1] = frm::FRM_SUN_COMPONENT_FORMATTEDFIELD;
224cdf0e10cSrcweir     aServices.getArray()[2] = frm::FRM_SUN_COMPONENT_DATABASE_FORMATTEDFIELD;
225cdf0e10cSrcweir 	aServices.getArray()[3] = frm::BINDABLE_DATABASE_FORMATTED_FIELD;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	registerClassInfo(::rtl::OUString::createFromAscii("com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted"),
228cdf0e10cSrcweir 		aServices,
229cdf0e10cSrcweir 		frm::OFormattedFieldWrapper_CreateInstance_ForceFormatted);
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	// ========================================================================
232cdf0e10cSrcweir 	// = Controls
233cdf0e10cSrcweir 	// - RadioButton
234cdf0e10cSrcweir 	REGISTER_CLASS2(ORadioButtonControl, STARDIV_ONE_FORM_CONTROL_RADIOBUTTON, FRM_SUN_CONTROL_RADIOBUTTON);
235cdf0e10cSrcweir 	// - CheckBox
236cdf0e10cSrcweir 	REGISTER_CLASS2(OCheckBoxControl, STARDIV_ONE_FORM_CONTROL_CHECKBOX, FRM_SUN_CONTROL_CHECKBOX);
237cdf0e10cSrcweir 	// - GroupBox
238cdf0e10cSrcweir 	REGISTER_CLASS2(OGroupBoxControl, STARDIV_ONE_FORM_CONTROL_GROUPBOX, FRM_SUN_CONTROL_GROUPBOX);
239cdf0e10cSrcweir 	// - ListBox
240cdf0e10cSrcweir 	REGISTER_CLASS2(OListBoxControl, STARDIV_ONE_FORM_CONTROL_LISTBOX, FRM_SUN_CONTROL_LISTBOX);
241cdf0e10cSrcweir 	// - ComboBox
242cdf0e10cSrcweir 	REGISTER_CLASS2(OComboBoxControl, STARDIV_ONE_FORM_CONTROL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX);
243cdf0e10cSrcweir 	// - EditControl
244cdf0e10cSrcweir 	REGISTER_CLASS3(OEditControl, STARDIV_ONE_FORM_CONTROL_TEXTFIELD, FRM_SUN_CONTROL_TEXTFIELD, STARDIV_ONE_FORM_CONTROL_EDIT);
245cdf0e10cSrcweir 	// - DateControl
246cdf0e10cSrcweir 	REGISTER_CLASS2(ODateControl, STARDIV_ONE_FORM_CONTROL_DATEFIELD, FRM_SUN_CONTROL_DATEFIELD);
247cdf0e10cSrcweir 	// - TimeControl
248cdf0e10cSrcweir 	REGISTER_CLASS2(OTimeControl, STARDIV_ONE_FORM_CONTROL_TIMEFIELD, FRM_SUN_CONTROL_TIMEFIELD);
249cdf0e10cSrcweir 	// - NumericField
250cdf0e10cSrcweir 	REGISTER_CLASS2(ONumericControl, STARDIV_ONE_FORM_CONTROL_NUMERICFIELD, FRM_SUN_CONTROL_NUMERICFIELD);
251cdf0e10cSrcweir 	// - CurrencyField
252cdf0e10cSrcweir 	REGISTER_CLASS2(OCurrencyControl, STARDIV_ONE_FORM_CONTROL_CURRENCYFIELD, FRM_SUN_CONTROL_CURRENCYFIELD);
253cdf0e10cSrcweir 	// - PatternField
254cdf0e10cSrcweir 	REGISTER_CLASS2(OPatternControl, STARDIV_ONE_FORM_CONTROL_PATTERNFIELD, FRM_SUN_CONTROL_PATTERNFIELD);
255cdf0e10cSrcweir 	// - FormattedField
256cdf0e10cSrcweir 	REGISTER_CLASS2(OFormattedControl, STARDIV_ONE_FORM_CONTROL_FORMATTEDFIELD, FRM_SUN_CONTROL_FORMATTEDFIELD);
257cdf0e10cSrcweir 	// - Button
258cdf0e10cSrcweir 	REGISTER_CLASS2(OButtonControl, STARDIV_ONE_FORM_CONTROL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON);
259cdf0e10cSrcweir 	// - ImageButton
260cdf0e10cSrcweir 	REGISTER_CLASS2(OImageButtonControl, STARDIV_ONE_FORM_CONTROL_IMAGEBUTTON, FRM_SUN_CONTROL_IMAGEBUTTON);
261cdf0e10cSrcweir 	// - ImageControl
262cdf0e10cSrcweir 	REGISTER_CLASS2(OImageControlControl, STARDIV_ONE_FORM_CONTROL_IMAGECONTROL, FRM_SUN_CONTROL_IMAGECONTROL);
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 	// ========================================================================
266cdf0e10cSrcweir 	// = various
267cdf0e10cSrcweir 	REGISTER_CLASS1(OFormsCollection, FRM_SUN_FORMS_COLLECTION);
268cdf0e10cSrcweir 	REGISTER_CLASS1(ImageProducer, SRV_AWT_IMAGEPRODUCER);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 	// ========================================================================
271cdf0e10cSrcweir 	// = XForms core
272cdf0e10cSrcweir #define REGISTER_XFORMS_CLASS(name) \
273cdf0e10cSrcweir 	aServices.realloc(1); \
274cdf0e10cSrcweir 	aServices.getArray()[0] = rtl::OUString::createFromAscii( "com.sun.star.xforms." #name ); \
275cdf0e10cSrcweir 	REGISTER_CLASS_CORE(name)
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     REGISTER_XFORMS_CLASS(Model);
278cdf0e10cSrcweir     REGISTER_XFORMS_CLASS(XForms);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir //=======================================================================================
283cdf0e10cSrcweir extern "C"
284cdf0e10cSrcweir {
285cdf0e10cSrcweir 
286cdf0e10cSrcweir //---------------------------------------------------------------------------------------
287cdf0e10cSrcweir void SAL_CALL createRegistryInfo_ODatabaseForm();
288cdf0e10cSrcweir void SAL_CALL createRegistryInfo_OFilterControl();
289cdf0e10cSrcweir void SAL_CALL createRegistryInfo_OScrollBarModel();
290cdf0e10cSrcweir void SAL_CALL createRegistryInfo_OSpinButtonModel();
291cdf0e10cSrcweir void SAL_CALL createRegistryInfo_ONavigationBarModel();
292cdf0e10cSrcweir void SAL_CALL createRegistryInfo_ONavigationBarControl();
293cdf0e10cSrcweir void SAL_CALL createRegistryInfo_ORichTextModel();
294cdf0e10cSrcweir void SAL_CALL createRegistryInfo_ORichTextControl();
295cdf0e10cSrcweir void SAL_CALL createRegistryInfo_CLibxml2XFormsExtension();
296cdf0e10cSrcweir void SAL_CALL createRegistryInfo_FormOperations();
297cdf0e10cSrcweir 
298cdf0e10cSrcweir //---------------------------------------------------------------------------------------
createRegistryInfo_FORMS()299cdf0e10cSrcweir void SAL_CALL createRegistryInfo_FORMS()
300cdf0e10cSrcweir {
301cdf0e10cSrcweir 	static sal_Bool bInit = sal_False;
302cdf0e10cSrcweir 	if (!bInit)
303cdf0e10cSrcweir 	{
304cdf0e10cSrcweir 		createRegistryInfo_ODatabaseForm();
305cdf0e10cSrcweir 		createRegistryInfo_OFilterControl();
306cdf0e10cSrcweir 		createRegistryInfo_OScrollBarModel();
307cdf0e10cSrcweir 		createRegistryInfo_OSpinButtonModel();
308cdf0e10cSrcweir         createRegistryInfo_ONavigationBarModel();
309cdf0e10cSrcweir         createRegistryInfo_ONavigationBarControl();
310cdf0e10cSrcweir         createRegistryInfo_ORichTextModel();
311cdf0e10cSrcweir         createRegistryInfo_ORichTextControl();
312cdf0e10cSrcweir         createRegistryInfo_CLibxml2XFormsExtension();
313cdf0e10cSrcweir         createRegistryInfo_FormOperations();
314cdf0e10cSrcweir 		bInit = sal_True;
315cdf0e10cSrcweir 	}
316cdf0e10cSrcweir }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir //---------------------------------------------------------------------------------------
component_getImplementationEnvironment(const sal_Char ** _ppEnvTypeName,uno_Environment **)319cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** /*_ppEnv*/)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir 	*_ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir //---------------------------------------------------------------------------------------
component_getFactory(const sal_Char * _pImplName,XMultiServiceFactory * _pServiceManager,void *)325cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* _pImplName, XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/)
326cdf0e10cSrcweir {
327cdf0e10cSrcweir 	if (!_pServiceManager || !_pImplName)
328cdf0e10cSrcweir 		return NULL;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     // ========================================================================
331cdf0e10cSrcweir 	// a lot of stuff which is implemented "manually" here in this file
332cdf0e10cSrcweir 	void* pRet = NULL;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 	// collect the class infos
335cdf0e10cSrcweir 	ensureClassInfos();
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 	// both our static sequences should have the same length ...
338cdf0e10cSrcweir 	sal_Int32 nClasses = s_aClassImplementationNames.getLength();
339cdf0e10cSrcweir 	OSL_ENSURE((s_aClassServiceNames.getLength() == nClasses) &&
340cdf0e10cSrcweir 		(s_aFactories.getLength() == nClasses),
341cdf0e10cSrcweir 		"forms::component_writeInfo : invalid class infos !");
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	// loop through the sequences and register the service providers
344cdf0e10cSrcweir 	const ::rtl::OUString* pClasses = s_aClassImplementationNames.getConstArray();
345cdf0e10cSrcweir 	const Sequence< ::rtl::OUString >* pServices = s_aClassServiceNames.getConstArray();
346cdf0e10cSrcweir 	const sal_Int64* pFunctionsAsInts = s_aFactories.getConstArray();
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices, ++pFunctionsAsInts)
349cdf0e10cSrcweir 	{
350*24c56ab9SHerbert Dürr 		if( pClasses->compareToAscii( _pImplName) == 0)
351cdf0e10cSrcweir 		{
352cdf0e10cSrcweir 			::cppu::ComponentInstantiation aCurrentCreateFunction =
353cdf0e10cSrcweir 				reinterpret_cast< ::cppu::ComponentInstantiation>(*pFunctionsAsInts);
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 			Reference<XSingleServiceFactory> xFactory(
356cdf0e10cSrcweir 				::cppu::createSingleFactory(
357cdf0e10cSrcweir 					_pServiceManager,
358cdf0e10cSrcweir 					*pClasses,
359cdf0e10cSrcweir 					aCurrentCreateFunction,
360cdf0e10cSrcweir 					*pServices
361cdf0e10cSrcweir 				)
362cdf0e10cSrcweir 			);
363cdf0e10cSrcweir 			if (xFactory.is())
364cdf0e10cSrcweir 			{
365cdf0e10cSrcweir 				xFactory->acquire();
366cdf0e10cSrcweir 				pRet = xFactory.get();
367cdf0e10cSrcweir 				break;
368cdf0e10cSrcweir 			}
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 	}
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     // ========================================================================
373cdf0e10cSrcweir 	// the real way - use the OModule
374cdf0e10cSrcweir 	if ( !pRet )
375cdf0e10cSrcweir 	{
376cdf0e10cSrcweir 		createRegistryInfo_FORMS();
377cdf0e10cSrcweir 		{
378cdf0e10cSrcweir 			// let the module look for the component
379cdf0e10cSrcweir 			Reference< XInterface > xRet;
380cdf0e10cSrcweir 			xRet = ::frm::OFormsModule::getComponentFactory(
381cdf0e10cSrcweir 				::rtl::OUString::createFromAscii( _pImplName ),
382cdf0e10cSrcweir 				static_cast< XMultiServiceFactory* >( _pServiceManager ) );
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 			if ( xRet.is() )
385cdf0e10cSrcweir 				xRet->acquire();
386cdf0e10cSrcweir 			pRet = xRet.get();
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	return pRet;
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir }
394