1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: IDocumentRedlineAccess.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef IDOCUMENTREDLINE_HXX_INCLUDED
32 #define IDOCUMENTREDLINE_HXX_INCLUDED
35 #include <sal/types.h>
38 #include <tools/solar.h>
41 #include <limits.h> // USHRT_MAX
43 #ifndef _COM_SUN_STAR_SEQUENCE_HXX_
44 #include <com/sun/star/uno/Sequence.hxx>
55 typedef USHORT RedlineMode_t
;
56 namespace nsRedlineMode_t
58 const RedlineMode_t REDLINE_NONE
= 0; // no RedlineMode
59 const RedlineMode_t REDLINE_ON
= 0x01;// RedlineMode on
60 const RedlineMode_t REDLINE_IGNORE
= 0x02;// ignore Redlines
61 const RedlineMode_t REDLINE_SHOW_INSERT
= 0x10;// show all inserts
62 const RedlineMode_t REDLINE_SHOW_DELETE
= 0x20;// show all delets
63 const RedlineMode_t REDLINE_SHOW_MASK
= REDLINE_SHOW_INSERT
| REDLINE_SHOW_DELETE
;
65 // fuer die interne Verwaltung:
66 // die originalen Redlines inclusive des Contents entfernen
67 // (ClipBoard/Textbausteine)
68 const RedlineMode_t REDLINE_DELETE_REDLINES
= 0x100;
69 // beim Loeschen innerhalb ein RedlineObjectes, waehrend des Appends,
70 // das DeleteRedline ignorieren
71 const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES
= 0x200;
72 // don't combine any readlines. This flags is may only used in the Undo.
73 const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES
= 0x400;
76 typedef USHORT RedlineType_t
;
77 namespace nsRedlineType_t
79 // die RedlineTypen gehen von 0 bis 127
80 const RedlineType_t REDLINE_INSERT
= 0x0;// Inhalt wurde eingefuegt
81 const RedlineType_t REDLINE_DELETE
= 0x1;// Inhalt wurde geloescht
82 const RedlineType_t REDLINE_FORMAT
= 0x2;// Attributierung wurde angewendet
83 const RedlineType_t REDLINE_TABLE
= 0x3;// TabellenStruktur wurde veraendert
84 const RedlineType_t REDLINE_FMTCOLL
= 0x4;// FormatVorlage wurde veraendert (Autoformat!)
86 // ab 128 koennen Flags hineinverodert werden
87 const RedlineType_t REDLINE_NO_FLAG_MASK
= 0x7F;
88 //const RedlineType_t REDLINE_FLAG_MASK = 0xFF80;
89 const RedlineType_t REDLINE_FORM_AUTOFMT
= 0x80;// kann als Flag im RedlineType stehen
92 /** IDocumentRedlineAccess
94 class IDocumentRedlineAccess
96 // Static helper functions
98 static bool IsShowChanges(const USHORT eM
)
99 { return (nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE
) == (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
101 static bool IsHideChanges(const USHORT eM
)
102 { return nsRedlineMode_t::REDLINE_SHOW_INSERT
== (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
104 static bool IsShowOriginal(const USHORT eM
)
105 { return nsRedlineMode_t::REDLINE_SHOW_DELETE
== (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
107 static bool IsRedlineOn(const USHORT eM
)
108 { return nsRedlineMode_t::REDLINE_ON
== (eM
& (nsRedlineMode_t::REDLINE_ON
| nsRedlineMode_t::REDLINE_IGNORE
)); }
112 /*************************************************
114 *************************************************/
116 /** Query the currently set redline mode
119 the currently set redline mode
121 virtual RedlineMode_t
GetRedlineMode() const = 0;
123 /** Set a new redline mode.
126 [in] the new redline mode.
128 virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode
) = 0;
130 /** Set a new redline mode.
133 [in] the new redline mode.
135 virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode
) = 0;
137 /** Query if redlining is on.
140 </TRUE> if redlining is on </FALSE> otherwise
142 virtual bool IsRedlineOn() const = 0;
146 virtual bool IsIgnoreRedline() const = 0;
150 virtual const SwRedlineTbl
& GetRedlineTbl() const = 0;
155 virtual bool IsInRedlines(const SwNode
& rNode
) const = 0;
157 /***************************************************
159 ***************************************************/
161 /** Append a new redline
169 virtual bool AppendRedline(/*[in]*/SwRedline
* pPtr
, /*[in]*/bool bCallDelete
) = 0;
173 virtual bool SplitRedline(/*[in]*/const SwPaM
& rPam
) = 0;
177 virtual bool DeleteRedline(
178 /*[in]*/const SwPaM
& rPam
,
179 /*[in]*/bool bSaveInUndo
,
180 /*[in]*/sal_uInt16 nDelType
) = 0;
184 virtual bool DeleteRedline(
185 /*[in]*/const SwStartNode
& rSection
,
186 /*[in]*/bool bSaveInUndo
,
187 /*[in]*/sal_uInt16 nDelType
) = 0;
191 virtual sal_uInt16
GetRedlinePos(
192 /*[in]*/const SwNode
& rNode
,
193 /*[in]*/sal_uInt16 nType
) const = 0;
195 virtual void CompressRedlines() = 0;
199 virtual const SwRedline
* GetRedline(
200 /*[in]*/const SwPosition
& rPos
,
201 /*[in]*/sal_uInt16
* pFndPos
) const = 0;
205 virtual bool IsRedlineMove() const = 0;
209 virtual void SetRedlineMove(/*[in]*/bool bFlag
) = 0;
213 virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos
, /*[in]*/bool bCallDelete
) = 0;
217 virtual bool AcceptRedline(/*[in]*/const SwPaM
& rPam
, /*[in]*/bool bCallDelete
) = 0;
221 virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos
, /*[in]*/bool bCallDelete
) = 0;
225 virtual bool RejectRedline(/*[in]*/const SwPaM
& rPam
, /*[in]*/bool bCallDelete
) = 0;
229 virtual const SwRedline
* SelNextRedline(/*[in]*/SwPaM
& rPam
) const = 0;
233 virtual const SwRedline
* SelPrevRedline(/*[in]*/SwPaM
& rPam
) const = 0;
235 // alle Redline invalidieren, die Darstellung hat sich geaendert
236 virtual void UpdateRedlineAttr() = 0;
238 // legt gegebenenfalls einen neuen Author an
239 virtual sal_uInt16
GetRedlineAuthor() = 0;
241 // fuer die Reader usw. - neuen Author in die Tabelle eintragen
242 virtual sal_uInt16
InsertRedlineAuthor(const String
& rAuthor
) = 0;
244 // Kommentar am Redline an der Position setzen
245 virtual bool SetRedlineComment(
246 /*[in]*/const SwPaM
& rPam
,
247 /*[in]*/const String
& rComment
) = 0;
251 virtual const ::com::sun::star::uno::Sequence
<sal_Int8
>& GetRedlinePassword() const = 0;
255 virtual void SetRedlinePassword(
256 /*[in]*/const ::com::sun::star::uno::Sequence
<sal_Int8
>& rNewPassword
) = 0;
259 virtual ~IDocumentRedlineAccess() {};