bump product version to 4.1.6.2
[LibreOffice.git] / include / svx / ctredlin.hxx
blobe8cb58b5937a10542982dca32b0f4b173e38792c
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 _SVX_CTREDLIN_HXX
21 #define _SVX_CTREDLIN_HXX
23 #include <vcl/morebtn.hxx>
24 #include <vcl/combobox.hxx>
25 #include <svtools/headbar.hxx>
26 #include <svtools/svtabbx.hxx>
27 #include "svtools/svlbitm.hxx"
28 #include <vcl/lstbox.hxx>
29 #include <vcl/tabpage.hxx>
30 #include <vcl/field.hxx>
31 #include <vcl/fixed.hxx>
33 #ifndef _SVX_SIMPTABL
34 #include <svx/simptabl.hxx>
35 #endif
36 #include <vcl/tabctrl.hxx>
37 #include <tools/datetime.hxx>
38 #include <unotools/textsearch.hxx>
39 #include "svtools/treelistentry.hxx"
40 #include "svx/svxdllapi.h"
42 #define FLT_DATE_BEFORE 0
43 #define FLT_DATE_SINCE 1
44 #define FLT_DATE_EQUAL 2
45 #define FLT_DATE_NOTEQUAL 3
46 #define FLT_DATE_BETWEEN 4
47 #define FLT_DATE_SAVE 5
50 // Struct for sorting data
52 class SVX_DLLPUBLIC RedlinData
54 public:
55 RedlinData();
56 virtual ~RedlinData();
57 sal_Bool bDisabled;
58 DateTime aDateTime;
59 void* pData;
62 class SvxRedlinEntry : public SvTreeListEntry
64 public:
65 SvxRedlinEntry();
66 virtual ~SvxRedlinEntry();
69 // Class for the representation of Strings depending on the font
70 class SvLBoxColorString : public SvLBoxString
72 private:
74 Color aPrivColor;
76 public:
77 SvLBoxColorString( SvTreeListEntry*,sal_uInt16 nFlags,const XubString& rStr,
78 const Color& rCol);
79 SvLBoxColorString();
80 ~SvLBoxColorString();
82 virtual void Paint(
83 const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
85 SvLBoxItem* Create() const;
88 class SVX_DLLPUBLIC SvxRedlinTable : public SvxSimpleTable
90 using SvTabListBox::InsertEntry;
92 private:
94 sal_Bool bIsCalc;
95 sal_uInt16 nDatePos;
96 sal_Bool bAuthor;
97 sal_Bool bDate;
98 sal_Bool bComment;
99 sal_uInt16 nDaTiMode;
100 DateTime aDaTiFirst;
101 DateTime aDaTiLast;
102 DateTime aDaTiFilterFirst;
103 DateTime aDaTiFilterLast;
104 String aAuthor;
105 Color aEntryColor;
106 String aCurEntry;
107 utl::TextSearch* pCommentSearcher;
108 Link aColCompareLink;
110 protected:
112 virtual StringCompare ColCompare(SvTreeListEntry*,SvTreeListEntry*);
113 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
117 public:
119 SvxRedlinTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
120 ~SvxRedlinTable();
122 // For FilterPage only {
123 void SetFilterDate(sal_Bool bFlag=sal_True);
124 void SetDateTimeMode(sal_uInt16 nMode);
125 void SetFirstDate(const Date&);
126 void SetLastDate(const Date&);
127 void SetFirstTime(const Time&);
128 void SetLastTime(const Time&);
129 void SetFilterAuthor(sal_Bool bFlag=sal_True);
130 void SetAuthor(const String &);
131 void SetFilterComment(sal_Bool bFlag=sal_True);
132 void SetCommentParams( const utl::SearchParam* pSearchPara );
134 void UpdateFilterTest();
135 // } For FilterPage only
137 void SetCalcView(sal_Bool bFlag=sal_True);
139 // no NULL-pointer checking {
140 sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment);
141 sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime);
142 sal_Bool IsValidComment(const String* pComment);
143 // }
145 SvTreeListEntry* InsertEntry(const String& ,RedlinData *pUserData,
146 SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
148 SvTreeListEntry* InsertEntry(const String& ,RedlinData *pUserData,const Color&,
149 SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
152 virtual SvTreeListEntry* CreateEntry() const;
154 void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; }
155 const Link& GetColCompareHdl() const { return aColCompareLink; }
160 //==================================================================
161 // Filter- Tabpage
162 //==================================================================
163 class SVX_DLLPUBLIC SvxTPFilter: public TabPage
165 private:
167 Link aReadyLink;
168 Link aModifyLink;
169 Link aModifyDateLink;
170 Link aModifyAuthorLink;
171 Link aModifyRefLink;
172 Link aRefLink;
173 Link aModifyComLink;
175 SvxRedlinTable* pRedlinTable;
176 CheckBox* m_pCbDate;
177 ListBox* m_pLbDate;
178 DateField* m_pDfDate;
179 TimeField* m_pTfDate;
180 PushButton* m_pIbClock;
181 FixedText* m_pFtDate2;
182 DateField* m_pDfDate2;
183 TimeField* m_pTfDate2;
184 PushButton* m_pIbClock2;
185 CheckBox* m_pCbAuthor;
186 ListBox* m_pLbAuthor;
187 CheckBox* m_pCbRange;
188 Edit* m_pEdRange;
189 PushButton* m_pBtnRange;
190 CheckBox* m_pCbAction;
191 ListBox* m_pLbAction;
192 CheckBox* m_pCbComment;
193 Edit* m_pEdComment;
194 sal_Bool bModified;
196 DECL_LINK( SelDateHdl, ListBox* );
197 DECL_LINK( RowEnableHdl, CheckBox* );
198 DECL_LINK( TimeHdl, ImageButton* );
199 DECL_LINK( ModifyHdl, void* );
200 DECL_LINK( ModifyDate, void* );
201 DECL_LINK( RefHandle, PushButton* );
204 protected:
206 void ShowDateFields(sal_uInt16 nKind);
207 void EnableDateLine1(sal_Bool bFlag);
208 void EnableDateLine2(sal_Bool bFlag);
210 public:
211 SvxTPFilter( Window * pParent);
213 virtual void DeactivatePage();
214 void SetRedlinTable(SvxRedlinTable*);
216 Date GetFirstDate() const;
217 void SetFirstDate(const Date &aDate);
218 Time GetFirstTime() const;
219 void SetFirstTime(const Time &aTime);
221 Date GetLastDate() const;
222 void SetLastDate(const Date &aDate);
223 Time GetLastTime() const;
224 void SetLastTime(const Time &aTime);
226 void SetDateMode(sal_uInt16 nMode);
227 sal_uInt16 GetDateMode();
229 void ClearAuthors();
230 void InsertAuthor( const String& rString, sal_uInt16 nPos = LISTBOX_APPEND );
231 String GetSelectedAuthor()const;
232 void SelectedAuthorPos(sal_uInt16 nPos);
233 sal_uInt16 SelectAuthor(const String& aString);
234 void SetComment(const String &rComment);
235 String GetComment()const;
238 // Methods for Calc {
239 void SetRange(const String& rString);
240 String GetRange() const;
241 void HideRange(sal_Bool bHide=sal_True);
242 void SetFocusToRange();
243 // } Methods for Calc
245 void DisableRef(sal_Bool bFlag);
247 sal_Bool IsDate();
248 sal_Bool IsAuthor();
249 sal_Bool IsRange();
250 sal_Bool IsAction();
251 sal_Bool IsComment();
253 void ShowAction(sal_Bool bShow=sal_True);
255 void CheckDate(sal_Bool bFlag=sal_True);
256 void CheckAuthor(sal_Bool bFlag=sal_True);
257 void CheckRange(sal_Bool bFlag=sal_True);
258 void CheckAction(sal_Bool bFlag=sal_True);
259 void CheckComment(sal_Bool bFlag=sal_True);
261 ListBox* GetLbAction();
263 void SetReadyHdl( const Link& rLink ) { aReadyLink= rLink; }
264 const Link& GetReadyHdl() const { return aReadyLink; }
266 void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
267 const Link& GetModifyHdl() const { return aModifyLink; }
269 void SetModifyDateHdl( const Link& rLink ) { aModifyDateLink = rLink; }
270 const Link& GetModifyDateHdl() const { return aModifyDateLink; }
272 void SetModifyAuthorHdl( const Link& rLink ) { aModifyAuthorLink = rLink; }
273 const Link& GetModifyAuthorHdl() const { return aModifyAuthorLink; }
275 void SetModifyCommentHdl(const Link& rLink ) { aModifyComLink = rLink; }
276 const Link& GetModifyCommentHdl() const { return aModifyComLink; }
279 // Methods for Calc {
280 void SetModifyRangeHdl( const Link& rLink ) { aModifyRefLink = rLink; }
281 const Link& GetModifyRangeHdl() const { return aModifyRefLink; }
283 void SetRefHdl( const Link& rLink ) { aRefLink = rLink; }
284 const Link& GetRefHdl() const { return aRefLink; }
286 void Enable( bool bEnable = true, bool bChild = true );
287 void Disable( bool bChild = true );
289 // } Methods for Calc
293 //==================================================================
294 // View- Tabpage
295 //==================================================================
297 class SVX_DLLPUBLIC SvxTPView: public TabPage
299 private:
301 Link AcceptClickLk;
302 Link AcceptAllClickLk;
303 Link RejectClickLk;
304 Link RejectAllClickLk;
305 Link UndoClickLk;
307 SvxRedlinTable* m_pViewData;
308 PushButton* m_pAccept;
309 PushButton* m_pReject;
310 PushButton* m_pAcceptAll;
311 PushButton* m_pRejectAll;
312 PushButton* m_pUndo;
314 bool bEnableAccept;
315 bool bEnableAcceptAll;
316 bool bEnableReject;
317 bool bEnableRejectAll;
318 bool bEnableUndo;
320 DECL_LINK( PbClickHdl, PushButton* );
322 public:
323 SvxTPView(Window * pParent);
324 ~SvxTPView();
326 void InsertWriterHeader();
327 void InsertCalcHeader();
328 SvxRedlinTable* GetTableControl();
330 void EnableAccept(sal_Bool nFlag=sal_True);
331 void EnableAcceptAll(sal_Bool nFlag=sal_True);
332 void EnableReject(sal_Bool nFlag=sal_True);
333 void EnableRejectAll(sal_Bool nFlag=sal_True);
334 void EnableUndo(sal_Bool nFlag=sal_True);
336 void DisableAccept() {EnableAccept(sal_False);}
337 void DisableAcceptAll() {EnableAcceptAll(sal_False);}
338 void DisableReject() {EnableReject(sal_False);}
339 void DisableRejectAll() {EnableRejectAll(sal_False);}
340 void DisableUndo() {EnableUndo(sal_False);}
342 void ShowUndo(sal_Bool nFlag=sal_True);
343 void HideUndo() {ShowUndo(sal_False);}
344 sal_Bool IsUndoVisible();
346 void SetAcceptClickHdl( const Link& rLink ) { AcceptClickLk = rLink; }
347 const Link& GetAcceptClickHdl() const { return AcceptClickLk; }
349 void SetAcceptAllClickHdl( const Link& rLink ) { AcceptAllClickLk = rLink; }
350 const Link& GetAcceptAllClickHdl() const { return AcceptAllClickLk; }
352 void SetRejectClickHdl( const Link& rLink ) { RejectClickLk = rLink; }
353 const Link& GetRejectClickHdl() const { return RejectClickLk; }
355 void SetRejectAllClickHdl( const Link& rLink ) { RejectAllClickLk = rLink; }
356 const Link& GetRejectAllClickHdl() const { return RejectAllClickLk; }
358 void SetUndoClickHdl( const Link& rLink ) { UndoClickLk = rLink; }
359 const Link& GetUndoAllClickHdl() const { return UndoClickLk; }
361 virtual void ActivatePage();
362 virtual void DeactivatePage();
365 //==================================================================
366 // Redlining - Control (Accept- Changes)
367 //==================================================================
369 class SVX_DLLPUBLIC SvxAcceptChgCtr
370 : public TabControl
371 , public VclBuilderContainer
373 private:
375 SvxTPFilter* pTPFilter;
376 SvxTPView* pTPView;
378 sal_uInt16 m_nViewPageId;
379 sal_uInt16 m_nFilterPageId;
381 public:
382 SvxAcceptChgCtr(Window* pParent);
384 ~SvxAcceptChgCtr();
386 void ShowFilterPage();
387 void ShowViewPage();
389 SvxTPFilter* GetFilterPage();
390 SvxTPView* GetViewPage();
391 SvxRedlinTable* GetViewTable();
395 #endif // _SVX_CTREDLIN_HXX
397 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */