xref: /aoo42x/main/sw/inc/SwUndoField.hxx (revision 1d2dbeb0)
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 SW_UNDO_FIELD_HXX
24 #define SW_UNDO_FIELD_HXX
25 
26 #include <undobj.hxx>
27 
28 #include <com/sun/star/uno/Any.h>
29 
30 
31 class SwDoc;
32 class SwField;
33 class SwMsgPoolItem;
34 
35 class SwUndoField : public SwUndo
36 {
37     sal_uLong nNodeIndex;
38     xub_StrLen nOffset;
39 
40 protected:
41     SwDoc * pDoc;
42     SwPosition GetPosition();
43 
44 public:
45     SwUndoField(const SwPosition & rPos, SwUndoId nId = UNDO_FIELD );
46     virtual ~SwUndoField();
47 };
48 
49 class SwUndoFieldFromDoc : public SwUndoField
50 {
51     SwField * pOldField, * pNewField;
52     SwMsgPoolItem * pHnt;
53     sal_Bool bUpdate;
54 
55     void DoImpl();
56 
57 public:
58     SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
59                        const SwField & aNewField,
60                        SwMsgPoolItem * pHnt, sal_Bool bUpdate,
61                        SwUndoId nId = UNDO_FIELD );
62 
63     virtual ~SwUndoFieldFromDoc();
64 
65     virtual void UndoImpl( ::sw::UndoRedoContext & );
66     virtual void RedoImpl( ::sw::UndoRedoContext & );
67     virtual void RepeatImpl( ::sw::RepeatContext & );
68 };
69 
70 class SwUndoFieldFromAPI : public SwUndoField
71 {
72     com::sun::star::uno::Any aOldVal, aNewVal;
73     sal_uInt16 nWhich;
74 
75     void DoImpl();
76 
77 public:
78     SwUndoFieldFromAPI(const SwPosition & rPos,
79                        const com::sun::star::uno::Any & rOldVal,
80                        const com::sun::star::uno::Any & rNewVal,
81                        sal_uInt16 nWhich);
82     virtual ~SwUndoFieldFromAPI();
83 
84     virtual void UndoImpl( ::sw::UndoRedoContext & );
85     virtual void RedoImpl( ::sw::UndoRedoContext & );
86     virtual void RepeatImpl( ::sw::RepeatContext & );
87 };
88 
89 #endif // SW_UNDO_FIELD_HXX
90