1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/svlbitm.hxx>
27 #include <tools/color.hxx>
28 #include <tools/date.hxx>
29 #include <tools/datetime.hxx>
30 #include <tools/link.hxx>
31 #include <tools/time.hxx>
32 #include <vcl/weld.hxx>
40 namespace comphelper::string
{ class NaturalStringSorter
; }
43 class SvViewDataEntry
;
46 enum class SvxRedlinDateMode
48 BEFORE
, SINCE
, EQUAL
, NOTEQUAL
, BETWEEN
, SAVE
, NONE
51 /// Struct for sorting data.
52 class SAL_WARN_UNUSED SVX_DLLPUBLIC RedlinData
56 virtual ~RedlinData();
62 /// Class for the representation of Strings depending on the font.
63 class SAL_WARN_UNUSED SvLBoxColorString
: public SvLBoxString
71 virtual ~SvLBoxColorString() override
;
73 /** Paint function of the SvLBoxColorString class.
75 The relevant text with the selected color is drawn in the output device.
77 virtual void Paint(const Point
& rPos
, SvTreeListBox
& rOutDev
, vcl::RenderContext
& rRenderContext
,
78 const SvViewDataEntry
* pView
, const SvTreeListEntry
& rEntry
) override
;
80 virtual std::unique_ptr
<SvLBoxItem
> Clone(SvLBoxItem
const * pSource
) const override
;
83 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
86 std::unique_ptr
<comphelper::string::NaturalStringSorter
> xSorter
;
87 std::unique_ptr
<weld::TreeView
> xWriterTreeView
;
88 std::unique_ptr
<weld::TreeView
> xCalcTreeView
;
89 weld::TreeView
* pTreeView
;
95 SvxRedlinDateMode nDaTiMode
;
98 DateTime aDaTiFilterFirst
;
99 DateTime aDaTiFilterLast
;
101 std::unique_ptr
<utl::TextSearch
> pCommentSearcher
;
103 int ColCompare(const weld::TreeIter
& rLeft
, const weld::TreeIter
& rRight
);
106 SvxRedlinTable(std::unique_ptr
<weld::TreeView
> xWriterControl
,
107 std::unique_ptr
<weld::TreeView
> xCalcControl
);
109 void set_size_request(int nWidth
, int nHeight
);
111 weld::TreeView
& GetWidget() { return *pTreeView
; }
115 // For FilterPage only {
116 void SetFilterDate(bool bFlag
);
117 void SetDateTimeMode(SvxRedlinDateMode nMode
);
118 void SetFirstDate(const Date
&);
119 void SetLastDate(const Date
&);
120 void SetFirstTime(const tools::Time
&);
121 void SetLastTime(const tools::Time
&);
122 void SetFilterAuthor(bool bFlag
);
123 void SetAuthor(const OUString
&);
124 void SetFilterComment(bool bFlag
);
125 void SetCommentParams( const utl::SearchParam
* pSearchPara
);
127 void UpdateFilterTest();
128 // } For FilterPage only
131 void SetWriterView();
133 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
, const OUString
&rComment
);
134 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
);
135 bool IsValidComment(const OUString
&rComment
);
137 DECL_LINK(HeaderBarClick
, int, void);
140 class SVX_DLLPUBLIC SvxTPage
143 std::unique_ptr
<weld::Builder
> m_xBuilder
;
144 std::unique_ptr
<weld::Container
> m_xContainer
;
146 SvxTPage(weld::Container
* pParent
, const OUString
& rUIXMLDescription
, const OString
& rID
);
148 virtual void ActivatePage();
149 virtual void DeactivatePage();
150 void Show() { m_xContainer
->show(); }
153 /// Tabpage with the filter text entries etc.
154 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final
: public SvxTPage
156 Link
<SvxTPFilter
*,void> aReadyLink
;
157 Link
<SvxTPFilter
*,void> aRefLink
;
161 SvxRedlinTable
* m_pRedlinTable
;
162 std::unique_ptr
<weld::CheckButton
> m_xCbDate
;
163 std::unique_ptr
<weld::ComboBox
> m_xLbDate
;
164 std::unique_ptr
<SvtCalendarBox
> m_xDfDate
;
165 std::unique_ptr
<weld::TimeSpinButton
> m_xTfDate
;
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::TimeSpinButton
> m_xTfDate2
;
170 std::unique_ptr
<weld::Button
> m_xIbClock2
;
171 std::unique_ptr
<weld::CheckButton
> m_xCbAuthor
;
172 std::unique_ptr
<weld::ComboBox
> m_xLbAuthor
;
173 std::unique_ptr
<weld::CheckButton
> m_xCbRange
;
174 std::unique_ptr
<weld::Entry
> m_xEdRange
;
175 std::unique_ptr
<weld::Button
> m_xBtnRange
;
176 std::unique_ptr
<weld::CheckButton
> m_xCbAction
;
177 std::unique_ptr
<weld::ComboBox
> m_xLbAction
;
178 std::unique_ptr
<weld::CheckButton
> m_xCbComment
;
179 std::unique_ptr
<weld::Entry
> m_xEdComment
;
181 DECL_LINK( SelDateHdl
, weld::ComboBox
&, void );
182 DECL_LINK( RowEnableHdl
, weld::Button
&, void );
183 DECL_LINK( TimeHdl
, weld::Button
&, void );
184 DECL_LINK( ModifyHdl
, weld::Entry
&, void );
185 DECL_LINK( ModifyListBoxHdl
, weld::ComboBox
&, void );
186 DECL_LINK( ModifyDate
, SvtCalendarBox
&, void );
187 DECL_LINK( ModifyTime
, weld::TimeSpinButton
&, void );
188 DECL_LINK( RefHandle
, weld::Button
&, void );
190 void EnableDateLine1(bool bFlag
);
191 void EnableDateLine2(bool bFlag
);
194 SvxTPFilter(weld::Container
* pParent
);
195 virtual ~SvxTPFilter() override
;
197 virtual void DeactivatePage() override
;
198 void SetRedlinTable(SvxRedlinTable
*);
200 Date
GetFirstDate() const;
201 void SetFirstDate(const Date
&aDate
);
202 tools::Time
GetFirstTime() const;
203 void SetFirstTime(const tools::Time
&aTime
);
205 Date
GetLastDate() const;
206 void SetLastDate(const Date
&aDate
);
207 tools::Time
GetLastTime() const;
208 void SetLastTime(const tools::Time
&aTime
);
210 void SetDateMode(sal_uInt16 nMode
);
211 SvxRedlinDateMode
GetDateMode();
214 void InsertAuthor( const OUString
& rString
);
215 OUString
GetSelectedAuthor()const;
216 void SelectedAuthorPos(sal_Int32 nPos
);
217 sal_Int32
SelectAuthor(const OUString
& aString
);
218 void SetComment(const OUString
& rComment
);
219 OUString
GetComment()const;
221 // Methods for Calc {
222 void SetRange(const OUString
& rString
);
223 OUString
GetRange() const;
224 void HideRange(bool bHide
=true);
225 void SetFocusToRange();
226 // } Methods for Calc
234 void ShowAction(bool bShow
=true);
236 void CheckDate(bool bFlag
);
237 void CheckAuthor(bool bFlag
);
238 void CheckRange(bool bFlag
);
239 void CheckAction(bool bFlag
);
240 void CheckComment(bool bFlag
);
242 weld::ComboBox
* GetLbAction() { return m_xLbAction
.get(); }
244 void SetReadyHdl( const Link
<SvxTPFilter
*,void>& rLink
) { aReadyLink
= rLink
; }
247 // Methods for Calc {
248 void SetRefHdl( const Link
<SvxTPFilter
*,void>& rLink
) { aRefLink
= rLink
; }
250 void Enable( bool bEnable
= true );
251 // } Methods for Calc
254 /// Tabpage with the redlining entries.
255 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView
: public SvxTPage
259 Link
<SvxTPView
*,void> AcceptClickLk
;
260 Link
<SvxTPView
*,void> AcceptAllClickLk
;
261 Link
<SvxTPView
*,void> RejectClickLk
;
262 Link
<SvxTPView
*,void> RejectAllClickLk
;
263 Link
<SvxTPView
*,void> UndoClickLk
;
266 bool bEnableAcceptAll
;
268 bool bEnableRejectAll
;
271 std::unique_ptr
<weld::Button
> m_xAccept
;
272 std::unique_ptr
<weld::Button
> m_xReject
;
273 std::unique_ptr
<weld::Button
> m_xAcceptAll
;
274 std::unique_ptr
<weld::Button
> m_xRejectAll
;
275 std::unique_ptr
<weld::Button
> m_xUndo
;
276 std::unique_ptr
<SvxRedlinTable
> m_xViewData
;
278 DECL_LINK( PbClickHdl
, weld::Button
&, void );
281 SvxTPView(weld::Container
* pParent
, weld::Builder
* pTopLevel
);
282 virtual ~SvxTPView() override
;
284 SvxRedlinTable
* GetTableControl() { return m_xViewData
.get(); }
286 void EnableAccept(bool bFlag
);
287 void EnableAcceptAll(bool bFlag
);
288 void EnableReject(bool bFlag
);
289 void EnableRejectAll(bool bFlag
);
290 static void EnableClearFormatButton(weld::Button
&, bool bFlag
);
291 void EnableClearFormat(bool bFlag
);
292 void EnableClearFormatAll(bool bFlag
);
293 void EnableUndo(bool bFlag
=true);
294 void DisableUndo() {EnableUndo(false);}
297 void SetAcceptClickHdl( const Link
<SvxTPView
*,void>& rLink
) { AcceptClickLk
= rLink
; }
299 void SetAcceptAllClickHdl( const Link
<SvxTPView
*,void>& rLink
) { AcceptAllClickLk
= rLink
; }
301 void SetRejectClickHdl( const Link
<SvxTPView
*,void>& rLink
) { RejectClickLk
= rLink
; }
303 void SetRejectAllClickHdl( const Link
<SvxTPView
*,void>& rLink
) { RejectAllClickLk
= rLink
; }
305 void SetUndoClickHdl( const Link
<SvxTPView
*,void>& rLink
) { UndoClickLk
= rLink
; }
307 virtual void ActivatePage() override
;
308 virtual void DeactivatePage() override
;
311 // Redlining - Control (Accept- Changes)
312 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxAcceptChgCtr
315 std::unique_ptr
<weld::Builder
> m_xBuilder
;
316 std::unique_ptr
<weld::Notebook
> m_xTabCtrl
;
318 std::unique_ptr
<SvxTPFilter
> m_xTPFilter
;
319 std::unique_ptr
<SvxTPView
> m_xTPView
;
321 DECL_DLLPRIVATE_LINK(ActivatePageHdl
, const OString
&, void);
322 DECL_DLLPRIVATE_LINK(DeactivatePageHdl
, const OString
&, bool);
325 SvxAcceptChgCtr(weld::Container
* pParent
, weld::Builder
* pTopLevel
);
328 void ShowFilterPage();
330 SvxTPFilter
* GetFilterPage() { return m_xTPFilter
.get(); }
331 SvxTPView
* GetViewPage() { return m_xTPView
.get(); }
333 void set_help_id(const OString
& rId
) { m_xTabCtrl
->set_help_id(rId
); }
336 #endif // INCLUDED_SVX_CTREDLIN_HXX
338 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */