Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "filcmd.hxx"
21 : #include "shell.hxx"
22 : #include "prov.hxx"
23 :
24 : using namespace fileaccess;
25 : using namespace com::sun::star;
26 : using namespace com::sun::star::ucb;
27 :
28 : #if OSL_DEBUG_LEVEL > 0
29 : #define THROW_WHERE SAL_WHERE
30 : #else
31 : #define THROW_WHERE ""
32 : #endif
33 :
34 0 : XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
35 : : m_pMyShell( pMyShell ),
36 0 : m_xProvider( pMyShell->m_pProvider )
37 : {
38 0 : }
39 :
40 0 : XCommandInfo_impl::~XCommandInfo_impl()
41 : {
42 0 : }
43 :
44 :
45 :
46 : void SAL_CALL
47 0 : XCommandInfo_impl::acquire(
48 : void )
49 : throw()
50 : {
51 0 : OWeakObject::acquire();
52 0 : }
53 :
54 :
55 : void SAL_CALL
56 0 : XCommandInfo_impl::release(
57 : void )
58 : throw()
59 : {
60 0 : OWeakObject::release();
61 0 : }
62 :
63 :
64 : uno::Any SAL_CALL
65 0 : XCommandInfo_impl::queryInterface(
66 : const uno::Type& rType )
67 : throw( uno::RuntimeException, std::exception )
68 : {
69 : uno::Any aRet = cppu::queryInterface( rType,
70 0 : (static_cast< XCommandInfo* >(this)) );
71 0 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
72 : }
73 :
74 :
75 : uno::Sequence< CommandInfo > SAL_CALL
76 0 : XCommandInfo_impl::getCommands(
77 : void )
78 : throw( uno::RuntimeException, std::exception )
79 : {
80 0 : return m_pMyShell->m_sCommandInfo;
81 : }
82 :
83 :
84 : CommandInfo SAL_CALL
85 0 : XCommandInfo_impl::getCommandInfoByName(
86 : const OUString& aName )
87 : throw( UnsupportedCommandException,
88 : uno::RuntimeException, std::exception)
89 : {
90 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
91 0 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
92 0 : return m_pMyShell->m_sCommandInfo[i];
93 :
94 0 : throw UnsupportedCommandException( OUString(THROW_WHERE), uno::Reference< uno::XInterface >() );
95 : }
96 :
97 :
98 : CommandInfo SAL_CALL
99 0 : XCommandInfo_impl::getCommandInfoByHandle(
100 : sal_Int32 Handle )
101 : throw( UnsupportedCommandException,
102 : uno::RuntimeException, std::exception )
103 : {
104 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
105 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
106 0 : return m_pMyShell->m_sCommandInfo[i];
107 :
108 0 : throw UnsupportedCommandException( OUString(THROW_WHERE), uno::Reference< uno::XInterface >() );
109 : }
110 :
111 :
112 : sal_Bool SAL_CALL
113 0 : XCommandInfo_impl::hasCommandByName(
114 : const OUString& aName )
115 : throw( uno::RuntimeException, std::exception )
116 : {
117 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
118 0 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
119 0 : return true;
120 :
121 0 : return false;
122 : }
123 :
124 :
125 : sal_Bool SAL_CALL
126 0 : XCommandInfo_impl::hasCommandByHandle(
127 : sal_Int32 Handle )
128 : throw( uno::RuntimeException, std::exception )
129 : {
130 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
131 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
132 0 : return true;
133 :
134 0 : return false;
135 : }
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|