Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / file / bc.hxx
blob655bb3a46a07f29450ae7cce1a95282cc7977b7e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_BC_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FILE_BC_HXX
23 #include <osl/mutex.hxx>
24 #include <rtl/ustring.hxx>
25 #include <cppuhelper/implbase.hxx>
26 #include <comphelper/interfacecontainer2.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"
50 namespace fileaccess {
52 class PropertyListeners;
53 class TaskManager;
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
68 private:
70 // A special creator for inserted contents; Creates an ugly object
71 BaseContent( TaskManager* pMyShell,
72 const OUString& parentName,
73 bool bFolder );
75 public:
76 BaseContent(
77 TaskManager* pMyShell,
78 const css::uno::Reference< css::ucb::XContentIdentifier >& xContentIdentifier,
79 const OUString& aUnqPath );
81 virtual ~BaseContent() override;
83 // XComponent
84 virtual void SAL_CALL
85 dispose() override;
87 virtual void SAL_CALL
88 addEventListener(
89 const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
91 virtual void SAL_CALL
92 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
95 // XServiceInfo
96 virtual OUString SAL_CALL
97 getImplementationName() override;
99 virtual sal_Bool SAL_CALL
100 supportsService( const OUString& ServiceName ) override;
102 virtual css::uno::Sequence< OUString > SAL_CALL
103 getSupportedServiceNames() override;
106 // XCommandProcessor
107 virtual sal_Int32 SAL_CALL
108 createCommandIdentifier() override;
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;
116 virtual void SAL_CALL
117 abort( sal_Int32 CommandId ) override;
120 // XContent
121 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
122 getIdentifier() override;
124 virtual OUString SAL_CALL
125 getContentType() override;
127 virtual void SAL_CALL
128 addContentEventListener(
129 const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
131 virtual void SAL_CALL
132 removeContentEventListener(
133 const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
135 // XPropertiesChangeNotifier
137 virtual void SAL_CALL
138 addPropertiesChangeListener(
139 const css::uno::Sequence< OUString >& PropertyNames,
140 const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
142 virtual void SAL_CALL
143 removePropertiesChangeListener( const css::uno::Sequence< OUString >& PropertyNames,
144 const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
146 // XPropertyContainer
148 virtual void SAL_CALL
149 addProperty(
150 const OUString& Name,
151 sal_Int16 Attributes,
152 const css::uno::Any& DefaultValue ) override;
154 virtual void SAL_CALL
155 removeProperty( const OUString& Name ) override;
157 // XPropertySetInfoChangeNotifier
159 virtual void SAL_CALL
160 addPropertySetInfoChangeListener(
161 const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
163 virtual void SAL_CALL
164 removePropertySetInfoChangeListener(
165 const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
168 // XContentCreator
170 virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL
171 queryCreatableContentsInfo() override;
173 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
174 createNewContent( const css::ucb::ContentInfo& Info ) override;
177 // XChild
178 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
179 getParent() override;
181 // Not supported
182 virtual void SAL_CALL
183 setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
186 // Notifier
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;
194 private:
195 // Data members
196 TaskManager* m_pMyShell;
197 css::uno::Reference< css::ucb::XContentIdentifier > m_xContentIdentifier;
198 OUString m_aUncPath;
200 enum state { NameForInsertionSet = 1,
201 JustInserted = 2,
202 Deleted = 4,
203 FullFeatured = 8 };
204 bool const m_bFolder;
205 sal_uInt16 m_nState;
207 osl::Mutex m_aMutex;
209 osl::Mutex m_aEventListenerMutex;
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;
216 // Private Methods
217 /// @throws css::uno::RuntimeException
218 css::uno::Reference< css::ucb::XCommandInfo >
219 getCommandInfo();
221 /// @throws css::uno::RuntimeException
222 css::uno::Reference< css::beans::XPropertySetInfo >
223 getPropertySetInfo();
225 /// @throws css::uno::RuntimeException
226 css::uno::Reference< css::sdbc::XRow >
227 getPropertyValues(
228 sal_Int32 nMyCommandIdentifier,
229 const css::uno::Sequence< css::beans::Property >& PropertySet );
231 css::uno::Sequence< css::uno::Any >
232 setPropertyValues(
233 sal_Int32 nMyCommandIdentifier,
234 const css::uno::Sequence< css::beans::PropertyValue >& Values );
236 css::uno::Reference< css::ucb::XDynamicResultSet >
237 open(
238 sal_Int32 nMyCommandIdentifier,
239 const css::ucb::OpenCommandArgument2& aCommandArgument );
241 void
242 deleteContent( sal_Int32 nMyCommandIdentifier );
245 void
246 transfer( sal_Int32 nMyCommandIdentifier,
247 const css::ucb::TransferInfo& aTransferInfo );
249 void
250 insert( sal_Int32 nMyCommandIdentifier,
251 const css::ucb::InsertCommandArgument& aInsertArgument );
253 void endTask( sal_Int32 CommandId );
255 friend class ContentEventNotifier;
258 } // end namespace fileaccess
260 #endif
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */