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 <svtools/headbar.hxx>
24 #include <svtools/simptabl.hxx>
25 #include <svtools/svlbitm.hxx>
26 #include <svtools/svtabbx.hxx>
27 #include <svtools/treelistentry.hxx>
28 #include <tools/datetime.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/combobox.hxx>
31 #include <vcl/field.hxx>
32 #include <vcl/fixed.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <vcl/tabpage.hxx>
35 #include <vcl/tabctrl.hxx>
36 #include <unotools/textsearch.hxx>
37 #include <svx/svxdllapi.h>
39 enum class SvxRedlinDateMode
41 BEFORE
, SINCE
, EQUAL
, NOTEQUAL
, BETWEEN
, SAVE
, NONE
44 /// Struct for sorting data.
45 class SVX_DLLPUBLIC SAL_WARN_UNUSED RedlinData
49 virtual ~RedlinData();
56 class SAL_WARN_UNUSED SvxRedlinEntry
: public SvTreeListEntry
60 virtual ~SvxRedlinEntry();
63 /// Class for the representation of Strings depending on the font.
64 class SAL_WARN_UNUSED SvLBoxColorString
: public SvLBoxString
71 SvLBoxColorString( SvTreeListEntry
*, sal_uInt16 nFlags
, const OUString
& rStr
,
74 virtual ~SvLBoxColorString();
76 /** Paint function of the SvLBoxColorString class.
78 The relevant text with the selected color is drawn in the output device.
80 virtual void Paint(const Point
& rPos
, SvTreeListBox
& rOutDev
, vcl::RenderContext
& rRenderContext
,
81 const SvViewDataEntry
* pView
, const SvTreeListEntry
* pEntry
) SAL_OVERRIDE
;
83 SvLBoxItem
* Create() const SAL_OVERRIDE
;
86 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxRedlinTable
: public SvSimpleTable
88 using SvTabListBox::InsertEntry
;
97 SvxRedlinDateMode nDaTiMode
;
100 DateTime aDaTiFilterFirst
;
101 DateTime aDaTiFilterLast
;
105 OUString maEntryString
;
106 utl::TextSearch
* pCommentSearcher
;
107 Link
<> aColCompareLink
;
111 virtual sal_Int32
ColCompare(SvTreeListEntry
*,SvTreeListEntry
*) SAL_OVERRIDE
;
112 virtual void InitEntry(SvTreeListEntry
*, const OUString
&, const Image
&, const Image
&, SvLBoxButtonKind
) SAL_OVERRIDE
;
116 SvxRedlinTable(SvSimpleTableContainer
& rParent
, WinBits nBits
= WB_BORDER
);
117 virtual ~SvxRedlinTable();
118 virtual void dispose() SAL_OVERRIDE
;
120 // For FilterPage only {
121 void SetFilterDate(bool bFlag
=true);
122 void SetDateTimeMode(SvxRedlinDateMode nMode
);
123 void SetFirstDate(const Date
&);
124 void SetLastDate(const Date
&);
125 void SetFirstTime(const tools::Time
&);
126 void SetLastTime(const tools::Time
&);
127 void SetFilterAuthor(bool bFlag
=true);
128 void SetAuthor(const OUString
&);
129 void SetFilterComment(bool bFlag
=true);
130 void SetCommentParams( const utl::SearchParam
* pSearchPara
);
132 void UpdateFilterTest();
133 // } For FilterPage only
135 void SetCalcView(bool bFlag
=true);
137 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
, const OUString
&rComment
);
138 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
);
139 bool IsValidComment(const OUString
&rComment
);
141 /** Insert a redline entry.
143 The rStr contains the entire redline entry; the columns are delimited by '\t'.
145 SvTreeListEntry
* InsertEntry(const OUString
&rStr
, RedlinData
*pUserData
,
146 SvTreeListEntry
* pParent
= NULL
, sal_uIntPtr nPos
= TREELIST_APPEND
);
148 /** Insert a redline entry.
150 The rStr contains the entire redline entry; the columns are delimited by '\t'.
152 SvTreeListEntry
* InsertEntry(const OUString
&rStr
, RedlinData
*pUserData
, const Color
&,
153 SvTreeListEntry
* pParent
= NULL
, sal_uIntPtr nPos
= TREELIST_APPEND
);
155 /** Insert a redline entry.
157 rRedlineType contains the image for this redline entry (plus for insertion, minus for deletion etc.).
158 rStr contains the rest of the redline entry; the columns are delimited by '\t'.
160 SvTreeListEntry
* InsertEntry(const Image
&rRedlineType
, const OUString
&rStr
, RedlinData
*pUserData
,
161 SvTreeListEntry
* pParent
= NULL
, sal_uIntPtr nPos
= TREELIST_APPEND
);
163 virtual SvTreeListEntry
* CreateEntry() const SAL_OVERRIDE
;
165 void SetColCompareHdl(const Link
<>& rLink
) { aColCompareLink
= rLink
; }
166 const Link
<>& GetColCompareHdl() const { return aColCompareLink
; }
169 /// Tabpage with the filter text entries etc.
170 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxTPFilter
: public TabPage
176 Link
<> aModifyDateLink
;
177 Link
<> aModifyAuthorLink
;
178 Link
<> aModifyRefLink
;
180 Link
<> aModifyComLink
;
182 VclPtr
<SvxRedlinTable
> pRedlinTable
;
183 VclPtr
<CheckBox
> m_pCbDate
;
184 VclPtr
<ListBox
> m_pLbDate
;
185 VclPtr
<DateField
> m_pDfDate
;
186 VclPtr
<TimeField
> m_pTfDate
;
187 VclPtr
<PushButton
> m_pIbClock
;
188 VclPtr
<FixedText
> m_pFtDate2
;
189 VclPtr
<DateField
> m_pDfDate2
;
190 VclPtr
<TimeField
> m_pTfDate2
;
191 VclPtr
<PushButton
> m_pIbClock2
;
192 VclPtr
<CheckBox
> m_pCbAuthor
;
193 VclPtr
<ListBox
> m_pLbAuthor
;
194 VclPtr
<CheckBox
> m_pCbRange
;
195 VclPtr
<Edit
> m_pEdRange
;
196 VclPtr
<PushButton
> m_pBtnRange
;
197 VclPtr
<CheckBox
> m_pCbAction
;
198 VclPtr
<ListBox
> m_pLbAction
;
199 VclPtr
<CheckBox
> m_pCbComment
;
200 VclPtr
<Edit
> m_pEdComment
;
203 DECL_LINK( SelDateHdl
, ListBox
* );
204 DECL_LINK( RowEnableHdl
, CheckBox
* );
205 DECL_LINK( TimeHdl
, ImageButton
* );
206 DECL_LINK( ModifyHdl
, void* );
207 DECL_LINK( ModifyDate
, void* );
208 DECL_LINK( RefHandle
, PushButton
* );
212 void ShowDateFields(SvxRedlinDateMode nKind
);
213 void EnableDateLine1(bool bFlag
);
214 void EnableDateLine2(bool bFlag
);
217 SvxTPFilter( vcl::Window
* pParent
);
218 virtual ~SvxTPFilter();
219 virtual void dispose() SAL_OVERRIDE
;
221 virtual void DeactivatePage() SAL_OVERRIDE
;
222 void SetRedlinTable(SvxRedlinTable
*);
224 Date
GetFirstDate() const;
225 void SetFirstDate(const Date
&aDate
);
226 tools::Time
GetFirstTime() const;
227 void SetFirstTime(const tools::Time
&aTime
);
229 Date
GetLastDate() const;
230 void SetLastDate(const Date
&aDate
);
231 tools::Time
GetLastTime() const;
232 void SetLastTime(const tools::Time
&aTime
);
234 void SetDateMode(sal_uInt16 nMode
);
235 SvxRedlinDateMode
GetDateMode();
238 void InsertAuthor( const OUString
& rString
, sal_Int32 nPos
= LISTBOX_APPEND
);
239 OUString
GetSelectedAuthor()const;
240 void SelectedAuthorPos(sal_Int32 nPos
);
241 sal_Int32
SelectAuthor(const OUString
& aString
);
242 void SetComment(const OUString
& rComment
);
243 OUString
GetComment()const;
245 // Methods for Calc {
246 void SetRange(const OUString
& rString
);
247 OUString
GetRange() const;
248 void HideRange(bool bHide
=true);
249 void SetFocusToRange();
250 // } Methods for Calc
252 void DisableRef(bool bFlag
);
260 void ShowAction(bool bShow
=true);
262 void CheckDate(bool bFlag
=true);
263 void CheckAuthor(bool bFlag
=true);
264 void CheckRange(bool bFlag
=true);
265 void CheckAction(bool bFlag
=true);
266 void CheckComment(bool bFlag
=true);
268 ListBox
* GetLbAction() { return m_pLbAction
;}
270 void SetReadyHdl( const Link
<>& rLink
) { aReadyLink
= rLink
; }
271 const Link
<>& GetReadyHdl() const { return aReadyLink
; }
273 void SetModifyHdl( const Link
<>& rLink
) { aModifyLink
= rLink
; }
274 const Link
<>& GetModifyHdl() const { return aModifyLink
; }
276 void SetModifyDateHdl( const Link
<>& rLink
) { aModifyDateLink
= rLink
; }
277 const Link
<>& GetModifyDateHdl() const { return aModifyDateLink
; }
279 void SetModifyAuthorHdl( const Link
<>& rLink
) { aModifyAuthorLink
= rLink
; }
280 const Link
<>& GetModifyAuthorHdl() const { return aModifyAuthorLink
; }
282 void SetModifyCommentHdl(const Link
<>& rLink
) { aModifyComLink
= rLink
; }
283 const Link
<>& GetModifyCommentHdl() const { return aModifyComLink
; }
286 // Methods for Calc {
287 void SetModifyRangeHdl( const Link
<>& rLink
) { aModifyRefLink
= rLink
; }
288 const Link
<>& GetModifyRangeHdl() const { return aModifyRefLink
; }
290 void SetRefHdl( const Link
<>& rLink
) { aRefLink
= rLink
; }
291 const Link
<>& GetRefHdl() const { return aRefLink
; }
293 void Enable( bool bEnable
= true, bool bChild
= true );
294 void Disable( bool bChild
= true );
295 // } Methods for Calc
298 /// Tabpage with the redlining entries.
299 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxTPView
: public TabPage
303 Link
<> AcceptClickLk
;
304 Link
<> AcceptAllClickLk
;
305 Link
<> RejectClickLk
;
306 Link
<> RejectAllClickLk
;
309 VclPtr
<SvxRedlinTable
> m_pViewData
;
310 VclPtr
<PushButton
> m_pAccept
;
311 VclPtr
<PushButton
> m_pReject
;
312 VclPtr
<PushButton
> m_pAcceptAll
;
313 VclPtr
<PushButton
> m_pRejectAll
;
314 VclPtr
<PushButton
> m_pUndo
;
317 bool bEnableAcceptAll
;
319 bool bEnableRejectAll
;
322 DECL_LINK( PbClickHdl
, PushButton
* );
325 SvxTPView(vcl::Window
* pParent
, VclBuilderContainer
*pTopLevel
);
326 virtual ~SvxTPView();
327 virtual void dispose() SAL_OVERRIDE
;
329 void InsertWriterHeader();
330 void InsertCalcHeader();
331 SvxRedlinTable
* GetTableControl() { return m_pViewData
;}
333 void EnableAccept(bool nFlag
=true);
334 void EnableAcceptAll(bool nFlag
=true);
335 void EnableReject(bool nFlag
=true);
336 void EnableRejectAll(bool nFlag
=true);
337 void EnableUndo(bool nFlag
=true);
339 void DisableAccept() {EnableAccept(false);}
340 void DisableAcceptAll() {EnableAcceptAll(false);}
341 void DisableReject() {EnableReject(false);}
342 void DisableRejectAll() {EnableRejectAll(false);}
343 void DisableUndo() {EnableUndo(false);}
345 void ShowUndo(bool nFlag
=true);
346 void HideUndo() {ShowUndo(false);}
347 bool IsUndoVisible();
349 void SetAcceptClickHdl( const Link
<>& rLink
) { AcceptClickLk
= rLink
; }
350 const Link
<>& GetAcceptClickHdl() const { return AcceptClickLk
; }
352 void SetAcceptAllClickHdl( const Link
<>& rLink
) { AcceptAllClickLk
= rLink
; }
353 const Link
<>& GetAcceptAllClickHdl() const { return AcceptAllClickLk
; }
355 void SetRejectClickHdl( const Link
<>& rLink
) { RejectClickLk
= rLink
; }
356 const Link
<>& GetRejectClickHdl() const { return RejectClickLk
; }
358 void SetRejectAllClickHdl( const Link
<>& rLink
) { RejectAllClickLk
= rLink
; }
359 const Link
<>& GetRejectAllClickHdl() const { return RejectAllClickLk
; }
361 void SetUndoClickHdl( const Link
<>& rLink
) { UndoClickLk
= rLink
; }
362 const Link
<>& GetUndoAllClickHdl() const { return UndoClickLk
; }
364 virtual void ActivatePage() SAL_OVERRIDE
;
365 virtual void DeactivatePage() SAL_OVERRIDE
;
369 // Redlining - Control (Accept- Changes)
370 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxAcceptChgCtr
372 , public VclBuilderContainer
376 VclPtr
<SvxTPFilter
> pTPFilter
;
377 VclPtr
<SvxTPView
> pTPView
;
379 sal_uInt16 m_nViewPageId
;
380 sal_uInt16 m_nFilterPageId
;
383 SvxAcceptChgCtr(vcl::Window
* pParent
, VclBuilderContainer
* pTopLevel
);
385 virtual ~SvxAcceptChgCtr();
386 virtual void dispose() SAL_OVERRIDE
;
388 void ShowFilterPage();
391 SvxTPFilter
* GetFilterPage() { return pTPFilter
;}
392 SvxTPView
* GetViewPage() { return pTPView
;}
393 SvxRedlinTable
* GetViewTable();
396 #endif // INCLUDED_SVX_CTREDLIN_HXX
398 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */