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
;
38 // UcbCommandEnvironment Implementation.
43 UcbCommandEnvironment::UcbCommandEnvironment(
44 const uno::Reference
< lang::XMultiServiceFactory
>& /*xSMgr*/ )
51 UcbCommandEnvironment::~UcbCommandEnvironment()
57 // XInitialization methods.
62 void SAL_CALL
UcbCommandEnvironment::initialize(
63 const uno::Sequence
< uno::Any
>& aArguments
)
64 throw( uno::Exception
,
65 uno::RuntimeException
, std::exception
)
67 if ( ( aArguments
.getLength() < 2 ) ||
68 !( aArguments
[ 0 ] >>= m_xIH
) ||
69 !( aArguments
[ 1 ] >>= m_xPH
))
70 throw lang::IllegalArgumentException();
75 // XServiceInfo methods.
80 OUString SAL_CALL
UcbCommandEnvironment::getImplementationName()
81 throw ( uno::RuntimeException
, std::exception
)
83 return getImplementationName_Static();
89 UcbCommandEnvironment::supportsService( const OUString
& ServiceName
)
90 throw ( uno::RuntimeException
, std::exception
)
92 return cppu::supportsService(this, ServiceName
);
97 uno::Sequence
< OUString
> SAL_CALL
98 UcbCommandEnvironment::getSupportedServiceNames()
99 throw ( uno::RuntimeException
, std::exception
)
101 return getSupportedServiceNames_Static();
106 OUString
UcbCommandEnvironment::getImplementationName_Static()
108 return OUString( "com.sun.star.comp.ucb.CommandEnvironment" );
113 uno::Sequence
< OUString
>
114 UcbCommandEnvironment::getSupportedServiceNames_Static()
116 uno::Sequence
< OUString
> aSNS( 1 );
117 aSNS
.getArray()[ 0 ] = "com.sun.star.ucb.CommandEnvironment";
123 // XCommandInfo methods.
128 uno::Reference
< task::XInteractionHandler
> SAL_CALL
129 UcbCommandEnvironment::getInteractionHandler()
130 throw ( uno::RuntimeException
, std::exception
)
137 uno::Reference
< ucb::XProgressHandler
> SAL_CALL
138 UcbCommandEnvironment::getProgressHandler()
139 throw ( uno::RuntimeException
, std::exception
)
146 // Service factory implementation.
150 static uno::Reference
< uno::XInterface
> SAL_CALL
151 UcbCommandEnvironment_CreateInstance(
152 const uno::Reference
< lang::XMultiServiceFactory
> & rSMgr
)
153 throw( uno::Exception
)
155 lang::XServiceInfo
* pX
= static_cast< lang::XServiceInfo
* >(
156 new UcbCommandEnvironment( rSMgr
) );
157 return uno::Reference
< uno::XInterface
>::query( pX
);
162 uno::Reference
< lang::XSingleServiceFactory
>
163 UcbCommandEnvironment::createServiceFactory(
164 const uno::Reference
< lang::XMultiServiceFactory
>& rxServiceMgr
)
166 return uno::Reference
< lang::XSingleServiceFactory
>(
167 cppu::createSingleFactory(
169 UcbCommandEnvironment::getImplementationName_Static(),
170 UcbCommandEnvironment_CreateInstance
,
171 UcbCommandEnvironment::getSupportedServiceNames_Static() ) );
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */