1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filcmd.cxx,v $
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"
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()
56 XCommandInfo_impl::acquire(
60 OWeakObject::acquire();
65 XCommandInfo_impl::release(
69 OWeakObject::release();
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(
87 throw( uno::RuntimeException
)
89 return m_pMyShell
->m_sCommandInfo
;
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
>() );
108 XCommandInfo_impl::getCommandInfoByHandle(
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
>() );
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
)
135 XCommandInfo_impl::hasCommandByHandle(
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
)