bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / ctredlin.hxx
bloba1eb813c7a2acfc81bb96fb2ff9e3fe91d0f714b
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 <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
50 public:
51 RedlinData();
52 virtual ~RedlinData();
53 sal_Bool bDisabled;
54 DateTime aDateTime;
55 void* pData;
58 class SvxRedlinEntry : public SvTreeListEntry
60 public:
61 SvxRedlinEntry();
62 virtual ~SvxRedlinEntry();
65 // Class for the representation of Strings depending on the font
66 class SvLBoxColorString : public SvLBoxString
68 private:
70 Color aPrivColor;
72 public:
73 SvLBoxColorString( SvTreeListEntry*, sal_uInt16 nFlags, const OUString& rStr,
74 const Color& rCol);
75 SvLBoxColorString();
76 ~SvLBoxColorString();
78 virtual void Paint(
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;
88 private:
90 sal_Bool bIsCalc;
91 sal_uInt16 nDatePos;
92 sal_Bool bAuthor;
93 sal_Bool bDate;
94 sal_Bool bComment;
95 sal_uInt16 nDaTiMode;
96 DateTime aDaTiFirst;
97 DateTime aDaTiLast;
98 DateTime aDaTiFilterFirst;
99 DateTime aDaTiFilterLast;
100 OUString aAuthor;
101 Color aEntryColor;
102 OUString aCurEntry;
103 utl::TextSearch* pCommentSearcher;
104 Link aColCompareLink;
106 protected:
108 virtual sal_Int32 ColCompare(SvTreeListEntry*,SvTreeListEntry*);
109 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
113 public:
115 SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
116 ~SvxRedlinTable();
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 //==================================================================
155 // Filter- Tabpage
156 //==================================================================
157 class SVX_DLLPUBLIC SvxTPFilter: public TabPage
159 private:
161 Link aReadyLink;
162 Link aModifyLink;
163 Link aModifyDateLink;
164 Link aModifyAuthorLink;
165 Link aModifyRefLink;
166 Link aRefLink;
167 Link aModifyComLink;
169 SvxRedlinTable* pRedlinTable;
170 CheckBox* m_pCbDate;
171 ListBox* m_pLbDate;
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;
182 Edit* m_pEdRange;
183 PushButton* m_pBtnRange;
184 CheckBox* m_pCbAction;
185 ListBox* m_pLbAction;
186 CheckBox* m_pCbComment;
187 Edit* m_pEdComment;
188 sal_Bool bModified;
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* );
198 protected:
200 void ShowDateFields(sal_uInt16 nKind);
201 void EnableDateLine1(sal_Bool bFlag);
202 void EnableDateLine2(sal_Bool bFlag);
204 public:
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();
223 void ClearAuthors();
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);
241 sal_Bool IsDate();
242 sal_Bool IsAuthor();
243 sal_Bool IsRange();
244 sal_Bool IsAction();
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 //==================================================================
288 // View- Tabpage
289 //==================================================================
291 class SVX_DLLPUBLIC SvxTPView: public TabPage
293 private:
295 Link AcceptClickLk;
296 Link AcceptAllClickLk;
297 Link RejectClickLk;
298 Link RejectAllClickLk;
299 Link UndoClickLk;
301 SvxRedlinTable* m_pViewData;
302 PushButton* m_pAccept;
303 PushButton* m_pReject;
304 PushButton* m_pAcceptAll;
305 PushButton* m_pRejectAll;
306 PushButton* m_pUndo;
308 bool bEnableAccept;
309 bool bEnableAcceptAll;
310 bool bEnableReject;
311 bool bEnableRejectAll;
312 bool bEnableUndo;
314 DECL_LINK( PbClickHdl, PushButton* );
316 public:
317 SvxTPView(Window * pParent);
318 ~SvxTPView();
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
364 : public TabControl
365 , public VclBuilderContainer
367 private:
369 SvxTPFilter* pTPFilter;
370 SvxTPView* pTPView;
372 sal_uInt16 m_nViewPageId;
373 sal_uInt16 m_nFilterPageId;
375 public:
376 SvxAcceptChgCtr(Window* pParent);
378 ~SvxAcceptChgCtr();
380 void ShowFilterPage();
381 void ShowViewPage();
383 SvxTPFilter* GetFilterPage();
384 SvxTPView* GetViewPage();
385 SvxRedlinTable* GetViewTable();
389 #endif // INCLUDED_SVX_CTREDLIN_HXX
391 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */