1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
;
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
,
66 public fileaccess::Notifier
// implementation class
70 // A special creator for inserted contents; Creates an ugly object
71 BaseContent( TaskManager
* pMyShell
,
72 const OUString
& parentName
,
77 TaskManager
* pMyShell
,
78 const css::uno::Reference
< css::ucb::XContentIdentifier
>& xContentIdentifier
,
79 const OUString
& aUnqPath
);
81 virtual ~BaseContent() override
;
89 const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
92 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
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
;
107 virtual sal_Int32 SAL_CALL
108 createCommandIdentifier() override
;
110 virtual css::uno::Any SAL_CALL
112 const css::ucb::Command
& aCommand
,
114 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& Environment
) override
;
116 virtual void SAL_CALL
117 abort( sal_Int32 CommandId
) override
;
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
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
;
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
;
178 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
179 getParent() override
;
182 virtual void SAL_CALL
183 setParent( const css::uno::Reference
< css::uno::XInterface
>& Parent
) override
;
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
;
196 TaskManager
* m_pMyShell
;
197 css::uno::Reference
< css::ucb::XContentIdentifier
> m_xContentIdentifier
;
200 enum state
{ NameForInsertionSet
= 1,
204 bool const m_bFolder
;
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
;
217 /// @throws css::uno::RuntimeException
218 css::uno::Reference
< css::ucb::XCommandInfo
>
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
>
228 sal_Int32 nMyCommandIdentifier
,
229 const css::uno::Sequence
< css::beans::Property
>& PropertySet
);
231 css::uno::Sequence
< css::uno::Any
>
233 sal_Int32 nMyCommandIdentifier
,
234 const css::uno::Sequence
< css::beans::PropertyValue
>& Values
);
236 css::uno::Reference
< css::ucb::XDynamicResultSet
>
238 sal_Int32 nMyCommandIdentifier
,
239 const css::ucb::OpenCommandArgument2
& aCommandArgument
);
242 deleteContent( sal_Int32 nMyCommandIdentifier
);
246 transfer( sal_Int32 nMyCommandIdentifier
,
247 const css::ucb::TransferInfo
& aTransferInfo
);
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
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */