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 <sal/config.h>
22 #include <sal/macros.h>
23 #include <svx/fmdmod.hxx>
24 #include <fmservs.hxx>
26 #include <svx/unoshape.hxx>
27 #include <comphelper/processfactory.hxx>
28 #include <comphelper/sequence.hxx>
29 #include <com/sun/star/uno/XComponentContext.hpp>
31 using namespace ::svxform
;
34 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SvxFmMSFactory::createInstance(const OUString
& rServiceSpecifier
)
36 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRet
;
38 if ( rServiceSpecifier
.startsWith( "com.sun.star.form.component." ) )
40 css::uno::Reference
<css::uno::XComponentContext
> xContext
= comphelper::getProcessComponentContext();
41 xRet
= xContext
->getServiceManager()->createInstanceWithContext(rServiceSpecifier
, xContext
);
43 else if ( rServiceSpecifier
== "com.sun.star.drawing.ControlShape" )
45 SdrModel
& rTargetModel(getSdrModelFromUnoModel());
46 rtl::Reference
<SdrObject
> pObj
= new FmFormObj(rTargetModel
);
47 xRet
= static_cast<cppu::OWeakObject
*>(static_cast<SvxShape_UnoImplHelper
*>(new SvxShapeControl(pObj
.get())));
52 xRet
= SvxUnoDrawMSFactory::createInstance(rServiceSpecifier
);
59 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
SvxFmMSFactory::getAvailableServiceNames()
61 static const rtl::OUStringConstExpr aSvxComponentServiceNameList
[] =
63 FM_SUN_COMPONENT_TEXTFIELD
,
64 FM_SUN_COMPONENT_FORM
,
65 FM_SUN_COMPONENT_LISTBOX
,
66 FM_SUN_COMPONENT_COMBOBOX
,
67 FM_SUN_COMPONENT_RADIOBUTTON
,
68 FM_SUN_COMPONENT_GROUPBOX
,
69 FM_SUN_COMPONENT_FIXEDTEXT
,
70 FM_SUN_COMPONENT_COMMANDBUTTON
,
71 FM_SUN_COMPONENT_CHECKBOX
,
72 FM_SUN_COMPONENT_GRIDCONTROL
,
73 FM_SUN_COMPONENT_IMAGEBUTTON
,
74 FM_SUN_COMPONENT_FILECONTROL
,
75 FM_SUN_COMPONENT_TIMEFIELD
,
76 FM_SUN_COMPONENT_DATEFIELD
,
77 FM_SUN_COMPONENT_NUMERICFIELD
,
78 FM_SUN_COMPONENT_CURRENCYFIELD
,
79 FM_SUN_COMPONENT_PATTERNFIELD
,
80 FM_SUN_COMPONENT_HIDDENCONTROL
,
81 FM_SUN_COMPONENT_IMAGECONTROL
84 static const sal_uInt16 nSvxComponentServiceNameListCount
= SAL_N_ELEMENTS(aSvxComponentServiceNameList
);
86 auto aSeq( comphelper::arrayToSequence
< OUString
>(aSvxComponentServiceNameList
, nSvxComponentServiceNameListCount
) );
88 ::com::sun::star::uno::Sequence
< OUString
> aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
89 return comphelper::concatSequences( aParentSeq
, aSeq
);
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */