LibreOffice Module sw (master) 1
IDocumentRedlineAccess.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <cstddef>
25
26#include <sal/types.h>
27
28#include <com/sun/star/uno/Sequence.h>
30#include <svx/ctredlin.hxx>
31
32#include "docary.hxx"
33
34class SwRangeRedline;
37class SwPaM;
38struct SwPosition;
39class SwStartNode;
40class SwNode;
41
42enum class RedlineFlags
43{
44 NONE = 0x000,
45 On = 0x001,
46 Ignore = 0x002,
47 ShowInsert = 0x010,
48 ShowDelete = 0x020,
50
51 // For internal management:
52 // remove the original Redlines together with their content
53 // (Clipboard/text modules).
54 DeleteRedlines = 0x100,
55 // don't combine any redlines. This flag may be only used in Undo.
56 DontCombineRedlines = 0x400,
57};
58namespace o3tl
59{
60 template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x533> {};
61}
62
64{
65 OUString sRet;
66 switch(eType)
67 {
68 case RedlineType::Insert: sRet = "Insert"; break;
69 case RedlineType::Delete: sRet = "Delete"; break;
70 case RedlineType::Format: sRet = "Format"; break;
71 case RedlineType::ParagraphFormat: sRet = "ParagraphFormat"; break;
72 case RedlineType::Table: sRet = "TextTable"; break;
73 case RedlineType::FmtColl:sRet = "Style"; break;
74 default: break;
75 }
76 return sRet;
77};
78
80{
81 // Static helper functions
82public:
83 static bool IsShowChanges(const RedlineFlags eM)
85
86 static bool IsHideChanges(const RedlineFlags eM)
88
89 static bool IsShowOriginal(const RedlineFlags eM)
91
92 static bool IsRedlineOn(const RedlineFlags eM)
94
95public:
96
102 virtual RedlineFlags GetRedlineFlags() const = 0;
103
109 virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0;
110
116 virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0;
117
123 virtual bool IsRedlineOn() const = 0;
124
125 virtual bool IsIgnoreRedline() const = 0;
126
127 virtual const SwRedlineTable& GetRedlineTable() const = 0;
129 virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0;
131
132 virtual bool IsInRedlines(const SwNode& rNode) const = 0;
133
134 enum class AppendResult { IGNORED, MERGED, APPENDED };
150 virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0;
151
152 virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0;
153 virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0;
154
155 virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
156
157 virtual bool DeleteRedline(
158 /*[in]*/const SwPaM& rPam,
159 /*[in]*/bool bSaveInUndo,
160 /*[in]*/RedlineType nDelType) = 0;
161
162 virtual bool DeleteRedline(
163 /*[in]*/const SwStartNode& rSection,
164 /*[in]*/bool bSaveInUndo,
165 /*[in]*/RedlineType nDelType) = 0;
166
168 /*[in]*/const SwNode& rNode,
169 /*[in]*/RedlineType nType) const = 0;
170
171 virtual bool HasRedline(
172 /*[in]*/const SwPaM& rPam,
173 /*[in]*/RedlineType nType,
174 /*[in]*/bool bStartOrEndInRange) const = 0;
175
176 virtual void CompressRedlines(size_t nStartIndex = 0) = 0;
177
179 /*[in]*/const SwPosition& rPos,
180 /*[in]*/SwRedlineTable::size_type* pFndPos) const = 0;
181
182 virtual bool IsRedlineMove() const = 0;
183
184 virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
185
186 virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
187
188 virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
189
190 virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0;
191
192 virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
193
194 virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
195
196 virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
197
198 virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
199
200 virtual void AcceptAllRedline(/*[in]*/bool bAcceptReject) = 0;
201
202 // Representation has changed, invalidate all Redlines.
203 virtual void UpdateRedlineAttr() = 0;
204
205 // Create a new Author if required.
206 virtual std::size_t GetRedlineAuthor() = 0;
207
208 // For Readers etc.: register new Author in table.
209 virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0;
210
211 // Place a comment at Redline at given position.
212 virtual bool SetRedlineComment(
213 /*[in]*/const SwPaM& rPam,
214 /*[in]*/const OUString& rComment) = 0;
215
216 virtual const css::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
217
218 virtual void SetRedlinePassword(
219 /*[in]*/const css::uno::Sequence <sal_Int8>& rNewPassword) = 0;
220
221protected:
223};
224
225/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ ShowDelete
show all deletes
@ On
RedlineFlags on.
@ ShowInsert
show all inserts
@ Ignore
ignore Redlines
OUString SwRedlineTypeToOUString(RedlineType eType)
virtual bool IsIgnoreRedline() const =0
virtual bool IsRedlineOn() const =0
Query if redlining is on.
virtual const SwRangeRedline * SelNextRedline(SwPaM &rPam) const =0
virtual void AcceptAllRedline(bool bAcceptReject)=0
virtual bool HasRedline(const SwPaM &rPam, RedlineType nType, bool bStartOrEndInRange) const =0
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual bool IsRedlineMove() const =0
virtual void UpdateRedlineAttr()=0
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
static bool IsShowOriginal(const RedlineFlags eM)
virtual bool RejectRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
virtual std::size_t GetRedlineAuthor()=0
virtual void SetRedlineMove(bool bFlag)=0
static bool IsShowChanges(const RedlineFlags eM)
virtual bool RejectRedline(const SwPaM &rPam, bool bCallDelete)=0
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
virtual SwRedlineTable & GetRedlineTable()=0
virtual SwExtraRedlineTable & GetExtraRedlineTable()=0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual void AcceptRedlineParagraphFormatting(const SwPaM &rPam)=0
virtual bool DeleteRedline(const SwStartNode &rSection, bool bSaveInUndo, RedlineType nDelType)=0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual bool AcceptRedline(const SwPaM &rPam, bool bCallDelete)=0
virtual const SwRangeRedline * SelPrevRedline(SwPaM &rPam) const =0
virtual bool IsInRedlines(const SwNode &rNode) const =0
virtual void CompressRedlines(size_t nStartIndex=0)=0
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr)=0
virtual bool AcceptRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
virtual bool SetRedlineComment(const SwPaM &rPam, const OUString &rComment)=0
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr)=0
static bool IsHideChanges(const RedlineFlags eM)
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
Table that holds 'extra' redlines, such as 'table row insert/delete', 'paragraph moves' etc....
Definition: docary.hxx:283
Base class of the Writer document model elements.
Definition: node.hxx:98
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
vector_type::size_type size_type
Definition: docary.hxx:223
Starts a section of nodes in the document model.
Definition: node.hxx:348
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:321
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:300
RedlineType
DocumentType eType
NONE
Marks a position in the document model.
Definition: pam.hxx:38