LibreOffice Module ucb (master)  1
cmdenv.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 
21 #include <cppuhelper/factory.hxx>
23 #include <cppuhelper/weak.hxx>
24 #include <com/sun/star/lang/IllegalArgumentException.hpp>
25 
26 #include "cmdenv.hxx"
27 
28 /**************************************************************************
29  TODO
30  **************************************************************************
31 
32  *************************************************************************/
33 using namespace com::sun::star;
34 using namespace ucb_cmdenv;
35 
36 // UcbCommandEnvironment Implementation.
37 
38 
39 UcbCommandEnvironment::UcbCommandEnvironment() : UcbCommandEnvironment_Base(m_aMutex)
40 {
41 }
42 
43 
44 // virtual
46 {
47 }
48 
49 // XInitialization methods.
50 
51 
52 // virtual
54  const uno::Sequence< uno::Any >& aArguments )
55 {
56  if ( ( aArguments.getLength() < 2 ) ||
57  !( aArguments[ 0 ] >>= m_xIH ) ||
58  !( aArguments[ 1 ] >>= m_xPH ))
59  throw lang::IllegalArgumentException();
60 }
61 
62 
63 // XServiceInfo methods.
64 
65 
66 // virtual
68 {
69  return "com.sun.star.comp.ucb.CommandEnvironment";
70 }
71 
72 
73 // virtual
74 sal_Bool SAL_CALL
75 UcbCommandEnvironment::supportsService( const OUString& ServiceName )
76 {
77  return cppu::supportsService(this, ServiceName);
78 }
79 
80 
81 // virtual
82 uno::Sequence< OUString > SAL_CALL
84 {
85  return { "com.sun.star.ucb.CommandEnvironment" };
86 }
87 
88 
89 // XCommandInfo methods.
90 
91 
92 // virtual
93 uno::Reference< task::XInteractionHandler > SAL_CALL
95 {
96  return m_xIH;
97 }
98 
99 
100 // virtual
101 uno::Reference< ucb::XProgressHandler > SAL_CALL
103 {
104  return m_xPH;
105 }
106 
107 
108 // Service factory implementation.
109 
110 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
112  css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
113 {
114  return cppu::acquire(new UcbCommandEnvironment());
115 }
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::task::XInteractionHandler > m_xIH
Definition: cmdenv.hxx:39
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: cmdenv.cxx:83
virtual OUString SAL_CALL getImplementationName() override
Definition: cmdenv.cxx:67
virtual css::uno::Reference< css::ucb::XProgressHandler > SAL_CALL getProgressHandler() override
Definition: cmdenv.cxx:102
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::mutex m_aMutex
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: cmdenv.cxx:53
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ucb_UcbCommandEnvironment_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: cmdenv.cxx:111
virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() override
Definition: cmdenv.cxx:94
unsigned char sal_Bool
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: cmdenv.cxx:75
cppu::WeakComponentImplHelper< css::lang::XInitialization, css::lang::XServiceInfo, css::ucb::XCommandEnvironment > UcbCommandEnvironment_Base
Definition: cmdenv.hxx:35
virtual ~UcbCommandEnvironment() override
Definition: cmdenv.cxx:45
css::uno::Reference< css::ucb::XProgressHandler > m_xPH
Definition: cmdenv.hxx:40