bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / file / filcmd.cxx
blob95be18aa33ddba0cc3cd41c41d5c883e6c789da0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include "filcmd.hxx"
21 #include "shell.hxx"
22 #include "prov.hxx"
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
30 #else
31 #define THROW_WHERE ""
32 #endif
34 XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
35 : m_pMyShell( pMyShell ),
36 m_xProvider( pMyShell->m_pProvider )
40 XCommandInfo_impl::~XCommandInfo_impl()
46 void SAL_CALL
47 XCommandInfo_impl::acquire(
48 void )
49 throw()
51 OWeakObject::acquire();
55 void SAL_CALL
56 XCommandInfo_impl::release(
57 void )
58 throw()
60 OWeakObject::release();
64 uno::Any SAL_CALL
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(
77 void )
78 throw( uno::RuntimeException, std::exception )
80 return m_pMyShell->m_sCommandInfo;
84 CommandInfo SAL_CALL
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 );
98 CommandInfo SAL_CALL
99 XCommandInfo_impl::getCommandInfoByHandle(
100 sal_Int32 Handle )
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 );
112 sal_Bool SAL_CALL
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 )
119 return true;
121 return false;
125 sal_Bool SAL_CALL
126 XCommandInfo_impl::hasCommandByHandle(
127 sal_Int32 Handle )
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 )
132 return true;
134 return false;
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */