Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / ucb / source / core / cmdenv.cxx
blob638db5cc6044f11577e8666e4bd2622e92644817
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include "cmdenv.hxx"
27 /**************************************************************************
28 TODO
29 **************************************************************************
31 *************************************************************************/
32 using namespace com::sun::star;
33 using namespace ucb_cmdenv;
36 // UcbCommandEnvironment Implementation.
39 UcbCommandEnvironment::UcbCommandEnvironment()
44 // virtual
45 UcbCommandEnvironment::~UcbCommandEnvironment()
50 // XInitialization methods.
53 // virtual
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.
67 // virtual
68 OUString SAL_CALL UcbCommandEnvironment::getImplementationName()
70 return getImplementationName_Static();
74 // virtual
75 sal_Bool SAL_CALL
76 UcbCommandEnvironment::supportsService( const OUString& ServiceName )
78 return cppu::supportsService(this, ServiceName);
82 // virtual
83 uno::Sequence< OUString > SAL_CALL
84 UcbCommandEnvironment::getSupportedServiceNames()
86 return getSupportedServiceNames_Static();
90 // static
91 OUString UcbCommandEnvironment::getImplementationName_Static()
93 return "com.sun.star.comp.ucb.CommandEnvironment";
97 // static
98 uno::Sequence< OUString >
99 UcbCommandEnvironment::getSupportedServiceNames_Static()
101 uno::Sequence<OUString> aSNS { "com.sun.star.ucb.CommandEnvironment" };
102 return aSNS;
106 // XCommandInfo methods.
109 // virtual
110 uno::Reference< task::XInteractionHandler > SAL_CALL
111 UcbCommandEnvironment::getInteractionHandler()
113 return m_xIH;
117 // virtual
118 uno::Reference< ucb::XProgressHandler > SAL_CALL
119 UcbCommandEnvironment::getProgressHandler()
121 return m_xPH;
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 );
137 // static
138 uno::Reference< lang::XSingleServiceFactory >
139 UcbCommandEnvironment::createServiceFactory(
140 const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
142 return cppu::createSingleFactory(
143 rxServiceMgr,
144 UcbCommandEnvironment::getImplementationName_Static(),
145 UcbCommandEnvironment_CreateInstance,
146 UcbCommandEnvironment::getSupportedServiceNames_Static() );
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */