xref: /AOO41X/main/svtools/source/edit/textundo.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
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 #ifndef _TEXTUNDO_HXX
24 #define _TEXTUNDO_HXX
25 
26 #include <svl/undo.hxx>
27 
28 class TextEngine;
29 
30 class TextUndoManager : public SfxUndoManager
31 {
32     TextEngine*     mpTextEngine;
33 
34 protected:
35 
36     void            UndoRedoStart();
37     void            UndoRedoEnd();
38 
GetView() const39     TextView*       GetView() const { return mpTextEngine->GetActiveView(); }
40 
41 public:
42                     TextUndoManager( TextEngine* pTextEngine );
43                     ~TextUndoManager();
44 
45     using SfxUndoManager::Undo;
46     virtual sal_Bool Undo();
47     using SfxUndoManager::Redo;
48     virtual sal_Bool Redo();
49 
50 };
51 
52 class TextUndo : public SfxUndoAction
53 {
54 private:
55     TextEngine*         mpTextEngine;
56 
57 protected:
58 
GetView() const59     TextView*           GetView() const { return mpTextEngine->GetActiveView(); }
60     void                SetSelection( const TextSelection& rSel );
61 
GetDoc() const62     TextDoc*            GetDoc() const { return mpTextEngine->mpDoc; }
GetTEParaPortions() const63     TEParaPortions*     GetTEParaPortions() const { return mpTextEngine->mpTEParaPortions; }
64 
65 public:
66                         TYPEINFO();
67                         TextUndo( TextEngine* pTextEngine );
68     virtual             ~TextUndo();
69 
GetTextEngine() const70     TextEngine*         GetTextEngine() const   { return mpTextEngine; }
71 
72     virtual void        Undo()      = 0;
73     virtual void        Redo()      = 0;
74 
75     virtual XubString   GetComment() const;
76 };
77 
78 #endif // _TEXTUNDO_HXX
79