1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ctredlin.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // System - Includes ---------------------------------------------------------
35 #include <vcl/svapp.hxx>
36 #include <tools/shl.hxx>
37 #include <sfx2/app.hxx>
38 #include <sfx2/module.hxx>
39 #include <svtools/txtcmp.hxx>
40 #include <unotools/charclass.hxx>
41 // INCLUDE -------------------------------------------------------------------
42 #include <unolingu.hxx>
43 #include <svx/dialmgr.hxx>
44 #include "ctredlin.hrc"
45 #include <svx/ctredlin.hxx>
48 //============================================================================
49 // Local Defines and Function
50 //----------------------------------------------------------------------------
52 inline void EnableDisable( Window
& rWin
, BOOL bEnable
)
60 static long nStaticTabs
[]=
65 #define MIN_DISTANCE 6
66 #define WRITER_AUTHOR 1
71 RedlinData::RedlinData()
76 RedlinData::~RedlinData()
80 //============================================================================
81 // class SvxRedlinEntry (Eintraege fuer Liste)
82 //----------------------------------------------------------------------------
84 SvxRedlinEntry::SvxRedlinEntry()
89 SvxRedlinEntry::~SvxRedlinEntry()
91 RedlinData
* pRedDat
=(RedlinData
*) GetUserData();
98 /*************************************************************************
99 #* Funktionen der in den SvxRedlinTable eingefuegten Items
100 #************************************************************************/
102 DBG_NAME(SvLBoxColorString
);
104 /*************************************************************************
105 #* Member: SvLBoxColorString Datum:23.10.97
106 #*------------------------------------------------------------------------
108 #* Klasse: SvLBoxColorString
110 #* Funktion: Konstruktor der Klasse SvLBoxColorString
112 #* Input: Box- Entry,Flags, Text fuer Anzeige, Schrift
116 #************************************************************************/
118 SvLBoxColorString::SvLBoxColorString( SvLBoxEntry
*pEntry
,USHORT nFlags
,const XubString
& rStr
,
121 : SvLBoxString( pEntry
, nFlags
, rStr
)
123 DBG_CTOR(SvLBoxColorString
,0);
125 SetText( pEntry
, rStr
);
128 /*************************************************************************
129 #* Member: SvLBoxColorString Datum:23.10.97
130 #*------------------------------------------------------------------------
132 #* Klasse: SvLBoxColorString
134 #* Funktion: Default Konstruktor der Klasse SvLBoxColorString
140 #************************************************************************/
142 SvLBoxColorString::SvLBoxColorString()
145 DBG_CTOR(SvLBoxColorString
,0);
148 /*************************************************************************
149 #* Member: ~SvLBoxColorString Datum:23.10.97
150 #*------------------------------------------------------------------------
152 #* Klasse: SvLBoxColorString
154 #* Funktion: Destruktor der Klasse SvLBoxColorString
160 #************************************************************************/
162 SvLBoxColorString::~SvLBoxColorString()
164 DBG_DTOR(SvLBoxColorString
,0);
168 /*************************************************************************
169 #* Member: SvLBoxColorString Datum:23.10.97
170 #*------------------------------------------------------------------------
172 #* Klasse: SvLBoxColorString
174 #* Funktion: Erzeugt einen neuen SvLBoxColorString
178 #* Output: SvLBoxColorString
180 #************************************************************************/
182 SvLBoxItem
* SvLBoxColorString::Create() const
184 DBG_CHKTHIS(SvLBoxColorString
,0);
185 return new SvLBoxColorString
;
190 /*************************************************************************
191 #* Member: SvLBoxColorString Datum:23.10.97
192 #*------------------------------------------------------------------------
194 #* Klasse: SvLBoxColorString
196 #* Funktion: Zeichenroutine des SvLBoxColorString. Gezeichnet wird
197 #* der entsprechende Text mit der eingestellten Farbe
198 #* im Ausgabe- Device.
200 #* Input: Position, Ausgabe- Device, Flag fuer Selection,
201 #* Zeiger auf den Eintrag
205 #************************************************************************/
207 void SvLBoxColorString::Paint( const Point
& rPos
, SvLBox
& rDev
,
208 USHORT nFlags
, SvLBoxEntry
* pEntry
)
210 Color aColor
=rDev
.GetTextColor();
211 Color a2Color
=aColor
;
212 if(!(nFlags
& SVLISTENTRYFLAG_SELECTED
))
214 rDev
.SetTextColor(aPrivColor
);
216 SvLBoxString::Paint(rPos
,rDev
,nFlags
,pEntry
);
217 rDev
.SetTextColor(a2Color
);
220 //============================================================================
221 // class SvxRedlinTable
222 //----------------------------------------------------------------------------
224 SvxRedlinTable::SvxRedlinTable( Window
* pParent
,WinBits nBits
):
225 SvxSimpleTable(pParent
,nBits
)
231 nDatePos
=WRITER_DATE
;
232 pCommentSearcher
=NULL
;
233 SetNodeDefaultImages();
236 SvxRedlinTable::SvxRedlinTable( Window
* pParent
,const ResId
& rResId
):
237 SvxSimpleTable(pParent
,rResId
)
243 nDatePos
=WRITER_DATE
;
244 pCommentSearcher
=NULL
;
245 SetNodeDefaultImages();
248 SvxRedlinTable::~SvxRedlinTable()
250 if(pCommentSearcher
!=NULL
)
251 delete pCommentSearcher
;
254 StringCompare
SvxRedlinTable::ColCompare(SvLBoxEntry
* pLeft
,SvLBoxEntry
* pRight
)
256 StringCompare eCompare
=COMPARE_EQUAL
;
258 if(aColCompareLink
.IsSet())
260 SvSortData aRedlinCompare
;
261 aRedlinCompare
.pLeft
=pLeft
;
262 aRedlinCompare
.pRight
=pRight
;
263 eCompare
=(StringCompare
) aColCompareLink
.Call(&aRedlinCompare
);
267 if(nDatePos
==GetSortedCol())
269 RedlinData
*pLeftData
=(RedlinData
*)(pLeft
->GetUserData());
270 RedlinData
*pRightData
=(RedlinData
*)(pRight
->GetUserData());
272 if(pLeftData
!=NULL
&& pRightData
!=NULL
)
274 if(pLeftData
->aDateTime
< pRightData
->aDateTime
)
276 eCompare
=COMPARE_LESS
;
278 else if(pLeftData
->aDateTime
> pRightData
->aDateTime
)
280 eCompare
=COMPARE_GREATER
;
284 eCompare
=SvxSimpleTable::ColCompare(pLeft
,pRight
);
288 eCompare
=SvxSimpleTable::ColCompare(pLeft
,pRight
);
295 void SvxRedlinTable::SetCalcView(BOOL bFlag
)
304 nDatePos
=WRITER_DATE
;
309 void SvxRedlinTable::UpdateFilterTest()
312 USHORT nYEAR
=aDateMax
.GetYear()+100;
313 aDateMax
.SetYear(nYEAR
);
314 Date
aDateMin(1,1,1989);
316 Time
aTMax(23,59,59);
319 DateTime
aDTMin(aDateMin
);
320 DateTime
aDTMax(aDateMax
);
324 case FLT_DATE_BEFORE
:
325 aDaTiFilterFirst
=aDTMin
;
326 aDaTiFilterLast
=aDaTiFirst
;
330 aDaTiFilterFirst
=aDaTiFirst
;
331 aDaTiFilterLast
=aDTMax
;
334 aDaTiFilterFirst
=aDaTiFirst
;
335 aDaTiFilterLast
=aDaTiFirst
;
336 aDaTiFilterFirst
.SetTime(aTMin
.GetTime());
337 aDaTiFilterLast
.SetTime(aTMax
.GetTime());
339 case FLT_DATE_NOTEQUAL
:
340 aDaTiFilterFirst
=aDaTiFirst
;
341 aDaTiFilterLast
=aDaTiFirst
;
342 aDaTiFilterFirst
.SetTime(aTMin
.GetTime());
343 aDaTiFilterLast
.SetTime(aTMax
.GetTime());
345 case FLT_DATE_BETWEEN
:
346 aDaTiFilterFirst
=aDaTiFirst
;
347 aDaTiFilterLast
=aDaTiLast
;
353 void SvxRedlinTable::SetFilterDate(BOOL bFlag
)
358 void SvxRedlinTable::SetDateTimeMode(USHORT nMode
)
363 void SvxRedlinTable::SetFirstDate(const Date
& aDate
)
365 aDaTiFirst
.SetDate(aDate
.GetDate());
368 void SvxRedlinTable::SetLastDate(const Date
& aDate
)
370 aDaTiLast
.SetDate(aDate
.GetDate());
373 void SvxRedlinTable::SetFirstTime(const Time
& aTime
)
375 aDaTiFirst
.SetTime(aTime
.GetTime());
378 void SvxRedlinTable::SetLastTime(const Time
& aTime
)
380 aDaTiLast
.SetTime(aTime
.GetTime());
383 void SvxRedlinTable::SetFilterAuthor(BOOL bFlag
)
388 void SvxRedlinTable::SetAuthor(const String
&aString
)
393 void SvxRedlinTable::SetFilterComment(BOOL bFlag
)
398 void SvxRedlinTable::SetCommentParams( const utl::SearchParam
* pSearchPara
)
400 if(pSearchPara
!=NULL
)
402 if(pCommentSearcher
!=NULL
) delete pCommentSearcher
;
404 pCommentSearcher
=new utl::TextSearch(*pSearchPara
, LANGUAGE_SYSTEM
);
408 BOOL
SvxRedlinTable::IsValidWriterEntry(const String
& rString
,RedlinData
*pUserData
)
411 String aString
=rString
.GetToken(WRITER_AUTHOR
,'\t');
416 if(aAuthor
.CompareTo(aString
)==COMPARE_EQUAL
)
424 DateTime aDateTime
=pUserData
->aDateTime
;
425 nTheFlag
=IsValidEntry(&aString
,&aDateTime
);
430 BOOL
SvxRedlinTable::IsValidCalcEntry(const String
& rString
,RedlinData
*pUserData
)
433 String aString
=rString
.GetToken(CALC_AUTHOR
,'\t');
438 if(aAuthor
.CompareTo(aString
)==COMPARE_EQUAL
)
446 DateTime aDateTime
=pUserData
->aDateTime
;
447 nTheFlag
=IsValidEntry(&aString
,&aDateTime
);
452 BOOL
SvxRedlinTable::IsValidEntry(const String
* pAuthorStr
,
453 const DateTime
*pDateTime
,const String
* pCommentStr
)
458 nTheFlag
= aAuthor
.CompareTo(*pAuthorStr
)==COMPARE_EQUAL
;
460 if(bDate
&& nTheFlag
)
462 if(nDaTiMode
!=FLT_DATE_NOTEQUAL
)
464 nTheFlag
=pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
);
468 nTheFlag
=!(pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
));
471 if(bComment
&& nTheFlag
)
473 xub_StrLen nStartPos
= 0;
474 xub_StrLen nEndPos
= pCommentStr
->Len();
476 nTheFlag
=pCommentSearcher
->SearchFrwrd( *pCommentStr
, &nStartPos
, &nEndPos
);
481 BOOL
SvxRedlinTable::IsValidEntry(const String
* pAuthorStr
,const DateTime
*pDateTime
)
486 if(aAuthor
.CompareTo(*pAuthorStr
)==COMPARE_EQUAL
)
491 if(bDate
&& nTheFlag
)
493 if(nDaTiMode
!=FLT_DATE_NOTEQUAL
)
495 nTheFlag
=pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
);
499 nTheFlag
=!(pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
));
505 BOOL
SvxRedlinTable::IsValidComment(const String
* pCommentStr
)
511 xub_StrLen nStartPos
= 0;
512 xub_StrLen nEndPos
= pCommentStr
->Len();
514 nTheFlag
=pCommentSearcher
->SearchFrwrd( *pCommentStr
, &nStartPos
, &nEndPos
);
519 SvLBoxEntry
* SvxRedlinTable::InsertEntry(const String
& rStr
,RedlinData
*pUserData
,
520 SvLBoxEntry
* pParent
,ULONG nPos
)
522 aEntryColor
=GetTextColor();
525 if(pUserData
->bDisabled
)
526 aEntryColor
=Color(COL_GRAY
);
529 XubString aStr
= rStr
;
531 XubString
aFirstStr( aStr
);
532 xub_StrLen nEnd
= aFirstStr
.Search( sal_Unicode( '\t' ) );
533 if( nEnd
!= STRING_NOTFOUND
)
535 aFirstStr
.Erase( nEnd
);
537 aCurEntry
.Erase( 0, ++nEnd
);
542 return SvTreeListBox::InsertEntry( aFirstStr
, pParent
, FALSE
, nPos
, pUserData
);
546 SvLBoxEntry
* SvxRedlinTable::InsertEntry(const String
& rStr
,RedlinData
*pUserData
,const Color
& aColor
,
547 SvLBoxEntry
* pParent
,ULONG nPos
)
551 XubString aStr
= rStr
;
553 XubString
aFirstStr( aStr
);
554 xub_StrLen nEnd
= aFirstStr
.Search( sal_Unicode ( '\t' ) );
555 if( nEnd
!= STRING_NOTFOUND
)
557 aFirstStr
.Erase( nEnd
);
559 aCurEntry
.Erase( 0, ++nEnd
);
564 return SvTreeListBox::InsertEntry( aFirstStr
, pParent
, FALSE
, nPos
, pUserData
);
567 SvLBoxEntry
* SvxRedlinTable::CreateEntry() const
569 return new SvxRedlinEntry
;
572 void SvxRedlinTable::InitEntry( SvLBoxEntry
* pEntry
, const XubString
& rStr
,
573 const Image
& rColl
, const Image
& rExp
, SvLBoxButtonKind eButtonKind
)
575 SvLBoxButton
* pButton
;
576 SvLBoxString
* pString
;
577 SvLBoxContextBmp
* pContextBmp
;
579 if( nTreeFlags
& TREEFLAG_CHKBTN
)
581 pButton
= new SvLBoxButton( pEntry
,eButtonKind
,0,pCheckButtonData
);
582 pEntry
->AddItem( pButton
);
585 pContextBmp
= new SvLBoxContextBmp( pEntry
,0, rColl
,rExp
,
586 SVLISTENTRYFLAG_EXPANDED
);
587 pEntry
->AddItem( pContextBmp
);
589 pString
= new SvLBoxColorString( pEntry
, 0, rStr
,aEntryColor
);
590 pEntry
->AddItem( pString
);
594 xub_Unicode
* pCurToken
= (xub_Unicode
*)aCurEntry
.GetBuffer();
596 xub_Unicode
* pNextToken
= (xub_Unicode
*)GetToken( pCurToken
, nCurTokenLen
);
597 USHORT nCount
= TabCount(); nCount
--;
599 for( USHORT nToken
= 0; nToken
< nCount
; nToken
++ )
601 if( pCurToken
&& nCurTokenLen
)
602 // aToken.Assign( pCurToken, nCurTokenLen );
603 aToken
= XubString( pCurToken
, nCurTokenLen
);
607 SvLBoxColorString
* pStr
= new SvLBoxColorString( pEntry
, 0, aToken
,aEntryColor
);
608 pEntry
->AddItem( pStr
);
610 pCurToken
= pNextToken
;
612 pNextToken
= (xub_Unicode
*)GetToken( pCurToken
, nCurTokenLen
);
621 //============================================================================
623 //----------------------------------------------------------------------------
625 SvxTPView::SvxTPView( Window
* pParent
)
626 : TabPage( pParent
, SVX_RES(SID_REDLIN_VIEW_PAGE
)),
627 aViewData ( this, SVX_RES( DG_VIEW
) ),
628 PbAccept ( this, SVX_RES(PB_ACCEPT
) ),
629 PbReject ( this, SVX_RES(PB_REJECT
) ),
630 PbAcceptAll ( this, SVX_RES(PB_ACCEPTALL
) ),
631 PbRejectAll ( this, SVX_RES(PB_REJECTALL
) ),
632 PbUndo ( this, SVX_RES(PB_UNDO
) ),
633 aTitle1 ( SVX_RES( STR_TITLE1
) ), // lokale Resource
634 aTitle2 ( SVX_RES( STR_TITLE2
) ),
635 aTitle3 ( SVX_RES( STR_TITLE3
) ),
636 aTitle4 ( SVX_RES( STR_TITLE4
) ),
637 aTitle5 ( SVX_RES( STR_TITLE5
) ),
638 aStrMyName ( SVX_RES( STR_VIEW
) )
642 aViewData
.SetHelpId(HID_REDLINING_VIEW_DG_VIEW_TABLE
);
643 aViewData
.SetHeaderBarHelpId(HID_REDLINING_VIEW_DG_VIEW_HEADER
);
645 aMinSize
=GetSizePixel();
647 Link aLink
=LINK( this, SvxTPView
, PbClickHdl
);
649 PbAccept
.SetClickHdl(aLink
);
650 PbAcceptAll
.SetClickHdl(aLink
);
651 PbReject
.SetClickHdl(aLink
);
652 PbRejectAll
.SetClickHdl(aLink
);
653 PbUndo
.SetClickHdl(aLink
);
655 nDistance
=PbAccept
.GetSizePixel().Height()+2*MIN_DISTANCE
;
656 aViewData
.SetTabs(nStaticTabs
);
659 String
SvxTPView::GetMyName() const
664 void SvxTPView::Resize()
666 Size aSize
=GetOutputSizePixel();
667 Point aPos
=aViewData
.GetPosPixel();
668 aSize
.Height()-=aPos
.Y()+nDistance
;
669 aSize
.Width()-=2*aPos
.X();
671 long newY
=aPos
.Y()+aSize
.Height()+MIN_DISTANCE
;
672 aPos
=PbAccept
.GetPosPixel();
674 PbAccept
.SetPosPixel(aPos
);
675 aPos
=PbAcceptAll
.GetPosPixel();
677 PbAcceptAll
.SetPosPixel(aPos
);
678 aPos
=PbReject
.GetPosPixel();
680 PbReject
.SetPosPixel(aPos
);
681 aPos
=PbRejectAll
.GetPosPixel();
683 PbRejectAll
.SetPosPixel(aPos
);
685 if(PbUndo
.IsVisible())
687 aPos
=PbUndo
.GetPosPixel();
689 PbUndo
.SetPosPixel(aPos
);
691 aViewData
.SetSizePixel(aSize
);
694 void SvxTPView::InsertWriterHeader()
696 String
aStrTab(sal_Unicode('\t'));
697 String
aString(aTitle1
);
704 aViewData
.ClearHeader();
705 aViewData
.InsertHeaderEntry(aString
);
708 void SvxTPView::InsertCalcHeader()
710 String
aStrTab(sal_Unicode('\t'));
711 String
aString(aTitle1
);
720 aViewData
.ClearHeader();
721 aViewData
.InsertHeaderEntry(aString
);
724 void SvxTPView::EnableAccept(BOOL nFlag
)
726 PbAccept
.Enable(nFlag
);
729 void SvxTPView::EnableAcceptAll(BOOL nFlag
)
731 PbAcceptAll
.Enable(nFlag
);
734 void SvxTPView::EnableReject(BOOL nFlag
)
736 PbReject
.Enable(nFlag
);
739 void SvxTPView::EnableRejectAll(BOOL nFlag
)
741 PbRejectAll
.Enable(nFlag
);
744 void SvxTPView::ShowUndo(BOOL nFlag
)
749 void SvxTPView::EnableUndo(BOOL nFlag
)
751 PbUndo
.Enable(nFlag
);
754 Size
SvxTPView::GetMinSizePixel()
757 if(PbUndo
.IsVisible())
759 ULONG nSize
=PbUndo
.GetSizePixel().Width()
760 +PbUndo
.GetPosPixel().X()
761 +PbAccept
.GetPosPixel().X();
770 SvxRedlinTable
* SvxTPView::GetTableControl()
775 IMPL_LINK( SvxTPView
, PbClickHdl
, PushButton
*, pPushB
)
777 if(pPushB
==&PbAccept
)
779 AcceptClickLk
.Call(this);
781 else if(pPushB
==&PbAcceptAll
)
783 AcceptAllClickLk
.Call(this);
785 else if(pPushB
==&PbReject
)
787 RejectClickLk
.Call(this);
789 else if(pPushB
==&PbRejectAll
)
791 RejectAllClickLk
.Call(this);
793 else if(pPushB
==&PbUndo
)
795 UndoClickLk
.Call(this);
804 //============================================================================
806 //----------------------------------------------------------------------------
808 SvxTPFilter::SvxTPFilter( Window
* pParent
)
809 : TabPage( pParent
, SVX_RES(SID_REDLIN_FILTER_PAGE
)),
811 aCbDate ( this, SVX_RES( CB_DATE
) ),
812 aLbDate ( this, SVX_RES( LB_DATE
) ),
813 aDfDate ( this, SVX_RES( DF_DATE
) ),
814 aTfDate ( this, SVX_RES( TF_DATE
) ),
815 aIbClock ( this, SVX_RES( IB_CLOCK
) ),
816 aFtDate2 ( this, SVX_RES( FT_DATE2
) ),
817 aDfDate2 ( this, SVX_RES( DF_DATE2
) ),
818 aTfDate2 ( this, SVX_RES( TF_DATE2
) ),
819 aIbClock2 ( this, SVX_RES( IB_CLOCK2
) ),
820 aCbAuthor ( this, SVX_RES( CB_AUTOR
) ),
821 aLbAuthor ( this, SVX_RES( LB_AUTOR
) ),
822 aCbRange ( this, SVX_RES( CB_RANGE
) ),
823 aEdRange ( this, SVX_RES( ED_RANGE
) ),
824 aBtnRange ( this, SVX_RES( BTN_REF
) ),
825 aLbAction ( this, SVX_RES( LB_ACTION
) ),
826 aCbComment ( this, SVX_RES( CB_COMMENT
) ),
827 aEdComment ( this, SVX_RES( ED_COMMENT
) ),
828 aActionStr ( SVX_RES( STR_ACTION
) ),
829 aStrMyName ( SVX_RES( STR_FILTER
) ),
832 Image
aImgTimeHC( SVX_RES( IMG_TIME_H
) );
835 aIbClock
.SetModeImage( aImgTimeHC
, BMP_COLOR_HIGHCONTRAST
);
836 aIbClock2
.SetModeImage( aImgTimeHC
, BMP_COLOR_HIGHCONTRAST
);
838 aDfDate
.SetShowDateCentury( TRUE
);
839 aDfDate2
.SetShowDateCentury( TRUE
);
841 aRangeStr
=aCbRange
.GetText();
842 aLbDate
.SelectEntryPos(0);
843 aLbDate
.SetSelectHdl( LINK( this, SvxTPFilter
, SelDateHdl
) );
844 aIbClock
.SetClickHdl( LINK( this, SvxTPFilter
, TimeHdl
) );
845 aIbClock2
.SetClickHdl( LINK( this, SvxTPFilter
,TimeHdl
) );
846 aBtnRange
.SetClickHdl( LINK( this, SvxTPFilter
, RefHandle
));
848 Link aLink
=LINK( this, SvxTPFilter
, RowEnableHdl
) ;
849 aCbDate
.SetClickHdl(aLink
);
850 aCbAuthor
.SetClickHdl(aLink
);
851 aCbRange
.SetClickHdl(aLink
);
852 aCbComment
.SetClickHdl(aLink
);
854 Link a2Link
=LINK( this, SvxTPFilter
, ModifyDate
);
855 aDfDate
.SetModifyHdl(a2Link
);
856 aTfDate
.SetModifyHdl(a2Link
);
857 aDfDate2
.SetModifyHdl(a2Link
);
858 aTfDate2
.SetModifyHdl(a2Link
);
860 Link a3Link
=LINK( this, SvxTPFilter
, ModifyHdl
);
861 aEdRange
.SetModifyHdl(a3Link
);
862 aEdComment
.SetModifyHdl(a3Link
);
863 aLbAction
.SetSelectHdl(a3Link
);
864 aLbAuthor
.SetSelectHdl(a3Link
);
866 RowEnableHdl(&aCbDate
);
867 RowEnableHdl(&aCbAuthor
);
868 RowEnableHdl(&aCbRange
);
869 RowEnableHdl(&aCbComment
);
873 aDfDate
.SetDate(aDate
);
874 aTfDate
.SetTime(aTime
);
875 aDfDate2
.SetDate(aDate
);
876 aTfDate2
.SetTime(aTime
);
882 void SvxTPFilter::SetRedlinTable(SvxRedlinTable
* pTable
)
887 String
SvxTPFilter::GetMyName() const
892 void SvxTPFilter::DisableRange(BOOL bFlag
)
908 void SvxTPFilter::ShowDateFields(USHORT nKind
)
913 case FLT_DATE_BEFORE
:
914 EnableDateLine1(TRUE
);
915 EnableDateLine2(FALSE
);
918 EnableDateLine1(TRUE
);
919 EnableDateLine2(FALSE
);
922 EnableDateLine1(TRUE
);
924 aTfDate
.SetText(aEmpty
);
925 EnableDateLine2(FALSE
);
927 case FLT_DATE_NOTEQUAL
:
928 EnableDateLine1(TRUE
);
930 aTfDate
.SetText(aEmpty
);
931 EnableDateLine2(FALSE
);
933 case FLT_DATE_BETWEEN
:
934 EnableDateLine1(TRUE
);
935 EnableDateLine2(TRUE
);
938 EnableDateLine1(FALSE
);
939 EnableDateLine2(FALSE
);
944 void SvxTPFilter::EnableDateLine1(BOOL bFlag
)
946 if(bFlag
&& aCbDate
.IsChecked())
959 void SvxTPFilter::EnableDateLine2(BOOL bFlag
)
962 if(bFlag
&& aCbDate
.IsChecked())
973 aDfDate2
.SetText(aEmpty
);
975 aTfDate2
.SetText(aEmpty
);
980 Date
SvxTPFilter::GetFirstDate() const
982 return aDfDate
.GetDate();
985 void SvxTPFilter::SetFirstDate(const Date
&aDate
)
987 aDfDate
.SetDate(aDate
);
990 Time
SvxTPFilter::GetFirstTime() const
992 return aTfDate
.GetTime();
995 void SvxTPFilter::SetFirstTime(const Time
&aTime
)
997 aTfDate
.SetTime(aTime
);
1001 Date
SvxTPFilter::GetLastDate() const
1003 return aDfDate2
.GetDate();
1006 void SvxTPFilter::SetLastDate(const Date
&aDate
)
1008 aDfDate2
.SetDate(aDate
);
1011 Time
SvxTPFilter::GetLastTime() const
1013 return aTfDate2
.GetTime();
1016 void SvxTPFilter::SetLastTime(const Time
&aTime
)
1018 aTfDate2
.SetTime(aTime
);
1021 void SvxTPFilter::SetDateMode(USHORT nMode
)
1023 aLbDate
.SelectEntryPos(nMode
);
1024 SelDateHdl(&aLbDate
);
1027 USHORT
SvxTPFilter::GetDateMode()
1029 return (USHORT
) aLbDate
.GetSelectEntryPos();
1031 void SvxTPFilter::ClearAuthors()
1036 void SvxTPFilter::InsertAuthor( const String
& rString
, USHORT nPos
)
1038 aLbAuthor
.InsertEntry(rString
,nPos
);
1041 String
SvxTPFilter::GetSelectedAuthor() const
1043 return aLbAuthor
.GetSelectEntry();
1046 USHORT
SvxTPFilter::GetSelectedAuthorPos()
1048 return (USHORT
) aLbAuthor
.GetSelectEntryPos();
1051 void SvxTPFilter::SelectedAuthorPos(USHORT nPos
)
1053 aLbAuthor
.SelectEntryPos(nPos
);
1056 USHORT
SvxTPFilter::SelectAuthor(const String
& aString
)
1058 aLbAuthor
.SelectEntry(aString
);
1059 return aLbAuthor
.GetSelectEntryPos();
1062 void SvxTPFilter::SetRange(const String
& rString
)
1064 aEdRange
.SetText(rString
);
1067 String
SvxTPFilter::GetRange() const
1069 return aEdRange
.GetText();
1072 void SvxTPFilter::SetFocusToRange()
1074 aEdRange
.GrabFocus();
1077 void SvxTPFilter::HideRange(BOOL bHide
)
1088 aCbRange
.SetText(aRangeStr
);
1095 void SvxTPFilter::HideClocks(BOOL bHide
)
1109 void SvxTPFilter::SetComment(const String
&rComment
)
1111 aEdComment
.SetText(rComment
);
1113 String
SvxTPFilter::GetComment()const
1115 return aEdComment
.GetText();
1118 BOOL
SvxTPFilter::IsDate()
1120 return aCbDate
.IsChecked();
1123 BOOL
SvxTPFilter::IsAuthor()
1125 return aCbAuthor
.IsChecked();
1128 BOOL
SvxTPFilter::IsRange()
1130 return aCbRange
.IsChecked();
1132 BOOL
SvxTPFilter::IsAction()
1134 return aCbRange
.IsChecked();
1137 BOOL
SvxTPFilter::IsComment()
1139 return aCbComment
.IsChecked();
1142 void SvxTPFilter::CheckDate(BOOL bFlag
)
1144 aCbDate
.Check(bFlag
);
1145 RowEnableHdl(&aCbDate
);
1149 void SvxTPFilter::CheckAuthor(BOOL bFlag
)
1151 aCbAuthor
.Check(bFlag
);
1152 RowEnableHdl(&aCbAuthor
);
1156 void SvxTPFilter::CheckRange(BOOL bFlag
)
1158 aCbRange
.Check(bFlag
);
1159 RowEnableHdl(&aCbRange
);
1163 void SvxTPFilter::CheckAction(BOOL bFlag
)
1165 aCbRange
.Check(bFlag
);
1166 RowEnableHdl(&aCbRange
);
1170 void SvxTPFilter::CheckComment(BOOL bFlag
)
1172 aCbComment
.Check(bFlag
);
1173 RowEnableHdl(&aCbComment
);
1177 void SvxTPFilter::ShowAction(BOOL bShow
)
1183 aCbRange
.SetHelpId(HID_REDLINING_FILTER_CB_RANGE
);
1188 aCbRange
.SetText(aActionStr
);
1189 aCbRange
.SetHelpId(HID_REDLINING_FILTER_CB_ACTION
);
1196 ListBox
* SvxTPFilter::GetLbAction()
1201 IMPL_LINK( SvxTPFilter
, SelDateHdl
, ListBox
*, pLb
)
1203 ShowDateFields((USHORT
)aLbDate
.GetSelectEntryPos());
1208 IMPL_LINK( SvxTPFilter
, RowEnableHdl
, CheckBox
*, pCB
)
1212 aLbDate
.Enable(aCbDate
.IsChecked());
1213 aLbDate
.Invalidate();
1214 EnableDateLine1(FALSE
);
1215 EnableDateLine2(FALSE
);
1216 if(aCbDate
.IsChecked()) SelDateHdl(&aLbDate
);
1218 else if(pCB
==&aCbAuthor
)
1220 aLbAuthor
.Enable(aCbAuthor
.IsChecked());
1221 aLbAuthor
.Invalidate();
1223 else if(pCB
==&aCbRange
)
1225 aLbAction
.Enable(aCbRange
.IsChecked());
1226 aLbAction
.Invalidate();
1227 aEdRange
.Enable(aCbRange
.IsChecked());
1228 aBtnRange
.Enable(aCbRange
.IsChecked());
1230 else if(pCB
==&aCbComment
)
1232 aEdComment
.Enable(aCbComment
.IsChecked());
1233 aEdComment
.Invalidate();
1240 IMPL_LINK( SvxTPFilter
, TimeHdl
, ImageButton
*,pIB
)
1246 aDfDate
.SetDate(aDate
);
1247 aTfDate
.SetTime(aTime
);
1249 else if(pIB
==&aIbClock2
)
1251 aDfDate2
.SetDate(aDate
);
1252 aTfDate2
.SetTime(aTime
);
1254 ModifyHdl(&aDfDate
);
1258 IMPL_LINK( SvxTPFilter
, ModifyHdl
, void*, pCtr
)
1262 if(pCtr
==&aCbDate
|| pCtr
==&aLbDate
||
1263 pCtr
==&aDfDate
|| pCtr
==&aTfDate
||
1264 pCtr
==&aIbClock
|| pCtr
==&aFtDate2
||
1265 pCtr
==&aDfDate2
|| pCtr
==&aTfDate2
||
1268 aModifyDateLink
.Call(this);
1270 else if(pCtr
==&aCbAuthor
|| pCtr
==&aLbAuthor
)
1272 aModifyAuthorLink
.Call(this);
1274 else if(pCtr
==&aCbRange
|| pCtr
==&aEdRange
||
1277 aModifyRefLink
.Call(this);
1279 else if(pCtr
==&aCbComment
|| pCtr
==&aEdComment
)
1281 aModifyComLink
.Call(this);
1285 aModifyLink
.Call(this);
1290 void SvxTPFilter::DeactivatePage()
1294 if(pRedlinTable
!=NULL
)
1296 pRedlinTable
->SetFilterDate(IsDate());
1297 pRedlinTable
->SetDateTimeMode(GetDateMode());
1298 pRedlinTable
->SetFirstDate(aDfDate
.GetDate());
1299 pRedlinTable
->SetLastDate(aDfDate2
.GetDate());
1300 pRedlinTable
->SetFirstTime(aTfDate
.GetTime());
1301 pRedlinTable
->SetLastTime(aTfDate2
.GetTime());
1302 pRedlinTable
->SetFilterAuthor(IsAuthor());
1303 pRedlinTable
->SetAuthor(GetSelectedAuthor());
1305 pRedlinTable
->SetFilterComment(IsComment());
1307 utl::SearchParam
aSearchParam( aEdComment
.GetText(),
1308 utl::SearchParam::SRCH_REGEXP
,FALSE
,FALSE
,FALSE
);
1310 pRedlinTable
->SetCommentParams(&aSearchParam
);
1312 pRedlinTable
->UpdateFilterTest();
1315 aReadyLink
.Call(this);
1318 TabPage::DeactivatePage();
1321 void SvxTPFilter::Enable( bool bEnable
, bool bChild
)
1323 TabPage::Enable(bEnable
,bChild
);
1324 if(aCbDate
.IsEnabled())
1326 RowEnableHdl(&aCbDate
);
1327 RowEnableHdl(&aCbAuthor
);
1328 RowEnableHdl(&aCbRange
);
1329 RowEnableHdl(&aCbComment
);
1332 void SvxTPFilter::Disable( bool bChild
)
1334 Enable( false, bChild
);
1337 IMPL_LINK( SvxTPFilter
, ModifyDate
, void*,pTF
)
1344 if(aDfDate
.GetText().Len()==0)
1345 aDfDate
.SetDate(aDate
);
1347 if(pRedlinTable
!=NULL
)
1348 pRedlinTable
->SetFirstDate(aDfDate
.GetDate());
1350 else if(&aDfDate2
==pTF
)
1352 if(aDfDate2
.GetText().Len()==0)
1353 aDfDate2
.SetDate(aDate
);
1355 if(pRedlinTable
!=NULL
)
1356 pRedlinTable
->SetLastDate(aDfDate2
.GetDate());
1358 else if(&aTfDate
==pTF
)
1360 if(aTfDate
.GetText().Len()==0)
1361 aTfDate
.SetTime(aTime
);
1363 if(pRedlinTable
!=NULL
)
1364 pRedlinTable
->SetFirstTime(aTfDate
.GetTime());
1366 else if(&aTfDate2
==pTF
)
1368 if(aTfDate2
.GetText().Len()==0)
1369 aTfDate2
.SetTime(aTime
);
1371 if(pRedlinTable
!=NULL
)
1372 pRedlinTable
->SetLastTime(aTfDate2
.GetTime());
1375 ModifyHdl(&aDfDate
);
1379 IMPL_LINK( SvxTPFilter
, RefHandle
, PushButton
*, pRef
)
1383 aRefLink
.Call(this);
1388 static Size gDiffSize
;
1389 //============================================================================
1390 // class SvxAcceptChgCtr
1391 //----------------------------------------------------------------------------
1393 SvxAcceptChgCtr::SvxAcceptChgCtr( Window
* pParent
, WinBits nWinStyle
)
1394 : Control(pParent
,nWinStyle
|WB_DIALOGCONTROL
),
1395 aTCAccept(this,WB_TABSTOP
|WB_DIALOGCONTROL
)
1397 pTPFilter
=new SvxTPFilter(&aTCAccept
);
1398 pTPView
=new SvxTPView(&aTCAccept
);
1399 aMinSize
=pTPView
->GetMinSizePixel();
1401 aTCAccept
.InsertPage( TP_VIEW
, pTPView
->GetMyName());
1402 aTCAccept
.InsertPage( TP_FILTER
, pTPFilter
->GetMyName());
1403 aTCAccept
.SetTabPage( TP_VIEW
, pTPView
);
1404 aTCAccept
.SetTabPage( TP_FILTER
, pTPFilter
);
1405 aTCAccept
.SetHelpId(HID_REDLINING_TABCONTROL
);
1407 aTCAccept
.SetTabPageSizePixel(aMinSize
);
1408 Size aSize
=aTCAccept
.GetSizePixel();
1410 gDiffSize
.Height()=aSize
.Height()-aMinSize
.Height();
1411 gDiffSize
.Width()=aSize
.Width()-aMinSize
.Width();
1414 pTPFilter
->SetRedlinTable(GetViewTable());
1420 SvxAcceptChgCtr::SvxAcceptChgCtr( Window
* pParent
, const ResId
& rResId
)
1421 : Control(pParent
,rResId
),
1422 aTCAccept(this,WB_TABSTOP
|WB_DIALOGCONTROL
)
1424 pTPFilter
=new SvxTPFilter(&aTCAccept
);
1425 pTPView
=new SvxTPView(&aTCAccept
);
1426 aMinSize
=pTPView
->GetMinSizePixel();
1428 aTCAccept
.InsertPage( TP_VIEW
, pTPView
->GetMyName());
1429 aTCAccept
.InsertPage( TP_FILTER
, pTPFilter
->GetMyName());
1430 aTCAccept
.SetTabPage( TP_VIEW
, pTPView
);
1431 aTCAccept
.SetTabPage( TP_FILTER
, pTPFilter
);
1432 aTCAccept
.SetHelpId(HID_REDLINING_TABCONTROL
);
1434 aTCAccept
.SetTabPageSizePixel(aMinSize
);
1435 Size aSize
=aTCAccept
.GetSizePixel();
1437 gDiffSize
.Height()=aSize
.Height()-aMinSize
.Height();
1438 gDiffSize
.Width()=aSize
.Width()-aMinSize
.Width();
1441 pTPFilter
->SetRedlinTable(GetViewTable());
1442 WinBits nWinStyle
=GetStyle()|WB_DIALOGCONTROL
;
1443 SetStyle(nWinStyle
);
1450 SvxAcceptChgCtr::~SvxAcceptChgCtr()
1456 void SvxAcceptChgCtr::Resize()
1458 aMinSize
=pTPView
->GetMinSizePixel();
1459 Size aSize
=GetOutputSizePixel();
1462 if(aMinSize
.Height()>aSize
.Height())
1464 aSize
.Height()=aMinSize
.Height();
1467 if(aMinSize
.Width()>aSize
.Width())
1469 aSize
.Width()=aMinSize
.Width();
1475 SetOutputSizePixel(aSize
);
1476 aMinSizeLink
.Call(this);
1481 aTCAccept
.SetSizePixel(aSize
);
1484 Size
SvxAcceptChgCtr::GetMinSizePixel() const
1486 Size aSize
=pTPView
->GetMinSizePixel();
1487 aSize
.Height()+=gDiffSize
.Height();
1488 aSize
.Width()+=gDiffSize
.Width();
1492 void SvxAcceptChgCtr::ShowFilterPage()
1494 aTCAccept
.SetCurPageId(TP_FILTER
);
1497 void SvxAcceptChgCtr::ShowViewPage()
1499 aTCAccept
.SetCurPageId(TP_VIEW
);
1502 BOOL
SvxAcceptChgCtr::IsFilterPageVisible()
1504 return (aTCAccept
.GetCurPageId()==TP_FILTER
);
1507 BOOL
SvxAcceptChgCtr::IsViewPageVisible()
1509 return (aTCAccept
.GetCurPageId()==TP_VIEW
);
1512 SvxTPFilter
* SvxAcceptChgCtr::GetFilterPage()
1517 SvxTPView
* SvxAcceptChgCtr::GetViewPage()
1522 SvxRedlinTable
* SvxAcceptChgCtr::GetViewTable()
1526 return pTPView
->GetTableControl();