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 
33 namespace utl {
34  class SearchParam;
35  class TextSearch;
36 }
37 
38 namespace comphelper::string { class NaturalStringSorter; }
39 
40 class Point;
41 class SvViewDataEntry;
42 class SvtCalendarBox;
43 
45 {
47 };
48 
49 enum 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 {
69 public:
70  RedlinData();
71  virtual ~RedlinData();
73  void* pData;
75  bool bDisabled;
76 };
77 
79 {
80 private:
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;
89  bool bComment;
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 
101 public:
102  SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
103  std::unique_ptr<weld::TreeView> xCalcControl);
104 
105  void set_size_request(int nWidth, int nHeight);
106 
107  weld::TreeView& GetWidget() { return *pTreeView; }
108  bool IsSorted() const { return bSorted; }
109 
110  ~SvxRedlinTable();
111 
112  // For FilterPage only {
113  void SetFilterDate(bool bFlag);
114  void SetDateTimeMode(SvxRedlinDateMode nMode);
115  void SetFirstDate(const Date&);
116  void SetLastDate(const Date&);
117  void SetFirstTime(const tools::Time&);
118  void SetLastTime(const tools::Time&);
119  void SetFilterAuthor(bool bFlag);
120  void SetAuthor(const OUString &);
121  void SetFilterComment(bool bFlag);
122  void SetCommentParams( const utl::SearchParam* pSearchPara );
123 
124  void UpdateFilterTest();
125  // } For FilterPage only
126 
127  void SetCalcView();
128  void SetWriterView();
129 
130  bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment);
131  bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime);
132  bool IsValidComment(const OUString &rComment);
133 
134  DECL_LINK(HeaderBarClick, int, void);
135 };
136 
138 {
139 protected:
140  std::unique_ptr<weld::Builder> m_xBuilder;
141  std::unique_ptr<weld::Container> m_xContainer;
142 public:
143  SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID);
144  virtual ~SvxTPage();
145  virtual void ActivatePage();
146  void Show() { m_xContainer->show(); }
147 };
148 
149 namespace weld
150 {
151  class TimeFormatter;
152 }
153 
156 {
159 
160  bool bModified;
161 
163  std::unique_ptr<weld::CheckButton> m_xCbDate;
164  std::unique_ptr<weld::ComboBox> m_xLbDate;
165  std::unique_ptr<SvtCalendarBox> m_xDfDate;
166  std::unique_ptr<weld::FormattedSpinButton> m_xTfDate;
167  std::unique_ptr<weld::TimeFormatter> m_xTfDateFormatter;
168  std::unique_ptr<weld::Button> m_xIbClock;
169  std::unique_ptr<weld::Label> m_xFtDate2;
170  std::unique_ptr<SvtCalendarBox> m_xDfDate2;
171  std::unique_ptr<weld::FormattedSpinButton> m_xTfDate2;
172  std::unique_ptr<weld::TimeFormatter> m_xTfDate2Formatter;
173  std::unique_ptr<weld::Button> m_xIbClock2;
174  std::unique_ptr<weld::CheckButton> m_xCbAuthor;
175  std::unique_ptr<weld::ComboBox> m_xLbAuthor;
176  std::unique_ptr<weld::CheckButton> m_xCbRange;
177  std::unique_ptr<weld::Entry> m_xEdRange;
178  std::unique_ptr<weld::Button> m_xBtnRange;
179  std::unique_ptr<weld::CheckButton> m_xCbAction;
180  std::unique_ptr<weld::ComboBox> m_xLbAction;
181  std::unique_ptr<weld::CheckButton> m_xCbComment;
182  std::unique_ptr<weld::Entry> m_xEdComment;
183 
184  DECL_LINK( SelDateHdl, weld::ComboBox&, void );
185  DECL_LINK( RowEnableHdl, weld::Toggleable&, void );
186  DECL_LINK( TimeHdl, weld::Button&, void );
187  DECL_LINK( ModifyHdl, weld::Entry&, void );
188  DECL_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
189  DECL_LINK( ModifyDate, SvtCalendarBox&, void );
190  DECL_LINK( ModifyTime, weld::FormattedSpinButton&, void );
191  DECL_LINK( RefHandle, weld::Button&, void );
192 
193  void EnableDateLine1(bool bFlag);
194  void EnableDateLine2(bool bFlag);
195 
196 public:
197  SvxTPFilter(weld::Container* pParent);
198  virtual ~SvxTPFilter() override;
199 
200  void DeactivatePage();
201  void SetRedlinTable(SvxRedlinTable*);
202 
203  Date GetFirstDate() const;
204  void SetFirstDate(const Date &aDate);
205  tools::Time GetFirstTime() const;
206  void SetFirstTime(const tools::Time &aTime);
207 
208  Date GetLastDate() const;
209  void SetLastDate(const Date &aDate);
210  tools::Time GetLastTime() const;
211  void SetLastTime(const tools::Time &aTime);
212 
213  void SetDateMode(sal_uInt16 nMode);
214  SvxRedlinDateMode GetDateMode() const;
215 
216  void ClearAuthors();
217  void InsertAuthor( const OUString& rString );
218  OUString GetSelectedAuthor()const;
219  void SelectedAuthorPos(sal_Int32 nPos);
220  sal_Int32 SelectAuthor(const OUString& aString);
221  void SetComment(const OUString& rComment);
222  OUString GetComment()const;
223 
224  // Methods for Calc {
225  void SetRange(const OUString& rString);
226  OUString GetRange() const;
227  void HideRange(bool bHide=true);
228  void SetFocusToRange();
229  // } Methods for Calc
230 
231  bool IsDate() const;
232  bool IsAuthor() const;
233  bool IsRange() const;
234  bool IsAction() const;
235  bool IsComment() const;
236 
237  void ShowAction(bool bShow=true);
238 
239  void CheckDate(bool bFlag);
240  void CheckAuthor(bool bFlag);
241  void CheckRange(bool bFlag);
242  void CheckAction(bool bFlag);
243  void CheckComment(bool bFlag);
244 
245  weld::ComboBox* GetLbAction() { return m_xLbAction.get(); }
246 
247  void SetReadyHdl( const Link<SvxTPFilter*,void>& rLink ) { aReadyLink= rLink; }
248 
249 
250  // Methods for Calc {
251  void SetRefHdl( const Link<SvxTPFilter*,void>& rLink ) { aRefLink = rLink; }
252 
253  void Enable( bool bEnable = true );
254  // } Methods for Calc
255 };
256 
259 {
260 private:
261 
267 
273 
276 
278  std::unique_ptr<weld::Button> m_xAccept;
279  std::unique_ptr<weld::Button> m_xReject;
280  std::unique_ptr<weld::Button> m_xAcceptAll;
281  std::unique_ptr<weld::Button> m_xRejectAll;
282  std::unique_ptr<weld::Button> m_xUndo;
283  std::unique_ptr<SvxRedlinTable> m_xViewData;
284 
285  DECL_LINK( PbClickHdl, weld::Button&, void );
286 
287  void EnableClearFormatButton(weld::Button&, bool bFlag);
288 public:
289  SvxTPView(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel);
290  virtual ~SvxTPView() override;
291 
292  SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
293 
294  void EnableAccept(bool bFlag);
295  void EnableAcceptAll(bool bFlag);
296  void EnableReject(bool bFlag);
297  void EnableRejectAll(bool bFlag);
298  void EnableClearFormat(bool bFlag);
299  void EnableClearFormatAll(bool bFlag);
300  void EnableUndo(bool bFlag=true);
301  void DisableUndo() {EnableUndo(false);}
302  void ShowUndo();
303 
304  void SetAcceptClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptClickLk = rLink; }
305 
306  void SetAcceptAllClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptAllClickLk = rLink; }
307 
308  void SetRejectClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectClickLk = rLink; }
309 
310  void SetRejectAllClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectAllClickLk = rLink; }
311 
312  void SetUndoClickHdl( const Link<SvxTPView*,void>& rLink ) { UndoClickLk = rLink; }
313 
314  virtual void ActivatePage() override;
315  void DeactivatePage();
316 };
317 
318 // Redlining - Control (Accept- Changes)
320 {
321 private:
322  std::unique_ptr<weld::Builder> m_xBuilder;
323  std::unique_ptr<weld::Notebook> m_xTabCtrl;
324 
325  std::unique_ptr<SvxTPFilter> m_xTPFilter;
326  std::unique_ptr<SvxTPView> m_xTPView;
327 
328  DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void);
329  DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
330 
331 public:
332  SvxAcceptChgCtr(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel);
333  ~SvxAcceptChgCtr();
334 
335  void ShowFilterPage();
336 
337  SvxTPFilter* GetFilterPage() { return m_xTPFilter.get(); }
338  SvxTPView* GetViewPage() { return m_xTPView.get(); }
339 
340  void set_help_id(const OString& rId) { m_xTabCtrl->set_help_id(rId); }
341 };
342 
343 #endif // INCLUDED_SVX_CTREDLIN_HXX
344 
345 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsSorted() const
Definition: ctredlin.hxx:108
std::unique_ptr< weld::Button > m_xReject
Definition: ctredlin.hxx:279
SvxTPFilter * GetFilterPage()
Definition: ctredlin.hxx:337
Link< SvxTPFilter *, void > aReadyLink
Definition: ctredlin.hxx:157
std::unique_ptr< utl::TextSearch > pCommentSearcher
Definition: ctredlin.hxx:97
std::unique_ptr< weld::Entry > m_xEdComment
Definition: ctredlin.hxx:182
std::unique_ptr< weld::TreeView > xCalcTreeView
Definition: ctredlin.hxx:83
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:310
Link< SvxTPView *, void > UndoClickLk
Definition: ctredlin.hxx:266
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate
Definition: ctredlin.hxx:166
Link< SvxTPFilter *, void > aRefLink
Definition: ctredlin.hxx:158
std::unique_ptr< weld::CheckButton > m_xCbAction
Definition: ctredlin.hxx:179
void * pData
Definition: ctredlin.hxx:73
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: ctredlin.hxx:180
std::unique_ptr< weld::Button > m_xAcceptAll
Definition: ctredlin.hxx:280
std::unique_ptr< weld::Button > m_xRejectAll
Definition: ctredlin.hxx:281
std::unique_ptr< SvxRedlinTable > m_xViewData
Definition: ctredlin.hxx:283
SvxRedlinDateMode nDaTiMode
Definition: ctredlin.hxx:91
std::unique_ptr< weld::CheckButton > m_xCbAuthor
Definition: ctredlin.hxx:174
std::unique_ptr< SvtCalendarBox > m_xDfDate
Definition: ctredlin.hxx:165
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
std::unique_ptr< comphelper::string::NaturalStringSorter > xSorter
Definition: ctredlin.hxx:81
std::unique_ptr< weld::Builder > m_xBuilder
Definition: ctredlin.hxx:140
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:308
std::unique_ptr< weld::Entry > m_xEdRange
Definition: ctredlin.hxx:177
bool bEnableRejectAll
Definition: ctredlin.hxx:271
std::unique_ptr< SvxTPView > m_xTPView
Definition: ctredlin.hxx:326
weld::ComboBox * GetLbAction()
Definition: ctredlin.hxx:245
void SetReadyHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:247
std::unique_ptr< weld::TreeView > xWriterTreeView
Definition: ctredlin.hxx:82
bool bEnableAccept
Definition: ctredlin.hxx:268
DateTime aDateTime
Definition: ctredlin.hxx:72
sal_uInt16 nDatePos
Definition: ctredlin.hxx:86
std::unique_ptr< weld::ComboBox > m_xLbAuthor
Definition: ctredlin.hxx:175
DateTime aDaTiFilterLast
Definition: ctredlin.hxx:95
Tabpage with the filter text entries etc.
Definition: ctredlin.hxx:155
OUString aAuthor
Definition: ctredlin.hxx:96
DateTime aDaTiFilterFirst
Definition: ctredlin.hxx:94
std::unique_ptr< weld::CheckButton > m_xCbComment
Definition: ctredlin.hxx:181
bool bEnableAcceptAll
Definition: ctredlin.hxx:269
std::unique_ptr< weld::Button > m_xBtnRange
Definition: ctredlin.hxx:178
std::unique_ptr< weld::ComboBox > m_xLbDate
Definition: ctredlin.hxx:164
Link< SvxTPView *, void > AcceptAllClickLk
Definition: ctredlin.hxx:263
std::unique_ptr< weld::Button > m_xIbClock2
Definition: ctredlin.hxx:173
bool bModified
Definition: ctredlin.hxx:160
std::unique_ptr< weld::Button > m_xIbClock
Definition: ctredlin.hxx:168
bool bEnableReject
Definition: ctredlin.hxx:270
std::unique_ptr< weld::Button > m_xAccept
Definition: ctredlin.hxx:278
std::unique_ptr< weld::Button > m_xUndo
Definition: ctredlin.hxx:282
Link< SvxTPView *, void > RejectClickLk
Definition: ctredlin.hxx:264
void Show()
Definition: ctredlin.hxx:146
weld::TreeView * pTreeView
Definition: ctredlin.hxx:84
std::unique_ptr< weld::Container > m_xContainer
Definition: ctredlin.hxx:141
SvxRedlinTable * m_pRedlinTable
Definition: ctredlin.hxx:162
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate2
Definition: ctredlin.hxx:171
void DisableUndo()
Definition: ctredlin.hxx:301
std::unique_ptr< weld::Label > m_xFtDate2
Definition: ctredlin.hxx:169
std::unique_ptr< weld::Builder > m_xBuilder
Definition: ctredlin.hxx:322
std::unique_ptr< weld::CheckButton > m_xCbDate
Definition: ctredlin.hxx:163
#define SAL_WARN_UNUSED
bool bDisabled
Definition: ctredlin.hxx:75
void SetUndoClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:312
Link< SvxTPView *, void > RejectAllClickLk
Definition: ctredlin.hxx:265
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: ctredlin.hxx:323
SvxRedlinDateMode
Definition: ctredlin.hxx:44
bool bEnableUndo
Definition: ctredlin.hxx:272
Link< SvxTPView *, void > AcceptClickLk
Definition: ctredlin.hxx:262
std::unique_ptr< SvxTPFilter > m_xTPFilter
Definition: ctredlin.hxx:325
weld::TreeView & GetWidget()
Definition: ctredlin.hxx:107
Tabpage with the redlining entries.
Definition: ctredlin.hxx:258
bool bEnableClearFormat
Definition: ctredlin.hxx:274
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:306
DateTime aDaTiFirst
Definition: ctredlin.hxx:92
std::unique_ptr< SvtCalendarBox > m_xDfDate2
Definition: ctredlin.hxx:170
virtual void ActivatePage()
Definition: ctredlin.cxx:297
SvxRedlinTable * GetTableControl()
Definition: ctredlin.hxx:292
weld::Window * m_pDialog
Definition: ctredlin.hxx:277
DateTime aDaTiLast
Definition: ctredlin.hxx:93
SvxTPView * GetViewPage()
Definition: ctredlin.hxx:338
RedlineType
Definition: ctredlin.hxx:49
void SetRefHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:251
std::unique_ptr< weld::TimeFormatter > m_xTfDateFormatter
Definition: ctredlin.hxx:167
std::unique_ptr< weld::CheckButton > m_xCbRange
Definition: ctredlin.hxx:176
Struct for sorting data.
Definition: ctredlin.hxx:67
bool bEnableClearFormatAll
Definition: ctredlin.hxx:275
std::unique_ptr< weld::TimeFormatter > m_xTfDate2Formatter
Definition: ctredlin.hxx:172
RedlineType eType
Definition: ctredlin.hxx:74
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:304
void set_help_id(const OString &rId)
Definition: ctredlin.hxx:340