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 .
21 #include <cppuhelper/factory.hxx>
22 #include <cppuhelper/supportsservice.hxx>
23 #include <com/sun/star/lang/IllegalArgumentException.hpp>
27 /**************************************************************************
29 **************************************************************************
31 *************************************************************************/
32 using namespace com::sun::star
;
33 using namespace ucb_cmdenv
;
36 // UcbCommandEnvironment Implementation.
39 UcbCommandEnvironment::UcbCommandEnvironment()
45 UcbCommandEnvironment::~UcbCommandEnvironment()
50 // XInitialization methods.
54 void SAL_CALL
UcbCommandEnvironment::initialize(
55 const uno::Sequence
< uno::Any
>& aArguments
)
57 if ( ( aArguments
.getLength() < 2 ) ||
58 !( aArguments
[ 0 ] >>= m_xIH
) ||
59 !( aArguments
[ 1 ] >>= m_xPH
))
60 throw lang::IllegalArgumentException();
64 // XServiceInfo methods.
68 OUString SAL_CALL
UcbCommandEnvironment::getImplementationName()
70 return getImplementationName_Static();
76 UcbCommandEnvironment::supportsService( const OUString
& ServiceName
)
78 return cppu::supportsService(this, ServiceName
);
83 uno::Sequence
< OUString
> SAL_CALL
84 UcbCommandEnvironment::getSupportedServiceNames()
86 return getSupportedServiceNames_Static();
91 OUString
UcbCommandEnvironment::getImplementationName_Static()
93 return "com.sun.star.comp.ucb.CommandEnvironment";
98 uno::Sequence
< OUString
>
99 UcbCommandEnvironment::getSupportedServiceNames_Static()
101 uno::Sequence
<OUString
> aSNS
{ "com.sun.star.ucb.CommandEnvironment" };
106 // XCommandInfo methods.
110 uno::Reference
< task::XInteractionHandler
> SAL_CALL
111 UcbCommandEnvironment::getInteractionHandler()
118 uno::Reference
< ucb::XProgressHandler
> SAL_CALL
119 UcbCommandEnvironment::getProgressHandler()
125 // Service factory implementation.
127 /// @throws uno::Exception
128 static uno::Reference
< uno::XInterface
>
129 UcbCommandEnvironment_CreateInstance(
130 const uno::Reference
< lang::XMultiServiceFactory
> & /*rSMgr*/ )
132 lang::XServiceInfo
* pX
= new UcbCommandEnvironment
;
133 return uno::Reference
< uno::XInterface
>::query( pX
);
138 uno::Reference
< lang::XSingleServiceFactory
>
139 UcbCommandEnvironment::createServiceFactory(
140 const uno::Reference
< lang::XMultiServiceFactory
>& rxServiceMgr
)
142 return cppu::createSingleFactory(
144 UcbCommandEnvironment::getImplementationName_Static(),
145 UcbCommandEnvironment_CreateInstance
,
146 UcbCommandEnvironment::getSupportedServiceNames_Static() );
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */