Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / IDocumentRedlineAccess.hxx
blobeb37a3ac63d6d5cbbbc864dd19e6b36b7891e4b7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
21 #define INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
23 #include <sal/types.h>
24 #include <tools/solar.h>
26 #include <limits.h>
28 #include <com/sun/star/uno/Sequence.hxx>
30 class SwRangeRedline;
31 class SwTableRowRedline;
32 class SwTableCellRedline;
33 class SwRedlineTable;
34 class SwExtraRedlineTable;
35 class SwPaM;
36 struct SwPosition;
37 class SwStartNode;
38 class SwNode;
40 typedef sal_uInt16 RedlineMode_t;
41 namespace nsRedlineMode_t
43 const RedlineMode_t REDLINE_NONE = 0; ///< no RedlineMode
44 const RedlineMode_t REDLINE_ON = 0x01;///< RedlineMode on
45 const RedlineMode_t REDLINE_IGNORE = 0x02;///< ignore Redlines
46 const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;///< show all inserts
47 const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;///< show all deletes
48 const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE;
50 // For internal management:
51 // remove the original Redlines together with their content
52 // (Clipboard/text modules).
53 const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100;
54 // When deleting within a RedlineObject
55 // ignore the DeleteRedline during Append.
56 const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200;
57 // don't combine any redlines. This flag may be only used in Undo.
58 const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400;
61 typedef sal_uInt16 RedlineType_t;
62 namespace nsRedlineType_t
64 // Range of RedlineTypes is 0 to 127.
65 const RedlineType_t REDLINE_INSERT = 0x0;// Content has been inserted.
66 const RedlineType_t REDLINE_DELETE = 0x1;// Content has been deleted.
67 const RedlineType_t REDLINE_FORMAT = 0x2;// Attributes have been applied.
68 const RedlineType_t REDLINE_TABLE = 0x3;// Table structure has been altered.
69 const RedlineType_t REDLINE_FMTCOLL = 0x4;// Style has been altered (Autoformat!).
70 const RedlineType_t REDLINE_PARAGRAPH_FORMAT = 0x5;// Paragraph attributes have been changed.
71 const RedlineType_t REDLINE_TABLE_ROW_INSERT = 0x6;// Table row has been inserted.
72 const RedlineType_t REDLINE_TABLE_ROW_DELETE = 0x7;// Table row has been deleted.
73 const RedlineType_t REDLINE_TABLE_CELL_INSERT = 0x8;// Table cell has been inserted.
74 const RedlineType_t REDLINE_TABLE_CELL_DELETE = 0x9;// Table cell has been deleted.
76 // When larger than 128, flags can be inserted.
77 const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
78 const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// Can be a flag in RedlineType.
81 class IDocumentRedlineAccess
83 // Static helper functions
84 public:
85 static bool IsShowChanges(const sal_uInt16 eM)
86 { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
88 static bool IsHideChanges(const sal_uInt16 eM)
89 { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
91 static bool IsShowOriginal(const sal_uInt16 eM)
92 { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
94 static bool IsRedlineOn(const sal_uInt16 eM)
95 { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
97 public:
99 /** Query the currently set redline mode
101 @returns
102 the currently set redline mode
104 virtual RedlineMode_t GetRedlineMode() const = 0;
106 /** Set a new redline mode.
108 @param eMode
109 [in] the new redline mode.
111 virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
113 /** Set a new redline mode.
115 @param eMode
116 [in] the new redline mode.
118 virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
120 /** Query if redlining is on.
122 @returns
123 <TRUE/> if redlining is on <FALSE/> otherwise
125 virtual bool IsRedlineOn() const = 0;
127 virtual bool IsIgnoreRedline() const = 0;
129 virtual const SwRedlineTable& GetRedlineTable() const = 0;
130 virtual SwRedlineTable& GetRedlineTable() = 0;
131 virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0;
132 virtual SwExtraRedlineTable& GetExtraRedlineTable() = 0;
133 virtual bool HasExtraRedlineTable() const = 0;
135 virtual bool IsInRedlines(const SwNode& rNode) const = 0;
137 /** Append a new redline
139 @param pPtr
141 @param bCallDelete
143 @returns
145 virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
147 virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
148 virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
150 virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
152 virtual bool DeleteRedline(
153 /*[in]*/const SwPaM& rPam,
154 /*[in]*/bool bSaveInUndo,
155 /*[in]*/sal_uInt16 nDelType) = 0;
157 virtual bool DeleteRedline(
158 /*[in]*/const SwStartNode& rSection,
159 /*[in]*/bool bSaveInUndo,
160 /*[in]*/sal_uInt16 nDelType) = 0;
162 virtual sal_uInt16 GetRedlinePos(
163 /*[in]*/const SwNode& rNode,
164 /*[in]*/sal_uInt16 nType) const = 0;
166 virtual void CompressRedlines() = 0;
168 virtual const SwRangeRedline* GetRedline(
169 /*[in]*/const SwPosition& rPos,
170 /*[in]*/sal_uInt16* pFndPos) const = 0;
172 virtual bool IsRedlineMove() const = 0;
174 virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
176 virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
178 virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
180 virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
182 virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
184 virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
186 virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
188 // Representation has changed, invalidate all Redlines.
189 virtual void UpdateRedlineAttr() = 0;
191 // Create a new Author if required.
192 virtual sal_uInt16 GetRedlineAuthor() = 0;
194 // For Readers etc.: register new Author in table.
195 virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) = 0;
197 // Place a comment at Redline at given position.
198 virtual bool SetRedlineComment(
199 /*[in]*/const SwPaM& rPam,
200 /*[in]*/const OUString& rComment) = 0;
202 virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
204 virtual void SetRedlinePassword(
205 /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0;
207 protected:
208 virtual ~IDocumentRedlineAccess() {};
211 #endif
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */