xref: /trunk/main/svx/inc/svx/ctredlin.hxx (revision 4d7c9de0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_CTREDLIN_HXX
25 #define _SVX_CTREDLIN_HXX
26 
27 #ifndef _MOREBTN_HXX //autogen
28 #include <vcl/morebtn.hxx>
29 #endif
30 #ifndef _COMBOBOX_HXX //autogen
31 #include <vcl/combobox.hxx>
32 #endif
33 #include <svtools/headbar.hxx>
34 #include <svtools/svtabbx.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/tabpage.hxx>
37 #include <vcl/field.hxx>
38 #include <vcl/fixed.hxx>
39 
40 #ifndef _SVX_SIMPTABL
41 #include <svx/simptabl.hxx>
42 #endif
43 #include <vcl/tabctrl.hxx>
44 #include <tools/datetime.hxx>
45 #include <svtools/txtcmp.hxx>
46 #include "svx/svxdllapi.h"
47 
48 #define FLT_DATE_BEFORE		0
49 #define FLT_DATE_SINCE		1
50 #define FLT_DATE_EQUAL		2
51 #define FLT_DATE_NOTEQUAL	3
52 #define FLT_DATE_BETWEEN	4
53 #define FLT_DATE_SAVE		5
54 
55 
56 //	Struct fuer Datums-Sortierung
57 
58 class SVX_DLLPUBLIC RedlinData
59 {
60 public:
61 					RedlinData();
62 	virtual			~RedlinData();
63 	sal_Bool			bDisabled;
64 	DateTime		aDateTime;
65 	void*			pData;
66 };
67 
68 class SvxRedlinEntry : public SvLBoxEntry
69 {
70 public:
71 					SvxRedlinEntry();
72 		virtual		~SvxRedlinEntry();
73 };
74 
75 // Klasse fuer die Darstellung von schriftabhaengigen Strings
76 class SvLBoxColorString : public SvLBoxString
77 {
78 private:
79 
80 	Color			aPrivColor;
81 
82 public:
83 					SvLBoxColorString( SvLBoxEntry*,sal_uInt16 nFlags,const XubString& rStr,
84 									const Color& rCol);
85 					SvLBoxColorString();
86 					~SvLBoxColorString();
87 
88 	void			Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
89 	SvLBoxItem* 	Create() const;
90 };
91 
92 class SVX_DLLPUBLIC SvxRedlinTable : public SvxSimpleTable
93 {
94 	using SvTabListBox::InsertEntry;
95 
96 private:
97 
98 	sal_Bool			bIsCalc;
99 	sal_uInt16			nDatePos;
100 	sal_Bool			bAuthor;
101 	sal_Bool			bDate;
102 	sal_Bool			bComment;
103 	sal_uInt16			nDaTiMode;
104 	DateTime		aDaTiFirst;
105 	DateTime		aDaTiLast;
106 	DateTime		aDaTiFilterFirst;
107 	DateTime		aDaTiFilterLast;
108 	String			aAuthor;
109 	Color			aEntryColor;
110 	String			aCurEntry;
111 	utl::TextSearch* pCommentSearcher;
112 	Link			aColCompareLink;
113 
114 protected:
115 
116 	virtual StringCompare	ColCompare(SvLBoxEntry*,SvLBoxEntry*);
117 	virtual void			InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind);
118 
119 
120 
121 public:
122 
123 					SvxRedlinTable( Window* pParent,WinBits nBits );
124 					SvxRedlinTable( Window* pParent,const ResId& rResId);
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 	sal_Bool			IsValidCalcEntry(const String& ,RedlinData *pUserData);
144 	sal_Bool			IsValidWriterEntry(const String& ,RedlinData *pUserData);
145 
146 	// keine NULL-Ptr. ueberpruefung {
147 	sal_Bool			IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment);
148 	sal_Bool			IsValidEntry(const String* pAuthor,const DateTime *pDateTime);
149 	sal_Bool			IsValidComment(const String* pComment);
150 	// }
151 
152 	SvLBoxEntry*	InsertEntry(const String& ,RedlinData *pUserData,
153 								SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
154 
155 	SvLBoxEntry*	InsertEntry(const String& ,RedlinData *pUserData,const Color&,
156 								SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
157 
158 
159 	virtual	SvLBoxEntry* CreateEntry() const;
160 
SetColCompareHdl(const Link & rLink)161 	void			SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; }
GetColCompareHdl() const162 	const Link&     GetColCompareHdl() const { return aColCompareLink; }
163 
164 
165 };
166 
167 //==================================================================
168 //	Filter- Tabpage
169 //==================================================================
170 class SVX_DLLPUBLIC SvxTPFilter: public TabPage
171 {
172 private:
173 
174 	Link			aReadyLink;
175 	Link			aModifyLink;
176 	Link			aModifyDateLink;
177 	Link			aModifyAuthorLink;
178 	Link			aModifyRefLink;
179 	Link			aRefLink;
180 	Link			aModifyComLink;
181 
182 	SvxRedlinTable*	pRedlinTable;
183 	CheckBox		aCbDate;
184 	ListBox			aLbDate;
185 	DateField		aDfDate;
186 	TimeField		aTfDate;
187 	ImageButton     aIbClock;
188 	FixedText		aFtDate2;
189 	DateField		aDfDate2;
190 	TimeField		aTfDate2;
191 	ImageButton     aIbClock2;
192 	CheckBox		aCbAuthor;
193 	ListBox			aLbAuthor;
194 	CheckBox		aCbRange;
195 	Edit			aEdRange;
196 	PushButton		aBtnRange;
197 	ListBox			aLbAction;
198 	CheckBox		aCbComment;
199 	Edit			aEdComment;
200 	String			aActionStr;
201 	String			aRangeStr;
202 	String			aStrMyName;
203 	sal_Bool			bModified;
204 
205 	DECL_LINK( SelDateHdl, ListBox* );
206 	DECL_LINK( RowEnableHdl, CheckBox* );
207 	DECL_LINK( TimeHdl, ImageButton* );
208 	DECL_LINK( ModifyHdl, void* );
209 	DECL_LINK( ModifyDate, void* );
210 	DECL_LINK( RefHandle, PushButton* );
211 
212 
213 protected:
214 
215 	void			ShowDateFields(sal_uInt16 nKind);
216 	void			EnableDateLine1(sal_Bool bFlag);
217 	void			EnableDateLine2(sal_Bool bFlag);
218 
219 public:
220 					SvxTPFilter( Window * pParent);
221 
222 	virtual void    DeactivatePage();
223 	void			SetRedlinTable(SvxRedlinTable*);
224 
225 	String			GetMyName() const;
226 	Date			GetFirstDate() const;
227 	void			SetFirstDate(const Date &aDate);
228 	Time			GetFirstTime() const;
229 	void			SetFirstTime(const Time &aTime);
230 
231 	Date			GetLastDate() const;
232 	void			SetLastDate(const Date &aDate);
233 	Time			GetLastTime() const;
234 	void			SetLastTime(const Time &aTime);
235 
236 	void			SetDateMode(sal_uInt16 nMode);
237 	sal_uInt16			GetDateMode();
238 
239 	void			ClearAuthors();
240 	void			InsertAuthor( const String& rString, sal_uInt16 nPos = LISTBOX_APPEND );
241 	sal_uInt16			GetSelectedAuthorPos();
242 	String			GetSelectedAuthor()const;
243 	void			SelectedAuthorPos(sal_uInt16 nPos);
244 	sal_uInt16			SelectAuthor(const String& aString);
245 	void			SetComment(const String &rComment);
246 	String			GetComment()const;
247 
248 
249 	// Methoden fuer Calc {
250 	void			SetRange(const String& rString);
251 	String			GetRange() const;
252 	void			HideRange(sal_Bool bHide=sal_True);
253 	void			DisableRange(sal_Bool bFlag=sal_True);
254 	void			SetFocusToRange();
255 	// } Methoden fuer Calc
256 
257 	void			HideClocks(sal_Bool bHide=sal_True);
258 	void			DisableRef(sal_Bool bFlag);
259 
260 	sal_Bool			IsDate();
261 	sal_Bool			IsAuthor();
262 	sal_Bool			IsRange();
263 	sal_Bool			IsAction();
264 	sal_Bool			IsComment();
265 
266 	void			ShowAction(sal_Bool bShow=sal_True);
267 
268 	void			CheckDate(sal_Bool bFlag=sal_True);
269 	void			CheckAuthor(sal_Bool bFlag=sal_True);
270 	void			CheckRange(sal_Bool bFlag=sal_True);
271 	void			CheckAction(sal_Bool bFlag=sal_True);
272 	void			CheckComment(sal_Bool bFlag=sal_True);
273 
274 	ListBox*		GetLbAction();
275 
SetReadyHdl(const Link & rLink)276 	void            SetReadyHdl( const Link& rLink ) { aReadyLink= rLink; }
GetReadyHdl() const277 	const Link&     GetReadyHdl() const { return aReadyLink; }
278 
SetModifyHdl(const Link & rLink)279 	void            SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
GetModifyHdl() const280 	const Link&     GetModifyHdl() const { return aModifyLink; }
281 
SetModifyDateHdl(const Link & rLink)282 	void            SetModifyDateHdl( const Link& rLink ) { aModifyDateLink = rLink; }
GetModifyDateHdl() const283 	const Link&     GetModifyDateHdl() const { return aModifyDateLink; }
284 
SetModifyAuthorHdl(const Link & rLink)285 	void            SetModifyAuthorHdl( const Link& rLink ) { aModifyAuthorLink = rLink; }
GetModifyAuthorHdl() const286 	const Link&     GetModifyAuthorHdl() const { return aModifyAuthorLink; }
287 
SetModifyCommentHdl(const Link & rLink)288 	void			SetModifyCommentHdl(const Link& rLink ) { aModifyComLink = rLink; }
GetModifyCommentHdl() const289 	const Link&     GetModifyCommentHdl() const { return aModifyComLink; }
290 
291 
292 	// Methoden fuer Calc {
SetModifyRangeHdl(const Link & rLink)293 	void            SetModifyRangeHdl( const Link& rLink ) { aModifyRefLink = rLink; }
GetModifyRangeHdl() const294 	const Link&     GetModifyRangeHdl() const { return aModifyRefLink; }
295 
SetRefHdl(const Link & rLink)296 	void            SetRefHdl( const Link& rLink ) { aRefLink = rLink; }
GetRefHdl() const297 	const Link&     GetRefHdl() const { return aRefLink; }
298 
299 	void			Enable( bool bEnable = true, bool bChild = true );
300 	void			Disable( bool bChild = true );
301 
302 	void			SetAccessibleRelationMemberOf( Window* pWindow);
303 
304 	// } Methoden fuer Calc
305 };
306 
307 
308 //==================================================================
309 //	View- Tabpage
310 //==================================================================
311 
312 class SVX_DLLPUBLIC SvxTPView: public TabPage
313 {
314 private:
315 
316 	Link			AcceptClickLk;
317 	Link			AcceptAllClickLk;
318 	Link			RejectClickLk;
319 	Link			RejectAllClickLk;
320 	Link			UndoClickLk;
321 
322 	SvxRedlinTable 	aViewData;
323 	PushButton		PbAccept;
324 	PushButton		PbReject;
325 	PushButton		PbAcceptAll;
326 	PushButton		PbRejectAll;
327 	PushButton		PbUndo;
328 	String			aTitle1;
329 	String			aTitle2;
330 	String			aTitle3;
331 	String			aTitle4;
332 	String			aTitle5;
333 	String			aStrMyName;
334 	long			nDistance;
335 	Size			aMinSize;
336 
337 	DECL_LINK( PbClickHdl, PushButton* );
338 
339 
340 protected:
341 
342 	void			Resize();
343 
344 public:
345 					SvxTPView( Window * pParent);
346 
347 	String			GetMyName() const;
348 
349 	void			InsertWriterHeader();
350 	void			InsertCalcHeader();
351 	SvxRedlinTable* GetTableControl();
352 
353 	void			EnableAccept(sal_Bool nFlag=sal_True);
354 	void			EnableAcceptAll(sal_Bool nFlag=sal_True);
355 	void			EnableReject(sal_Bool nFlag=sal_True);
356 	void			EnableRejectAll(sal_Bool nFlag=sal_True);
357 	void			EnableUndo(sal_Bool nFlag=sal_True);
358 
DisableAccept()359 	void			DisableAccept()		{EnableAccept(sal_False);}
DisableAcceptAll()360 	void			DisableAcceptAll()	{EnableAcceptAll(sal_False);}
DisableReject()361 	void			DisableReject()		{EnableReject(sal_False);}
DisableRejectAll()362 	void			DisableRejectAll()	{EnableRejectAll(sal_False);}
DisableUndo()363 	void			DisableUndo()		{EnableUndo(sal_False);}
364 
365 	void			ShowUndo(sal_Bool nFlag=sal_True);
HideUndo()366 	void			HideUndo()			{ShowUndo(sal_False);}
367 	sal_Bool			IsUndoVisible();
368 
369 	Size			GetMinSizePixel();
370 
SetAcceptClickHdl(const Link & rLink)371 	void            SetAcceptClickHdl( const Link& rLink ) { AcceptClickLk = rLink; }
GetAcceptClickHdl() const372 	const Link&     GetAcceptClickHdl() const { return AcceptClickLk; }
373 
SetAcceptAllClickHdl(const Link & rLink)374 	void            SetAcceptAllClickHdl( const Link& rLink ) { AcceptAllClickLk = rLink; }
GetAcceptAllClickHdl() const375 	const Link&     GetAcceptAllClickHdl() const { return AcceptAllClickLk; }
376 
SetRejectClickHdl(const Link & rLink)377 	void            SetRejectClickHdl( const Link& rLink ) { RejectClickLk = rLink; }
GetRejectClickHdl() const378 	const Link&     GetRejectClickHdl() const { return RejectClickLk; }
379 
SetRejectAllClickHdl(const Link & rLink)380 	void            SetRejectAllClickHdl( const Link& rLink ) { RejectAllClickLk = rLink; }
GetRejectAllClickHdl() const381 	const Link&     GetRejectAllClickHdl() const { return RejectAllClickLk; }
382 
SetUndoClickHdl(const Link & rLink)383 	void            SetUndoClickHdl( const Link& rLink ) { UndoClickLk = rLink; }
GetUndoAllClickHdl() const384 	const Link&     GetUndoAllClickHdl() const { return UndoClickLk; }
385 };
386 
387 //==================================================================
388 //	Redlining - Control (Accept- Changes)
389 //==================================================================
390 
391 class SVX_DLLPUBLIC SvxAcceptChgCtr : public Control
392 {
393 private:
394 
395 	Link			aMinSizeLink;
396 	TabControl		aTCAccept;
397 	SvxTPFilter*	pTPFilter;
398 	SvxTPView*		pTPView;
399 	Size			aMinSize;
400 
401 protected:
402 
403 	virtual void	Resize();
404 
405 public:
406 					SvxAcceptChgCtr( Window* pParent, WinBits nWinStyle = 0 );
407 					SvxAcceptChgCtr( Window* pParent, const ResId& rResId );
408 
409 					~SvxAcceptChgCtr();
410 
411 	Size			GetMinSizePixel() const;
412 
413 	void			ShowFilterPage();
414 	void			ShowViewPage();
415 
416 	sal_Bool			IsFilterPageVisible();
417 	sal_Bool			IsViewPageVisible();
418 
419 	SvxTPFilter*	GetFilterPage();
420 	SvxTPView*		GetViewPage();
421 	SvxRedlinTable* GetViewTable();
422 
SetMinSizeHdl(const Link & rLink)423 	void            SetMinSizeHdl( const Link& rLink ) { aMinSizeLink= rLink; }
GetMinSizeHdl() const424 	const Link&     GetMinSizeHdl() const { return aMinSizeLink; }
425 };
426 
427 
428 #endif // _SVX_CTREDLIN_HXX
429 
430