LibreOffice Module svx (master) 1
ctredlin.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_SVX_CTREDLIN_HXX
21#define INCLUDED_SVX_CTREDLIN_HXX
22
23#include <rtl/ustring.hxx>
24#include <sal/types.h>
25#include <svx/svxdllapi.h>
26#include <tools/date.hxx>
27#include <tools/datetime.hxx>
28#include <tools/link.hxx>
29#include <tools/time.hxx>
30#include <vcl/weld.hxx>
31#include <memory>
32
33namespace utl {
34 class SearchParam;
35 class TextSearch;
36}
37
38namespace comphelper::string { class NaturalStringSorter; }
39
40class Point;
41class SvViewDataEntry;
42class SvtCalendarBox;
43
45{
47};
48
49enum class RedlineType : sal_uInt16
50{
51 // Range of RedlineTypes is 0 to 127.
52 Insert = 0x0,// Content has been inserted.
53 Delete = 0x1,// Content has been deleted.
54 Format = 0x2,// Attributes have been applied.
55 Table = 0x3,// Table structure has been altered.
56 FmtColl = 0x4,// Style has been altered (Autoformat!).
57 ParagraphFormat = 0x5,// Paragraph attributes have been changed.
58 TableRowInsert = 0x6,// Table row has been inserted.
59 TableRowDelete = 0x7,// Table row has been deleted.
60 TableCellInsert = 0x8,// Table cell has been inserted.
61 TableCellDelete = 0x9,// Table cell has been deleted.
62 None = USHRT_MAX - 1, // special value to indicate missing redlining in some return value
63 Any = USHRT_MAX // special value to indicate any redline type in some method calls
64};
65
68{
69public:
70 RedlinData();
71 virtual ~RedlinData();
73 void* pData;
76};
77
79{
80private:
81 std::unique_ptr<comphelper::string::NaturalStringSorter> xSorter;
82 std::unique_ptr<weld::TreeView> xWriterTreeView;
83 std::unique_ptr<weld::TreeView> xCalcTreeView;
85
86 sal_uInt16 nDatePos;
87 bool bAuthor;
88 bool bDate;
90 bool bSorted;
96 OUString aAuthor;
97 std::unique_ptr<utl::TextSearch> pCommentSearcher;
98
99 int ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter& rRight);
100
101public:
102 SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
103 std::unique_ptr<weld::TreeView> xCalcControl);
104
105 weld::TreeView& GetWidget() { return *pTreeView; }
106 bool IsSorted() const { return bSorted; }
107
109
110 // For FilterPage only {
111 void SetFilterDate(bool bFlag);
112 void SetDateTimeMode(SvxRedlinDateMode nMode);
113 void SetFirstDate(const Date&);
114 void SetLastDate(const Date&);
115 void SetFirstTime(const tools::Time&);
116 void SetLastTime(const tools::Time&);
117 void SetFilterAuthor(bool bFlag);
118 void SetAuthor(const OUString &);
119 void SetFilterComment(bool bFlag);
120 void SetCommentParams( const utl::SearchParam* pSearchPara );
121
122 void UpdateFilterTest();
123 // } For FilterPage only
124
125 void SetCalcView();
126 void SetWriterView();
127
128 bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment);
129 bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime);
130 bool IsValidComment(const OUString &rComment);
131
132 DECL_LINK(HeaderBarClick, int, void);
133};
134
136{
137protected:
138 std::unique_ptr<weld::Builder> m_xBuilder;
139 std::unique_ptr<weld::Container> m_xContainer;
140public:
141 SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID);
142 virtual ~SvxTPage();
143 virtual void ActivatePage();
144 void Show() { m_xContainer->show(); }
145};
146
147namespace weld
148{
149 class TimeFormatter;
150}
151
154{
157
159
161 std::unique_ptr<weld::CheckButton> m_xCbDate;
162 std::unique_ptr<weld::ComboBox> m_xLbDate;
163 std::unique_ptr<SvtCalendarBox> m_xDfDate;
164 std::unique_ptr<weld::FormattedSpinButton> m_xTfDate;
165 std::unique_ptr<weld::TimeFormatter> m_xTfDateFormatter;
166 std::unique_ptr<weld::Button> m_xIbClock;
167 std::unique_ptr<weld::Label> m_xFtDate2;
168 std::unique_ptr<SvtCalendarBox> m_xDfDate2;
169 std::unique_ptr<weld::FormattedSpinButton> m_xTfDate2;
170 std::unique_ptr<weld::TimeFormatter> m_xTfDate2Formatter;
171 std::unique_ptr<weld::Button> m_xIbClock2;
172 std::unique_ptr<weld::CheckButton> m_xCbAuthor;
173 std::unique_ptr<weld::ComboBox> m_xLbAuthor;
174 std::unique_ptr<weld::CheckButton> m_xCbRange;
175 std::unique_ptr<weld::Entry> m_xEdRange;
176 std::unique_ptr<weld::Button> m_xBtnRange;
177 std::unique_ptr<weld::CheckButton> m_xCbAction;
178 std::unique_ptr<weld::ComboBox> m_xLbAction;
179 std::unique_ptr<weld::CheckButton> m_xCbComment;
180 std::unique_ptr<weld::Entry> m_xEdComment;
181
183 DECL_DLLPRIVATE_LINK( RowEnableHdl, weld::Toggleable&, void );
185 DECL_DLLPRIVATE_LINK( ModifyHdl, weld::Entry&, void );
186 DECL_DLLPRIVATE_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
189 DECL_DLLPRIVATE_LINK( RefHandle, weld::Button&, void );
190
191 void EnableDateLine1(bool bFlag);
192 void EnableDateLine2(bool bFlag);
193
194public:
196 virtual ~SvxTPFilter() override;
197
198 void DeactivatePage();
199 void SetRedlinTable(SvxRedlinTable*);
200
201 Date GetFirstDate() const;
202 void SetFirstDate(const Date &aDate);
203 tools::Time GetFirstTime() const;
204 void SetFirstTime(const tools::Time &aTime);
205
206 Date GetLastDate() const;
207 void SetLastDate(const Date &aDate);
208 tools::Time GetLastTime() const;
209 void SetLastTime(const tools::Time &aTime);
210
211 void SetDateMode(sal_uInt16 nMode);
212 SvxRedlinDateMode GetDateMode() const;
213
214 void ClearAuthors();
215 void InsertAuthor( const OUString& rString );
216 OUString GetSelectedAuthor()const;
217 void SelectedAuthorPos(sal_Int32 nPos);
218 sal_Int32 SelectAuthor(const OUString& aString);
219 void SetComment(const OUString& rComment);
220 OUString GetComment()const;
221
222 // Methods for Calc {
223 void SetRange(const OUString& rString);
224 OUString GetRange() const;
225 void HideRange(bool bHide=true);
226 void SetFocusToRange();
227 // } Methods for Calc
228
229 bool IsDate() const;
230 bool IsAuthor() const;
231 bool IsRange() const;
232 bool IsAction() const;
233 bool IsComment() const;
234
235 void ShowAction(bool bShow=true);
236
237 void CheckDate(bool bFlag);
238 void CheckAuthor(bool bFlag);
239 void CheckRange(bool bFlag);
240 void CheckAction(bool bFlag);
241 void CheckComment(bool bFlag);
242
243 weld::ComboBox* GetLbAction() { return m_xLbAction.get(); }
244
245 void SetReadyHdl( const Link<SvxTPFilter*,void>& rLink ) { aReadyLink= rLink; }
246
247
248 // Methods for Calc {
249 void SetRefHdl( const Link<SvxTPFilter*,void>& rLink ) { aRefLink = rLink; }
250
251 void Enable( bool bEnable = true );
252 // } Methods for Calc
253};
254
257{
258private:
259
265
271
274
275 std::unique_ptr<weld::Button> m_xAccept;
276 std::unique_ptr<weld::Button> m_xReject;
277 std::unique_ptr<weld::Button> m_xAcceptAll;
278 std::unique_ptr<weld::Button> m_xRejectAll;
279 std::unique_ptr<weld::Button> m_xUndo;
280 std::unique_ptr<SvxRedlinTable> m_xViewData;
281
282 DECL_DLLPRIVATE_LINK( PbClickHdl, weld::Button&, void );
283
284public:
285 SvxTPView(weld::Container* pParent);
286 virtual ~SvxTPView() override;
287
288 SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
289
290 void EnableAccept(bool bFlag);
291 void EnableAcceptAll(bool bFlag);
292 void EnableReject(bool bFlag);
293 void EnableRejectAll(bool bFlag);
294 void EnableClearFormat(bool bFlag);
295 void EnableClearFormatAll(bool bFlag);
296 void EnableUndo(bool bFlag=true);
297 void DisableUndo() {EnableUndo(false);}
298 void ShowUndo();
299
300 void SetAcceptClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptClickLk = rLink; }
301
302 void SetAcceptAllClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptAllClickLk = rLink; }
303
304 void SetRejectClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectClickLk = rLink; }
305
306 void SetRejectAllClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectAllClickLk = rLink; }
307
308 void SetUndoClickHdl( const Link<SvxTPView*,void>& rLink ) { UndoClickLk = rLink; }
309
310 virtual void ActivatePage() override;
311 void DeactivatePage();
312};
313
314// Redlining - Control (Accept- Changes)
316{
317private:
318 std::unique_ptr<weld::Builder> m_xBuilder;
319 std::unique_ptr<weld::Notebook> m_xTabCtrl;
320
321 std::unique_ptr<SvxTPFilter> m_xTPFilter;
322 std::unique_ptr<SvxTPView> m_xTPView;
323
324 DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OUString&, void);
325 DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OUString&, bool);
326
327public:
330
331 void ShowFilterPage();
332
333 SvxTPFilter* GetFilterPage() { return m_xTPFilter.get(); }
334 SvxTPView* GetViewPage() { return m_xTPView.get(); }
335};
336
337#endif // INCLUDED_SVX_CTREDLIN_HXX
338
339/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Struct for sorting data.
Definition: ctredlin.hxx:68
RedlineType eType
Definition: ctredlin.hxx:74
bool bDisabled
Definition: ctredlin.hxx:75
DateTime aDateTime
Definition: ctredlin.hxx:72
void * pData
Definition: ctredlin.hxx:73
std::unique_ptr< weld::Builder > m_xBuilder
Definition: ctredlin.hxx:318
std::unique_ptr< SvxTPView > m_xTPView
Definition: ctredlin.hxx:322
SvxTPFilter * GetFilterPage()
Definition: ctredlin.hxx:333
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: ctredlin.hxx:319
DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OUString &, bool)
SvxTPView * GetViewPage()
Definition: ctredlin.hxx:334
DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OUString &, void)
std::unique_ptr< SvxTPFilter > m_xTPFilter
Definition: ctredlin.hxx:321
std::unique_ptr< comphelper::string::NaturalStringSorter > xSorter
Definition: ctredlin.hxx:81
bool IsSorted() const
Definition: ctredlin.hxx:106
DECL_LINK(HeaderBarClick, int, void)
weld::TreeView * pTreeView
Definition: ctredlin.hxx:84
std::unique_ptr< weld::TreeView > xCalcTreeView
Definition: ctredlin.hxx:83
DateTime aDaTiFilterLast
Definition: ctredlin.hxx:95
DateTime aDaTiFilterFirst
Definition: ctredlin.hxx:94
DateTime aDaTiLast
Definition: ctredlin.hxx:93
std::unique_ptr< utl::TextSearch > pCommentSearcher
Definition: ctredlin.hxx:97
SvxRedlinDateMode nDaTiMode
Definition: ctredlin.hxx:91
sal_uInt16 nDatePos
Definition: ctredlin.hxx:86
DateTime aDaTiFirst
Definition: ctredlin.hxx:92
std::unique_ptr< weld::TreeView > xWriterTreeView
Definition: ctredlin.hxx:82
weld::TreeView & GetWidget()
Definition: ctredlin.hxx:105
OUString aAuthor
Definition: ctredlin.hxx:96
Tabpage with the filter text entries etc.
Definition: ctredlin.hxx:154
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: ctredlin.hxx:178
DECL_DLLPRIVATE_LINK(SelDateHdl, weld::ComboBox &, void)
std::unique_ptr< weld::CheckButton > m_xCbComment
Definition: ctredlin.hxx:179
DECL_DLLPRIVATE_LINK(ModifyListBoxHdl, weld::ComboBox &, void)
DECL_DLLPRIVATE_LINK(RowEnableHdl, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > m_xCbDate
Definition: ctredlin.hxx:161
DECL_DLLPRIVATE_LINK(TimeHdl, weld::Button &, void)
std::unique_ptr< SvtCalendarBox > m_xDfDate2
Definition: ctredlin.hxx:168
std::unique_ptr< weld::Entry > m_xEdComment
Definition: ctredlin.hxx:180
std::unique_ptr< weld::Button > m_xBtnRange
Definition: ctredlin.hxx:176
Link< SvxTPFilter *, void > aReadyLink
Definition: ctredlin.hxx:155
std::unique_ptr< weld::Entry > m_xEdRange
Definition: ctredlin.hxx:175
bool bModified
Definition: ctredlin.hxx:158
std::unique_ptr< weld::ComboBox > m_xLbAuthor
Definition: ctredlin.hxx:173
void SetRefHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:249
DECL_DLLPRIVATE_LINK(ModifyTime, weld::FormattedSpinButton &, void)
weld::ComboBox * GetLbAction()
Definition: ctredlin.hxx:243
std::unique_ptr< weld::TimeFormatter > m_xTfDateFormatter
Definition: ctredlin.hxx:165
std::unique_ptr< weld::CheckButton > m_xCbAction
Definition: ctredlin.hxx:177
std::unique_ptr< weld::ComboBox > m_xLbDate
Definition: ctredlin.hxx:162
void SetReadyHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:245
std::unique_ptr< weld::CheckButton > m_xCbAuthor
Definition: ctredlin.hxx:172
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate2
Definition: ctredlin.hxx:169
std::unique_ptr< weld::Label > m_xFtDate2
Definition: ctredlin.hxx:167
DECL_DLLPRIVATE_LINK(RefHandle, weld::Button &, void)
std::unique_ptr< weld::Button > m_xIbClock
Definition: ctredlin.hxx:166
std::unique_ptr< weld::TimeFormatter > m_xTfDate2Formatter
Definition: ctredlin.hxx:170
SvxRedlinTable * m_pRedlinTable
Definition: ctredlin.hxx:160
std::unique_ptr< weld::CheckButton > m_xCbRange
Definition: ctredlin.hxx:174
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate
Definition: ctredlin.hxx:164
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry &, void)
DECL_DLLPRIVATE_LINK(ModifyDate, SvtCalendarBox &, void)
Link< SvxTPFilter *, void > aRefLink
Definition: ctredlin.hxx:156
std::unique_ptr< SvtCalendarBox > m_xDfDate
Definition: ctredlin.hxx:163
std::unique_ptr< weld::Button > m_xIbClock2
Definition: ctredlin.hxx:171
Tabpage with the redlining entries.
Definition: ctredlin.hxx:257
Link< SvxTPView *, void > AcceptClickLk
Definition: ctredlin.hxx:260
std::unique_ptr< SvxRedlinTable > m_xViewData
Definition: ctredlin.hxx:280
Link< SvxTPView *, void > RejectClickLk
Definition: ctredlin.hxx:262
bool bEnableUndo
Definition: ctredlin.hxx:270
SvxRedlinTable * GetTableControl()
Definition: ctredlin.hxx:288
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:304
bool bEnableRejectAll
Definition: ctredlin.hxx:269
Link< SvxTPView *, void > UndoClickLk
Definition: ctredlin.hxx:264
bool bEnableClearFormatAll
Definition: ctredlin.hxx:273
void SetUndoClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:308
bool bEnableClearFormat
Definition: ctredlin.hxx:272
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:306
Link< SvxTPView *, void > RejectAllClickLk
Definition: ctredlin.hxx:263
Link< SvxTPView *, void > AcceptAllClickLk
Definition: ctredlin.hxx:261
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:300
DECL_DLLPRIVATE_LINK(PbClickHdl, weld::Button &, void)
bool bEnableAcceptAll
Definition: ctredlin.hxx:267
std::unique_ptr< weld::Button > m_xRejectAll
Definition: ctredlin.hxx:278
std::unique_ptr< weld::Button > m_xAccept
Definition: ctredlin.hxx:275
std::unique_ptr< weld::Button > m_xReject
Definition: ctredlin.hxx:276
void DisableUndo()
Definition: ctredlin.hxx:297
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:302
bool bEnableAccept
Definition: ctredlin.hxx:266
bool bEnableReject
Definition: ctredlin.hxx:268
std::unique_ptr< weld::Button > m_xUndo
Definition: ctredlin.hxx:279
std::unique_ptr< weld::Button > m_xAcceptAll
Definition: ctredlin.hxx:277
std::unique_ptr< weld::Builder > m_xBuilder
Definition: ctredlin.hxx:138
std::unique_ptr< weld::Container > m_xContainer
Definition: ctredlin.hxx:139
void Show()
Definition: ctredlin.hxx:144
SvxRedlinDateMode
Definition: ctredlin.hxx:45
RedlineType
Definition: ctredlin.hxx:50
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
NONE
None
Reference< XNameAccess > m_xContainer
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
#define SAL_WARN_UNUSED