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 .
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
23 #include <com/sun/star/beans/XPropertySetInfoChangeListener.hpp>
24 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
25 #include <com/sun/star/ucb/XContentIdentifier.hpp>
26 #include <com/sun/star/ucb/XContent.hpp>
28 #include <unordered_map>
31 namespace fileaccess
{
35 class ContentEventNotifier
38 TaskManager
* m_pMyShell
;
39 css::uno::Reference
< css::ucb::XContent
> m_xCreatorContent
;
40 css::uno::Reference
< css::ucb::XContentIdentifier
> m_xCreatorId
;
41 css::uno::Reference
< css::ucb::XContentIdentifier
> m_xOldId
;
42 std::vector
< css::uno::Reference
< css::ucb::XContentEventListener
> > m_sListeners
;
46 TaskManager
* pMyShell
,
47 const css::uno::Reference
< css::ucb::XContent
>& xCreatorContent
,
48 const css::uno::Reference
< css::ucb::XContentIdentifier
>& xCreatorId
,
49 std::vector
< css::uno::Reference
< css::ucb::XContentEventListener
> >&& sListeners
);
52 TaskManager
* pMyShell
,
53 const css::uno::Reference
< css::ucb::XContent
>& xCreatorContent
,
54 const css::uno::Reference
< css::ucb::XContentIdentifier
>& xCreatorId
,
55 const css::uno::Reference
< css::ucb::XContentIdentifier
>& xOldId
,
56 std::vector
< css::uno::Reference
< css::ucb::XContentEventListener
> >&& sListeners
);
58 void notifyChildInserted( const OUString
& aChildName
) const;
59 void notifyDeleted() const;
60 void notifyRemoved( const OUString
& aChildName
) const;
61 void notifyExchanged() const;
65 class PropertySetInfoChangeNotifier
68 css::uno::Reference
< css::ucb::XContent
> m_xCreatorContent
;
69 std::vector
< css::uno::Reference
< css::beans::XPropertySetInfoChangeListener
> > m_sListeners
;
71 PropertySetInfoChangeNotifier(
72 const css::uno::Reference
< css::ucb::XContent
>& xCreatorContent
,
73 std::vector
< css::uno::Reference
< css::beans::XPropertySetInfoChangeListener
> >&& sListeners
);
75 void notifyPropertyAdded( const OUString
& aPropertyName
) const;
76 void notifyPropertyRemoved( const OUString
& aPropertyName
) const;
80 typedef std::unordered_map
< OUString
,
81 std::vector
< css::uno::Reference
< css::beans::XPropertiesChangeListener
> > > ListenerMap
;
83 class PropertyChangeNotifier
86 css::uno::Reference
< css::ucb::XContent
> m_xCreatorContent
;
87 ListenerMap m_aListeners
;
89 PropertyChangeNotifier(
90 const css::uno::Reference
< css::ucb::XContent
>& xCreatorContent
,
91 ListenerMap
&& pListeners
);
93 void notifyPropertyChanged(
94 const css::uno::Sequence
< css::beans::PropertyChangeEvent
>& seqChanged
) const;
101 // Side effect of this function is the change of the name
102 virtual std::optional
<ContentEventNotifier
> cEXC( const OUString
& aNewName
) = 0;
103 // Side effect is the change of the state of the object to "deleted".
104 virtual std::optional
<ContentEventNotifier
> cDEL() = 0;
105 virtual std::optional
<ContentEventNotifier
> cCEL() = 0;
106 virtual std::optional
<PropertySetInfoChangeNotifier
> cPSL() = 0;
107 virtual std::optional
<PropertyChangeNotifier
> cPCL() = 0;
114 } // end namespace fileaccess
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */