1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/container/XSet.hpp>
21 #include <cppuhelper/factory.hxx>
22 #include <comphelper/processfactory.hxx>
23 #include "fmservs.hxx"
25 using namespace com::sun::star
;
27 // ------------------------------------------------------------------------
28 #define DECL_SERVICE(ImplName) \
29 uno::Reference< uno::XInterface > SAL_CALL ImplName##_NewInstance_Impl(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::Exception );
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));
40 DECL_SERVICE( FmXGridControl
)
41 DECL_SERVICE( FormController
)
42 DECL_SERVICE( LegacyFormController
)
45 // ------------------------------------------------------------------------
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();
55 // ------------------------------------------------------------------------
56 void ImplSmartRegisterUnoServices()
58 uno::Reference
< lang::XMultiServiceFactory
> xServiceFactory(::comphelper::getProcessServiceFactory(), uno::UNO_QUERY
);
59 uno::Reference
< container::XSet
> xSet(xServiceFactory
, uno::UNO_QUERY
);
63 uno::Sequence
< OUString
> aServices
;
64 uno::Reference
< lang::XSingleServiceFactory
> xSingleFactory
;
68 // ------------------------------------------------------------------------
70 REGISTER_SERVICE( FormController
, OUString( "com.sun.star.form.runtime.FormController" ) );
71 REGISTER_SERVICE( LegacyFormController
, OUString( "com.sun.star.form.FormController" ) );
73 // ------------------------------------------------------------------------
74 // FormController - register selfaware service
75 xSingleFactory
= ::cppu::createSingleFactory( xServiceFactory
,
76 OAddConditionDialog_GetImplementationName(),
77 OAddConditionDialog_Create
,
78 OAddConditionDialog_GetSupportedServiceNames()
80 if ( xSingleFactory
.is() )
81 xSet
->insert( uno::makeAny( xSingleFactory
) );
83 // ------------------------------------------------------------------------
85 REGISTER_SERVICE(FmXGridControl
, FM_CONTROL_GRID
); // compatibility
86 REGISTER_SERVICE(FmXGridControl
, FM_CONTROL_GRIDCONTROL
);
87 REGISTER_SERVICE(FmXGridControl
, FM_SUN_CONTROL_GRIDCONTROL
);
90 } // namespace svxform
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */