Line data Source code
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 : #ifndef _FILNOT_HXX_
20 : #define _FILNOT_HXX_
21 :
22 : #include <boost/unordered_map.hpp>
23 : #include <com/sun/star/uno/Sequence.hxx>
24 : #include <com/sun/star/uno/XInterface.hpp>
25 : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
26 : #include <com/sun/star/ucb/XContentIdentifier.hpp>
27 : #include "filglob.hxx"
28 :
29 :
30 : namespace fileaccess {
31 :
32 : class shell;
33 :
34 0 : class ContentEventNotifier
35 : {
36 : private:
37 : shell* m_pMyShell;
38 : com::sun::star::uno::Reference< com::sun::star::ucb::XContent > m_xCreatorContent;
39 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
40 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xOldId;
41 : com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
42 : public:
43 :
44 : ContentEventNotifier(
45 : shell* pMyShell,
46 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
47 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
48 : const com::sun::star::uno::Sequence<
49 : com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
50 :
51 : ContentEventNotifier(
52 : shell* pMyShell,
53 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
54 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
55 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xOldId,
56 : const com::sun::star::uno::Sequence<
57 : com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
58 :
59 : void notifyChildInserted( const OUString& aChildName );
60 : void notifyDeleted( void );
61 : void notifyRemoved( const OUString& aChildName );
62 : void notifyExchanged( );
63 : };
64 :
65 :
66 0 : class PropertySetInfoChangeNotifier
67 : {
68 : private:
69 : com::sun::star::uno::Reference< com::sun::star::ucb::XContent > m_xCreatorContent;
70 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
71 : com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
72 : public:
73 : PropertySetInfoChangeNotifier(
74 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
75 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
76 : const com::sun::star::uno::Sequence<
77 : com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
78 :
79 : void SAL_CALL notifyPropertyAdded( const OUString & aPropertyName );
80 : void SAL_CALL notifyPropertyRemoved( const OUString & aPropertyName );
81 : };
82 :
83 :
84 : typedef boost::unordered_map< OUString,
85 : com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >,
86 : OUStringHash > ListenerMap;
87 :
88 : class PropertyChangeNotifier
89 : {
90 : private:
91 : com::sun::star::uno::Reference< com::sun::star::ucb::XContent > m_xCreatorContent;
92 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
93 : ListenerMap* m_pListeners;
94 : public:
95 : PropertyChangeNotifier(
96 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
97 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
98 : ListenerMap* pListeners );
99 :
100 : ~PropertyChangeNotifier();
101 :
102 : void notifyPropertyChanged(
103 : com::sun::star::uno::Sequence< com::sun::star::beans::PropertyChangeEvent > seqChanged );
104 : };
105 :
106 :
107 0 : class Notifier
108 : {
109 : public:
110 : // Side effect of this function is the change of the name
111 : virtual ContentEventNotifier* cEXC( const OUString& aNewName ) = 0;
112 : // Side effect is the change of the state of the object to "deleted".
113 : virtual ContentEventNotifier* cDEL( void ) = 0;
114 : virtual ContentEventNotifier* cCEL( void ) = 0;
115 : virtual PropertySetInfoChangeNotifier* cPSL( void ) = 0;
116 : virtual PropertyChangeNotifier* cPCL( void ) = 0;
117 : virtual OUString getKey( void ) = 0;
118 :
119 : protected:
120 0 : ~Notifier() {}
121 : };
122 :
123 :
124 : } // end namespace fileaccess
125 :
126 : #endif
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|