1 /*************************************************************************
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * Copyright 2000, 2010 Oracle and/or its affiliates.
5  *
6  * OpenOffice.org - a multi-platform office productivity suite
7  *
8  * This file is part of OpenOffice.org.
9  *
10  * OpenOffice.org is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License version 3
12  * only, as published by the Free Software Foundation.
13  *
14  * OpenOffice.org is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License version 3 for more details
18  * (a copy is included in the LICENSE file that accompanied this code).
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with OpenOffice.org.  If not, see
22  * <http://www.openoffice.org/license.html>
23  * for a copy of the LGPLv3 License.
24  *
25  ************************************************************************/
26 
27 #ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
28 #define DBAUI_SINGLEDOCCONTROLLER_HXX
29 
30 #include "dbsubcomponentcontroller.hxx"
31 
32 /** === begin UNO includes === **/
33 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
34 /** === end UNO includes === **/
35 
36 #include <cppuhelper/implbase1.hxx>
37 
38 class SfxUndoAction;
39 class SfxUndoManager;
40 
41 //......................................................................................................................
42 namespace dbaui
43 {
44 //......................................................................................................................
45 
46 	//==================================================================================================================
47 	//= OSingleDocumentController
48 	//==================================================================================================================
49     struct OSingleDocumentController_Data;
50     typedef ::cppu::ImplInheritanceHelper1  <   DBSubComponentController
51                                             ,   ::com::sun::star::document::XUndoManagerSupplier
52                                             >   OSingleDocumentController_Base;
53     class OSingleDocumentController : public OSingleDocumentController_Base
54 	{
55     protected:
56 		OSingleDocumentController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB );
57         virtual ~OSingleDocumentController();
58 
59         // OComponentHelper
60 	    virtual void SAL_CALL disposing();
61 
62     public:
63 		/// need for undo's and redo's
64 		SfxUndoManager& GetUndoManager() const;
65 
66         /// complete clears the Undo/Redo stacks
67         void ClearUndoManager();
68 
69 		/** addUndoActionAndInvalidate adds an undo action to the undoManager,
70 			additionally invalidates the UNDO and REDO slot
71 			@param	pAction	the undo action to add
72 		*/
73 		void addUndoActionAndInvalidate( SfxUndoAction* pAction );
74 
75         // OGenericUnoController
76 		virtual FeatureState	GetState( sal_uInt16 nId ) const;
77 		virtual void			Execute( sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs );
78 
79         // XUndoManagerSupplier
80         virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL getUndoManager(  ) throw (::com::sun::star::uno::RuntimeException);
81 
82 		// XEventListener
83 		virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
84 
85     private:
86         ::std::auto_ptr< OSingleDocumentController_Data >   m_pData;
87 	};
88 
89 //......................................................................................................................
90 } // namespace dbaui
91 //......................................................................................................................
92 
93 #endif // DBAUI_SINGLEDOCCONTROLLER_HXX
94