xref: /trunk/main/sfx2/source/inc/docundomanager.hxx (revision 67e470da)
1*353d8f4dSAndrew Rist /**************************************************************
2*353d8f4dSAndrew Rist  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef DOCUMENT_UNDO_MANAGER_HXX
25cdf0e10cSrcweir #define DOCUMENT_UNDO_MANAGER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sfx2/sfxbasemodel.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir /** === begin UNO includes === **/
30cdf0e10cSrcweir #include <com/sun/star/document/XUndoManager.hpp>
31cdf0e10cSrcweir /** === end UNO includes === **/
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <boost/scoped_ptr.hpp>
36cdf0e10cSrcweir #include <boost/noncopyable.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace svl
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     class IUndoManager;
41cdf0e10cSrcweir }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //......................................................................................................................
44cdf0e10cSrcweir namespace sfx2
45cdf0e10cSrcweir {
46cdf0e10cSrcweir //......................................................................................................................
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	//==================================================================================================================
49cdf0e10cSrcweir 	//= DocumentUndoManager
50cdf0e10cSrcweir 	//==================================================================================================================
51cdf0e10cSrcweir     typedef ::cppu::ImplHelper1 <   ::com::sun::star::document::XUndoManager
52cdf0e10cSrcweir                                 >   DocumentUndoManager_Base;
53cdf0e10cSrcweir     struct DocumentUndoManager_Impl;
54cdf0e10cSrcweir     class DocumentUndoManager   :public DocumentUndoManager_Base
55cdf0e10cSrcweir                                 ,public SfxModelSubComponent
56cdf0e10cSrcweir                                 ,public ::boost::noncopyable
57cdf0e10cSrcweir 	{
58cdf0e10cSrcweir         friend struct DocumentUndoManager_Impl;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     public:
61cdf0e10cSrcweir         DocumentUndoManager( SfxBaseModel& i_document );
62cdf0e10cSrcweir         virtual ~DocumentUndoManager();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir         // SfxModelSubComponent overridables
65cdf0e10cSrcweir         virtual void    disposing();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         // non-UNO API for our owner
68cdf0e10cSrcweir         /** determines whether we have an open Undo context. No mutex locking within this method, no disposal check - this
69cdf0e10cSrcweir             is the responsibility of the owner.
70cdf0e10cSrcweir         */
71cdf0e10cSrcweir         bool    isInContext() const;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         // XInterface
74cdf0e10cSrcweir         virtual void SAL_CALL acquire(  ) throw ();
75cdf0e10cSrcweir         virtual void SAL_CALL release(  ) throw ();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         // XUndoManager
78cdf0e10cSrcweir         virtual void SAL_CALL enterUndoContext( const ::rtl::OUString& i_title ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir         virtual void SAL_CALL enterHiddenUndoContext(  ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir         virtual void SAL_CALL leaveUndoContext(  ) throw (::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir         virtual void SAL_CALL addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir         virtual void SAL_CALL undo(  ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir         virtual void SAL_CALL redo(  ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL isUndoPossible(  ) throw (::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL isRedoPossible(  ) throw (::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getCurrentUndoActionTitle(  ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getCurrentRedoActionTitle(  ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoActionTitles(  ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoActionTitles(  ) throw (::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir         virtual void SAL_CALL clear(  ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir         virtual void SAL_CALL clearRedo(  ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir         virtual void SAL_CALL reset(  ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir         virtual void SAL_CALL addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir         virtual void SAL_CALL removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         // XLockable, base of XUndoManager
97cdf0e10cSrcweir         virtual void SAL_CALL lock(  ) throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir         virtual void SAL_CALL unlock(  ) throw (::com::sun::star::util::NotLockedException, ::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL isLocked(  ) throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         // XChild, base of XUndoManager
102cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir         virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     private:
106cdf0e10cSrcweir         ::boost::scoped_ptr< DocumentUndoManager_Impl > m_pImpl;
107cdf0e10cSrcweir 	};
108cdf0e10cSrcweir 
109cdf0e10cSrcweir //......................................................................................................................
110cdf0e10cSrcweir } // namespace sfx2
111cdf0e10cSrcweir //......................................................................................................................
112cdf0e10cSrcweir 
113cdf0e10cSrcweir #endif // DOCUMENT_UNDO_MANAGER_HXX
114