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