LibreOffice Module ucb (master)  1
filcmd.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 #include <sal/log.hxx>
23 
24 #include <com/sun/star/ucb/UnsupportedCommandException.hpp>
25 
26 #include "filcmd.hxx"
27 #include "filtask.hxx"
28 #include "prov.hxx"
29 
30 using namespace fileaccess;
31 using namespace com::sun::star;
32 using namespace com::sun::star::ucb;
33 
34 #if OSL_DEBUG_LEVEL > 0
35 #define THROW_WHERE SAL_WHERE
36 #else
37 #define THROW_WHERE ""
38 #endif
39 
41  : m_pMyShell( pMyShell )
42 {
43 }
44 
46 {
47 }
48 
49 
50 void SAL_CALL
52  throw()
53 {
54  OWeakObject::acquire();
55 }
56 
57 
58 void SAL_CALL
60  throw()
61 {
62  OWeakObject::release();
63 }
64 
65 
66 uno::Any SAL_CALL
68 {
69  uno::Any aRet = cppu::queryInterface( rType,
70  static_cast< XCommandInfo* >(this) );
71  return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
72 }
73 
74 
75 uno::Sequence< CommandInfo > SAL_CALL
77 {
78  return m_pMyShell->m_sCommandInfo;
79 }
80 
81 
82 CommandInfo SAL_CALL
84  const OUString& aName )
85 {
86  for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); i++ )
87  if( m_pMyShell->m_sCommandInfo[i].Name == aName )
88  return m_pMyShell->m_sCommandInfo[i];
89 
90  throw UnsupportedCommandException( THROW_WHERE );
91 }
92 
93 
94 CommandInfo SAL_CALL
96  sal_Int32 Handle )
97 {
98  for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
99  if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
100  return m_pMyShell->m_sCommandInfo[i];
101 
102  throw UnsupportedCommandException( THROW_WHERE );
103 }
104 
105 
106 sal_Bool SAL_CALL
108  const OUString& aName )
109 {
110  for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
111  if( m_pMyShell->m_sCommandInfo[i].Name == aName )
112  return true;
113 
114  return false;
115 }
116 
117 
118 sal_Bool SAL_CALL
120  sal_Int32 Handle )
121 {
122  for( sal_Int32 i = 0; i < m_pMyShell->m_sCommandInfo.getLength(); ++i )
123  if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
124  return true;
125 
126  return false;
127 }
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL acquire() override
Definition: filcmd.cxx:51
bool hasValue()
#define THROW_WHERE
Definition: filcmd.cxx:35
virtual sal_Bool SAL_CALL hasCommandByName(const OUString &Name) override
Definition: filcmd.cxx:107
virtual ~XCommandInfo_impl() override
Definition: filcmd.cxx:45
virtual css::ucb::CommandInfo SAL_CALL getCommandInfoByHandle(sal_Int32 Handle) override
Definition: filcmd.cxx:95
XCommandInfo_impl(TaskManager *pMyShell)
Definition: filcmd.cxx:40
TaskManager * m_pMyShell
Definition: filcmd.hxx:78
int i
unsigned char sal_Bool
css::uno::Sequence< css::ucb::CommandInfo > m_sCommandInfo
Definition: filtask.hxx:650
virtual css::uno::Sequence< css::ucb::CommandInfo > SAL_CALL getCommands() override
Definition: filcmd.cxx:76
virtual sal_Bool SAL_CALL hasCommandByHandle(sal_Int32 Handle) override
Definition: filcmd.cxx:119
SQLHANDLE Handle
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: filcmd.cxx:67
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
virtual css::ucb::CommandInfo SAL_CALL getCommandInfoByName(const OUString &Name) override
Definition: filcmd.cxx:83
virtual void SAL_CALL release() override
Definition: filcmd.cxx:59