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 <unordered_map>
28 #include <vector>
29 
30 namespace fileaccess {
31 
32  class TaskManager;
33 
35  {
36  private:
38  css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
39  css::uno::Reference< css::ucb::XContentIdentifier > m_xCreatorId;
40  css::uno::Reference< css::ucb::XContentIdentifier > m_xOldId;
41  std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners;
42  public:
43 
45  TaskManager* pMyShell,
46  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
47  const css::uno::Reference< css::ucb::XContentIdentifier >& xCreatorId,
48  const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners );
49 
51  TaskManager* pMyShell,
52  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
53  const css::uno::Reference< css::ucb::XContentIdentifier >& xCreatorId,
54  const css::uno::Reference< css::ucb::XContentIdentifier >& xOldId,
55  const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners );
56 
57  void notifyChildInserted( const OUString& aChildName );
58  void notifyDeleted();
59  void notifyRemoved( const OUString& aChildName );
60  void notifyExchanged( );
61  };
62 
63 
65  {
66  private:
67  css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
68  std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners;
69  public:
71  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
72  const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners );
73 
74  void notifyPropertyAdded( const OUString & aPropertyName );
75  void notifyPropertyRemoved( const OUString & aPropertyName );
76  };
77 
78 
79  typedef std::unordered_map< OUString,
80  css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > > ListenerMap;
81 
83  {
84  private:
85  css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
86  std::unique_ptr<ListenerMap> m_pListeners;
87  public:
89  const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
90  std::unique_ptr<ListenerMap> pListeners );
91 
93 
95  const css::uno::Sequence< css::beans::PropertyChangeEvent >& seqChanged );
96  };
97 
98 
99  class Notifier
100  {
101  public:
102  // Side effect of this function is the change of the name
103  virtual std::unique_ptr<ContentEventNotifier> cEXC( const OUString& aNewName ) = 0;
104  // Side effect is the change of the state of the object to "deleted".
105  virtual std::unique_ptr<ContentEventNotifier> cDEL() = 0;
106  virtual std::unique_ptr<ContentEventNotifier> cCEL() = 0;
107  virtual std::unique_ptr<PropertySetInfoChangeNotifier> cPSL() = 0;
108  virtual std::unique_ptr<PropertyChangeNotifier> cPCL() = 0;
109 
110  protected:
112  };
113 
114 
115 } // end namespace fileaccess
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void notifyPropertyChanged(const css::uno::Sequence< css::beans::PropertyChangeEvent > &seqChanged)
Definition: filnot.cxx:207
void notifyPropertyRemoved(const OUString &aPropertyName)
Definition: filnot.cxx:170
ContentEventNotifier(TaskManager *pMyShell, const css::uno::Reference< css::ucb::XContent > &xCreatorContent, const css::uno::Reference< css::ucb::XContentIdentifier > &xCreatorId, const std::vector< css::uno::Reference< css::uno::XInterface > > &sListeners)
virtual std::unique_ptr< PropertySetInfoChangeNotifier > cPSL()=0
void notifyPropertyAdded(const OUString &aPropertyName)
Definition: filnot.cxx:153
std::unordered_map< OUString, css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > > ListenerMap
Definition: filnot.hxx:80
virtual std::unique_ptr< PropertyChangeNotifier > cPCL()=0
PropertyChangeNotifier(const css::uno::Reference< css::ucb::XContent > &xCreatorContent, std::unique_ptr< ListenerMap > pListeners)
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:85
css::uno::Reference< css::ucb::XContentIdentifier > m_xCreatorId
Definition: filnot.hxx:39
virtual std::unique_ptr< ContentEventNotifier > cCEL()=0
css::uno::Reference< css::ucb::XContentIdentifier > m_xOldId
Definition: filnot.hxx:40
virtual std::unique_ptr< ContentEventNotifier > cDEL()=0
void notifyChildInserted(const OUString &aChildName)
Definition: filnot.cxx:60
virtual std::unique_ptr< ContentEventNotifier > cEXC(const OUString &aNewName)=0
std::unique_ptr< ListenerMap > m_pListeners
Definition: filnot.hxx:86
PropertySetInfoChangeNotifier(const css::uno::Reference< css::ucb::XContent > &xCreatorContent, const std::vector< css::uno::Reference< css::uno::XInterface > > &sListeners)
Definition: filnot.cxx:142
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:67
std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners
Definition: filnot.hxx:41
std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners
Definition: filnot.hxx:68
void notifyRemoved(const OUString &aChildName)
Definition: filnot.cxx:97
css::uno::Reference< css::ucb::XContent > m_xCreatorContent
Definition: filnot.hxx:38