LCOV - code coverage report
Current view: top level - forms/source/misc - services.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 99 100 99.0 %
Date: 2012-08-25 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 371 732 50.7 %

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

Generated by: LCOV version 1.10