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 #ifndef INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
21 #define INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
22 
23 #include <sal/config.h>
24 
25 #include <cstddef>
26 
27 #include <sal/types.h>
28 
29 #include <com/sun/star/uno/Sequence.h>
30 #include <o3tl/typed_flags_set.hxx>
31 #include <svx/ctredlin.hxx>
32 
33 #include "docary.hxx"
34 
35 class SwRangeRedline;
36 class SwTableRowRedline;
37 class SwTableCellRedline;
38 class SwPaM;
39 struct SwPosition;
40 class SwStartNode;
41 class SwNode;
42 
43 enum class RedlineFlags
44 {
45  NONE = 0x000,
46  On = 0x001,
47  Ignore = 0x002,
48  ShowInsert = 0x010,
49  ShowDelete = 0x020,
51 
52  // For internal management:
53  // remove the original Redlines together with their content
54  // (Clipboard/text modules).
55  DeleteRedlines = 0x100,
56  // don't combine any redlines. This flag may be only used in Undo.
57  DontCombineRedlines = 0x400,
58 };
59 namespace o3tl
60 {
61  template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x533> {};
62 }
63 
64 inline OUString SwRedlineTypeToOUString(RedlineType eType)
65 {
66  OUString sRet;
67  switch(eType)
68  {
69  case RedlineType::Insert: sRet = "Insert"; break;
70  case RedlineType::Delete: sRet = "Delete"; break;
71  case RedlineType::Format: sRet = "Format"; break;
72  case RedlineType::ParagraphFormat: sRet = "ParagraphFormat"; break;
73  case RedlineType::Table: sRet = "TextTable"; break;
74  case RedlineType::FmtColl:sRet = "Style"; break;
75  default: break;
76  }
77  return sRet;
78 };
79 
81 {
82  // Static helper functions
83 public:
84  static bool IsShowChanges(const RedlineFlags eM)
86 
87  static bool IsHideChanges(const RedlineFlags eM)
89 
90  static bool IsShowOriginal(const RedlineFlags eM)
92 
93  static bool IsRedlineOn(const RedlineFlags eM)
94  { return RedlineFlags::On == (eM & (RedlineFlags::On | RedlineFlags::Ignore )); }
95 
96 public:
97 
103  virtual RedlineFlags GetRedlineFlags() const = 0;
104 
110  virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0;
111 
117  virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0;
118 
124  virtual bool IsRedlineOn() const = 0;
125 
126  virtual bool IsIgnoreRedline() const = 0;
127 
128  virtual const SwRedlineTable& GetRedlineTable() const = 0;
129  virtual SwRedlineTable& GetRedlineTable() = 0;
130  virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0;
132  virtual bool HasExtraRedlineTable() const = 0;
133 
134  virtual bool IsInRedlines(const SwNode& rNode) const = 0;
135 
152  virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0;
153 
154  virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0;
155  virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0;
156 
157  virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
158 
159  virtual bool DeleteRedline(
160  /*[in]*/const SwPaM& rPam,
161  /*[in]*/bool bSaveInUndo,
162  /*[in]*/RedlineType nDelType) = 0;
163 
164  virtual bool DeleteRedline(
165  /*[in]*/const SwStartNode& rSection,
166  /*[in]*/bool bSaveInUndo,
167  /*[in]*/RedlineType nDelType) = 0;
168 
170  /*[in]*/const SwNode& rNode,
171  /*[in]*/RedlineType nType) const = 0;
172 
173  virtual void CompressRedlines() = 0;
174 
175  virtual const SwRangeRedline* GetRedline(
176  /*[in]*/const SwPosition& rPos,
177  /*[in]*/SwRedlineTable::size_type* pFndPos) const = 0;
178 
179  virtual bool IsRedlineMove() const = 0;
180 
181  virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
182 
183  virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
184 
185  virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
186 
187  virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0;
188 
189  virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
190 
191  virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
192 
193  virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
194 
195  virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
196 
197  virtual void AcceptAllRedline(/*[in]*/bool bAcceptReject) = 0;
198 
199  // Representation has changed, invalidate all Redlines.
200  virtual void UpdateRedlineAttr() = 0;
201 
202  // Create a new Author if required.
203  virtual std::size_t GetRedlineAuthor() = 0;
204 
205  // For Readers etc.: register new Author in table.
206  virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0;
207 
208  // Place a comment at Redline at given position.
209  virtual bool SetRedlineComment(
210  /*[in]*/const SwPaM& rPam,
211  /*[in]*/const OUString& rComment) = 0;
212 
213  virtual const css::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
214 
215  virtual void SetRedlinePassword(
216  /*[in]*/const css::uno::Sequence <sal_Int8>& rNewPassword) = 0;
217 
218 protected:
220 };
221 
222 #endif
223 
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:311
virtual bool SetRedlineComment(const SwPaM &rPam, const OUString &rComment)=0
virtual const SwRangeRedline * SelPrevRedline(SwPaM &rPam) const =0
Marks a position in the document model.
Definition: pam.hxx:35
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
virtual bool IsInRedlines(const SwNode &rNode) const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual bool HasExtraRedlineTable() const =0
static bool IsShowChanges(const RedlineFlags eM)
show all inserts
virtual void AcceptRedlineParagraphFormatting(const SwPaM &rPam)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual bool IsRedlineMove() const =0
RedlineFlags on.
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:302
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr)=0
virtual void CompressRedlines()=0
virtual std::size_t GetRedlineAuthor()=0
Table that holds 'extra' redlines, such as 'table row insert/delete', 'paragraph moves' etc...
Definition: docary.hxx:277
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
OUString SwRedlineTypeToOUString(RedlineType eType)
static bool IsShowOriginal(const RedlineFlags eM)
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
virtual void AcceptAllRedline(bool bAcceptReject)=0
vector_type::size_type size_type
Definition: docary.hxx:228
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:281
show all deletes
virtual void SetRedlineMove(bool bFlag)=0
virtual bool IsIgnoreRedline() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
ignore Redlines
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr)=0
static bool IsHideChanges(const RedlineFlags eM)
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual bool IsRedlineOn() const =0
Query if redlining is on.
virtual const SwRangeRedline * SelNextRedline(SwPaM &rPam) const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void UpdateRedlineAttr()=0
virtual bool AcceptRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
RedlineType
virtual bool RejectRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
no RedlineFlags
Base class of the Writer document model elements.
Definition: node.hxx:79