sd: keep a non-owning pointer to the OverridingShell
[LibreOffice.git] / svx / source / form / fmservs.cxx
bloba6c0daf5d1c3c23dba0f657032a90d197abb7710
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <com/sun/star/lang/XSingleServiceFactory.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <fmservs.hxx>
27 using namespace com::sun::star;
29 #define REGISTER_SERVICE(ImplName, ServiceName) \
30 sString = (ServiceName); \
31 xSingleFactory = ::cppu::createSingleFactory(xServiceFactory, \
32 OUString(), ImplName##_NewInstance_Impl, \
33 uno::Sequence< OUString>(&sString, 1)); \
34 if (xSingleFactory.is()) \
35 xSet->insert(uno::Any(xSingleFactory));
37 namespace svxform
39 void ImplSmartRegisterUnoServices()
41 uno::Reference< lang::XMultiServiceFactory > xServiceFactory = ::comphelper::getProcessServiceFactory();
42 uno::Reference< container::XSet > xSet(xServiceFactory, uno::UNO_QUERY);
43 if (!xSet.is())
44 return;
46 uno::Reference< lang::XSingleServiceFactory > xSingleFactory;
48 OUString sString;
51 // FormController
52 REGISTER_SERVICE( FormController, "com.sun.star.form.runtime.FormController" );
53 REGISTER_SERVICE( LegacyFormController, "com.sun.star.form.FormController" );
56 // FormController - register selfaware service
57 xSingleFactory = ::cppu::createSingleFactory( xServiceFactory,
58 OAddConditionDialog_GetImplementationName(),
59 OAddConditionDialog_Create,
60 OAddConditionDialog_GetSupportedServiceNames()
62 if ( xSingleFactory.is() )
63 xSet->insert( uno::Any( xSingleFactory ) );
66 // DBGridControl
67 REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRID); // compatibility
68 REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRIDCONTROL);
69 REGISTER_SERVICE(FmXGridControl, FM_SUN_CONTROL_GRIDCONTROL);
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */