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  weld::TreeView& GetWidget() { return *pTreeView; }
106  bool IsSorted() const { return bSorted; }
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(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 {
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 
147 namespace weld
148 {
149  class TimeFormatter;
150 }
151 
154 {
157 
158  bool bModified;
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 
182  DECL_DLLPRIVATE_LINK( SelDateHdl, weld::ComboBox&, void );
183  DECL_DLLPRIVATE_LINK( RowEnableHdl, weld::Toggleable&, void );
184  DECL_DLLPRIVATE_LINK( TimeHdl, weld::Button&, void );
185  DECL_DLLPRIVATE_LINK( ModifyHdl, weld::Entry&, void );
186  DECL_DLLPRIVATE_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
187  DECL_DLLPRIVATE_LINK( ModifyDate, SvtCalendarBox&, void );
188  DECL_DLLPRIVATE_LINK( ModifyTime, weld::FormattedSpinButton&, void );
189  DECL_DLLPRIVATE_LINK( RefHandle, weld::Button&, void );
190 
191  void EnableDateLine1(bool bFlag);
192  void EnableDateLine2(bool bFlag);
193 
194 public:
195  SvxTPFilter(weld::Container* pParent);
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 {
258 private:
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 
284 public:
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 {
317 private:
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 OString&, void);
325  DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
326 
327 public:
329  ~SvxAcceptChgCtr();
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: */
bool IsSorted() const
Definition: ctredlin.hxx:106
std::unique_ptr< weld::Button > m_xReject
Definition: ctredlin.hxx:276
SvxTPFilter * GetFilterPage()
Definition: ctredlin.hxx:333
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
Link< SvxTPFilter *, void > aReadyLink
Definition: ctredlin.hxx:155
std::unique_ptr< utl::TextSearch > pCommentSearcher
Definition: ctredlin.hxx:97
std::unique_ptr< weld::Entry > m_xEdComment
Definition: ctredlin.hxx:180
std::unique_ptr< weld::TreeView > xCalcTreeView
Definition: ctredlin.hxx:83
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:306
Link< SvxTPView *, void > UndoClickLk
Definition: ctredlin.hxx:264
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate
Definition: ctredlin.hxx:164
Link< SvxTPFilter *, void > aRefLink
Definition: ctredlin.hxx:156
std::unique_ptr< weld::CheckButton > m_xCbAction
Definition: ctredlin.hxx:177
void * pData
Definition: ctredlin.hxx:73
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: ctredlin.hxx:178
std::unique_ptr< weld::Button > m_xAcceptAll
Definition: ctredlin.hxx:277
std::unique_ptr< weld::Button > m_xRejectAll
Definition: ctredlin.hxx:278
std::unique_ptr< SvxRedlinTable > m_xViewData
Definition: ctredlin.hxx:280
SvxRedlinDateMode nDaTiMode
Definition: ctredlin.hxx:91
std::unique_ptr< weld::CheckButton > m_xCbAuthor
Definition: ctredlin.hxx:172
std::unique_ptr< SvtCalendarBox > m_xDfDate
Definition: ctredlin.hxx:163
#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:138
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:304
std::unique_ptr< weld::Entry > m_xEdRange
Definition: ctredlin.hxx:175
bool bEnableRejectAll
Definition: ctredlin.hxx:269
std::unique_ptr< SvxTPView > m_xTPView
Definition: ctredlin.hxx:322
weld::ComboBox * GetLbAction()
Definition: ctredlin.hxx:243
void SetReadyHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:245
std::unique_ptr< weld::TreeView > xWriterTreeView
Definition: ctredlin.hxx:82
bool bEnableAccept
Definition: ctredlin.hxx:266
DateTime aDateTime
Definition: ctredlin.hxx:72
sal_uInt16 nDatePos
Definition: ctredlin.hxx:86
std::unique_ptr< weld::ComboBox > m_xLbAuthor
Definition: ctredlin.hxx:173
DateTime aDaTiFilterLast
Definition: ctredlin.hxx:95
Tabpage with the filter text entries etc.
Definition: ctredlin.hxx:153
OUString aAuthor
Definition: ctredlin.hxx:96
DateTime aDaTiFilterFirst
Definition: ctredlin.hxx:94
std::unique_ptr< weld::CheckButton > m_xCbComment
Definition: ctredlin.hxx:179
bool bEnableAcceptAll
Definition: ctredlin.hxx:267
std::unique_ptr< weld::Button > m_xBtnRange
Definition: ctredlin.hxx:176
std::unique_ptr< weld::ComboBox > m_xLbDate
Definition: ctredlin.hxx:162
Link< SvxTPView *, void > AcceptAllClickLk
Definition: ctredlin.hxx:261
std::unique_ptr< weld::Button > m_xIbClock2
Definition: ctredlin.hxx:171
bool bModified
Definition: ctredlin.hxx:158
std::unique_ptr< weld::Button > m_xIbClock
Definition: ctredlin.hxx:166
bool bEnableReject
Definition: ctredlin.hxx:268
std::unique_ptr< weld::Button > m_xAccept
Definition: ctredlin.hxx:275
std::unique_ptr< weld::Button > m_xUndo
Definition: ctredlin.hxx:279
Link< SvxTPView *, void > RejectClickLk
Definition: ctredlin.hxx:262
void Show()
Definition: ctredlin.hxx:144
weld::TreeView * pTreeView
Definition: ctredlin.hxx:84
std::unique_ptr< weld::Container > m_xContainer
Definition: ctredlin.hxx:139
SvxRedlinTable * m_pRedlinTable
Definition: ctredlin.hxx:160
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate2
Definition: ctredlin.hxx:169
void DisableUndo()
Definition: ctredlin.hxx:297
std::unique_ptr< weld::Label > m_xFtDate2
Definition: ctredlin.hxx:167
std::unique_ptr< weld::Builder > m_xBuilder
Definition: ctredlin.hxx:318
std::unique_ptr< weld::CheckButton > m_xCbDate
Definition: ctredlin.hxx:161
#define SAL_WARN_UNUSED
bool bDisabled
Definition: ctredlin.hxx:75
void SetUndoClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:308
Link< SvxTPView *, void > RejectAllClickLk
Definition: ctredlin.hxx:263
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: ctredlin.hxx:319
SvxRedlinDateMode
Definition: ctredlin.hxx:44
bool bEnableUndo
Definition: ctredlin.hxx:270
Link< SvxTPView *, void > AcceptClickLk
Definition: ctredlin.hxx:260
std::unique_ptr< SvxTPFilter > m_xTPFilter
Definition: ctredlin.hxx:321
weld::TreeView & GetWidget()
Definition: ctredlin.hxx:105
Tabpage with the redlining entries.
Definition: ctredlin.hxx:256
bool bEnableClearFormat
Definition: ctredlin.hxx:272
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:302
DateTime aDaTiFirst
Definition: ctredlin.hxx:92
std::unique_ptr< SvtCalendarBox > m_xDfDate2
Definition: ctredlin.hxx:168
virtual void ActivatePage()
Definition: ctredlin.cxx:291
SvxRedlinTable * GetTableControl()
Definition: ctredlin.hxx:288
DateTime aDaTiLast
Definition: ctredlin.hxx:93
SvxTPView * GetViewPage()
Definition: ctredlin.hxx:334
RedlineType
Definition: ctredlin.hxx:49
void SetRefHdl(const Link< SvxTPFilter *, void > &rLink)
Definition: ctredlin.hxx:249
std::unique_ptr< weld::TimeFormatter > m_xTfDateFormatter
Definition: ctredlin.hxx:165
std::unique_ptr< weld::CheckButton > m_xCbRange
Definition: ctredlin.hxx:174
Struct for sorting data.
Definition: ctredlin.hxx:67
bool bEnableClearFormatAll
Definition: ctredlin.hxx:273
std::unique_ptr< weld::TimeFormatter > m_xTfDate2Formatter
Definition: ctredlin.hxx:170
RedlineType eType
Definition: ctredlin.hxx:74
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: ctredlin.hxx:300