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 
24 #ifndef BASCTL_DOCEVENTNOTIFIER_HXX
25 #define BASCTL_DOCEVENTNOTIFIER_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/frame/XModel.hpp>
29 /** === end UNO includes === **/
30 
31 #include <rtl/ref.hxx>
32 
33 #include <boost/noncopyable.hpp>
34 
35 //........................................................................
36 namespace basctl
37 {
38 //........................................................................
39 
40     class ScriptDocument;
41 
42 	//====================================================================
43 	//= DocumentEventListener
44 	//====================================================================
45     class SAL_NO_VTABLE DocumentEventListener : ::boost::noncopyable
46     {
47     public:
48         virtual void onDocumentCreated( const ScriptDocument& _rDocument ) = 0;
49         virtual void onDocumentOpened( const ScriptDocument& _rDocument ) = 0;
50         virtual void onDocumentSave( const ScriptDocument& _rDocument ) = 0;
51         virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) = 0;
52         virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) = 0;
53         virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) = 0;
54         virtual void onDocumentClosed( const ScriptDocument& _rDocument ) = 0;
55         virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) = 0;
56         virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) = 0;
57 
58         virtual ~DocumentEventListener();
59     };
60 
61 	//====================================================================
62 	//= DocumentEventNotifier
63 	//====================================================================
64     class DocumentEventNotifier_Impl;
65     /** allows registering at the GlobalEventBroadcaster for global document events
66     */
67 	class DocumentEventNotifier
68 	{
69     public:
70         /** create a notifier instance which notifies about events of all documents in the whole application
71         */
72         DocumentEventNotifier( DocumentEventListener& _rListener );
73 
74         /** creates a notifier instance which notifies about events at a single document
75         */
76         DocumentEventNotifier( DocumentEventListener& _rListener,
77             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument );
78 
79         ~DocumentEventNotifier();
80 
81     public:
82         void    dispose();
83 
84     private:
85         ::rtl::Reference< DocumentEventNotifier_Impl >  m_pImpl;
86 	};
87 
88 //........................................................................
89 } // namespace basctl
90 //........................................................................
91 
92 #endif // BASCTL_DOCEVENTNOTIFIER_HXX
93