LibreOffice Module ucb (master)  1
filnot.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 #pragma once
20 
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <com/sun/star/uno/XInterface.hpp>
23 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
24 #include <com/sun/star/ucb/XContentIdentifier.hpp>
25 #include <com/sun/star/ucb/XContent.hpp>
26 #include <memory>
27 #include <optional>
28 #include <unordered_map>
29 #include <vector>
30 
31 namespace fileaccess {
32 
33  class TaskManager;
34 
36  {
37  private:
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::uno::XInterface > > m_sListeners;
43  public:
44 
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::uno::XInterface > >&& sListeners );
50 
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::uno::XInterface > >&& sListeners );
57 
58  void notifyChildInserted( const OUString& aChildName ) const;
59  void notifyDeleted() const;
60  void notifyRemoved( const OUString& aChildName ) const;
61  void notifyExchanged() const;
62  };
63 
64 
66  {
67  private:
68  css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
69  std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners;
70  public:
72  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
73  std::vector< css::uno::Reference< css::uno::XInterface > >&& sListeners );
74 
75  void notifyPropertyAdded( const OUString & aPropertyName ) const;
76  void notifyPropertyRemoved( const OUString & aPropertyName ) const;
77  };
78 
79 
80  typedef std::unordered_map< OUString,
81  std::vector< css::uno::Reference< css::uno::XInterface > > > ListenerMap;
82 
84  {
85  private:
86  css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
87  ListenerMap m_aListeners;
88  public:
90  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
91  ListenerMap&& pListeners );
92 
94  const css::uno::Sequence< css::beans::PropertyChangeEvent >& seqChanged ) const;
95  };
96 
97 
98  class Notifier
99  {
100  public:
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;
108 
109  protected:
111  };
112 
113 
114 } // end namespace fileaccess
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertySetInfoChangeNotifier(const css::uno::Reference< css::ucb::XContent > &xCreatorContent, std::vector< css::uno::Reference< css::uno::XInterface > > &&sListeners)
Definition: filnot.cxx:142
PropertyChangeNotifier(const css::uno::Reference< css::ucb::XContent > &xCreatorContent, ListenerMap &&pListeners)
void notifyRemoved(const OUString &aChildName) const
Definition: filnot.cxx:97
virtual std::optional< ContentEventNotifier > cDEL()=0
virtual std::optional< PropertySetInfoChangeNotifier > cPSL()=0
std::unordered_map< OUString, std::vector< css::uno::Reference< css::uno::XInterface > > > ListenerMap
Definition: filnot.hxx:81
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:86
virtual std::optional< ContentEventNotifier > cCEL()=0
css::uno::Reference< css::ucb::XContentIdentifier > m_xCreatorId
Definition: filnot.hxx:40
css::uno::Reference< css::ucb::XContentIdentifier > m_xOldId
Definition: filnot.hxx:41
virtual std::optional< PropertyChangeNotifier > cPCL()=0
void notifyPropertyRemoved(const OUString &aPropertyName) const
Definition: filnot.cxx:170
void notifyPropertyChanged(const css::uno::Sequence< css::beans::PropertyChangeEvent > &seqChanged) const
Definition: filnot.cxx:202
ContentEventNotifier(TaskManager *pMyShell, const css::uno::Reference< css::ucb::XContent > &xCreatorContent, const css::uno::Reference< css::ucb::XContentIdentifier > &xCreatorId, std::vector< css::uno::Reference< css::uno::XInterface > > &&sListeners)
void notifyPropertyAdded(const OUString &aPropertyName) const
Definition: filnot.cxx:153
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:68
void notifyChildInserted(const OUString &aChildName) const
Definition: filnot.cxx:60
std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners
Definition: filnot.hxx:42
virtual std::optional< ContentEventNotifier > cEXC(const OUString &aNewName)=0
std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners
Definition: filnot.hxx:69
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:39