LibreOffice Module svx (master)  1
fmdmod.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 
22 #include <string_view>
23 
24 #include <sal/macros.h>
25 #include <svx/fmdmod.hxx>
26 #include <fmservs.hxx>
27 #include <fmobj.hxx>
28 #include <svx/unoshape.hxx>
30 #include <comphelper/sequence.hxx>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 
33 using namespace ::svxform;
34 
35 
36 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier)
37 {
38  ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
39 
40  if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
41  {
42  css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
43  xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext);
44  }
45  else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
46  {
47  SdrModel& rTargetModel(getSdrModelFromUnoModel());
48  SdrObject* pObj = new FmFormObj(rTargetModel);
49  xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
50  }
51 
52  if (!xRet.is())
53  {
54  xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
55  }
56 
57  return xRet;
58 }
59 
60 
61 ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames()
62 {
63  static const std::u16string_view aSvxComponentServiceNameList[] =
64  {
84  };
85 
86  static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
87 
88  auto aSeq( comphelper::arrayToSequence< OUString >(aSvxComponentServiceNameList, nSvxComponentServiceNameListCount) );
89 
90  ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
91  return comphelper::concatSequences( aParentSeq, aSeq );
92 }
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FM_SUN_COMPONENT_RADIOBUTTON
Definition: fmservs.hxx:58
#define FM_SUN_COMPONENT_LISTBOX
Definition: fmservs.hxx:56
#define FM_SUN_COMPONENT_DATEFIELD
Definition: fmservs.hxx:67
#define FM_SUN_COMPONENT_PATTERNFIELD
Definition: fmservs.hxx:70
virtual SdrModel & getSdrModelFromUnoModel() const =0
abstract SdrModel provider
#define FM_SUN_COMPONENT_FIXEDTEXT
Definition: fmservs.hxx:60
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: unomod.cxx:222
#define SAL_N_ELEMENTS(arr)
#define FM_SUN_COMPONENT_TIMEFIELD
Definition: fmservs.hxx:66
#define FM_SUN_COMPONENT_CURRENCYFIELD
Definition: fmservs.hxx:69
float u
#define FM_SUN_COMPONENT_CHECKBOX
Definition: fmservs.hxx:62
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
Abstract DrawObject.
Definition: svdobj.hxx:259
#define FM_SUN_COMPONENT_IMAGECONTROL
Definition: fmservs.hxx:72
#define FM_SUN_COMPONENT_FILECONTROL
Definition: fmservs.hxx:65
virtual ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface > SAL_CALL createInstance(const OUString &ServiceSpecifier) override
Definition: fmdmod.cxx:36
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: fmdmod.cxx:61
#define FM_SUN_COMPONENT_FORM
Definition: fmservs.hxx:54
#define FM_SUN_COMPONENT_IMAGEBUTTON
Definition: fmservs.hxx:64
#define FM_SUN_COMPONENT_HIDDENCONTROL
Definition: fmservs.hxx:71
#define FM_SUN_COMPONENT_GRIDCONTROL
Definition: fmservs.hxx:63
Reference< XComponentContext > getProcessComponentContext()
Sequence< sal_Int8 > aSeq
#define FM_SUN_COMPONENT_NUMERICFIELD
Definition: fmservs.hxx:68
#define FM_SUN_COMPONENT_GROUPBOX
Definition: fmservs.hxx:59
class FmSearchEngine - Impl class for FmSearchDialog
#define FM_SUN_COMPONENT_COMMANDBUTTON
Definition: fmservs.hxx:61
#define FM_SUN_COMPONENT_COMBOBOX
Definition: fmservs.hxx:57
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
Definition: unomod.cxx:200
#define FM_SUN_COMPONENT_TEXTFIELD
Definition: fmservs.hxx:55