LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/form - fmservs.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 17 100.0 %
Date: 2013-07-09 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/container/XSet.hpp>
      21             : #include <cppuhelper/factory.hxx>
      22             : #include <comphelper/processfactory.hxx>
      23             : #include "fmservs.hxx"
      24             : 
      25             : using namespace com::sun::star;
      26             : 
      27             : // ------------------------------------------------------------------------
      28             : #define DECL_SERVICE(ImplName)                      \
      29             : uno::Reference< uno::XInterface > SAL_CALL ImplName##_NewInstance_Impl(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::Exception );
      30             : 
      31             : #define REGISTER_SERVICE(ImplName, ServiceName)                     \
      32             :     sString = (ServiceName);                                        \
      33             :     xSingleFactory = ::cppu::createSingleFactory(xServiceFactory,   \
      34             :                         OUString(), ImplName##_NewInstance_Impl,    \
      35             :                         uno::Sequence< OUString>(&sString, 1));     \
      36             :     if (xSingleFactory.is())                                        \
      37             :         xSet->insert(uno::makeAny(xSingleFactory));
      38             : 
      39             : 
      40             :     DECL_SERVICE( FmXGridControl )
      41             :     DECL_SERVICE( FormController )
      42             :     DECL_SERVICE( LegacyFormController )
      43             : 
      44             : 
      45             : // ------------------------------------------------------------------------
      46             : namespace svxform
      47             : {
      48             : 
      49             :     // ------------------------------------------------------------------------
      50             :     // declare selfaware service
      51             :     uno::Reference< uno::XInterface > SAL_CALL OAddConditionDialog_Create( const uno::Reference< lang::XMultiServiceFactory >& );
      52             :     OUString SAL_CALL OAddConditionDialog_GetImplementationName();
      53             :     uno::Sequence< OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames();
      54             : 
      55             :     // ------------------------------------------------------------------------
      56          68 :     void ImplSmartRegisterUnoServices()
      57             :     {
      58          68 :         uno::Reference< lang::XMultiServiceFactory >  xServiceFactory(::comphelper::getProcessServiceFactory(), uno::UNO_QUERY);
      59         136 :         uno::Reference< container::XSet >  xSet(xServiceFactory, uno::UNO_QUERY);
      60          68 :         if (!xSet.is())
      61          68 :             return;
      62             : 
      63         136 :         uno::Sequence< OUString> aServices;
      64         136 :         uno::Reference< lang::XSingleServiceFactory >  xSingleFactory;
      65             : 
      66         136 :         OUString sString;
      67             : 
      68             :         // ------------------------------------------------------------------------
      69             :         // FormController
      70          68 :         REGISTER_SERVICE( FormController, OUString( "com.sun.star.form.runtime.FormController" ) );
      71          68 :         REGISTER_SERVICE( LegacyFormController, OUString( "com.sun.star.form.FormController" ) );
      72             : 
      73             :         // ------------------------------------------------------------------------
      74             :         // FormController - register selfaware service
      75         136 :         xSingleFactory = ::cppu::createSingleFactory( xServiceFactory,
      76             :                              OAddConditionDialog_GetImplementationName(),
      77             :                              OAddConditionDialog_Create,
      78             :                              OAddConditionDialog_GetSupportedServiceNames()
      79          68 :                          );
      80          68 :         if ( xSingleFactory.is() )
      81          68 :             xSet->insert( uno::makeAny( xSingleFactory ) );
      82             : 
      83             :         // ------------------------------------------------------------------------
      84             :         // DBGridControl
      85          68 :         REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRID);  // compatibility
      86          68 :         REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRIDCONTROL);
      87         136 :         REGISTER_SERVICE(FmXGridControl, FM_SUN_CONTROL_GRIDCONTROL);
      88             :     };
      89             : 
      90             : }   // namespace svxform
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10