1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef IDOCUMENTREDLINE_HXX_INCLUDED
21 #define IDOCUMENTREDLINE_HXX_INCLUDED
23 #include <sal/types.h>
24 #include <tools/solar.h>
26 #include <limits.h> // USHRT_MAX
28 #include <com/sun/star/uno/Sequence.hxx>
38 typedef sal_uInt16 RedlineMode_t
;
39 namespace nsRedlineMode_t
41 const RedlineMode_t REDLINE_NONE
= 0; ///< no RedlineMode
42 const RedlineMode_t REDLINE_ON
= 0x01;///< RedlineMode on
43 const RedlineMode_t REDLINE_IGNORE
= 0x02;///< ignore Redlines
44 const RedlineMode_t REDLINE_SHOW_INSERT
= 0x10;///< show all inserts
45 const RedlineMode_t REDLINE_SHOW_DELETE
= 0x20;///< show all deletes
46 const RedlineMode_t REDLINE_SHOW_MASK
= REDLINE_SHOW_INSERT
| REDLINE_SHOW_DELETE
;
48 // For internal management:
49 // remove the original Redlines together with their content
50 // (Clipboard/text modules).
51 const RedlineMode_t REDLINE_DELETE_REDLINES
= 0x100;
52 // When deleting within a RedlineObject
53 // ignore the DeleteRedline during Append.
54 const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES
= 0x200;
55 // don't combine any redlines. This flag may be only used in Undo.
56 const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES
= 0x400;
59 typedef sal_uInt16 RedlineType_t
;
60 namespace nsRedlineType_t
62 // Range of RedlineTypes is 0 to 127.
63 const RedlineType_t REDLINE_INSERT
= 0x0;// Content has been inserted.
64 const RedlineType_t REDLINE_DELETE
= 0x1;// Content has been deleted.
65 const RedlineType_t REDLINE_FORMAT
= 0x2;// Attributes have been applied.
66 const RedlineType_t REDLINE_TABLE
= 0x3;// Table structure has been altered.
67 const RedlineType_t REDLINE_FMTCOLL
= 0x4;// Style has been altered (Autoformat!).
69 // When larger than 128, flags can be inserted.
70 const RedlineType_t REDLINE_NO_FLAG_MASK
= 0x7F;
71 const RedlineType_t REDLINE_FORM_AUTOFMT
= 0x80;// Can be a flag in RedlineType.
74 /** IDocumentRedlineAccess
76 class IDocumentRedlineAccess
78 // Static helper functions
80 static bool IsShowChanges(const sal_uInt16 eM
)
81 { return (nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE
) == (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
83 static bool IsHideChanges(const sal_uInt16 eM
)
84 { return nsRedlineMode_t::REDLINE_SHOW_INSERT
== (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
86 static bool IsShowOriginal(const sal_uInt16 eM
)
87 { return nsRedlineMode_t::REDLINE_SHOW_DELETE
== (eM
& nsRedlineMode_t::REDLINE_SHOW_MASK
); }
89 static bool IsRedlineOn(const sal_uInt16 eM
)
90 { return nsRedlineMode_t::REDLINE_ON
== (eM
& (nsRedlineMode_t::REDLINE_ON
| nsRedlineMode_t::REDLINE_IGNORE
)); }
94 /*************************************************
96 *************************************************/
98 /** Query the currently set redline mode
101 the currently set redline mode
103 virtual RedlineMode_t
GetRedlineMode() const = 0;
105 /** Set a new redline mode.
108 [in] the new redline mode.
110 virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode
) = 0;
112 /** Set a new redline mode.
115 [in] the new redline mode.
117 virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode
) = 0;
119 /** Query if redlining is on.
122 <TRUE/> if redlining is on <FALSE/> otherwise
124 virtual bool IsRedlineOn() const = 0;
126 virtual bool IsIgnoreRedline() const = 0;
128 virtual const SwRedlineTbl
& GetRedlineTbl() const = 0;
130 virtual bool IsInRedlines(const SwNode
& rNode
) const = 0;
132 /***************************************************
134 ***************************************************/
136 /** Append a new redline
144 virtual bool AppendRedline(/*[in]*/SwRedline
* pPtr
, /*[in]*/bool bCallDelete
) = 0;
146 virtual bool SplitRedline(/*[in]*/const SwPaM
& rPam
) = 0;
148 virtual bool DeleteRedline(
149 /*[in]*/const SwPaM
& rPam
,
150 /*[in]*/bool bSaveInUndo
,
151 /*[in]*/sal_uInt16 nDelType
) = 0;
153 virtual bool DeleteRedline(
154 /*[in]*/const SwStartNode
& rSection
,
155 /*[in]*/bool bSaveInUndo
,
156 /*[in]*/sal_uInt16 nDelType
) = 0;
158 virtual sal_uInt16
GetRedlinePos(
159 /*[in]*/const SwNode
& rNode
,
160 /*[in]*/sal_uInt16 nType
) const = 0;
162 virtual void CompressRedlines() = 0;
164 virtual const SwRedline
* GetRedline(
165 /*[in]*/const SwPosition
& rPos
,
166 /*[in]*/sal_uInt16
* pFndPos
) const = 0;
168 virtual bool IsRedlineMove() const = 0;
170 virtual void SetRedlineMove(/*[in]*/bool bFlag
) = 0;
172 virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos
, /*[in]*/bool bCallDelete
) = 0;
174 virtual bool AcceptRedline(/*[in]*/const SwPaM
& rPam
, /*[in]*/bool bCallDelete
) = 0;
176 virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos
, /*[in]*/bool bCallDelete
) = 0;
178 virtual bool RejectRedline(/*[in]*/const SwPaM
& rPam
, /*[in]*/bool bCallDelete
) = 0;
180 virtual const SwRedline
* SelNextRedline(/*[in]*/SwPaM
& rPam
) const = 0;
182 virtual const SwRedline
* SelPrevRedline(/*[in]*/SwPaM
& rPam
) const = 0;
184 // Representation has changed, invalidate all Redlines.
185 virtual void UpdateRedlineAttr() = 0;
187 // Create a new Author if required.
188 virtual sal_uInt16
GetRedlineAuthor() = 0;
190 // For Readers etc.: register new Author in table.
191 virtual sal_uInt16
InsertRedlineAuthor(const String
& rAuthor
) = 0;
193 // Place a comment at Redline at given position.
194 virtual bool SetRedlineComment(
195 /*[in]*/const SwPaM
& rPam
,
196 /*[in]*/const String
& rComment
) = 0;
198 virtual const ::com::sun::star::uno::Sequence
<sal_Int8
>& GetRedlinePassword() const = 0;
200 virtual void SetRedlinePassword(
201 /*[in]*/const ::com::sun::star::uno::Sequence
<sal_Int8
>& rNewPassword
) = 0;
204 virtual ~IDocumentRedlineAccess() {};
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */