xref: /aoo41x/main/ucb/source/ucp/file/filcmd.cxx (revision 2f86921c)
1*2f86921cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2f86921cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2f86921cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2f86921cSAndrew Rist  * distributed with this work for additional information
6*2f86921cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2f86921cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2f86921cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2f86921cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2f86921cSAndrew Rist  *
11*2f86921cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2f86921cSAndrew Rist  *
13*2f86921cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2f86921cSAndrew Rist  * software distributed under the License is distributed on an
15*2f86921cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2f86921cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2f86921cSAndrew Rist  * specific language governing permissions and limitations
18*2f86921cSAndrew Rist  * under the License.
19*2f86921cSAndrew Rist  *
20*2f86921cSAndrew Rist  *************************************************************/
21*2f86921cSAndrew Rist 
22*2f86921cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_ucb.hxx"
26cdf0e10cSrcweir #include "filcmd.hxx"
27cdf0e10cSrcweir #include "shell.hxx"
28cdf0e10cSrcweir #include "prov.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir using namespace fileaccess;
32cdf0e10cSrcweir using namespace com::sun::star;
33cdf0e10cSrcweir using namespace com::sun::star::ucb;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
XCommandInfo_impl(shell * pMyShell)36cdf0e10cSrcweir XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
37cdf0e10cSrcweir 	: m_pMyShell( pMyShell ),
38cdf0e10cSrcweir 	  m_xProvider( pMyShell->m_pProvider )
39cdf0e10cSrcweir {
40cdf0e10cSrcweir }
41cdf0e10cSrcweir 
~XCommandInfo_impl()42cdf0e10cSrcweir XCommandInfo_impl::~XCommandInfo_impl()
43cdf0e10cSrcweir {
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir void SAL_CALL
acquire(void)49cdf0e10cSrcweir XCommandInfo_impl::acquire(
50cdf0e10cSrcweir 			     void )
51cdf0e10cSrcweir   throw()
52cdf0e10cSrcweir {
53cdf0e10cSrcweir   OWeakObject::acquire();
54cdf0e10cSrcweir }
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir void SAL_CALL
release(void)58cdf0e10cSrcweir XCommandInfo_impl::release(
59cdf0e10cSrcweir 	void )
60cdf0e10cSrcweir   throw()
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	OWeakObject::release();
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir uno::Any SAL_CALL
queryInterface(const uno::Type & rType)67cdf0e10cSrcweir XCommandInfo_impl::queryInterface(
68cdf0e10cSrcweir 				    const uno::Type& rType )
69cdf0e10cSrcweir   throw( uno::RuntimeException )
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	uno::Any aRet = cppu::queryInterface( rType,
72cdf0e10cSrcweir 										  SAL_STATIC_CAST( XCommandInfo*,this) );
73cdf0e10cSrcweir 	return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir uno::Sequence< CommandInfo > SAL_CALL
getCommands(void)78cdf0e10cSrcweir XCommandInfo_impl::getCommands(
79cdf0e10cSrcweir 	void )
80cdf0e10cSrcweir 	throw( uno::RuntimeException )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	return m_pMyShell->m_sCommandInfo;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir CommandInfo SAL_CALL
getCommandInfoByName(const rtl::OUString & aName)87cdf0e10cSrcweir XCommandInfo_impl::getCommandInfoByName(
88cdf0e10cSrcweir 	const rtl::OUString& aName )
89cdf0e10cSrcweir 	throw( UnsupportedCommandException,
90cdf0e10cSrcweir 		   uno::RuntimeException)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
93cdf0e10cSrcweir 		if( m_pMyShell->m_sCommandInfo[i].Name == aName )
94cdf0e10cSrcweir 			return m_pMyShell->m_sCommandInfo[i];
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 
100cdf0e10cSrcweir CommandInfo SAL_CALL
getCommandInfoByHandle(sal_Int32 Handle)101cdf0e10cSrcweir XCommandInfo_impl::getCommandInfoByHandle(
102cdf0e10cSrcweir 	sal_Int32 Handle )
103cdf0e10cSrcweir 	throw( UnsupportedCommandException,
104cdf0e10cSrcweir 		   uno::RuntimeException )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
107cdf0e10cSrcweir 		if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
108cdf0e10cSrcweir 			return m_pMyShell->m_sCommandInfo[i];
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir sal_Bool SAL_CALL
hasCommandByName(const rtl::OUString & aName)115cdf0e10cSrcweir XCommandInfo_impl::hasCommandByName(
116cdf0e10cSrcweir 	const rtl::OUString& aName )
117cdf0e10cSrcweir 	throw( uno::RuntimeException )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
120cdf0e10cSrcweir 		if( m_pMyShell->m_sCommandInfo[i].Name == aName )
121cdf0e10cSrcweir 			return true;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	return false;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir sal_Bool SAL_CALL
hasCommandByHandle(sal_Int32 Handle)128cdf0e10cSrcweir XCommandInfo_impl::hasCommandByHandle(
129cdf0e10cSrcweir 	sal_Int32 Handle )
130cdf0e10cSrcweir 	throw( uno::RuntimeException )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
133cdf0e10cSrcweir 		if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
134cdf0e10cSrcweir 			return true;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	return false;
137cdf0e10cSrcweir }
138