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