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