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 <com/sun/star/lang/IllegalArgumentException.hpp>
24 
25 #include "cmdenv.hxx"
26 
27 /**************************************************************************
28  TODO
29  **************************************************************************
30 
31  *************************************************************************/
32 using namespace com::sun::star;
33 using namespace ucb_cmdenv;
34 
35 
36 // UcbCommandEnvironment Implementation.
37 
38 
39 UcbCommandEnvironment::UcbCommandEnvironment()
40 {
41 }
42 
43 
44 // virtual
45 UcbCommandEnvironment::~UcbCommandEnvironment()
46 {
47 }
48 
49 
50 // XInitialization methods.
51 
52 
53 // virtual
54 void SAL_CALL UcbCommandEnvironment::initialize(
55  const uno::Sequence< uno::Any >& aArguments )
56 {
57  if ( ( aArguments.getLength() < 2 ) ||
58  !( aArguments[ 0 ] >>= m_xIH ) ||
59  !( aArguments[ 1 ] >>= m_xPH ))
60  throw lang::IllegalArgumentException();
61 }
62 
63 
64 // XServiceInfo methods.
65 
66 
67 // virtual
68 OUString SAL_CALL UcbCommandEnvironment::getImplementationName()
69 {
70  return getImplementationName_Static();
71 }
72 
73 
74 // virtual
75 sal_Bool SAL_CALL
76 UcbCommandEnvironment::supportsService( const OUString& ServiceName )
77 {
78  return cppu::supportsService(this, ServiceName);
79 }
80 
81 
82 // virtual
83 uno::Sequence< OUString > SAL_CALL
84 UcbCommandEnvironment::getSupportedServiceNames()
85 {
86  return getSupportedServiceNames_Static();
87 }
88 
89 
90 // static
91 OUString UcbCommandEnvironment::getImplementationName_Static()
92 {
93  return "com.sun.star.comp.ucb.CommandEnvironment";
94 }
95 
96 
97 // static
98 uno::Sequence< OUString >
99 UcbCommandEnvironment::getSupportedServiceNames_Static()
100 {
101  uno::Sequence<OUString> aSNS { "com.sun.star.ucb.CommandEnvironment" };
102  return aSNS;
103 }
104 
105 
106 // XCommandInfo methods.
107 
108 
109 // virtual
110 uno::Reference< task::XInteractionHandler > SAL_CALL
111 UcbCommandEnvironment::getInteractionHandler()
112 {
113  return m_xIH;
114 }
115 
116 
117 // virtual
118 uno::Reference< ucb::XProgressHandler > SAL_CALL
119 UcbCommandEnvironment::getProgressHandler()
120 {
121  return m_xPH;
122 }
123 
124 
125 // Service factory implementation.
126 
128 static uno::Reference< uno::XInterface >
130  const uno::Reference< lang::XMultiServiceFactory> & /*rSMgr*/ )
131 {
132  lang::XServiceInfo* pX = new UcbCommandEnvironment;
133  return uno::Reference< uno::XInterface >::query( pX );
134 }
135 
136 
137 // static
138 uno::Reference< lang::XSingleServiceFactory >
139 UcbCommandEnvironment::createServiceFactory(
140  const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
141 {
143  rxServiceMgr,
144  UcbCommandEnvironment::getImplementationName_Static(),
146  UcbCommandEnvironment::getSupportedServiceNames_Static() );
147 }
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static uno::Reference< uno::XInterface > UcbCommandEnvironment_CreateInstance(const uno::Reference< lang::XMultiServiceFactory > &)
Definition: cmdenv.cxx:129
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool
css::uno::Reference< css::uno::XInterface >(SAL_CALL *ComponentInstantiation)(const css CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL createSingleFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceManager, const ::rtl::OUString &rImplementationName, ComponentInstantiation pCreateFunction, const css::uno::Sequence< ::rtl::OUString > &rServiceNames, rtl_ModuleCount *pModCount=NULL)