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 
32 #include "docary.hxx"
33 
34 class SwRangeRedline;
35 class SwTableRowRedline;
36 class SwTableCellRedline;
37 class SwPaM;
38 struct SwPosition;
39 class SwStartNode;
40 class SwNode;
41 
42 enum 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 };
58 namespace o3tl
59 {
60  template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x533> {};
61 }
62 
63 enum class RedlineType : sal_uInt16
64 {
65  // Range of RedlineTypes is 0 to 127.
66  Insert = 0x0,// Content has been inserted.
67  Delete = 0x1,// Content has been deleted.
68  Format = 0x2,// Attributes have been applied.
69  Table = 0x3,// Table structure has been altered.
70  FmtColl = 0x4,// Style has been altered (Autoformat!).
71  ParagraphFormat = 0x5,// Paragraph attributes have been changed.
72  TableRowInsert = 0x6,// Table row has been inserted.
73  TableRowDelete = 0x7,// Table row has been deleted.
74  TableCellInsert = 0x8,// Table cell has been inserted.
75  TableCellDelete = 0x9,// Table cell has been deleted.
76  Any = USHRT_MAX // special value to indicate any redline type in some method calls
77 };
78 inline OUString SwRedlineTypeToOUString(RedlineType eType)
79 {
80  OUString sRet;
81  switch(eType)
82  {
83  case RedlineType::Insert: sRet = "Insert"; break;
84  case RedlineType::Delete: sRet = "Delete"; break;
85  case RedlineType::Format: sRet = "Format"; break;
86  case RedlineType::ParagraphFormat: sRet = "ParagraphFormat"; break;
87  case RedlineType::Table: sRet = "TextTable"; break;
88  case RedlineType::FmtColl:sRet = "Style"; break;
89  default: break;
90  }
91  return sRet;
92 };
93 
95 {
96  // Static helper functions
97 public:
98  static bool IsShowChanges(const RedlineFlags eM)
100 
101  static bool IsHideChanges(const RedlineFlags eM)
103 
104  static bool IsShowOriginal(const RedlineFlags eM)
106 
107  static bool IsRedlineOn(const RedlineFlags eM)
108  { return RedlineFlags::On == (eM & (RedlineFlags::On | RedlineFlags::Ignore )); }
109 
110 public:
111 
117  virtual RedlineFlags GetRedlineFlags() const = 0;
118 
124  virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0;
125 
131  virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0;
132 
138  virtual bool IsRedlineOn() const = 0;
139 
140  virtual bool IsIgnoreRedline() const = 0;
141 
142  virtual const SwRedlineTable& GetRedlineTable() const = 0;
143  virtual SwRedlineTable& GetRedlineTable() = 0;
144  virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0;
146  virtual bool HasExtraRedlineTable() const = 0;
147 
148  virtual bool IsInRedlines(const SwNode& rNode) const = 0;
149 
166  virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0;
167 
168  virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
169  virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
170 
171  virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
172 
173  virtual bool DeleteRedline(
174  /*[in]*/const SwPaM& rPam,
175  /*[in]*/bool bSaveInUndo,
176  /*[in]*/RedlineType nDelType) = 0;
177 
178  virtual bool DeleteRedline(
179  /*[in]*/const SwStartNode& rSection,
180  /*[in]*/bool bSaveInUndo,
181  /*[in]*/RedlineType nDelType) = 0;
182 
184  /*[in]*/const SwNode& rNode,
185  /*[in]*/RedlineType nType) const = 0;
186 
187  virtual void CompressRedlines() = 0;
188 
189  virtual const SwRangeRedline* GetRedline(
190  /*[in]*/const SwPosition& rPos,
191  /*[in]*/SwRedlineTable::size_type* pFndPos) const = 0;
192 
193  virtual bool IsRedlineMove() const = 0;
194 
195  virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
196 
197  virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
198 
199  virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
200 
201  virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0;
202 
203  virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
204 
205  virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
206 
207  virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
208 
209  virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
210 
211  virtual void AcceptAllRedline(/*[in]*/bool bAcceptReject) = 0;
212 
213  // Representation has changed, invalidate all Redlines.
214  virtual void UpdateRedlineAttr() = 0;
215 
216  // Create a new Author if required.
217  virtual std::size_t GetRedlineAuthor() = 0;
218 
219  // For Readers etc.: register new Author in table.
220  virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0;
221 
222  // Place a comment at Redline at given position.
223  virtual bool SetRedlineComment(
224  /*[in]*/const SwPaM& rPam,
225  /*[in]*/const OUString& rComment) = 0;
226 
227  virtual const css::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
228 
229  virtual void SetRedlinePassword(
230  /*[in]*/const css::uno::Sequence <sal_Int8>& rNewPassword) = 0;
231 
232  virtual bool IsFinalizeImport() const = 0;
233 
234  virtual void SetFinalizeImport(bool const bFinalizeImport) = 0;
235 
236 protected:
238 };
239 
240 #endif
241 
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:303
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 void SetFinalizeImport(bool const bFinalizeImport)=0
virtual bool HasExtraRedlineTable() const =0
static bool IsShowChanges(const RedlineFlags eM)
show all inserts
virtual void AcceptRedlineParagraphFormatting(const SwPaM &rPam)=0
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr, bool bCallDelete)=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:298
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:379
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:330
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:277
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 IsFinalizeImport() const =0
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
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
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr, bool bCallDelete)=0
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