xref: /trunk/main/ucb/source/ucp/file/filnot.hxx (revision 6df1ea1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FILNOT_HXX_
24 #define _FILNOT_HXX_
25 
26 #include <hash_map>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/uno/XInterface.hpp>
29 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
30 #include <com/sun/star/ucb/XContentIdentifier.hpp>
31 #include "filglob.hxx"
32 
33 
34 namespace fileaccess {
35 
36 	class shell;
37 	class BaseContent;
38 
39 	class ContentEventNotifier
40 	{
41 	private:
42 		shell* m_pMyShell;
43 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
44 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
45 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xOldId;
46 		com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
47 	public:
48 
49 		ContentEventNotifier(
50 			shell* pMyShell,
51 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
52 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
53 			const com::sun::star::uno::Sequence<
54 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
55 
56 		ContentEventNotifier(
57 			shell* pMyShell,
58 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
59 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
60 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xOldId,
61 			const com::sun::star::uno::Sequence<
62 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
63 
64 		void notifyChildInserted( const rtl::OUString& aChildName );
65 		void notifyDeleted( void );
66 		void notifyRemoved( const rtl::OUString& aChildName );
67 		void notifyExchanged( );
68 	};
69 
70 
71 	class PropertySetInfoChangeNotifier
72 	{
73 	private:
74 		shell* m_pMyShell;
75 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
76 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
77 		com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
78 	public:
79 		PropertySetInfoChangeNotifier(
80 			shell* pMyShell,
81 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
82 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
83 			const com::sun::star::uno::Sequence<
84 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
85 
86 		void SAL_CALL notifyPropertyAdded( const rtl::OUString & aPropertyName );
87 		void SAL_CALL notifyPropertyRemoved( const rtl::OUString & aPropertyName );
88 	};
89 
90 
91 	typedef std::hash_map< rtl::OUString,
92 						   com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >,
93 		                   hashOUString,
94 		                   equalOUString >      ListenerMap;
95 
96 	class PropertyChangeNotifier
97 	{
98 	private:
99 		shell* m_pMyShell;
100 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
101 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
102 		ListenerMap* m_pListeners;
103 	public:
104 		PropertyChangeNotifier(
105 			shell* pMyShell,
106 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
107 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
108 			ListenerMap* pListeners );
109 
110 		~PropertyChangeNotifier();
111 
112 		void notifyPropertyChanged(
113 			com::sun::star::uno::Sequence< com::sun::star::beans::PropertyChangeEvent > seqChanged );
114 	};
115 
116 
117 	class Notifier
118 	{
119 	public:
120 		// Side effect of this function is the change of the name
121 		virtual ContentEventNotifier*          cEXC( const rtl::OUString aNewName ) = 0;
122 		// Side effect is the change of the state of the object to "deleted".
123 		virtual ContentEventNotifier*          cDEL( void ) = 0;
124 	    virtual ContentEventNotifier*          cCEL( void ) = 0;
125 		virtual PropertySetInfoChangeNotifier* cPSL( void ) = 0;
126 		virtual PropertyChangeNotifier*        cPCL( void ) = 0;
127 		virtual rtl::OUString                  getKey( void ) = 0;
128 	};
129 
130 
131 }   // end namespace fileaccess
132 
133 #endif
134