LibreOffice Module ucb (master)  1
bc.hxx
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 #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_BC_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FILE_BC_HXX
22 
23 #include <osl/mutex.hxx>
24 #include <rtl/ustring.hxx>
25 #include <cppuhelper/implbase.hxx>
27 #include <com/sun/star/uno/XInterface.hpp>
28 #include <com/sun/star/lang/XComponent.hpp>
29 #include <com/sun/star/ucb/XCommandProcessor.hpp>
30 #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
31 #include <com/sun/star/ucb/XContent.hpp>
32 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/sdbc/XRow.hpp>
35 #include <com/sun/star/beans/Property.hpp>
36 #include <com/sun/star/beans/PropertyValue.hpp>
37 #include <com/sun/star/ucb/XCommandInfo.hpp>
38 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
39 #include <com/sun/star/beans/XPropertySetInfo.hpp>
40 #include <com/sun/star/beans/XPropertyContainer.hpp>
41 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
42 #include <com/sun/star/beans/XPropertySetInfoChangeListener.hpp>
43 #include <com/sun/star/container/XChild.hpp>
44 #include <com/sun/star/ucb/XContentCreator.hpp>
45 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
46 #include <com/sun/star/ucb/TransferInfo.hpp>
47 #include "filtask.hxx"
48 
49 
50 namespace fileaccess {
51 
52  class PropertyListeners;
53  class TaskManager;
54 
55  class BaseContent:
56  public cppu::WeakImplHelper<
57  css::lang::XComponent,
58  css::lang::XServiceInfo,
59  css::ucb::XCommandProcessor,
60  css::beans::XPropertiesChangeNotifier,
61  css::beans::XPropertyContainer,
62  css::beans::XPropertySetInfoChangeNotifier,
63  css::ucb::XContentCreator,
64  css::container::XChild,
65  css::ucb::XContent>,
66  public fileaccess::Notifier // implementation class
67  {
68  private:
69 
70  // A special creator for inserted contents; Creates an ugly object
71  BaseContent( TaskManager* pMyShell,
72  const OUString& parentName,
73  bool bFolder );
74 
75  public:
77  TaskManager* pMyShell,
78  const css::uno::Reference< css::ucb::XContentIdentifier >& xContentIdentifier,
79  const OUString& aUnqPath );
80 
81  virtual ~BaseContent() override;
82 
83  // XComponent
84  virtual void SAL_CALL
85  dispose() override;
86 
87  virtual void SAL_CALL
89  const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
90 
91  virtual void SAL_CALL
92  removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
93 
94 
95  // XServiceInfo
96  virtual OUString SAL_CALL
97  getImplementationName() override;
98 
99  virtual sal_Bool SAL_CALL
100  supportsService( const OUString& ServiceName ) override;
101 
102  virtual css::uno::Sequence< OUString > SAL_CALL
103  getSupportedServiceNames() override;
104 
105 
106  // XCommandProcessor
107  virtual sal_Int32 SAL_CALL
108  createCommandIdentifier() override;
109 
110  virtual css::uno::Any SAL_CALL
111  execute(
112  const css::ucb::Command& aCommand,
113  sal_Int32 CommandId,
114  const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override;
115 
116  virtual void SAL_CALL
117  abort( sal_Int32 CommandId ) override;
118 
119 
120  // XContent
121  virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
122  getIdentifier() override;
123 
124  virtual OUString SAL_CALL
125  getContentType() override;
126 
127  virtual void SAL_CALL
129  const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
130 
131  virtual void SAL_CALL
133  const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
134 
135  // XPropertiesChangeNotifier
136 
137  virtual void SAL_CALL
139  const css::uno::Sequence< OUString >& PropertyNames,
140  const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
141 
142  virtual void SAL_CALL
143  removePropertiesChangeListener( const css::uno::Sequence< OUString >& PropertyNames,
144  const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
145 
146  // XPropertyContainer
147 
148  virtual void SAL_CALL
149  addProperty(
150  const OUString& Name,
151  sal_Int16 Attributes,
152  const css::uno::Any& DefaultValue ) override;
153 
154  virtual void SAL_CALL
155  removeProperty( const OUString& Name ) override;
156 
157  // XPropertySetInfoChangeNotifier
158 
159  virtual void SAL_CALL
161  const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
162 
163  virtual void SAL_CALL
165  const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
166 
167 
168  // XContentCreator
169 
170  virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL
171  queryCreatableContentsInfo() override;
172 
173  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
174  createNewContent( const css::ucb::ContentInfo& Info ) override;
175 
176 
177  // XChild
178  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
179  getParent() override;
180 
181  // Not supported
182  virtual void SAL_CALL
183  setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
184 
185 
186  // Notifier
187 
188  std::unique_ptr<ContentEventNotifier> cDEL() override;
189  std::unique_ptr<ContentEventNotifier> cEXC( const OUString& aNewName ) override;
190  std::unique_ptr<ContentEventNotifier> cCEL() override;
191  std::unique_ptr<PropertySetInfoChangeNotifier> cPSL() override;
192  std::unique_ptr<PropertyChangeNotifier> cPCL() override;
193 
194  private:
195  // Data members
197  css::uno::Reference< css::ucb::XContentIdentifier > m_xContentIdentifier;
198  OUString m_aUncPath;
199 
202  Deleted = 4,
204  bool const m_bFolder;
205  sal_uInt16 m_nState;
206 
207  osl::Mutex m_aMutex;
208 
210  std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
211  std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pContentEventListeners;
212  std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pPropertySetInfoChangeListeners;
213  std::unique_ptr<PropertyListeners> m_pPropertyListener;
214 
215 
216  // Private Methods
218  css::uno::Reference< css::ucb::XCommandInfo >
219  getCommandInfo();
220 
222  css::uno::Reference< css::beans::XPropertySetInfo >
224 
226  css::uno::Reference< css::sdbc::XRow >
228  sal_Int32 nMyCommandIdentifier,
229  const css::uno::Sequence< css::beans::Property >& PropertySet );
230 
231  css::uno::Sequence< css::uno::Any >
233  sal_Int32 nMyCommandIdentifier,
234  const css::uno::Sequence< css::beans::PropertyValue >& Values );
235 
236  css::uno::Reference< css::ucb::XDynamicResultSet >
237  open(
238  sal_Int32 nMyCommandIdentifier,
239  const css::ucb::OpenCommandArgument2& aCommandArgument );
240 
241  void
242  deleteContent( sal_Int32 nMyCommandIdentifier );
243 
244 
245  void
246  transfer( sal_Int32 nMyCommandIdentifier,
247  const css::ucb::TransferInfo& aTransferInfo );
248 
249  void
250  insert( sal_Int32 nMyCommandIdentifier,
251  const css::ucb::InsertCommandArgument& aInsertArgument );
252 
253  void endTask( sal_Int32 CommandId );
254 
255  friend class ContentEventNotifier;
256  };
257 
258 } // end namespace fileaccess
259 
260 #endif
261 
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< ContentEventNotifier > cCEL() override
Definition: bc.cxx:1152
css::uno::Reference< css::ucb::XCommandInfo > getCommandInfo()
Definition: bc.cxx:620
css::uno::Reference< css::ucb::XContentIdentifier > m_xContentIdentifier
Definition: bc.hxx:197
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: bc.cxx:609
void deleteContent(sal_Int32 nMyCommandIdentifier)
Definition: bc.cxx:902
virtual void SAL_CALL abort(sal_Int32 CommandId) override
Definition: bc.cxx:207
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: bc.cxx:184
virtual css::uno::Any SAL_CALL execute(const css::ucb::Command &aCommand, sal_Int32 CommandId, const css::uno::Reference< css::ucb::XCommandEnvironment > &Environment) override
Definition: bc.cxx:213
css::uno::Reference< css::ucb::XDynamicResultSet > open(sal_Int32 nMyCommandIdentifier, const css::ucb::OpenCommandArgument2 &aCommandArgument)
Definition: bc.cxx:826
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pPropertySetInfoChangeListeners
Definition: bc.hxx:212
Info
virtual void SAL_CALL addContentEventListener(const css::uno::Reference< css::ucb::XContentEventListener > &Listener) override
Definition: bc.cxx:432
OUString Name
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) override
Definition: bc.cxx:329
virtual void SAL_CALL addProperty(const OUString &Name, sal_Int16 Attributes, const css::uno::Any &DefaultValue) override
Definition: bc.cxx:461
virtual void SAL_CALL dispose() override
Definition: bc.cxx:145
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: bc.cxx:135
virtual sal_Int32 SAL_CALL createCommandIdentifier() override
Definition: bc.cxx:200
std::unique_ptr< PropertyListeners > m_pPropertyListener
Definition: bc.hxx:213
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: bc.cxx:122
virtual void SAL_CALL addPropertySetInfoChangeListener(const css::uno::Reference< css::beans::XPropertySetInfoChangeListener > &Listener) override
Definition: bc.cxx:558
virtual OUString SAL_CALL getContentType() override
Definition: bc.cxx:384
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL createNewContent(const css::ucb::ContentInfo &Info) override
Definition: bc.cxx:497
void transfer(sal_Int32 nMyCommandIdentifier, const css::ucb::TransferInfo &aTransferInfo)
Definition: bc.cxx:916
std::unique_ptr< ContentEventNotifier > cDEL() override
Definition: bc.cxx:1110
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pDisposeEventListeners
Definition: bc.hxx:210
virtual OUString SAL_CALL getImplementationName() override
Definition: bc.cxx:178
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: bc.cxx:190
osl::Mutex m_aEventListenerMutex
Definition: bc.hxx:209
unsigned char sal_Bool
sal_uInt16 m_nState
Definition: bc.hxx:205
OUString m_aUncPath
Definition: bc.hxx:198
virtual void SAL_CALL removePropertySetInfoChangeListener(const css::uno::Reference< css::beans::XPropertySetInfoChangeListener > &Listener) override
Definition: bc.cxx:570
void insert(sal_Int32 nMyCommandIdentifier, const css::ucb::InsertCommandArgument &aInsertArgument)
Definition: bc.cxx:985
virtual void SAL_CALL removeContentEventListener(const css::uno::Reference< css::ucb::XContentEventListener > &Listener) override
Definition: bc.cxx:447
virtual ~BaseContent() override
Definition: bc.cxx:108
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: bc.cxx:584
css::uno::Sequence< css::uno::Any > setPropertyValues(sal_Int32 nMyCommandIdentifier, const css::uno::Sequence< css::beans::PropertyValue > &Values)
Definition: bc.cxx:691
virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL queryCreatableContentsInfo() override
Definition: bc.cxx:490
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pContentEventListeners
Definition: bc.hxx:211
virtual void SAL_CALL removeProperty(const OUString &Name) override
Definition: bc.cxx:476
bool const m_bFolder
Definition: bc.hxx:204
std::unique_ptr< PropertyChangeNotifier > cPCL() override
Definition: bc.cxx:1179
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL getIdentifier() override
Definition: bc.cxx:377
osl::Mutex m_aMutex
Definition: bc.hxx:207
BaseContent(TaskManager *pMyShell, const OUString &parentName, bool bFolder)
Definition: bc.cxx:78
void endTask(sal_Int32 CommandId)
Definition: bc.cxx:1102
css::uno::Reference< css::beans::XPropertySetInfo > getPropertySetInfo()
Definition: bc.cxx:630
css::uno::Reference< css::sdbc::XRow > getPropertyValues(sal_Int32 nMyCommandIdentifier, const css::uno::Sequence< css::beans::Property > &PropertySet)
Definition: bc.cxx:639
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Sequence< OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) override
Definition: bc.cxx:355
std::unique_ptr< PropertySetInfoChangeNotifier > cPSL() override
Definition: bc.cxx:1166
std::unique_ptr< ContentEventNotifier > cEXC(const OUString &aNewName) override
Definition: bc.cxx:1130
TaskManager * m_pMyShell
Definition: bc.hxx:196