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