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