Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVX_CTREDLIN_HXX
30 : : #define _SVX_CTREDLIN_HXX
31 : :
32 : : #include <vcl/morebtn.hxx>
33 : : #include <vcl/combobox.hxx>
34 : : #include <svtools/headbar.hxx>
35 : : #include <svtools/svtabbx.hxx>
36 : : #include <vcl/lstbox.hxx>
37 : : #include <vcl/tabpage.hxx>
38 : : #include <vcl/field.hxx>
39 : : #include <vcl/fixed.hxx>
40 : :
41 : : #ifndef _SVX_SIMPTABL
42 : : #include <svx/simptabl.hxx>
43 : : #endif
44 : : #include <vcl/tabctrl.hxx>
45 : : #include <tools/datetime.hxx>
46 : : #include <svtools/txtcmp.hxx>
47 : : #include "svx/svxdllapi.h"
48 : :
49 : : #define FLT_DATE_BEFORE 0
50 : : #define FLT_DATE_SINCE 1
51 : : #define FLT_DATE_EQUAL 2
52 : : #define FLT_DATE_NOTEQUAL 3
53 : : #define FLT_DATE_BETWEEN 4
54 : : #define FLT_DATE_SAVE 5
55 : :
56 : :
57 : : // Struct for sorting data
58 : :
59 : : class SVX_DLLPUBLIC RedlinData
60 : : {
61 : : public:
62 : : RedlinData();
63 : : virtual ~RedlinData();
64 : : sal_Bool bDisabled;
65 : : DateTime aDateTime;
66 : : void* pData;
67 : : };
68 : :
69 : : class SvxRedlinEntry : public SvLBoxEntry
70 : : {
71 : : public:
72 : : SvxRedlinEntry();
73 : : virtual ~SvxRedlinEntry();
74 : : };
75 : :
76 : : // Class for the representation of Strings depending on the font
77 : : class SvLBoxColorString : public SvLBoxString
78 : : {
79 : : private:
80 : :
81 : : Color aPrivColor;
82 : :
83 : : public:
84 : : SvLBoxColorString( SvLBoxEntry*,sal_uInt16 nFlags,const XubString& rStr,
85 : : const Color& rCol);
86 : : SvLBoxColorString();
87 : : ~SvLBoxColorString();
88 : :
89 : : void Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
90 : : SvLBoxItem* Create() const;
91 : : };
92 : :
93 : : class SVX_DLLPUBLIC SvxRedlinTable : public SvxSimpleTable
94 : : {
95 : : using SvTabListBox::InsertEntry;
96 : :
97 : : private:
98 : :
99 : : sal_Bool bIsCalc;
100 : : sal_uInt16 nDatePos;
101 : : sal_Bool bAuthor;
102 : : sal_Bool bDate;
103 : : sal_Bool bComment;
104 : : sal_uInt16 nDaTiMode;
105 : : DateTime aDaTiFirst;
106 : : DateTime aDaTiLast;
107 : : DateTime aDaTiFilterFirst;
108 : : DateTime aDaTiFilterLast;
109 : : String aAuthor;
110 : : Color aEntryColor;
111 : : String aCurEntry;
112 : : utl::TextSearch* pCommentSearcher;
113 : : Link aColCompareLink;
114 : :
115 : : protected:
116 : :
117 : : virtual StringCompare ColCompare(SvLBoxEntry*,SvLBoxEntry*);
118 : : virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind);
119 : :
120 : :
121 : :
122 : : public:
123 : :
124 : : SvxRedlinTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
125 : : ~SvxRedlinTable();
126 : :
127 : : // For FilterPage only {
128 : : void SetFilterDate(sal_Bool bFlag=sal_True);
129 : : void SetDateTimeMode(sal_uInt16 nMode);
130 : : void SetFirstDate(const Date&);
131 : : void SetLastDate(const Date&);
132 : : void SetFirstTime(const Time&);
133 : : void SetLastTime(const Time&);
134 : : void SetFilterAuthor(sal_Bool bFlag=sal_True);
135 : : void SetAuthor(const String &);
136 : : void SetFilterComment(sal_Bool bFlag=sal_True);
137 : : void SetCommentParams( const utl::SearchParam* pSearchPara );
138 : :
139 : : void UpdateFilterTest();
140 : : // } For FilterPage only
141 : :
142 : : void SetCalcView(sal_Bool bFlag=sal_True);
143 : :
144 : : // no NULL-pointer checking {
145 : : sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment);
146 : : sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime);
147 : : sal_Bool IsValidComment(const String* pComment);
148 : : // }
149 : :
150 : : SvLBoxEntry* InsertEntry(const String& ,RedlinData *pUserData,
151 : : SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
152 : :
153 : : SvLBoxEntry* InsertEntry(const String& ,RedlinData *pUserData,const Color&,
154 : : SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
155 : :
156 : :
157 : : virtual SvLBoxEntry* CreateEntry() const;
158 : :
159 : 0 : void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; }
160 : : const Link& GetColCompareHdl() const { return aColCompareLink; }
161 : :
162 : :
163 : : };
164 : :
165 : : //==================================================================
166 : : // Filter- Tabpage
167 : : //==================================================================
168 [ # # ][ # # ]: 0 : class SVX_DLLPUBLIC SvxTPFilter: public TabPage
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
169 : : {
170 : : private:
171 : :
172 : : Link aReadyLink;
173 : : Link aModifyLink;
174 : : Link aModifyDateLink;
175 : : Link aModifyAuthorLink;
176 : : Link aModifyRefLink;
177 : : Link aRefLink;
178 : : Link aModifyComLink;
179 : :
180 : : SvxRedlinTable* pRedlinTable;
181 : : CheckBox aCbDate;
182 : : ListBox aLbDate;
183 : : DateField aDfDate;
184 : : TimeField aTfDate;
185 : : ImageButton aIbClock;
186 : : FixedText aFtDate2;
187 : : DateField aDfDate2;
188 : : TimeField aTfDate2;
189 : : ImageButton aIbClock2;
190 : : CheckBox aCbAuthor;
191 : : ListBox aLbAuthor;
192 : : CheckBox aCbRange;
193 : : Edit aEdRange;
194 : : PushButton aBtnRange;
195 : : ListBox aLbAction;
196 : : CheckBox aCbComment;
197 : : Edit aEdComment;
198 : : String aActionStr;
199 : : String aRangeStr;
200 : : String aStrMyName;
201 : : sal_Bool bModified;
202 : :
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* );
209 : :
210 : :
211 : : protected:
212 : :
213 : : void ShowDateFields(sal_uInt16 nKind);
214 : : void EnableDateLine1(sal_Bool bFlag);
215 : : void EnableDateLine2(sal_Bool bFlag);
216 : :
217 : : public:
218 : : SvxTPFilter( Window * pParent);
219 : :
220 : : virtual void DeactivatePage();
221 : : void SetRedlinTable(SvxRedlinTable*);
222 : :
223 : : String GetMyName() const;
224 : : Date GetFirstDate() const;
225 : : void SetFirstDate(const Date &aDate);
226 : : Time GetFirstTime() const;
227 : : void SetFirstTime(const Time &aTime);
228 : :
229 : : Date GetLastDate() const;
230 : : void SetLastDate(const Date &aDate);
231 : : Time GetLastTime() const;
232 : : void SetLastTime(const Time &aTime);
233 : :
234 : : void SetDateMode(sal_uInt16 nMode);
235 : : sal_uInt16 GetDateMode();
236 : :
237 : : void ClearAuthors();
238 : : void InsertAuthor( const String& rString, sal_uInt16 nPos = LISTBOX_APPEND );
239 : : String GetSelectedAuthor()const;
240 : : void SelectedAuthorPos(sal_uInt16 nPos);
241 : : sal_uInt16 SelectAuthor(const String& aString);
242 : : void SetComment(const String &rComment);
243 : : String GetComment()const;
244 : :
245 : :
246 : : // Methods for Calc {
247 : : void SetRange(const String& rString);
248 : : String GetRange() const;
249 : : void HideRange(sal_Bool bHide=sal_True);
250 : : void SetFocusToRange();
251 : : // } Methods for Calc
252 : :
253 : : void DisableRef(sal_Bool bFlag);
254 : :
255 : : sal_Bool IsDate();
256 : : sal_Bool IsAuthor();
257 : : sal_Bool IsRange();
258 : : sal_Bool IsAction();
259 : : sal_Bool IsComment();
260 : :
261 : : void ShowAction(sal_Bool bShow=sal_True);
262 : :
263 : : void CheckDate(sal_Bool bFlag=sal_True);
264 : : void CheckAuthor(sal_Bool bFlag=sal_True);
265 : : void CheckRange(sal_Bool bFlag=sal_True);
266 : : void CheckAction(sal_Bool bFlag=sal_True);
267 : : void CheckComment(sal_Bool bFlag=sal_True);
268 : :
269 : : ListBox* GetLbAction();
270 : :
271 : 0 : void SetReadyHdl( const Link& rLink ) { aReadyLink= rLink; }
272 : : const Link& GetReadyHdl() const { return aReadyLink; }
273 : :
274 : 0 : void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
275 : : const Link& GetModifyHdl() const { return aModifyLink; }
276 : :
277 : : void SetModifyDateHdl( const Link& rLink ) { aModifyDateLink = rLink; }
278 : : const Link& GetModifyDateHdl() const { return aModifyDateLink; }
279 : :
280 : : void SetModifyAuthorHdl( const Link& rLink ) { aModifyAuthorLink = rLink; }
281 : : const Link& GetModifyAuthorHdl() const { return aModifyAuthorLink; }
282 : :
283 : : void SetModifyCommentHdl(const Link& rLink ) { aModifyComLink = rLink; }
284 : : const Link& GetModifyCommentHdl() const { return aModifyComLink; }
285 : :
286 : :
287 : : // Methods for Calc {
288 : : void SetModifyRangeHdl( const Link& rLink ) { aModifyRefLink = rLink; }
289 : : const Link& GetModifyRangeHdl() const { return aModifyRefLink; }
290 : :
291 : 0 : void SetRefHdl( const Link& rLink ) { aRefLink = rLink; }
292 : : const Link& GetRefHdl() const { return aRefLink; }
293 : :
294 : : void Enable( bool bEnable = true, bool bChild = true );
295 : : void Disable( bool bChild = true );
296 : :
297 : : // } Methods for Calc
298 : : };
299 : :
300 : :
301 : : //==================================================================
302 : : // View- Tabpage
303 : : //==================================================================
304 : :
305 : : class SVX_DLLPUBLIC SvxTPView: public TabPage
306 : : {
307 : : private:
308 : :
309 : : Link AcceptClickLk;
310 : : Link AcceptAllClickLk;
311 : : Link RejectClickLk;
312 : : Link RejectAllClickLk;
313 : : Link UndoClickLk;
314 : :
315 : : SvxSimpleTableContainer m_aViewDataContainer;
316 : : SvxRedlinTable aViewData;
317 : : PushButton PbAccept;
318 : : PushButton PbReject;
319 : : PushButton PbAcceptAll;
320 : : PushButton PbRejectAll;
321 : : PushButton PbUndo;
322 : : String aTitle1;
323 : : String aTitle2;
324 : : String aTitle3;
325 : : String aTitle4;
326 : : String aTitle5;
327 : : String aStrMyName;
328 : : long nDistance;
329 : : Size aMinSize;
330 : :
331 : : DECL_LINK( PbClickHdl, PushButton* );
332 : :
333 : :
334 : : protected:
335 : :
336 : : void Resize();
337 : :
338 : : public:
339 : : SvxTPView( Window * pParent);
340 : :
341 : : String GetMyName() const;
342 : :
343 : : void InsertWriterHeader();
344 : : void InsertCalcHeader();
345 : : SvxRedlinTable* GetTableControl();
346 : :
347 : : void EnableAccept(sal_Bool nFlag=sal_True);
348 : : void EnableAcceptAll(sal_Bool nFlag=sal_True);
349 : : void EnableReject(sal_Bool nFlag=sal_True);
350 : : void EnableRejectAll(sal_Bool nFlag=sal_True);
351 : : void EnableUndo(sal_Bool nFlag=sal_True);
352 : :
353 : : void DisableAccept() {EnableAccept(sal_False);}
354 : : void DisableAcceptAll() {EnableAcceptAll(sal_False);}
355 : : void DisableReject() {EnableReject(sal_False);}
356 : : void DisableRejectAll() {EnableRejectAll(sal_False);}
357 : 0 : void DisableUndo() {EnableUndo(sal_False);}
358 : :
359 : : void ShowUndo(sal_Bool nFlag=sal_True);
360 : : void HideUndo() {ShowUndo(sal_False);}
361 : : sal_Bool IsUndoVisible();
362 : :
363 : : Size GetMinSizePixel();
364 : :
365 : 0 : void SetAcceptClickHdl( const Link& rLink ) { AcceptClickLk = rLink; }
366 : : const Link& GetAcceptClickHdl() const { return AcceptClickLk; }
367 : :
368 : 0 : void SetAcceptAllClickHdl( const Link& rLink ) { AcceptAllClickLk = rLink; }
369 : : const Link& GetAcceptAllClickHdl() const { return AcceptAllClickLk; }
370 : :
371 : 0 : void SetRejectClickHdl( const Link& rLink ) { RejectClickLk = rLink; }
372 : : const Link& GetRejectClickHdl() const { return RejectClickLk; }
373 : :
374 : 0 : void SetRejectAllClickHdl( const Link& rLink ) { RejectAllClickLk = rLink; }
375 : : const Link& GetRejectAllClickHdl() const { return RejectAllClickLk; }
376 : :
377 : 0 : void SetUndoClickHdl( const Link& rLink ) { UndoClickLk = rLink; }
378 : : const Link& GetUndoAllClickHdl() const { return UndoClickLk; }
379 : : };
380 : :
381 : : //==================================================================
382 : : // Redlining - Control (Accept- Changes)
383 : : //==================================================================
384 : :
385 : : class SVX_DLLPUBLIC SvxAcceptChgCtr : public Control
386 : : {
387 : : private:
388 : :
389 : : Link aMinSizeLink;
390 : : TabControl aTCAccept;
391 : : SvxTPFilter* pTPFilter;
392 : : SvxTPView* pTPView;
393 : : Size aMinSize;
394 : :
395 : : protected:
396 : :
397 : : virtual void Resize();
398 : :
399 : : public:
400 : : SvxAcceptChgCtr( Window* pParent, const ResId& rResId );
401 : :
402 : : ~SvxAcceptChgCtr();
403 : :
404 : : Size GetMinSizePixel() const;
405 : :
406 : : void ShowFilterPage();
407 : : void ShowViewPage();
408 : :
409 : : SvxTPFilter* GetFilterPage();
410 : : SvxTPView* GetViewPage();
411 : : SvxRedlinTable* GetViewTable();
412 : :
413 : 0 : void SetMinSizeHdl( const Link& rLink ) { aMinSizeLink= rLink; }
414 : : const Link& GetMinSizeHdl() const { return aMinSizeLink; }
415 : : };
416 : :
417 : :
418 : : #endif // _SVX_CTREDLIN_HXX
419 : :
420 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|