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