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/combobox.hxx>
30 #include <vcl/field.hxx>
31 #include <vcl/fixed.hxx>
32 #include <vcl/lstbox.hxx>
33 #include <vcl/tabpage.hxx>
34 #include <vcl/tabctrl.hxx>
35 #include <unotools/textsearch.hxx>
36 #include <svx/svxdllapi.h>
38 #define FLT_DATE_BEFORE 0
39 #define FLT_DATE_SINCE 1
40 #define FLT_DATE_EQUAL 2
41 #define FLT_DATE_NOTEQUAL 3
42 #define FLT_DATE_BETWEEN 4
43 #define FLT_DATE_SAVE 5
46 // Struct for sorting data
48 class SVX_DLLPUBLIC RedlinData
52 virtual ~RedlinData();
58 class SvxRedlinEntry
: public SvTreeListEntry
62 virtual ~SvxRedlinEntry();
65 // Class for the representation of Strings depending on the font
66 class SvLBoxColorString
: public SvLBoxString
73 SvLBoxColorString( SvTreeListEntry
*, sal_uInt16 nFlags
, const OUString
& rStr
,
79 const Point
& rPos
, SvTreeListBox
& rOutDev
, const SvViewDataEntry
* pView
, const SvTreeListEntry
* pEntry
);
81 SvLBoxItem
* Create() const;
84 class SVX_DLLPUBLIC SvxRedlinTable
: public SvSimpleTable
86 using SvTabListBox::InsertEntry
;
98 DateTime aDaTiFilterFirst
;
99 DateTime aDaTiFilterLast
;
103 utl::TextSearch
* pCommentSearcher
;
104 Link aColCompareLink
;
108 virtual sal_Int32
ColCompare(SvTreeListEntry
*,SvTreeListEntry
*);
109 virtual void InitEntry(SvTreeListEntry
*, const OUString
&, const Image
&, const Image
&, SvLBoxButtonKind
);
115 SvxRedlinTable(SvSimpleTableContainer
& rParent
, WinBits nBits
= WB_BORDER
);
118 // For FilterPage only {
119 void SetFilterDate(sal_Bool bFlag
=sal_True
);
120 void SetDateTimeMode(sal_uInt16 nMode
);
121 void SetFirstDate(const Date
&);
122 void SetLastDate(const Date
&);
123 void SetFirstTime(const Time
&);
124 void SetLastTime(const Time
&);
125 void SetFilterAuthor(sal_Bool bFlag
=sal_True
);
126 void SetAuthor(const OUString
&);
127 void SetFilterComment(sal_Bool bFlag
=sal_True
);
128 void SetCommentParams( const utl::SearchParam
* pSearchPara
);
130 void UpdateFilterTest();
131 // } For FilterPage only
133 void SetCalcView(sal_Bool bFlag
=sal_True
);
135 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
, const OUString
&rComment
);
136 bool IsValidEntry(const OUString
&rAuthor
, const DateTime
&rDateTime
);
137 bool IsValidComment(const OUString
&rComment
);
139 SvTreeListEntry
* InsertEntry(const OUString
& ,RedlinData
*pUserData
,
140 SvTreeListEntry
* pParent
=NULL
,sal_uIntPtr nPos
=LIST_APPEND
);
142 SvTreeListEntry
* InsertEntry(const OUString
& ,RedlinData
*pUserData
,const Color
&,
143 SvTreeListEntry
* pParent
=NULL
,sal_uIntPtr nPos
=LIST_APPEND
);
146 virtual SvTreeListEntry
* CreateEntry() const;
148 void SetColCompareHdl(const Link
& rLink
) { aColCompareLink
= rLink
; }
149 const Link
& GetColCompareHdl() const { return aColCompareLink
; }
154 //==================================================================
156 //==================================================================
157 class SVX_DLLPUBLIC SvxTPFilter
: public TabPage
163 Link aModifyDateLink
;
164 Link aModifyAuthorLink
;
169 SvxRedlinTable
* pRedlinTable
;
172 DateField
* m_pDfDate
;
173 TimeField
* m_pTfDate
;
174 PushButton
* m_pIbClock
;
175 FixedText
* m_pFtDate2
;
176 DateField
* m_pDfDate2
;
177 TimeField
* m_pTfDate2
;
178 PushButton
* m_pIbClock2
;
179 CheckBox
* m_pCbAuthor
;
180 ListBox
* m_pLbAuthor
;
181 CheckBox
* m_pCbRange
;
183 PushButton
* m_pBtnRange
;
184 CheckBox
* m_pCbAction
;
185 ListBox
* m_pLbAction
;
186 CheckBox
* m_pCbComment
;
190 DECL_LINK( SelDateHdl
, ListBox
* );
191 DECL_LINK( RowEnableHdl
, CheckBox
* );
192 DECL_LINK( TimeHdl
, ImageButton
* );
193 DECL_LINK( ModifyHdl
, void* );
194 DECL_LINK( ModifyDate
, void* );
195 DECL_LINK( RefHandle
, PushButton
* );
200 void ShowDateFields(sal_uInt16 nKind
);
201 void EnableDateLine1(sal_Bool bFlag
);
202 void EnableDateLine2(sal_Bool bFlag
);
205 SvxTPFilter( Window
* pParent
);
207 virtual void DeactivatePage();
208 void SetRedlinTable(SvxRedlinTable
*);
210 Date
GetFirstDate() const;
211 void SetFirstDate(const Date
&aDate
);
212 Time
GetFirstTime() const;
213 void SetFirstTime(const Time
&aTime
);
215 Date
GetLastDate() const;
216 void SetLastDate(const Date
&aDate
);
217 Time
GetLastTime() const;
218 void SetLastTime(const Time
&aTime
);
220 void SetDateMode(sal_uInt16 nMode
);
221 sal_uInt16
GetDateMode();
224 void InsertAuthor( const OUString
& rString
, sal_uInt16 nPos
= LISTBOX_APPEND
);
225 OUString
GetSelectedAuthor()const;
226 void SelectedAuthorPos(sal_uInt16 nPos
);
227 sal_uInt16
SelectAuthor(const OUString
& aString
);
228 void SetComment(const OUString
& rComment
);
229 OUString
GetComment()const;
232 // Methods for Calc {
233 void SetRange(const OUString
& rString
);
234 OUString
GetRange() const;
235 void HideRange(sal_Bool bHide
=sal_True
);
236 void SetFocusToRange();
237 // } Methods for Calc
239 void DisableRef(sal_Bool bFlag
);
245 sal_Bool
IsComment();
247 void ShowAction(sal_Bool bShow
=sal_True
);
249 void CheckDate(sal_Bool bFlag
=sal_True
);
250 void CheckAuthor(sal_Bool bFlag
=sal_True
);
251 void CheckRange(sal_Bool bFlag
=sal_True
);
252 void CheckAction(sal_Bool bFlag
=sal_True
);
253 void CheckComment(sal_Bool bFlag
=sal_True
);
255 ListBox
* GetLbAction();
257 void SetReadyHdl( const Link
& rLink
) { aReadyLink
= rLink
; }
258 const Link
& GetReadyHdl() const { return aReadyLink
; }
260 void SetModifyHdl( const Link
& rLink
) { aModifyLink
= rLink
; }
261 const Link
& GetModifyHdl() const { return aModifyLink
; }
263 void SetModifyDateHdl( const Link
& rLink
) { aModifyDateLink
= rLink
; }
264 const Link
& GetModifyDateHdl() const { return aModifyDateLink
; }
266 void SetModifyAuthorHdl( const Link
& rLink
) { aModifyAuthorLink
= rLink
; }
267 const Link
& GetModifyAuthorHdl() const { return aModifyAuthorLink
; }
269 void SetModifyCommentHdl(const Link
& rLink
) { aModifyComLink
= rLink
; }
270 const Link
& GetModifyCommentHdl() const { return aModifyComLink
; }
273 // Methods for Calc {
274 void SetModifyRangeHdl( const Link
& rLink
) { aModifyRefLink
= rLink
; }
275 const Link
& GetModifyRangeHdl() const { return aModifyRefLink
; }
277 void SetRefHdl( const Link
& rLink
) { aRefLink
= rLink
; }
278 const Link
& GetRefHdl() const { return aRefLink
; }
280 void Enable( bool bEnable
= true, bool bChild
= true );
281 void Disable( bool bChild
= true );
283 // } Methods for Calc
287 //==================================================================
289 //==================================================================
291 class SVX_DLLPUBLIC SvxTPView
: public TabPage
296 Link AcceptAllClickLk
;
298 Link RejectAllClickLk
;
301 SvxRedlinTable
* m_pViewData
;
302 PushButton
* m_pAccept
;
303 PushButton
* m_pReject
;
304 PushButton
* m_pAcceptAll
;
305 PushButton
* m_pRejectAll
;
309 bool bEnableAcceptAll
;
311 bool bEnableRejectAll
;
314 DECL_LINK( PbClickHdl
, PushButton
* );
317 SvxTPView(Window
* pParent
);
320 void InsertWriterHeader();
321 void InsertCalcHeader();
322 SvxRedlinTable
* GetTableControl();
324 void EnableAccept(sal_Bool nFlag
=sal_True
);
325 void EnableAcceptAll(sal_Bool nFlag
=sal_True
);
326 void EnableReject(sal_Bool nFlag
=sal_True
);
327 void EnableRejectAll(sal_Bool nFlag
=sal_True
);
328 void EnableUndo(sal_Bool nFlag
=sal_True
);
330 void DisableAccept() {EnableAccept(sal_False
);}
331 void DisableAcceptAll() {EnableAcceptAll(sal_False
);}
332 void DisableReject() {EnableReject(sal_False
);}
333 void DisableRejectAll() {EnableRejectAll(sal_False
);}
334 void DisableUndo() {EnableUndo(sal_False
);}
336 void ShowUndo(sal_Bool nFlag
=sal_True
);
337 void HideUndo() {ShowUndo(sal_False
);}
338 sal_Bool
IsUndoVisible();
340 void SetAcceptClickHdl( const Link
& rLink
) { AcceptClickLk
= rLink
; }
341 const Link
& GetAcceptClickHdl() const { return AcceptClickLk
; }
343 void SetAcceptAllClickHdl( const Link
& rLink
) { AcceptAllClickLk
= rLink
; }
344 const Link
& GetAcceptAllClickHdl() const { return AcceptAllClickLk
; }
346 void SetRejectClickHdl( const Link
& rLink
) { RejectClickLk
= rLink
; }
347 const Link
& GetRejectClickHdl() const { return RejectClickLk
; }
349 void SetRejectAllClickHdl( const Link
& rLink
) { RejectAllClickLk
= rLink
; }
350 const Link
& GetRejectAllClickHdl() const { return RejectAllClickLk
; }
352 void SetUndoClickHdl( const Link
& rLink
) { UndoClickLk
= rLink
; }
353 const Link
& GetUndoAllClickHdl() const { return UndoClickLk
; }
355 virtual void ActivatePage();
356 virtual void DeactivatePage();
359 //==================================================================
360 // Redlining - Control (Accept- Changes)
361 //==================================================================
363 class SVX_DLLPUBLIC SvxAcceptChgCtr
365 , public VclBuilderContainer
369 SvxTPFilter
* pTPFilter
;
372 sal_uInt16 m_nViewPageId
;
373 sal_uInt16 m_nFilterPageId
;
376 SvxAcceptChgCtr(Window
* pParent
);
380 void ShowFilterPage();
383 SvxTPFilter
* GetFilterPage();
384 SvxTPView
* GetViewPage();
385 SvxRedlinTable
* GetViewTable();
389 #endif // INCLUDED_SVX_CTREDLIN_HXX
391 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */