xref: /trunk/main/sw/inc/SwUndoField.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SW_UNDO_FIELD_HXX
28 #define SW_UNDO_FIELD_HXX
29 
30 #include <undobj.hxx>
31 
32 #include <com/sun/star/uno/Any.h>
33 
34 
35 class SwDoc;
36 class SwField;
37 class SwMsgPoolItem;
38 
39 class SwUndoField : public SwUndo
40 {
41     sal_uLong nNodeIndex;
42     xub_StrLen nOffset;
43 
44 protected:
45     SwDoc * pDoc;
46     SwPosition GetPosition();
47 
48 public:
49     SwUndoField(const SwPosition & rPos, SwUndoId nId = UNDO_FIELD );
50     virtual ~SwUndoField();
51 };
52 
53 class SwUndoFieldFromDoc : public SwUndoField
54 {
55     SwField * pOldField, * pNewField;
56     SwMsgPoolItem * pHnt;
57     sal_Bool bUpdate;
58 
59     void DoImpl();
60 
61 public:
62     SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
63                        const SwField & aNewField,
64                        SwMsgPoolItem * pHnt, sal_Bool bUpdate,
65                        SwUndoId nId = UNDO_FIELD );
66 
67     virtual ~SwUndoFieldFromDoc();
68 
69     virtual void UndoImpl( ::sw::UndoRedoContext & );
70     virtual void RedoImpl( ::sw::UndoRedoContext & );
71     virtual void RepeatImpl( ::sw::RepeatContext & );
72 };
73 
74 class SwUndoFieldFromAPI : public SwUndoField
75 {
76     com::sun::star::uno::Any aOldVal, aNewVal;
77     sal_uInt16 nWhich;
78 
79     void DoImpl();
80 
81 public:
82     SwUndoFieldFromAPI(const SwPosition & rPos,
83                        const com::sun::star::uno::Any & rOldVal,
84                        const com::sun::star::uno::Any & rNewVal,
85                        sal_uInt16 nWhich);
86     virtual ~SwUndoFieldFromAPI();
87 
88     virtual void UndoImpl( ::sw::UndoRedoContext & );
89     virtual void RedoImpl( ::sw::UndoRedoContext & );
90     virtual void RepeatImpl( ::sw::RepeatContext & );
91 };
92 
93 #endif // SW_UNDO_FIELD_HXX
94