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 .
24 using namespace fileaccess
;
25 using namespace com::sun::star
;
26 using namespace com::sun::star::ucb
;
28 #if OSL_DEBUG_LEVEL > 0
29 #define THROW_WHERE SAL_WHERE
31 #define THROW_WHERE ""
34 XCommandInfo_impl::XCommandInfo_impl( shell
* pMyShell
)
35 : m_pMyShell( pMyShell
),
36 m_xProvider( pMyShell
->m_pProvider
)
40 XCommandInfo_impl::~XCommandInfo_impl()
47 XCommandInfo_impl::acquire(
51 OWeakObject::acquire();
56 XCommandInfo_impl::release(
60 OWeakObject::release();
65 XCommandInfo_impl::queryInterface(
66 const uno::Type
& rType
)
67 throw( uno::RuntimeException
, std::exception
)
69 uno::Any aRet
= cppu::queryInterface( rType
,
70 (static_cast< XCommandInfo
* >(this)) );
71 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
75 uno::Sequence
< CommandInfo
> SAL_CALL
76 XCommandInfo_impl::getCommands(
78 throw( uno::RuntimeException
, std::exception
)
80 return m_pMyShell
->m_sCommandInfo
;
85 XCommandInfo_impl::getCommandInfoByName(
86 const OUString
& aName
)
87 throw( UnsupportedCommandException
,
88 uno::RuntimeException
, std::exception
)
90 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); i
++ )
91 if( m_pMyShell
->m_sCommandInfo
[i
].Name
== aName
)
92 return m_pMyShell
->m_sCommandInfo
[i
];
94 throw UnsupportedCommandException( THROW_WHERE
);
99 XCommandInfo_impl::getCommandInfoByHandle(
101 throw( UnsupportedCommandException
,
102 uno::RuntimeException
, std::exception
)
104 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
105 if( m_pMyShell
->m_sCommandInfo
[i
].Handle
== Handle
)
106 return m_pMyShell
->m_sCommandInfo
[i
];
108 throw UnsupportedCommandException( THROW_WHERE
);
113 XCommandInfo_impl::hasCommandByName(
114 const OUString
& aName
)
115 throw( uno::RuntimeException
, std::exception
)
117 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
118 if( m_pMyShell
->m_sCommandInfo
[i
].Name
== aName
)
126 XCommandInfo_impl::hasCommandByHandle(
128 throw( uno::RuntimeException
, std::exception
)
130 for( sal_Int32 i
= 0; i
< m_pMyShell
->m_sCommandInfo
.getLength(); ++i
)
131 if( m_pMyShell
->m_sCommandInfo
[i
].Handle
== Handle
)
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */