Enable building with Xcode 16.0 beta 3 on macOS 15.0 public beta
[LibreOffice.git] / include / svx / ctredlin.hxx
blobc098efa6a11bbefc1d2128bda3e9371f4917f9de
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_CTREDLIN_HXX
21 #define INCLUDED_SVX_CTREDLIN_HXX
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>
33 namespace utl {
34 class SearchParam;
35 class TextSearch;
38 namespace comphelper::string { class NaturalStringSorter; }
40 class Point;
41 class SvViewDataEntry;
42 class SvtCalendarBox;
44 enum class SvxRedlinDateMode
46 BEFORE, SINCE, EQUAL, NOTEQUAL, BETWEEN, SAVE, NONE
49 enum class RedlineType : sal_uInt16
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
66 /// Struct for sorting data.
67 class SAL_WARN_UNUSED SVX_DLLPUBLIC RedlinData
69 public:
70 RedlinData();
71 virtual ~RedlinData();
72 DateTime aDateTime;
73 void* pData;
74 RedlineType eType;
75 bool bDisabled;
78 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
80 private:
81 std::unique_ptr<comphelper::string::NaturalStringSorter> xSorter;
82 std::unique_ptr<weld::TreeView> xWriterTreeView;
83 std::unique_ptr<weld::TreeView> xCalcTreeView;
84 weld::TreeView* pTreeView;
86 weld::ComboBox* m_pSortByComboBox;
88 sal_uInt16 nDatePos;
89 bool bAuthor;
90 bool bDate;
91 bool bComment;
92 bool bSorted;
93 SvxRedlinDateMode nDaTiMode;
94 DateTime aDaTiFirst;
95 DateTime aDaTiLast;
96 DateTime aDaTiFilterFirst;
97 DateTime aDaTiFilterLast;
98 OUString aAuthor;
99 std::unique_ptr<utl::TextSearch> pCommentSearcher;
101 int ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter& rRight);
103 public:
104 SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
105 std::unique_ptr<weld::TreeView> xCalcControl,
106 weld::ComboBox* pSortByControl);
108 weld::TreeView& GetWidget() { return *pTreeView; }
109 bool IsSorted() const { return bSorted; }
111 ~SvxRedlinTable();
113 // For FilterPage only {
114 void SetFilterDate(bool bFlag);
115 void SetDateTimeMode(SvxRedlinDateMode nMode);
116 void SetFirstDate(const Date&);
117 void SetLastDate(const Date&);
118 void SetFirstTime(const tools::Time&);
119 void SetLastTime(const tools::Time&);
120 void SetFilterAuthor(bool bFlag);
121 void SetAuthor(const OUString &);
122 void SetFilterComment(bool bFlag);
123 void SetCommentParams( const utl::SearchParam* pSearchPara );
125 void UpdateFilterTest();
126 // } For FilterPage only
128 void SetCalcView();
129 void SetWriterView();
131 bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment);
132 bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime);
133 bool IsValidComment(const OUString &rComment);
135 DECL_LINK(HeaderBarClick, int, void);
138 class SVX_DLLPUBLIC SvxTPage
140 protected:
141 std::unique_ptr<weld::Builder> m_xBuilder;
142 std::unique_ptr<weld::Container> m_xContainer;
143 public:
144 SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID);
145 virtual ~SvxTPage();
146 virtual void ActivatePage();
147 void Show() { m_xContainer->show(); }
150 namespace weld
152 class TimeFormatter;
155 /// Tabpage with the filter text entries etc.
156 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
158 Link<SvxTPFilter*,void> aReadyLink;
159 Link<SvxTPFilter*,void> aRefLink;
161 bool bModified;
163 SvxRedlinTable* m_pRedlinTable;
164 std::unique_ptr<weld::CheckButton> m_xCbDate;
165 std::unique_ptr<weld::ComboBox> m_xLbDate;
166 std::unique_ptr<SvtCalendarBox> m_xDfDate;
167 std::unique_ptr<weld::FormattedSpinButton> m_xTfDate;
168 std::unique_ptr<weld::TimeFormatter> m_xTfDateFormatter;
169 std::unique_ptr<weld::Button> m_xIbClock;
170 std::unique_ptr<weld::Label> m_xFtDate2;
171 std::unique_ptr<SvtCalendarBox> m_xDfDate2;
172 std::unique_ptr<weld::FormattedSpinButton> m_xTfDate2;
173 std::unique_ptr<weld::TimeFormatter> m_xTfDate2Formatter;
174 std::unique_ptr<weld::Button> m_xIbClock2;
175 std::unique_ptr<weld::CheckButton> m_xCbAuthor;
176 std::unique_ptr<weld::ComboBox> m_xLbAuthor;
177 std::unique_ptr<weld::CheckButton> m_xCbRange;
178 std::unique_ptr<weld::Entry> m_xEdRange;
179 std::unique_ptr<weld::Button> m_xBtnRange;
180 std::unique_ptr<weld::CheckButton> m_xCbAction;
181 std::unique_ptr<weld::ComboBox> m_xLbAction;
182 std::unique_ptr<weld::CheckButton> m_xCbComment;
183 std::unique_ptr<weld::Entry> m_xEdComment;
185 DECL_DLLPRIVATE_LINK( SelDateHdl, weld::ComboBox&, void );
186 DECL_DLLPRIVATE_LINK( RowEnableHdl, weld::Toggleable&, void );
187 DECL_DLLPRIVATE_LINK( TimeHdl, weld::Button&, void );
188 DECL_DLLPRIVATE_LINK( ModifyHdl, weld::Entry&, void );
189 DECL_DLLPRIVATE_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
190 DECL_DLLPRIVATE_LINK( ModifyDate, SvtCalendarBox&, void );
191 DECL_DLLPRIVATE_LINK( ModifyTime, weld::FormattedSpinButton&, void );
192 DECL_DLLPRIVATE_LINK( RefHandle, weld::Button&, void );
194 void EnableDateLine1(bool bFlag);
195 void EnableDateLine2(bool bFlag);
197 public:
198 SvxTPFilter(weld::Container* pParent);
199 virtual ~SvxTPFilter() override;
201 void DeactivatePage();
202 void SetRedlinTable(SvxRedlinTable*);
204 Date GetFirstDate() const;
205 void SetFirstDate(const Date &aDate);
206 tools::Time GetFirstTime() const;
207 void SetFirstTime(const tools::Time &aTime);
209 Date GetLastDate() const;
210 void SetLastDate(const Date &aDate);
211 tools::Time GetLastTime() const;
212 void SetLastTime(const tools::Time &aTime);
214 void SetDateMode(sal_uInt16 nMode);
215 SvxRedlinDateMode GetDateMode() const;
217 void ClearAuthors();
218 void InsertAuthor( const OUString& rString );
219 OUString GetSelectedAuthor()const;
220 void SelectedAuthorPos(sal_Int32 nPos);
221 sal_Int32 SelectAuthor(const OUString& aString);
222 void SetComment(const OUString& rComment);
223 OUString GetComment()const;
225 // Methods for Calc {
226 void SetRange(const OUString& rString);
227 OUString GetRange() const;
228 void HideRange(bool bHide=true);
229 void SetFocusToRange();
230 // } Methods for Calc
232 bool IsDate() const;
233 bool IsAuthor() const;
234 bool IsRange() const;
235 bool IsAction() const;
236 bool IsComment() const;
238 void ShowAction(bool bShow=true);
240 void CheckDate(bool bFlag);
241 void CheckAuthor(bool bFlag);
242 void CheckRange(bool bFlag);
243 void CheckAction(bool bFlag);
244 void CheckComment(bool bFlag);
246 weld::ComboBox* GetLbAction() { return m_xLbAction.get(); }
248 void SetReadyHdl( const Link<SvxTPFilter*,void>& rLink ) { aReadyLink= rLink; }
251 // Methods for Calc {
252 void SetRefHdl( const Link<SvxTPFilter*,void>& rLink ) { aRefLink = rLink; }
254 void Enable( bool bEnable = true );
255 // } Methods for Calc
258 /// Tabpage with the redlining entries.
259 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView final : public SvxTPage
261 private:
262 Link<SvxTPView*,void> AcceptClickLk;
263 Link<SvxTPView*,void> AcceptAllClickLk;
264 Link<SvxTPView*,void> RejectClickLk;
265 Link<SvxTPView*,void> RejectAllClickLk;
266 Link<SvxTPView*,void> UndoClickLk;
268 Link<SvxTPView*,void> SortByComboBoxChangedLk;
270 bool bEnableAccept;
271 bool bEnableAcceptAll;
272 bool bEnableReject;
273 bool bEnableRejectAll;
274 bool bEnableUndo;
276 bool bEnableClearFormat;
277 bool bEnableClearFormatAll;
279 std::unique_ptr<weld::Button> m_xAccept;
280 std::unique_ptr<weld::Button> m_xReject;
281 std::unique_ptr<weld::Button> m_xAcceptAll;
282 std::unique_ptr<weld::Button> m_xRejectAll;
283 std::unique_ptr<weld::Button> m_xUndo;
284 std::unique_ptr<weld::ComboBox> m_xSortByComboBox;
285 std::unique_ptr<SvxRedlinTable> m_xViewData;
287 DECL_DLLPRIVATE_LINK( PbClickHdl, weld::Button&, void );
288 DECL_DLLPRIVATE_LINK(SortByComboBoxChangedHdl, weld::ComboBox&, void);
290 public:
291 SvxTPView(weld::Container* pParent);
292 virtual ~SvxTPView() override;
294 SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
296 weld::ComboBox* GetSortByComboBoxControl() { return m_xSortByComboBox.get(); }
298 void EnableAccept(bool bFlag);
299 void EnableAcceptAll(bool bFlag);
300 void EnableReject(bool bFlag);
301 void EnableRejectAll(bool bFlag);
302 void EnableClearFormat(bool bFlag);
303 void EnableClearFormatAll(bool bFlag);
304 void EnableUndo(bool bFlag=true);
305 void DisableUndo() {EnableUndo(false);}
306 void ShowUndo();
308 void SetAcceptClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptClickLk = rLink; }
310 void SetAcceptAllClickHdl( const Link<SvxTPView*,void>& rLink ) { AcceptAllClickLk = rLink; }
312 void SetRejectClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectClickLk = rLink; }
314 void SetRejectAllClickHdl( const Link<SvxTPView*,void>& rLink ) { RejectAllClickLk = rLink; }
316 void SetUndoClickHdl( const Link<SvxTPView*,void>& rLink ) { UndoClickLk = rLink; }
318 void SetSortByComboBoxChangedHdl(const Link<SvxTPView*, void>& rLink)
320 SortByComboBoxChangedLk = rLink;
323 virtual void ActivatePage() override;
324 void DeactivatePage();
327 // Redlining - Control (Accept- Changes)
328 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxAcceptChgCtr
330 private:
331 std::unique_ptr<weld::Builder> m_xBuilder;
332 std::unique_ptr<weld::Notebook> m_xTabCtrl;
334 std::unique_ptr<SvxTPFilter> m_xTPFilter;
335 std::unique_ptr<SvxTPView> m_xTPView;
337 DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OUString&, void);
338 DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OUString&, bool);
340 public:
341 SvxAcceptChgCtr(weld::Container* pParent);
342 ~SvxAcceptChgCtr();
344 void ShowFilterPage();
346 SvxTPFilter* GetFilterPage() { return m_xTPFilter.get(); }
347 SvxTPView* GetViewPage() { return m_xTPView.get(); }
350 #endif // INCLUDED_SVX_CTREDLIN_HXX
352 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */