Line data Source code
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"
22 : #include <cppuhelper/supportsservice.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 :
37 :
38 : // UcbCommandEnvironment Implementation.
39 :
40 :
41 :
42 :
43 0 : UcbCommandEnvironment::UcbCommandEnvironment(
44 0 : const uno::Reference< lang::XMultiServiceFactory >& /*xSMgr*/ )
45 : //: m_xSMgr( xSMgr )
46 : {
47 0 : }
48 :
49 :
50 : // virtual
51 0 : UcbCommandEnvironment::~UcbCommandEnvironment()
52 : {
53 0 : }
54 :
55 :
56 :
57 : // XInitialization methods.
58 :
59 :
60 :
61 : // virtual
62 0 : void SAL_CALL UcbCommandEnvironment::initialize(
63 : const uno::Sequence< uno::Any >& aArguments )
64 : throw( uno::Exception,
65 : uno::RuntimeException, std::exception )
66 : {
67 0 : if ( ( aArguments.getLength() < 2 ) ||
68 0 : !( aArguments[ 0 ] >>= m_xIH ) ||
69 0 : !( aArguments[ 1 ] >>= m_xPH ))
70 0 : throw lang::IllegalArgumentException();
71 0 : }
72 :
73 :
74 :
75 : // XServiceInfo methods.
76 :
77 :
78 :
79 : // virtual
80 0 : OUString SAL_CALL UcbCommandEnvironment::getImplementationName()
81 : throw ( uno::RuntimeException, std::exception )
82 : {
83 0 : return getImplementationName_Static();
84 : }
85 :
86 :
87 : // virtual
88 : sal_Bool SAL_CALL
89 0 : UcbCommandEnvironment::supportsService( const OUString& ServiceName )
90 : throw ( uno::RuntimeException, std::exception )
91 : {
92 0 : return cppu::supportsService(this, ServiceName);
93 : }
94 :
95 :
96 : // virtual
97 : uno::Sequence< OUString > SAL_CALL
98 0 : UcbCommandEnvironment::getSupportedServiceNames()
99 : throw ( uno::RuntimeException, std::exception )
100 : {
101 0 : return getSupportedServiceNames_Static();
102 : }
103 :
104 :
105 : // static
106 0 : OUString UcbCommandEnvironment::getImplementationName_Static()
107 : {
108 0 : return OUString( "com.sun.star.comp.ucb.CommandEnvironment" );
109 : }
110 :
111 :
112 : // static
113 : uno::Sequence< OUString >
114 0 : UcbCommandEnvironment::getSupportedServiceNames_Static()
115 : {
116 0 : uno::Sequence< OUString > aSNS( 1 );
117 0 : aSNS.getArray()[ 0 ] = "com.sun.star.ucb.CommandEnvironment";
118 0 : return aSNS;
119 : }
120 :
121 :
122 :
123 : // XCommandInfo methods.
124 :
125 :
126 :
127 : // virtual
128 : uno::Reference< task::XInteractionHandler > SAL_CALL
129 0 : UcbCommandEnvironment::getInteractionHandler()
130 : throw ( uno::RuntimeException, std::exception )
131 : {
132 0 : return m_xIH;
133 : }
134 :
135 :
136 : // virtual
137 : uno::Reference< ucb::XProgressHandler > SAL_CALL
138 0 : UcbCommandEnvironment::getProgressHandler()
139 : throw ( uno::RuntimeException, std::exception )
140 : {
141 0 : return m_xPH;
142 : }
143 :
144 :
145 :
146 : // Service factory implementation.
147 :
148 :
149 :
150 : static uno::Reference< uno::XInterface > SAL_CALL
151 0 : UcbCommandEnvironment_CreateInstance(
152 : const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
153 : throw( uno::Exception )
154 : {
155 : lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
156 0 : new UcbCommandEnvironment( rSMgr ) );
157 0 : return uno::Reference< uno::XInterface >::query( pX );
158 : }
159 :
160 :
161 : // static
162 : uno::Reference< lang::XSingleServiceFactory >
163 0 : UcbCommandEnvironment::createServiceFactory(
164 : const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
165 : {
166 : return uno::Reference< lang::XSingleServiceFactory >(
167 : cppu::createSingleFactory(
168 : rxServiceMgr,
169 : UcbCommandEnvironment::getImplementationName_Static(),
170 : UcbCommandEnvironment_CreateInstance,
171 0 : UcbCommandEnvironment::getSupportedServiceNames_Static() ) );
172 : }
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|