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_TXT_FMT_COLL_HXX 28 #define SW_UNDO_TXT_FMT_COLL_HXX 29 30 #include <undobj.hxx> 31 #include <swundo.hxx> 32 #include <numrule.hxx> 33 34 35 class SwDoc; 36 class SwTxtFmtColl; 37 class String; 38 class SwRewriter; 39 class SfxItemSet; 40 41 class SwUndoFmtCreate : public SwUndo 42 { 43 protected: 44 SwFmt * pNew; 45 String sDerivedFrom; 46 SwDoc * pDoc; 47 mutable String sNewName; 48 SfxItemSet * pNewSet; 49 sal_uInt16 nId; // FmtId related 50 sal_Bool bAuto; 51 52 public: 53 54 SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom, 55 SwDoc * pDoc); 56 virtual ~SwUndoFmtCreate(); 57 58 virtual void UndoImpl( ::sw::UndoRedoContext & ); 59 virtual void RedoImpl( ::sw::UndoRedoContext & ); 60 61 virtual SwRewriter GetRewriter() const; 62 63 virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0; 64 virtual void Delete() = 0; 65 virtual SwFmt * Find(const String & rName) const = 0; 66 }; 67 68 class SwUndoFmtDelete : public SwUndo 69 { 70 protected: 71 String sDerivedFrom; 72 SwDoc * pDoc; 73 String sOldName; 74 SfxItemSet aOldSet; 75 sal_uInt16 nId; // FmtId related 76 sal_Bool bAuto; 77 78 public: 79 SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc); 80 ~SwUndoFmtDelete(); 81 82 virtual void UndoImpl( ::sw::UndoRedoContext & ); 83 virtual void RedoImpl( ::sw::UndoRedoContext & ); 84 85 virtual SwRewriter GetRewriter() const; 86 87 virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0; 88 virtual void Delete(SwFmt * pFmt) = 0; 89 virtual SwFmt * Find(const String & rName) const = 0; 90 }; 91 92 class SwUndoRenameFmt : public SwUndo 93 { 94 protected: 95 String sOldName, sNewName; 96 SwDoc * pDoc; 97 // SwUndoId nId; 98 99 public: 100 SwUndoRenameFmt(SwUndoId nUndoId, const String & sOldName, 101 const String & sNewName, 102 SwDoc * pDoc); 103 ~SwUndoRenameFmt(); 104 105 virtual void UndoImpl( ::sw::UndoRedoContext & ); 106 virtual void RedoImpl( ::sw::UndoRedoContext & ); 107 108 SwRewriter GetRewriter() const; 109 110 virtual SwFmt * Find(const String & rName) const = 0; 111 }; 112 113 class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate 114 { 115 public: 116 SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom, 117 SwDoc * pDoc); 118 119 virtual SwFmt * Create(SwFmt * pDerivedFrom); 120 virtual void Delete(); 121 virtual SwFmt * Find(const String & rName) const; 122 }; 123 124 class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete 125 { 126 public: 127 SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc); 128 129 virtual SwFmt * Create(SwFmt * pDerivedFrom); 130 virtual void Delete(SwFmt * pFmt); 131 virtual SwFmt * Find(const String & rName) const; 132 }; 133 134 class SwUndoRenameFmtColl : public SwUndoRenameFmt 135 { 136 public: 137 SwUndoRenameFmtColl(const String & sOldName, 138 const String & sNewName, 139 SwDoc * pDoc); 140 141 virtual SwFmt * Find(const String & rName) const; 142 }; 143 144 class SwUndoCharFmtCreate : public SwUndoFmtCreate 145 { 146 public: 147 SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom, 148 SwDoc * pDoc); 149 150 virtual SwFmt * Create(SwFmt * pDerivedFrom); 151 virtual void Delete(); 152 virtual SwFmt * Find(const String & rName) const; 153 }; 154 155 class SwUndoCharFmtDelete : public SwUndoFmtDelete 156 { 157 public: 158 SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc); 159 160 virtual SwFmt * Create(SwFmt * pDerivedFrom); 161 virtual void Delete(SwFmt * pFmt); 162 virtual SwFmt * Find(const String & rName) const; 163 }; 164 165 class SwUndoRenameCharFmt : public SwUndoRenameFmt 166 { 167 public: 168 SwUndoRenameCharFmt(const String & sOldName, 169 const String & sNewName, 170 SwDoc * pDoc); 171 172 virtual SwFmt * Find(const String & rName) const; 173 }; 174 175 class SwUndoFrmFmtCreate : public SwUndoFmtCreate 176 { 177 sal_Bool bAuto; 178 179 public: 180 SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom, 181 SwDoc * pDoc); 182 183 virtual SwFmt * Create(SwFmt * pDerivedFrom); 184 virtual void Delete(); 185 virtual SwFmt * Find(const String & rName) const; 186 }; 187 188 class SwUndoFrmFmtDelete : public SwUndoFmtDelete 189 { 190 public: 191 SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc); 192 193 virtual SwFmt * Create(SwFmt * pDerivedFrom); 194 virtual void Delete(SwFmt * pFmt); 195 virtual SwFmt * Find(const String & rName) const; 196 }; 197 198 class SwUndoRenameFrmFmt : public SwUndoRenameFmt 199 { 200 public: 201 SwUndoRenameFrmFmt(const String & sOldName, 202 const String & sNewName, 203 SwDoc * pDoc); 204 205 virtual SwFmt * Find(const String & rName) const; 206 }; 207 208 class SwUndoNumruleCreate : public SwUndo 209 { 210 const SwNumRule * pNew; 211 mutable SwNumRule aNew; 212 SwDoc * pDoc; 213 mutable bool bInitialized; 214 215 public: 216 SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc); 217 218 virtual void UndoImpl( ::sw::UndoRedoContext & ); 219 virtual void RedoImpl( ::sw::UndoRedoContext & ); 220 221 SwRewriter GetRewriter() const; 222 }; 223 224 class SwUndoNumruleDelete : public SwUndo 225 { 226 SwNumRule aOld; 227 SwDoc * pDoc; 228 229 public: 230 SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc); 231 232 virtual void UndoImpl( ::sw::UndoRedoContext & ); 233 virtual void RedoImpl( ::sw::UndoRedoContext & ); 234 235 SwRewriter GetRewriter() const; 236 }; 237 238 class SwUndoNumruleRename : public SwUndo 239 { 240 String aOldName, aNewName; 241 SwDoc * pDoc; 242 243 public: 244 SwUndoNumruleRename(const String & aOldName, const String & aNewName, 245 SwDoc * pDoc); 246 247 virtual void UndoImpl( ::sw::UndoRedoContext & ); 248 virtual void RedoImpl( ::sw::UndoRedoContext & ); 249 250 SwRewriter GetRewriter() const; 251 }; 252 253 #endif // SW_UNDO_TXT_FMT_COLL_HXX 254