Update ooo320-m1
[ooovba.git] / ucb / source / ucp / file / filcmd.cxx
blobc84cc69439c0aaf013f5fb810eb2ee1f85bbcf0a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filcmd.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucb.hxx"
33 #include "filcmd.hxx"
34 #include "shell.hxx"
35 #include "prov.hxx"
38 using namespace fileaccess;
39 using namespace com::sun::star;
40 using namespace com::sun::star::ucb;
43 XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
44 : m_pMyShell( pMyShell ),
45 m_xProvider( pMyShell->m_pProvider )
49 XCommandInfo_impl::~XCommandInfo_impl()
55 void SAL_CALL
56 XCommandInfo_impl::acquire(
57 void )
58 throw()
60 OWeakObject::acquire();
64 void SAL_CALL
65 XCommandInfo_impl::release(
66 void )
67 throw()
69 OWeakObject::release();
73 uno::Any SAL_CALL
74 XCommandInfo_impl::queryInterface(
75 const uno::Type& rType )
76 throw( uno::RuntimeException )
78 uno::Any aRet = cppu::queryInterface( rType,
79 SAL_STATIC_CAST( XCommandInfo*,this) );
80 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
84 uno::Sequence< CommandInfo > SAL_CALL
85 XCommandInfo_impl::getCommands(
86 void )
87 throw( uno::RuntimeException )
89 return m_pMyShell->m_sCommandInfo;
93 CommandInfo SAL_CALL
94 XCommandInfo_impl::getCommandInfoByName(
95 const rtl::OUString& aName )
96 throw( UnsupportedCommandException,
97 uno::RuntimeException)
99 for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
100 if( m_pMyShell->m_sCommandInfo[i].Name == aName )
101 return m_pMyShell->m_sCommandInfo[i];
103 throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
107 CommandInfo SAL_CALL
108 XCommandInfo_impl::getCommandInfoByHandle(
109 sal_Int32 Handle )
110 throw( UnsupportedCommandException,
111 uno::RuntimeException )
113 for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
114 if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
115 return m_pMyShell->m_sCommandInfo[i];
117 throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
121 sal_Bool SAL_CALL
122 XCommandInfo_impl::hasCommandByName(
123 const rtl::OUString& aName )
124 throw( uno::RuntimeException )
126 for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
127 if( m_pMyShell->m_sCommandInfo[i].Name == aName )
128 return true;
130 return false;
134 sal_Bool SAL_CALL
135 XCommandInfo_impl::hasCommandByHandle(
136 sal_Int32 Handle )
137 throw( uno::RuntimeException )
139 for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
140 if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
141 return true;
143 return false;