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 :
25 : using namespace fileaccess;
26 : using namespace com::sun::star;
27 : using namespace com::sun::star::ucb;
28 :
29 :
30 0 : XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
31 : : m_pMyShell( pMyShell ),
32 0 : m_xProvider( pMyShell->m_pProvider )
33 : {
34 0 : }
35 :
36 0 : XCommandInfo_impl::~XCommandInfo_impl()
37 : {
38 0 : }
39 :
40 :
41 :
42 : void SAL_CALL
43 0 : XCommandInfo_impl::acquire(
44 : void )
45 : throw()
46 : {
47 0 : OWeakObject::acquire();
48 0 : }
49 :
50 :
51 : void SAL_CALL
52 0 : XCommandInfo_impl::release(
53 : void )
54 : throw()
55 : {
56 0 : OWeakObject::release();
57 0 : }
58 :
59 :
60 : uno::Any SAL_CALL
61 0 : XCommandInfo_impl::queryInterface(
62 : const uno::Type& rType )
63 : throw( uno::RuntimeException )
64 : {
65 : uno::Any aRet = cppu::queryInterface( rType,
66 0 : (static_cast< XCommandInfo* >(this)) );
67 0 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
68 : }
69 :
70 :
71 : uno::Sequence< CommandInfo > SAL_CALL
72 0 : XCommandInfo_impl::getCommands(
73 : void )
74 : throw( uno::RuntimeException )
75 : {
76 0 : return m_pMyShell->m_sCommandInfo;
77 : }
78 :
79 :
80 : CommandInfo SAL_CALL
81 0 : XCommandInfo_impl::getCommandInfoByName(
82 : const rtl::OUString& aName )
83 : throw( UnsupportedCommandException,
84 : uno::RuntimeException)
85 : {
86 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
87 0 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
88 0 : return m_pMyShell->m_sCommandInfo[i];
89 :
90 0 : throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
91 : }
92 :
93 :
94 : CommandInfo SAL_CALL
95 0 : XCommandInfo_impl::getCommandInfoByHandle(
96 : sal_Int32 Handle )
97 : throw( UnsupportedCommandException,
98 : uno::RuntimeException )
99 : {
100 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
101 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
102 0 : return m_pMyShell->m_sCommandInfo[i];
103 :
104 0 : throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
105 : }
106 :
107 :
108 : sal_Bool SAL_CALL
109 0 : XCommandInfo_impl::hasCommandByName(
110 : const rtl::OUString& aName )
111 : throw( uno::RuntimeException )
112 : {
113 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
114 0 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
115 0 : return true;
116 :
117 0 : return false;
118 : }
119 :
120 :
121 : sal_Bool SAL_CALL
122 0 : XCommandInfo_impl::hasCommandByHandle(
123 : sal_Int32 Handle )
124 : throw( uno::RuntimeException )
125 : {
126 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
127 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
128 0 : return true;
129 :
130 0 : return false;
131 : }
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|