Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "filcmd.hxx"
30 : : #include "shell.hxx"
31 : : #include "prov.hxx"
32 : :
33 : :
34 : : using namespace fileaccess;
35 : : using namespace com::sun::star;
36 : : using namespace com::sun::star::ucb;
37 : :
38 : :
39 : 16 : XCommandInfo_impl::XCommandInfo_impl( shell* pMyShell )
40 : : : m_pMyShell( pMyShell ),
41 [ + - ][ + - ]: 16 : m_xProvider( pMyShell->m_pProvider )
42 : : {
43 : 16 : }
44 : :
45 : 16 : XCommandInfo_impl::~XCommandInfo_impl()
46 : : {
47 [ - + ]: 32 : }
48 : :
49 : :
50 : :
51 : : void SAL_CALL
52 : 64 : XCommandInfo_impl::acquire(
53 : : void )
54 : : throw()
55 : : {
56 : 64 : OWeakObject::acquire();
57 : 64 : }
58 : :
59 : :
60 : : void SAL_CALL
61 : 64 : XCommandInfo_impl::release(
62 : : void )
63 : : throw()
64 : : {
65 : 64 : OWeakObject::release();
66 : 64 : }
67 : :
68 : :
69 : : uno::Any SAL_CALL
70 : 0 : XCommandInfo_impl::queryInterface(
71 : : const uno::Type& rType )
72 : : throw( uno::RuntimeException )
73 : : {
74 : : uno::Any aRet = cppu::queryInterface( rType,
75 [ # # ]: 0 : (static_cast< XCommandInfo* >(this)) );
76 [ # # ][ # # ]: 0 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
77 : : }
78 : :
79 : :
80 : : uno::Sequence< CommandInfo > SAL_CALL
81 : 0 : XCommandInfo_impl::getCommands(
82 : : void )
83 : : throw( uno::RuntimeException )
84 : : {
85 : 0 : return m_pMyShell->m_sCommandInfo;
86 : : }
87 : :
88 : :
89 : : CommandInfo SAL_CALL
90 : 0 : XCommandInfo_impl::getCommandInfoByName(
91 : : const rtl::OUString& aName )
92 : : throw( UnsupportedCommandException,
93 : : uno::RuntimeException)
94 : : {
95 [ # # ]: 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
96 [ # # ]: 0 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
97 : 0 : return m_pMyShell->m_sCommandInfo[i];
98 : :
99 [ # # ][ # # ]: 0 : throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
100 : : }
101 : :
102 : :
103 : : CommandInfo SAL_CALL
104 : 0 : XCommandInfo_impl::getCommandInfoByHandle(
105 : : sal_Int32 Handle )
106 : : throw( UnsupportedCommandException,
107 : : uno::RuntimeException )
108 : : {
109 [ # # ]: 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
110 [ # # ]: 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
111 : 0 : return m_pMyShell->m_sCommandInfo[i];
112 : :
113 [ # # ][ # # ]: 0 : throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
114 : : }
115 : :
116 : :
117 : : sal_Bool SAL_CALL
118 : 16 : XCommandInfo_impl::hasCommandByName(
119 : : const rtl::OUString& aName )
120 : : throw( uno::RuntimeException )
121 : : {
122 [ + + ]: 160 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
123 [ - + ]: 144 : if( m_pMyShell->m_sCommandInfo[i].Name == aName )
124 : 0 : return true;
125 : :
126 : 16 : return false;
127 : : }
128 : :
129 : :
130 : : sal_Bool SAL_CALL
131 : 0 : XCommandInfo_impl::hasCommandByHandle(
132 : : sal_Int32 Handle )
133 : : throw( uno::RuntimeException )
134 : : {
135 [ # # ]: 0 : for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
136 [ # # ]: 0 : if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
137 : 0 : return true;
138 : :
139 : 0 : return false;
140 : : }
141 : :
142 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|