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 28 #ifndef IDOCUMENTREDLINE_HXX_INCLUDED 29 #define IDOCUMENTREDLINE_HXX_INCLUDED 30 31 #ifndef _SAL_TYPES_H_ 32 #include <sal/types.h> 33 #endif 34 #ifndef _SOLAR_H 35 #include <tools/solar.h> 36 #endif 37 38 #include <limits.h> // USHRT_MAX 39 40 #ifndef _COM_SUN_STAR_SEQUENCE_HXX_ 41 #include <com/sun/star/uno/Sequence.hxx> 42 #endif 43 44 class SwRedline; 45 class SwRedlineTbl; 46 class SwPaM; 47 struct SwPosition; 48 class SwStartNode; 49 class SwNode; 50 class String; 51 52 typedef sal_uInt16 RedlineMode_t; 53 namespace nsRedlineMode_t 54 { 55 const RedlineMode_t REDLINE_NONE = 0; // no RedlineMode 56 const RedlineMode_t REDLINE_ON = 0x01;// RedlineMode on 57 const RedlineMode_t REDLINE_IGNORE = 0x02;// ignore Redlines 58 const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;// show all inserts 59 const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;// show all delets 60 const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE; 61 62 // fuer die interne Verwaltung: 63 // die originalen Redlines inclusive des Contents entfernen 64 // (ClipBoard/Textbausteine) 65 const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100; 66 // beim Loeschen innerhalb ein RedlineObjectes, waehrend des Appends, 67 // das DeleteRedline ignorieren 68 const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200; 69 // don't combine any readlines. This flags is may only used in the Undo. 70 const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400; 71 } 72 73 typedef sal_uInt16 RedlineType_t; 74 namespace nsRedlineType_t 75 { 76 // die RedlineTypen gehen von 0 bis 127 77 const RedlineType_t REDLINE_INSERT = 0x0;// Inhalt wurde eingefuegt 78 const RedlineType_t REDLINE_DELETE = 0x1;// Inhalt wurde geloescht 79 const RedlineType_t REDLINE_FORMAT = 0x2;// Attributierung wurde angewendet 80 const RedlineType_t REDLINE_TABLE = 0x3;// TabellenStruktur wurde veraendert 81 const RedlineType_t REDLINE_FMTCOLL = 0x4;// FormatVorlage wurde veraendert (Autoformat!) 82 83 // ab 128 koennen Flags hineinverodert werden 84 const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F; 85 //const RedlineType_t REDLINE_FLAG_MASK = 0xFF80; 86 const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// kann als Flag im RedlineType stehen 87 } 88 89 /** IDocumentRedlineAccess 90 */ 91 class IDocumentRedlineAccess 92 { 93 // Static helper functions 94 public: 95 static bool IsShowChanges(const sal_uInt16 eM) 96 { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); } 97 98 static bool IsHideChanges(const sal_uInt16 eM) 99 { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); } 100 101 static bool IsShowOriginal(const sal_uInt16 eM) 102 { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); } 103 104 static bool IsRedlineOn(const sal_uInt16 eM) 105 { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); } 106 107 public: 108 109 /************************************************* 110 Query 111 *************************************************/ 112 113 /** Query the currently set redline mode 114 115 @returns 116 the currently set redline mode 117 */ 118 virtual RedlineMode_t GetRedlineMode() const = 0; 119 120 /** Set a new redline mode. 121 122 @param eMode 123 [in] the new redline mode. 124 */ 125 virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0; 126 127 /** Set a new redline mode. 128 129 @param eMode 130 [in] the new redline mode. 131 */ 132 virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0; 133 134 /** Query if redlining is on. 135 136 @returns 137 <TRUE/> if redlining is on <FALSE/> otherwise 138 */ 139 virtual bool IsRedlineOn() const = 0; 140 141 /** 142 */ 143 virtual bool IsIgnoreRedline() const = 0; 144 145 /** 146 */ 147 virtual const SwRedlineTbl& GetRedlineTbl() const = 0; 148 149 150 /* 151 */ 152 virtual bool IsInRedlines(const SwNode& rNode) const = 0; 153 154 /*************************************************** 155 Manipulation 156 ***************************************************/ 157 158 /** Append a new redline 159 160 @param pPtr 161 162 @param bCallDelete 163 164 @returns 165 */ 166 virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete) = 0; 167 168 /** 169 */ 170 virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0; 171 172 /** 173 */ 174 virtual bool DeleteRedline( 175 /*[in]*/const SwPaM& rPam, 176 /*[in]*/bool bSaveInUndo, 177 /*[in]*/sal_uInt16 nDelType) = 0; 178 179 /** 180 */ 181 virtual bool DeleteRedline( 182 /*[in]*/const SwStartNode& rSection, 183 /*[in]*/bool bSaveInUndo, 184 /*[in]*/sal_uInt16 nDelType) = 0; 185 186 /** 187 */ 188 virtual sal_uInt16 GetRedlinePos( 189 /*[in]*/const SwNode& rNode, 190 /*[in]*/sal_uInt16 nType) const = 0; 191 192 virtual void CompressRedlines() = 0; 193 194 /** 195 */ 196 virtual const SwRedline* GetRedline( 197 /*[in]*/const SwPosition& rPos, 198 /*[in]*/sal_uInt16* pFndPos) const = 0; 199 200 /** 201 */ 202 virtual bool IsRedlineMove() const = 0; 203 204 /** 205 */ 206 virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0; 207 208 /** 209 */ 210 virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0; 211 212 /** 213 */ 214 virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; 215 216 /** 217 */ 218 virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0; 219 220 /** 221 */ 222 virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; 223 224 /** 225 */ 226 virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0; 227 228 /** 229 */ 230 virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0; 231 232 // alle Redline invalidieren, die Darstellung hat sich geaendert 233 virtual void UpdateRedlineAttr() = 0; 234 235 // legt gegebenenfalls einen neuen Author an 236 virtual sal_uInt16 GetRedlineAuthor() = 0; 237 238 // fuer die Reader usw. - neuen Author in die Tabelle eintragen 239 virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor) = 0; 240 241 // Kommentar am Redline an der Position setzen 242 virtual bool SetRedlineComment( 243 /*[in]*/const SwPaM& rPam, 244 /*[in]*/const String& rComment) = 0; 245 246 /** 247 */ 248 virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0; 249 250 /** 251 */ 252 virtual void SetRedlinePassword( 253 /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0; 254 255 protected: 256 virtual ~IDocumentRedlineAccess() {}; 257 }; 258 259 #endif 260