xref: /aoo41x/main/ucb/source/ucp/file/filnot.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _FILNOT_HXX_
28 #define _FILNOT_HXX_
29 
30 #include <hash_map>
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/uno/XInterface.hpp>
33 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
34 #include <com/sun/star/ucb/XContentIdentifier.hpp>
35 #include "filglob.hxx"
36 
37 
38 namespace fileaccess {
39 
40 	class shell;
41 	class BaseContent;
42 
43 	class ContentEventNotifier
44 	{
45 	private:
46 		shell* m_pMyShell;
47 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
48 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
49 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xOldId;
50 		com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
51 	public:
52 
53 		ContentEventNotifier(
54 			shell* pMyShell,
55 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
56 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
57 			const com::sun::star::uno::Sequence<
58 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
59 
60 		ContentEventNotifier(
61 			shell* pMyShell,
62 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
63 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
64 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xOldId,
65 			const com::sun::star::uno::Sequence<
66 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
67 
68 		void notifyChildInserted( const rtl::OUString& aChildName );
69 		void notifyDeleted( void );
70 		void notifyRemoved( const rtl::OUString& aChildName );
71 		void notifyExchanged( );
72 	};
73 
74 
75 	class PropertySetInfoChangeNotifier
76 	{
77 	private:
78 		shell* m_pMyShell;
79 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
80 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
81 		com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > > m_sListeners;
82 	public:
83 		PropertySetInfoChangeNotifier(
84 			shell* pMyShell,
85 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
86 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
87 			const com::sun::star::uno::Sequence<
88 			com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >& sListeners );
89 
90 		void SAL_CALL notifyPropertyAdded( const rtl::OUString & aPropertyName );
91 		void SAL_CALL notifyPropertyRemoved( const rtl::OUString & aPropertyName );
92 	};
93 
94 
95 	typedef std::hash_map< rtl::OUString,
96 						   com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::uno::XInterface > >,
97 		                   hashOUString,
98 		                   equalOUString >      ListenerMap;
99 
100 	class PropertyChangeNotifier
101 	{
102 	private:
103 		shell* m_pMyShell;
104 		com::sun::star::uno::Reference< com::sun::star::ucb::XContent >	m_xCreatorContent;
105 		com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xCreatorId;
106 		ListenerMap* m_pListeners;
107 	public:
108 		PropertyChangeNotifier(
109 			shell* pMyShell,
110 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContent >& xCreatorContent,
111 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xCreatorId,
112 			ListenerMap* pListeners );
113 
114 		~PropertyChangeNotifier();
115 
116 		void notifyPropertyChanged(
117 			com::sun::star::uno::Sequence< com::sun::star::beans::PropertyChangeEvent > seqChanged );
118 	};
119 
120 
121 	class Notifier
122 	{
123 	public:
124 		// Side effect of this function is the change of the name
125 		virtual ContentEventNotifier*          cEXC( const rtl::OUString aNewName ) = 0;
126 		// Side effect is the change of the state of the object to "deleted".
127 		virtual ContentEventNotifier*          cDEL( void ) = 0;
128 	    virtual ContentEventNotifier*          cCEL( void ) = 0;
129 		virtual PropertySetInfoChangeNotifier* cPSL( void ) = 0;
130 		virtual PropertyChangeNotifier*        cPCL( void ) = 0;
131 		virtual rtl::OUString                  getKey( void ) = 0;
132 	};
133 
134 
135 }   // end namespace fileaccess
136 
137 #endif
138