Line data Source code
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 IDOCUMENTREDLINE_HXX_INCLUDED
21 : #define IDOCUMENTREDLINE_HXX_INCLUDED
22 :
23 : #ifndef _SAL_TYPES_H_
24 : #include <sal/types.h>
25 : #endif
26 : #ifndef _SOLAR_H
27 : #include <tools/solar.h>
28 : #endif
29 :
30 : #include <limits.h> // USHRT_MAX
31 :
32 : #ifndef _COM_SUN_STAR_SEQUENCE_HXX_
33 : #include <com/sun/star/uno/Sequence.hxx>
34 : #endif
35 :
36 : class SwRedline;
37 : class SwRedlineTbl;
38 : class SwPaM;
39 : struct SwPosition;
40 : class SwStartNode;
41 : class SwNode;
42 : class String;
43 :
44 : typedef sal_uInt16 RedlineMode_t;
45 : namespace nsRedlineMode_t
46 : {
47 : const RedlineMode_t REDLINE_NONE = 0; ///< no RedlineMode
48 : const RedlineMode_t REDLINE_ON = 0x01;///< RedlineMode on
49 : const RedlineMode_t REDLINE_IGNORE = 0x02;///< ignore Redlines
50 : const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;///< show all inserts
51 : const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;///< show all deletes
52 : const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE;
53 :
54 : // For internal management:
55 : // remove the original Redlines together with their content
56 : // (Clipboard/text modules).
57 : const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100;
58 : // When deleting within a RedlineObject
59 : // ignore the DeleteRedline during Append.
60 : const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200;
61 : // don't combine any redlines. This flag may be only used in Undo.
62 : const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400;
63 : }
64 :
65 : typedef sal_uInt16 RedlineType_t;
66 : namespace nsRedlineType_t
67 : {
68 : // Range of RedlineTypes is 0 to 127.
69 : const RedlineType_t REDLINE_INSERT = 0x0;// Content has been inserted.
70 : const RedlineType_t REDLINE_DELETE = 0x1;// Content has been deleted.
71 : const RedlineType_t REDLINE_FORMAT = 0x2;// Attributes have been applied.
72 : const RedlineType_t REDLINE_TABLE = 0x3;// Table structure has been altered.
73 : const RedlineType_t REDLINE_FMTCOLL = 0x4;// Style has been altered (Autoformat!).
74 :
75 : // When larger than 128, flags can be inserted.
76 : const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
77 : const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// Can be a flag in RedlineType.
78 : }
79 :
80 : /** IDocumentRedlineAccess
81 : */
82 276 : class IDocumentRedlineAccess
83 : {
84 : // Static helper functions
85 : public:
86 7711 : static bool IsShowChanges(const sal_uInt16 eM)
87 7711 : { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
88 :
89 0 : static bool IsHideChanges(const sal_uInt16 eM)
90 0 : { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
91 :
92 819 : static bool IsShowOriginal(const sal_uInt16 eM)
93 819 : { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
94 :
95 62118 : static bool IsRedlineOn(const sal_uInt16 eM)
96 62118 : { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
97 :
98 : public:
99 :
100 : /*************************************************
101 : Query
102 : *************************************************/
103 :
104 : /** Query the currently set redline mode
105 :
106 : @returns
107 : the currently set redline mode
108 : */
109 : virtual RedlineMode_t GetRedlineMode() const = 0;
110 :
111 : /** Set a new redline mode.
112 :
113 : @param eMode
114 : [in] the new redline mode.
115 : */
116 : virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
117 :
118 : /** Set a new redline mode.
119 :
120 : @param eMode
121 : [in] the new redline mode.
122 : */
123 : virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
124 :
125 : /** Query if redlining is on.
126 :
127 : @returns
128 : <TRUE/> if redlining is on <FALSE/> otherwise
129 : */
130 : virtual bool IsRedlineOn() const = 0;
131 :
132 : virtual bool IsIgnoreRedline() const = 0;
133 :
134 : virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
135 :
136 : virtual bool IsInRedlines(const SwNode& rNode) const = 0;
137 :
138 : /***************************************************
139 : Manipulation
140 : ***************************************************/
141 :
142 : /** Append a new redline
143 :
144 : @param pPtr
145 :
146 : @param bCallDelete
147 :
148 : @returns
149 : */
150 : virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
151 :
152 : virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
153 :
154 : virtual bool DeleteRedline(
155 : /*[in]*/const SwPaM& rPam,
156 : /*[in]*/bool bSaveInUndo,
157 : /*[in]*/sal_uInt16 nDelType) = 0;
158 :
159 : virtual bool DeleteRedline(
160 : /*[in]*/const SwStartNode& rSection,
161 : /*[in]*/bool bSaveInUndo,
162 : /*[in]*/sal_uInt16 nDelType) = 0;
163 :
164 : virtual sal_uInt16 GetRedlinePos(
165 : /*[in]*/const SwNode& rNode,
166 : /*[in]*/sal_uInt16 nType) const = 0;
167 :
168 : virtual void CompressRedlines() = 0;
169 :
170 : virtual const SwRedline* GetRedline(
171 : /*[in]*/const SwPosition& rPos,
172 : /*[in]*/sal_uInt16* pFndPos) const = 0;
173 :
174 : virtual bool IsRedlineMove() const = 0;
175 :
176 : virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
177 :
178 : virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
179 :
180 : virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
181 :
182 : virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
183 :
184 : virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
185 :
186 : virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
187 :
188 : virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
189 :
190 : // Representation has changed, invalidate all Redlines.
191 : virtual void UpdateRedlineAttr() = 0;
192 :
193 : // Create a new Author if required.
194 : virtual sal_uInt16 GetRedlineAuthor() = 0;
195 :
196 : // For Readers etc.: register new Author in table.
197 : virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor) = 0;
198 :
199 : // Place a comment at Redline at given position.
200 : virtual bool SetRedlineComment(
201 : /*[in]*/const SwPaM& rPam,
202 : /*[in]*/const String& rComment) = 0;
203 :
204 : virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
205 :
206 : virtual void SetRedlinePassword(
207 : /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0;
208 :
209 : protected:
210 102 : virtual ~IDocumentRedlineAccess() {};
211 : };
212 :
213 : #endif
214 :
215 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|