xref: /AOO41X/main/dbaccess/source/ui/inc/singledoccontroller.hxx (revision 67e470dafe1997e73f56ff7ff4878983707e3e07)
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 DBAUI_SINGLEDOCCONTROLLER_HXX
25 #define DBAUI_SINGLEDOCCONTROLLER_HXX
26 
27 #include "dbsubcomponentcontroller.hxx"
28 
29 /** === begin UNO includes === **/
30 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
31 /** === end UNO includes === **/
32 
33 #include <cppuhelper/implbase1.hxx>
34 
35 class SfxUndoAction;
36 class SfxUndoManager;
37 
38 //......................................................................................................................
39 namespace dbaui
40 {
41 //......................................................................................................................
42 
43     //==================================================================================================================
44     //= OSingleDocumentController
45     //==================================================================================================================
46     struct OSingleDocumentController_Data;
47     typedef ::cppu::ImplInheritanceHelper1  <   DBSubComponentController
48                                             ,   ::com::sun::star::document::XUndoManagerSupplier
49                                             >   OSingleDocumentController_Base;
50     class OSingleDocumentController : public OSingleDocumentController_Base
51     {
52     protected:
53         OSingleDocumentController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB );
54         virtual ~OSingleDocumentController();
55 
56         // OComponentHelper
57         virtual void SAL_CALL disposing();
58 
59     public:
60         /// need for undo's and redo's
61         SfxUndoManager& GetUndoManager() const;
62 
63         /// complete clears the Undo/Redo stacks
64         void ClearUndoManager();
65 
66         /** addUndoActionAndInvalidate adds an undo action to the undoManager,
67             additionally invalidates the UNDO and REDO slot
68             @param  pAction the undo action to add
69         */
70         void addUndoActionAndInvalidate( SfxUndoAction* pAction );
71 
72         // OGenericUnoController
73         virtual FeatureState    GetState( sal_uInt16 nId ) const;
74         virtual void            Execute( sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs );
75 
76         // XUndoManagerSupplier
77         virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL getUndoManager(  ) throw (::com::sun::star::uno::RuntimeException);
78 
79         // XEventListener
80         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
81 
82     private:
83         ::std::auto_ptr< OSingleDocumentController_Data >   m_pData;
84     };
85 
86 //......................................................................................................................
87 } // namespace dbaui
88 //......................................................................................................................
89 
90 #endif // DBAUI_SINGLEDOCCONTROLLER_HXX
91