1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <vcl/dialog.hxx>
21 #include <vcl/layout.hxx>
22 #include <vcl/svapp.hxx>
23 #include <tools/shl.hxx>
24 #include <sfx2/app.hxx>
25 #include <sfx2/module.hxx>
26 #include <unotools/textsearch.hxx>
27 #include <svtools/svlbitm.hxx>
28 #include "svtools/viewdataentry.hxx"
29 #include <unotools/charclass.hxx>
31 #include <editeng/unolingu.hxx>
32 #include <svx/dialmgr.hxx>
33 #include "svx/dialogs.hrc"
34 #include "ctredlin.hrc"
35 #include <svx/ctredlin.hxx>
38 //============================================================================
39 // Local Defines and Function
40 //----------------------------------------------------------------------------
42 static long nStaticTabs
[]=
50 RedlinData::RedlinData()
52 aDateTime( DateTime::EMPTY
)
57 RedlinData::~RedlinData()
61 //============================================================================
62 // class SvxRedlinEntry (Entries for list)
63 //----------------------------------------------------------------------------
65 SvxRedlinEntry::SvxRedlinEntry()
70 SvxRedlinEntry::~SvxRedlinEntry()
72 RedlinData
* pRedDat
=(RedlinData
*) GetUserData();
76 // Functions in the inserts Items of SvxRedlinTable
78 DBG_NAME(SvLBoxColorString
);
80 SvLBoxColorString::SvLBoxColorString( SvTreeListEntry
*pEntry
,sal_uInt16 nFlags
,const XubString
& rStr
,
83 : SvLBoxString( pEntry
, nFlags
, rStr
)
85 DBG_CTOR(SvLBoxColorString
,0);
90 SvLBoxColorString::SvLBoxColorString()
93 DBG_CTOR(SvLBoxColorString
,0);
96 SvLBoxColorString::~SvLBoxColorString()
98 DBG_DTOR(SvLBoxColorString
,0);
101 SvLBoxItem
* SvLBoxColorString::Create() const
103 DBG_CHKTHIS(SvLBoxColorString
,0);
104 return new SvLBoxColorString
;
107 void SvLBoxColorString::Paint(
108 const Point
& rPos
, SvTreeListBox
& rDev
,
109 const SvViewDataEntry
* pView
, const SvTreeListEntry
* pEntry
)
112 Paint function of the SvLBoxColorString class. The relevant text with the
113 selected color is drawn in the output device.
117 Color aColor
=rDev
.GetTextColor();
118 Color a2Color
=aColor
;
119 if (!pView
->IsSelected())
121 rDev
.SetTextColor(aPrivColor
);
123 SvLBoxString::Paint(rPos
, rDev
, pView
, pEntry
);
124 rDev
.SetTextColor(a2Color
);
127 //============================================================================
128 // class SvxRedlinTable
129 //----------------------------------------------------------------------------
131 SvxRedlinTable::SvxRedlinTable(SvxSimpleTableContainer
& rParent
,WinBits nBits
)
132 : SvxSimpleTable(rParent
,nBits
),
133 aDaTiFirst( DateTime::EMPTY
),
134 aDaTiLast( DateTime::EMPTY
),
135 aDaTiFilterFirst( DateTime::EMPTY
),
136 aDaTiFilterLast( DateTime::EMPTY
)
142 nDatePos
=WRITER_DATE
;
143 pCommentSearcher
=NULL
;
144 SetNodeDefaultImages();
147 SvxRedlinTable::~SvxRedlinTable()
149 delete pCommentSearcher
;
152 StringCompare
SvxRedlinTable::ColCompare(SvTreeListEntry
* pLeft
,SvTreeListEntry
* pRight
)
154 StringCompare eCompare
=COMPARE_EQUAL
;
156 if(aColCompareLink
.IsSet())
158 SvSortData aRedlinCompare
;
159 aRedlinCompare
.pLeft
=pLeft
;
160 aRedlinCompare
.pRight
=pRight
;
161 eCompare
=(StringCompare
) aColCompareLink
.Call(&aRedlinCompare
);
165 if(nDatePos
==GetSortedCol())
167 RedlinData
*pLeftData
=(RedlinData
*)(pLeft
->GetUserData());
168 RedlinData
*pRightData
=(RedlinData
*)(pRight
->GetUserData());
170 if(pLeftData
!=NULL
&& pRightData
!=NULL
)
172 if(pLeftData
->aDateTime
< pRightData
->aDateTime
)
174 eCompare
=COMPARE_LESS
;
176 else if(pLeftData
->aDateTime
> pRightData
->aDateTime
)
178 eCompare
=COMPARE_GREATER
;
182 eCompare
=SvxSimpleTable::ColCompare(pLeft
,pRight
);
186 eCompare
=SvxSimpleTable::ColCompare(pLeft
,pRight
);
193 void SvxRedlinTable::SetCalcView(sal_Bool bFlag
)
202 nDatePos
=WRITER_DATE
;
207 void SvxRedlinTable::UpdateFilterTest()
209 Date
aDateMax( Date::SYSTEM
);
210 sal_uInt16 nYEAR
=aDateMax
.GetYear()+100;
211 aDateMax
.SetYear(nYEAR
);
212 Date
aDateMin(1,1,1989);
214 Time
aTMax(23,59,59);
217 DateTime
aDTMin(aDateMin
);
218 DateTime
aDTMax(aDateMax
);
222 case FLT_DATE_BEFORE
:
223 aDaTiFilterFirst
=aDTMin
;
224 aDaTiFilterLast
=aDaTiFirst
;
228 aDaTiFilterFirst
=aDaTiFirst
;
229 aDaTiFilterLast
=aDTMax
;
232 aDaTiFilterFirst
=aDaTiFirst
;
233 aDaTiFilterLast
=aDaTiFirst
;
234 aDaTiFilterFirst
.SetTime(aTMin
.GetTime());
235 aDaTiFilterLast
.SetTime(aTMax
.GetTime());
237 case FLT_DATE_NOTEQUAL
:
238 aDaTiFilterFirst
=aDaTiFirst
;
239 aDaTiFilterLast
=aDaTiFirst
;
240 aDaTiFilterFirst
.SetTime(aTMin
.GetTime());
241 aDaTiFilterLast
.SetTime(aTMax
.GetTime());
243 case FLT_DATE_BETWEEN
:
244 aDaTiFilterFirst
=aDaTiFirst
;
245 aDaTiFilterLast
=aDaTiLast
;
251 void SvxRedlinTable::SetFilterDate(sal_Bool bFlag
)
256 void SvxRedlinTable::SetDateTimeMode(sal_uInt16 nMode
)
261 void SvxRedlinTable::SetFirstDate(const Date
& aDate
)
263 aDaTiFirst
.SetDate(aDate
.GetDate());
266 void SvxRedlinTable::SetLastDate(const Date
& aDate
)
268 aDaTiLast
.SetDate(aDate
.GetDate());
271 void SvxRedlinTable::SetFirstTime(const Time
& aTime
)
273 aDaTiFirst
.SetTime(aTime
.GetTime());
276 void SvxRedlinTable::SetLastTime(const Time
& aTime
)
278 aDaTiLast
.SetTime(aTime
.GetTime());
281 void SvxRedlinTable::SetFilterAuthor(sal_Bool bFlag
)
286 void SvxRedlinTable::SetAuthor(const String
&aString
)
291 void SvxRedlinTable::SetFilterComment(sal_Bool bFlag
)
296 void SvxRedlinTable::SetCommentParams( const utl::SearchParam
* pSearchPara
)
298 if(pSearchPara
!=NULL
)
300 delete pCommentSearcher
;
302 pCommentSearcher
=new utl::TextSearch(*pSearchPara
, LANGUAGE_SYSTEM
);
306 sal_Bool
SvxRedlinTable::IsValidEntry(const String
* pAuthorStr
,
307 const DateTime
*pDateTime
,const String
* pCommentStr
)
312 nTheFlag
= aAuthor
.CompareTo(*pAuthorStr
)==COMPARE_EQUAL
;
314 if(bDate
&& nTheFlag
)
316 if(nDaTiMode
!=FLT_DATE_NOTEQUAL
)
318 nTheFlag
=pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
);
322 nTheFlag
=!(pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
));
325 if(bComment
&& nTheFlag
)
327 xub_StrLen nStartPos
= 0;
328 xub_StrLen nEndPos
= pCommentStr
->Len();
330 nTheFlag
=pCommentSearcher
->SearchFrwrd( *pCommentStr
, &nStartPos
, &nEndPos
);
335 sal_Bool
SvxRedlinTable::IsValidEntry(const String
* pAuthorStr
,const DateTime
*pDateTime
)
337 sal_Bool nTheFlag
=sal_True
;
340 if(aAuthor
.CompareTo(*pAuthorStr
)==COMPARE_EQUAL
)
345 if(bDate
&& nTheFlag
)
347 if(nDaTiMode
!=FLT_DATE_NOTEQUAL
)
349 nTheFlag
=pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
);
353 nTheFlag
=!(pDateTime
->IsBetween(aDaTiFilterFirst
,aDaTiFilterLast
));
359 sal_Bool
SvxRedlinTable::IsValidComment(const String
* pCommentStr
)
365 xub_StrLen nStartPos
= 0;
366 xub_StrLen nEndPos
= pCommentStr
->Len();
368 nTheFlag
=pCommentSearcher
->SearchFrwrd( *pCommentStr
, &nStartPos
, &nEndPos
);
373 SvTreeListEntry
* SvxRedlinTable::InsertEntry(const String
& rStr
,RedlinData
*pUserData
,
374 SvTreeListEntry
* pParent
,sal_uIntPtr nPos
)
376 aEntryColor
=GetTextColor();
379 if(pUserData
->bDisabled
)
380 aEntryColor
=Color(COL_GRAY
);
383 XubString aStr
= rStr
;
385 XubString
aFirstStr( aStr
);
386 xub_StrLen nEnd
= aFirstStr
.Search( sal_Unicode( '\t' ) );
387 if( nEnd
!= STRING_NOTFOUND
)
389 aFirstStr
.Erase( nEnd
);
391 aCurEntry
.Erase( 0, ++nEnd
);
396 return SvxSimpleTable::InsertEntry( aFirstStr
, pParent
, sal_False
, nPos
, pUserData
);
400 SvTreeListEntry
* SvxRedlinTable::InsertEntry(const String
& rStr
,RedlinData
*pUserData
,const Color
& aColor
,
401 SvTreeListEntry
* pParent
,sal_uIntPtr nPos
)
405 XubString aStr
= rStr
;
407 XubString
aFirstStr( aStr
);
408 xub_StrLen nEnd
= aFirstStr
.Search( sal_Unicode ( '\t' ) );
409 if( nEnd
!= STRING_NOTFOUND
)
411 aFirstStr
.Erase( nEnd
);
413 aCurEntry
.Erase( 0, ++nEnd
);
418 return SvxSimpleTable::InsertEntry( aFirstStr
, pParent
, sal_False
, nPos
, pUserData
);
421 SvTreeListEntry
* SvxRedlinTable::CreateEntry() const
423 return new SvxRedlinEntry
;
426 void SvxRedlinTable::InitEntry(SvTreeListEntry
* pEntry
, const OUString
& rStr
,
427 const Image
& rColl
, const Image
& rExp
, SvLBoxButtonKind eButtonKind
)
429 SvLBoxButton
* pButton
;
430 SvLBoxString
* pString
;
431 SvLBoxContextBmp
* pContextBmp
;
433 if( nTreeFlags
& TREEFLAG_CHKBTN
)
435 pButton
= new SvLBoxButton( pEntry
,eButtonKind
,0,pCheckButtonData
);
436 pEntry
->AddItem( pButton
);
439 pContextBmp
= new SvLBoxContextBmp(pEntry
,0, rColl
,rExp
, true);
440 pEntry
->AddItem( pContextBmp
);
442 pString
= new SvLBoxColorString( pEntry
, 0, rStr
,aEntryColor
);
443 pEntry
->AddItem( pString
);
447 sal_Unicode
* pCurToken
= (sal_Unicode
*)aCurEntry
.GetBuffer();
448 sal_uInt16 nCurTokenLen
;
449 sal_Unicode
* pNextToken
= (sal_Unicode
*)GetToken( pCurToken
, nCurTokenLen
);
450 sal_uInt16 nCount
= TabCount(); nCount
--;
452 for( sal_uInt16 nToken
= 0; nToken
< nCount
; nToken
++ )
454 if( pCurToken
&& nCurTokenLen
)
455 aToken
= OUString(pCurToken
, nCurTokenLen
);
459 SvLBoxColorString
* pStr
= new SvLBoxColorString( pEntry
, 0, aToken
,aEntryColor
);
460 pEntry
->AddItem( pStr
);
462 pCurToken
= pNextToken
;
464 pNextToken
= (sal_Unicode
*)GetToken( pCurToken
, nCurTokenLen
);
473 //============================================================================
475 //----------------------------------------------------------------------------
477 SvxTPView::SvxTPView(Window
* pParent
)
478 : TabPage(pParent
, "RedlineViewPage", "svx/ui/redlineviewpage.ui")
479 , bEnableAccept(true)
480 , bEnableAcceptAll(true)
481 , bEnableReject(true)
482 , bEnableRejectAll(true)
485 Dialog
*pTopLevel
= GetParentDialog();
486 pTopLevel
->get(m_pAccept
, "accept");
487 pTopLevel
->get(m_pReject
, "reject");
488 pTopLevel
->get(m_pAcceptAll
, "acceptall");
489 pTopLevel
->get(m_pRejectAll
, "rejectall");
490 pTopLevel
->get(m_pUndo
, "undo");
492 SvxSimpleTableContainer
* pTable
= get
<SvxSimpleTableContainer
>("changes");
493 Size
aControlSize(221, 65);
494 aControlSize
= LogicToPixel(aControlSize
, MAP_APPFONT
);
495 pTable
->set_width_request(aControlSize
.Width());
496 pTable
->set_height_request(aControlSize
.Height());
497 m_pViewData
= new SvxRedlinTable(*pTable
, 0);
499 Link aLink
=LINK( this, SvxTPView
, PbClickHdl
);
501 m_pAccept
->SetClickHdl(aLink
);
502 m_pAcceptAll
->SetClickHdl(aLink
);
503 m_pReject
->SetClickHdl(aLink
);
504 m_pRejectAll
->SetClickHdl(aLink
);
505 m_pUndo
->SetClickHdl(aLink
);
507 m_pViewData
->SetTabs(nStaticTabs
);
510 void SvxTPView::ActivatePage()
512 m_pAccept
->Enable(bEnableAccept
);
513 m_pReject
->Enable(bEnableReject
);
514 m_pAcceptAll
->Enable(bEnableAcceptAll
);
515 m_pRejectAll
->Enable(bEnableRejectAll
);
516 m_pUndo
->Enable(bEnableUndo
);
517 TabPage::ActivatePage();
520 void SvxTPView::DeactivatePage()
522 TabPage::DeactivatePage();
523 m_pAccept
->Disable();
524 m_pReject
->Disable();
525 m_pAcceptAll
->Disable();
526 m_pRejectAll
->Disable();
530 SvxTPView::~SvxTPView()
535 void SvxTPView::InsertWriterHeader()
537 OUString
aStrTab('\t');
538 OUString
aString(get
<FixedText
>("action")->GetText());
540 aString
+= get
<FixedText
>("author")->GetText();
542 aString
+= get
<FixedText
>("date")->GetText();
544 aString
+= get
<FixedText
>("comment")->GetText();
545 m_pViewData
->ClearHeader();
546 m_pViewData
->InsertHeaderEntry(aString
);
549 void SvxTPView::InsertCalcHeader()
551 OUString
aStrTab('\t');
552 OUString
aString(get
<FixedText
>("action")->GetText());
554 aString
+= get
<FixedText
>("position")->GetText();
556 aString
+= get
<FixedText
>("author")->GetText();
558 aString
+= get
<FixedText
>("date")->GetText();
560 aString
+= get
<FixedText
>("comment")->GetText();
561 m_pViewData
->ClearHeader();
562 m_pViewData
->InsertHeaderEntry(aString
);
565 void SvxTPView::EnableAccept(sal_Bool nFlag
)
567 bEnableAccept
= nFlag
;
568 m_pAccept
->Enable(nFlag
);
571 void SvxTPView::EnableAcceptAll(sal_Bool nFlag
)
573 bEnableAcceptAll
= nFlag
;
574 m_pAcceptAll
->Enable(nFlag
);
577 void SvxTPView::EnableReject(sal_Bool nFlag
)
579 bEnableReject
= nFlag
;
580 m_pReject
->Enable(nFlag
);
583 void SvxTPView::EnableRejectAll(sal_Bool nFlag
)
585 bEnableRejectAll
= nFlag
;
586 m_pRejectAll
->Enable(nFlag
);
589 void SvxTPView::ShowUndo(sal_Bool nFlag
)
591 m_pUndo
->Show(nFlag
);
594 void SvxTPView::EnableUndo(sal_Bool nFlag
)
597 m_pUndo
->Enable(nFlag
);
600 SvxRedlinTable
* SvxTPView::GetTableControl()
605 IMPL_LINK( SvxTPView
, PbClickHdl
, PushButton
*, pPushB
)
607 if (pPushB
== m_pAccept
)
609 AcceptClickLk
.Call(this);
611 else if (pPushB
== m_pAcceptAll
)
613 AcceptAllClickLk
.Call(this);
615 else if (pPushB
== m_pReject
)
617 RejectClickLk
.Call(this);
619 else if (pPushB
== m_pRejectAll
)
621 RejectAllClickLk
.Call(this);
623 else if (pPushB
== m_pUndo
)
625 UndoClickLk
.Call(this);
634 //============================================================================
636 //----------------------------------------------------------------------------
638 SvxTPFilter::SvxTPFilter( Window
* pParent
)
639 : TabPage(pParent
, "RedlineFilterPage", "svx/ui/redlinefilterpage.ui")
643 get(m_pCbDate
, "date");
644 get(m_pLbDate
, "datecond");
645 get(m_pDfDate
, "startdate");
646 get(m_pTfDate
, "starttime");
647 get(m_pIbClock
, "startclock");
648 get(m_pFtDate2
, "and");
649 get(m_pDfDate2
, "enddate");
650 get(m_pTfDate2
, "endtime");
651 get(m_pIbClock2
, "endclock");
652 get(m_pCbAuthor
, "author");
653 get(m_pLbAuthor
, "authorlist");
654 get(m_pCbRange
, "range");
655 get(m_pEdRange
, "rangeedit");
656 get(m_pBtnRange
, "dotdotdot");
657 get(m_pCbAction
, "action");
658 get(m_pLbAction
, "actionlist");
659 get(m_pCbComment
, "comment");
660 get(m_pEdComment
, "commentedit");
662 m_pLbAuthor
->SetAccessibleName(m_pCbAuthor
->GetText());
663 m_pEdComment
->SetAccessibleName(m_pCbComment
->GetText());
665 m_pDfDate
->SetShowDateCentury( sal_True
);
666 m_pDfDate2
->SetShowDateCentury( sal_True
);
668 m_pLbDate
->SelectEntryPos(0);
669 m_pLbDate
->SetSelectHdl( LINK( this, SvxTPFilter
, SelDateHdl
) );
670 m_pIbClock
->SetClickHdl( LINK( this, SvxTPFilter
, TimeHdl
) );
671 m_pIbClock2
->SetClickHdl( LINK( this, SvxTPFilter
,TimeHdl
) );
672 m_pBtnRange
->SetClickHdl( LINK( this, SvxTPFilter
, RefHandle
));
674 Link aLink
=LINK( this, SvxTPFilter
, RowEnableHdl
) ;
675 m_pCbDate
->SetClickHdl(aLink
);
676 m_pCbAuthor
->SetClickHdl(aLink
);
677 m_pCbRange
->SetClickHdl(aLink
);
678 m_pCbAction
->SetClickHdl(aLink
);
679 m_pCbComment
->SetClickHdl(aLink
);
681 Link a2Link
=LINK( this, SvxTPFilter
, ModifyDate
);
682 m_pDfDate
->SetModifyHdl(a2Link
);
683 m_pTfDate
->SetModifyHdl(a2Link
);
684 m_pDfDate2
->SetModifyHdl(a2Link
);
685 m_pTfDate2
->SetModifyHdl(a2Link
);
687 Link a3Link
=LINK( this, SvxTPFilter
, ModifyHdl
);
688 m_pEdRange
->SetModifyHdl(a3Link
);
689 m_pEdComment
->SetModifyHdl(a3Link
);
690 m_pLbAction
->SetSelectHdl(a3Link
);
691 m_pLbAuthor
->SetSelectHdl(a3Link
);
693 RowEnableHdl(m_pCbDate
);
694 RowEnableHdl(m_pCbAuthor
);
695 RowEnableHdl(m_pCbRange
);
696 RowEnableHdl(m_pCbAction
);
697 RowEnableHdl(m_pCbComment
);
699 Date
aDate( Date::SYSTEM
);
700 Time
aTime( Time::SYSTEM
);
701 m_pDfDate
->SetDate(aDate
);
702 m_pTfDate
->SetTime(aTime
);
703 m_pDfDate2
->SetDate(aDate
);
704 m_pTfDate2
->SetTime(aTime
);
710 void SvxTPFilter::SetRedlinTable(SvxRedlinTable
* pTable
)
715 void SvxTPFilter::ShowDateFields(sal_uInt16 nKind
)
720 case FLT_DATE_BEFORE
:
721 EnableDateLine1(sal_True
);
722 EnableDateLine2(sal_False
);
725 EnableDateLine1(sal_True
);
726 EnableDateLine2(sal_False
);
729 EnableDateLine1(sal_True
);
730 m_pTfDate
->Disable();
731 m_pTfDate
->SetText(aEmpty
);
732 EnableDateLine2(sal_False
);
734 case FLT_DATE_NOTEQUAL
:
735 EnableDateLine1(sal_True
);
736 m_pTfDate
->Disable();
737 m_pTfDate
->SetText(aEmpty
);
738 EnableDateLine2(sal_False
);
740 case FLT_DATE_BETWEEN
:
741 EnableDateLine1(sal_True
);
742 EnableDateLine2(sal_True
);
745 EnableDateLine1(sal_False
);
746 EnableDateLine2(sal_False
);
751 void SvxTPFilter::EnableDateLine1(sal_Bool bFlag
)
753 if(bFlag
&& m_pCbDate
->IsChecked())
757 m_pIbClock
->Enable();
761 m_pDfDate
->Disable();
762 m_pTfDate
->Disable();
763 m_pIbClock
->Disable();
766 void SvxTPFilter::EnableDateLine2(sal_Bool bFlag
)
769 if(bFlag
&& m_pCbDate
->IsChecked())
771 m_pFtDate2
->Enable();
772 m_pDfDate2
->Enable();
773 m_pTfDate2
->Enable();
774 m_pIbClock2
->Enable();
778 m_pFtDate2
->Disable();
779 m_pDfDate2
->Disable();
780 m_pDfDate2
->SetText(aEmpty
);
781 m_pTfDate2
->Disable();
782 m_pTfDate2
->SetText(aEmpty
);
783 m_pIbClock2
->Disable();
787 Date
SvxTPFilter::GetFirstDate() const
789 return m_pDfDate
->GetDate();
792 void SvxTPFilter::SetFirstDate(const Date
&aDate
)
794 m_pDfDate
->SetDate(aDate
);
797 Time
SvxTPFilter::GetFirstTime() const
799 return m_pTfDate
->GetTime();
802 void SvxTPFilter::SetFirstTime(const Time
&aTime
)
804 m_pTfDate
->SetTime(aTime
);
808 Date
SvxTPFilter::GetLastDate() const
810 return m_pDfDate2
->GetDate();
813 void SvxTPFilter::SetLastDate(const Date
&aDate
)
815 m_pDfDate2
->SetDate(aDate
);
818 Time
SvxTPFilter::GetLastTime() const
820 return m_pTfDate2
->GetTime();
823 void SvxTPFilter::SetLastTime(const Time
&aTime
)
825 m_pTfDate2
->SetTime(aTime
);
828 void SvxTPFilter::SetDateMode(sal_uInt16 nMode
)
830 m_pLbDate
->SelectEntryPos(nMode
);
831 SelDateHdl(m_pLbDate
);
834 sal_uInt16
SvxTPFilter::GetDateMode()
836 return (sal_uInt16
) m_pLbDate
->GetSelectEntryPos();
838 void SvxTPFilter::ClearAuthors()
840 m_pLbAuthor
->Clear();
843 void SvxTPFilter::InsertAuthor( const String
& rString
, sal_uInt16 nPos
)
845 m_pLbAuthor
->InsertEntry(rString
,nPos
);
848 String
SvxTPFilter::GetSelectedAuthor() const
850 return m_pLbAuthor
->GetSelectEntry();
853 void SvxTPFilter::SelectedAuthorPos(sal_uInt16 nPos
)
855 m_pLbAuthor
->SelectEntryPos(nPos
);
858 sal_uInt16
SvxTPFilter::SelectAuthor(const String
& aString
)
860 m_pLbAuthor
->SelectEntry(aString
);
861 return m_pLbAuthor
->GetSelectEntryPos();
864 void SvxTPFilter::SetRange(const String
& rString
)
866 m_pEdRange
->SetText(rString
);
869 String
SvxTPFilter::GetRange() const
871 return m_pEdRange
->GetText();
874 void SvxTPFilter::SetFocusToRange()
876 m_pEdRange
->GrabFocus();
879 void SvxTPFilter::HideRange(sal_Bool bHide
)
896 void SvxTPFilter::SetComment(const String
&rComment
)
898 m_pEdComment
->SetText(rComment
);
900 String
SvxTPFilter::GetComment()const
902 return m_pEdComment
->GetText();
905 sal_Bool
SvxTPFilter::IsDate()
907 return m_pCbDate
->IsChecked();
910 sal_Bool
SvxTPFilter::IsAuthor()
912 return m_pCbAuthor
->IsChecked();
915 sal_Bool
SvxTPFilter::IsRange()
917 return m_pCbRange
->IsChecked();
920 sal_Bool
SvxTPFilter::IsAction()
922 return m_pCbAction
->IsChecked();
925 sal_Bool
SvxTPFilter::IsComment()
927 return m_pCbComment
->IsChecked();
930 void SvxTPFilter::CheckDate(sal_Bool bFlag
)
932 m_pCbDate
->Check(bFlag
);
933 RowEnableHdl(m_pCbDate
);
937 void SvxTPFilter::CheckAuthor(sal_Bool bFlag
)
939 m_pCbAuthor
->Check(bFlag
);
940 RowEnableHdl(m_pCbAuthor
);
944 void SvxTPFilter::CheckRange(sal_Bool bFlag
)
946 m_pCbRange
->Check(bFlag
);
947 RowEnableHdl(m_pCbRange
);
951 void SvxTPFilter::CheckAction(sal_Bool bFlag
)
953 m_pCbAction
->Check(bFlag
);
954 RowEnableHdl(m_pCbAction
);
958 void SvxTPFilter::CheckComment(sal_Bool bFlag
)
960 m_pCbComment
->Check(bFlag
);
961 RowEnableHdl(m_pCbComment
);
965 void SvxTPFilter::ShowAction(sal_Bool bShow
)
980 ListBox
* SvxTPFilter::GetLbAction()
985 IMPL_LINK( SvxTPFilter
, SelDateHdl
, ListBox
*, pLb
)
987 ShowDateFields((sal_uInt16
)m_pLbDate
->GetSelectEntryPos());
992 IMPL_LINK( SvxTPFilter
, RowEnableHdl
, CheckBox
*, pCB
)
994 if (pCB
== m_pCbDate
)
996 m_pLbDate
->Enable(m_pCbDate
->IsChecked());
997 m_pLbDate
->Invalidate();
998 EnableDateLine1(sal_False
);
999 EnableDateLine2(sal_False
);
1000 if(m_pCbDate
->IsChecked()) SelDateHdl(m_pLbDate
);
1002 else if (pCB
== m_pCbAuthor
)
1004 m_pLbAuthor
->Enable(m_pCbAuthor
->IsChecked());
1005 m_pLbAuthor
->Invalidate();
1007 else if (pCB
== m_pCbRange
)
1009 m_pEdRange
->Enable(m_pCbRange
->IsChecked());
1010 m_pBtnRange
->Enable(m_pCbRange
->IsChecked());
1012 else if (pCB
== m_pCbAction
)
1014 m_pLbAction
->Enable(m_pCbAction
->IsChecked());
1015 m_pLbAction
->Invalidate();
1017 else if (pCB
== m_pCbComment
)
1019 m_pEdComment
->Enable(m_pCbComment
->IsChecked());
1020 m_pEdComment
->Invalidate();
1027 IMPL_LINK( SvxTPFilter
, TimeHdl
, ImageButton
*,pIB
)
1029 Date
aDate( Date::SYSTEM
);
1030 Time
aTime( Time::SYSTEM
);
1031 if (pIB
== m_pIbClock
)
1033 m_pDfDate
->SetDate(aDate
);
1034 m_pTfDate
->SetTime(aTime
);
1036 else if (pIB
== m_pIbClock2
)
1038 m_pDfDate2
->SetDate(aDate
);
1039 m_pTfDate2
->SetTime(aTime
);
1041 ModifyHdl(m_pDfDate
);
1045 IMPL_LINK( SvxTPFilter
, ModifyHdl
, void*, pCtr
)
1049 if (pCtr
== m_pCbDate
|| pCtr
== m_pLbDate
||
1050 pCtr
== m_pDfDate
|| pCtr
== m_pTfDate
||
1051 pCtr
== m_pIbClock
|| pCtr
== m_pFtDate2
||
1052 pCtr
== m_pDfDate2
|| pCtr
== m_pTfDate2
||
1053 pCtr
== m_pIbClock2
)
1055 aModifyDateLink
.Call(this);
1057 else if (pCtr
== m_pCbAuthor
|| pCtr
== m_pLbAuthor
)
1059 aModifyAuthorLink
.Call(this);
1061 else if (pCtr
== m_pCbRange
|| pCtr
== m_pLbAction
|| pCtr
== m_pEdRange
||
1062 pCtr
== m_pBtnRange
)
1064 aModifyRefLink
.Call(this);
1066 else if (pCtr
== m_pCbComment
|| pCtr
== m_pEdComment
)
1068 aModifyComLink
.Call(this);
1072 aModifyLink
.Call(this);
1077 void SvxTPFilter::DeactivatePage()
1081 if(pRedlinTable
!=NULL
)
1083 pRedlinTable
->SetFilterDate(IsDate());
1084 pRedlinTable
->SetDateTimeMode(GetDateMode());
1085 pRedlinTable
->SetFirstDate(m_pDfDate
->GetDate());
1086 pRedlinTable
->SetLastDate(m_pDfDate2
->GetDate());
1087 pRedlinTable
->SetFirstTime(m_pTfDate
->GetTime());
1088 pRedlinTable
->SetLastTime(m_pTfDate2
->GetTime());
1089 pRedlinTable
->SetFilterAuthor(IsAuthor());
1090 pRedlinTable
->SetAuthor(GetSelectedAuthor());
1092 pRedlinTable
->SetFilterComment(IsComment());
1094 utl::SearchParam
aSearchParam( m_pEdComment
->GetText(),
1095 utl::SearchParam::SRCH_REGEXP
,sal_False
,sal_False
,sal_False
);
1097 pRedlinTable
->SetCommentParams(&aSearchParam
);
1099 pRedlinTable
->UpdateFilterTest();
1102 aReadyLink
.Call(this);
1104 bModified
=sal_False
;
1105 TabPage::DeactivatePage();
1108 void SvxTPFilter::Enable( bool bEnable
, bool bChild
)
1110 TabPage::Enable(bEnable
,bChild
);
1111 if(m_pCbDate
->IsEnabled())
1113 RowEnableHdl(m_pCbDate
);
1114 RowEnableHdl(m_pCbAuthor
);
1115 RowEnableHdl(m_pCbRange
);
1116 RowEnableHdl(m_pCbComment
);
1119 void SvxTPFilter::Disable( bool bChild
)
1121 Enable( false, bChild
);
1124 IMPL_LINK( SvxTPFilter
, ModifyDate
, void*,pTF
)
1127 Date
aDate( Date::SYSTEM
);
1131 if(m_pDfDate
->GetText().isEmpty())
1132 m_pDfDate
->SetDate(aDate
);
1134 if(pRedlinTable
!=NULL
)
1135 pRedlinTable
->SetFirstDate(m_pDfDate
->GetDate());
1137 else if (m_pDfDate2
==pTF
)
1139 if(m_pDfDate2
->GetText().isEmpty())
1140 m_pDfDate2
->SetDate(aDate
);
1142 if(pRedlinTable
!=NULL
)
1143 pRedlinTable
->SetLastDate(m_pDfDate2
->GetDate());
1145 else if (m_pTfDate
==pTF
)
1147 if(m_pTfDate
->GetText().isEmpty())
1148 m_pTfDate
->SetTime(aTime
);
1150 if(pRedlinTable
!=NULL
)
1151 pRedlinTable
->SetFirstTime(m_pTfDate
->GetTime());
1153 else if (m_pTfDate2
==pTF
)
1155 if(m_pTfDate2
->GetText().isEmpty())
1156 m_pTfDate2
->SetTime(aTime
);
1158 if(pRedlinTable
!=NULL
)
1159 pRedlinTable
->SetLastTime(m_pTfDate2
->GetTime());
1162 ModifyHdl(m_pDfDate
);
1166 IMPL_LINK( SvxTPFilter
, RefHandle
, PushButton
*, pRef
)
1170 aRefLink
.Call(this);
1175 //============================================================================
1176 // class SvxAcceptChgCtr
1177 //----------------------------------------------------------------------------
1179 SvxAcceptChgCtr::SvxAcceptChgCtr(Window
* pParent
)
1180 : TabControl(pParent
, WB_TABSTOP
| WB_DIALOGCONTROL
)
1182 m_pUIBuilder
= new VclBuilder(this, getUIRootDir(), "svx/ui/redlinecontrol.ui", "RedlineControl");
1184 pTPFilter
= new SvxTPFilter(this);
1185 pTPView
= new SvxTPView(this);
1187 m_nViewPageId
= GetPageId("view");
1188 m_nFilterPageId
= GetPageId("filter");
1189 SetTabPage(m_nViewPageId
, pTPView
);
1190 SetTabPage(m_nFilterPageId
, pTPFilter
);
1192 pTPFilter
->SetRedlinTable(GetViewTable());
1199 SvxAcceptChgCtr::~SvxAcceptChgCtr()
1205 void SvxAcceptChgCtr::ShowFilterPage()
1207 SetCurPageId(m_nFilterPageId
);
1210 void SvxAcceptChgCtr::ShowViewPage()
1212 SetCurPageId(m_nViewPageId
);
1215 SvxTPFilter
* SvxAcceptChgCtr::GetFilterPage()
1220 SvxTPView
* SvxAcceptChgCtr::GetViewPage()
1225 SvxRedlinTable
* SvxAcceptChgCtr::GetViewTable()
1227 return pTPView
? pTPView
->GetTableControl() : NULL
;
1230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */