1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
25 using namespace fileaccess
;
26 using namespace com::sun::star
;
27 using namespace com::sun::star::ucb
;
30 XCommandInfo_impl::XCommandInfo_impl( shell
* pMyShell
)
31 : m_pMyShell( pMyShell
),
32 m_xProvider( pMyShell
->m_pProvider
)
36 XCommandInfo_impl::~XCommandInfo_impl()
43 XCommandInfo_impl::acquire(
47 OWeakObject::acquire();
52 XCommandInfo_impl::release(
56 OWeakObject::release();
61 XCommandInfo_impl::queryInterface(
62 const uno::Type
& rType
)
63 throw( uno::RuntimeException
)
65 uno::Any aRet
= cppu::queryInterface( rType
,
66 (static_cast< XCommandInfo
* >(this)) );
67 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
71 uno::Sequence
< CommandInfo
> SAL_CALL
72 XCommandInfo_impl::getCommands(
74 throw( uno::RuntimeException
)
76 return m_pMyShell
->m_sCommandInfo
;
81 XCommandInfo_impl::getCommandInfoByName(
82 const rtl::OUString
& aName
)
83 throw( UnsupportedCommandException
,
84 uno::RuntimeException
)
86 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); i
++ )
87 if( m_pMyShell
->m_sCommandInfo
[i
].Name
== aName
)
88 return m_pMyShell
->m_sCommandInfo
[i
];
90 throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
95 XCommandInfo_impl::getCommandInfoByHandle(
97 throw( UnsupportedCommandException
,
98 uno::RuntimeException
)
100 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
101 if( m_pMyShell
->m_sCommandInfo
[i
].Handle
== Handle
)
102 return m_pMyShell
->m_sCommandInfo
[i
];
104 throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
109 XCommandInfo_impl::hasCommandByName(
110 const rtl::OUString
& aName
)
111 throw( uno::RuntimeException
)
113 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
114 if( m_pMyShell
->m_sCommandInfo
[i
].Name
== aName
)
122 XCommandInfo_impl::hasCommandByHandle(
124 throw( uno::RuntimeException
)
126 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
127 if( m_pMyShell
->m_sCommandInfo
[i
].Handle
== Handle
)
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */