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