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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 // System - Includes --------------------------------------------------------- 28 #include <vcl/svapp.hxx> 29 #include <tools/shl.hxx> 30 #include <sfx2/app.hxx> 31 #include <sfx2/module.hxx> 32 #include <svtools/txtcmp.hxx> 33 #include <unotools/charclass.hxx> 34 // INCLUDE ------------------------------------------------------------------- 35 #include <editeng/unolingu.hxx> 36 #include <svx/dialmgr.hxx> 37 #include "ctredlin.hrc" 38 #include <svx/ctredlin.hxx> 39 #include "helpid.hrc" 40 41 //============================================================================ 42 // Local Defines and Function 43 //---------------------------------------------------------------------------- 44 45 inline void EnableDisable( Window& rWin, sal_Bool bEnable ) 46 { 47 if (bEnable) 48 rWin.Enable(); 49 else 50 rWin.Disable(); 51 } 52 53 static long nStaticTabs[]= 54 { 55 5,10,65,120,170,220 56 }; 57 58 #define MIN_DISTANCE 6 59 #define WRITER_AUTHOR 1 60 #define WRITER_DATE 2 61 #define CALC_AUTHOR 2 62 #define CALC_DATE 3 63 64 RedlinData::RedlinData() 65 { 66 bDisabled=sal_False; 67 pData=NULL; 68 } 69 RedlinData::~RedlinData() 70 { 71 } 72 73 //============================================================================ 74 // class SvxRedlinEntry (Eintraege fuer Liste) 75 //---------------------------------------------------------------------------- 76 77 SvxRedlinEntry::SvxRedlinEntry() 78 :SvLBoxEntry() 79 { 80 } 81 82 SvxRedlinEntry::~SvxRedlinEntry() 83 { 84 RedlinData* pRedDat=(RedlinData*) GetUserData(); 85 if(pRedDat!=NULL) 86 { 87 delete pRedDat; 88 } 89 } 90 91 /************************************************************************* 92 #* Funktionen der in den SvxRedlinTable eingefuegten Items 93 #************************************************************************/ 94 95 DBG_NAME(SvLBoxColorString); 96 97 /************************************************************************* 98 #* Member: SvLBoxColorString Datum:23.10.97 99 #*------------------------------------------------------------------------ 100 #* 101 #* Klasse: SvLBoxColorString 102 #* 103 #* Funktion: Konstruktor der Klasse SvLBoxColorString 104 #* 105 #* Input: Box- Entry,Flags, Text fuer Anzeige, Schrift 106 #* 107 #* Output: --- 108 #* 109 #************************************************************************/ 110 111 SvLBoxColorString::SvLBoxColorString( SvLBoxEntry*pEntry,sal_uInt16 nFlags,const XubString& rStr, 112 const Color& rCol) 113 114 : SvLBoxString( pEntry, nFlags, rStr ) 115 { 116 DBG_CTOR(SvLBoxColorString,0); 117 aPrivColor=rCol; 118 SetText( pEntry, rStr ); 119 } 120 121 /************************************************************************* 122 #* Member: SvLBoxColorString Datum:23.10.97 123 #*------------------------------------------------------------------------ 124 #* 125 #* Klasse: SvLBoxColorString 126 #* 127 #* Funktion: Default Konstruktor der Klasse SvLBoxColorString 128 #* 129 #* Input: --- 130 #* 131 #* Output: --- 132 #* 133 #************************************************************************/ 134 135 SvLBoxColorString::SvLBoxColorString() 136 : SvLBoxString() 137 { 138 DBG_CTOR(SvLBoxColorString,0); 139 } 140 141 /************************************************************************* 142 #* Member: ~SvLBoxColorString Datum:23.10.97 143 #*------------------------------------------------------------------------ 144 #* 145 #* Klasse: SvLBoxColorString 146 #* 147 #* Funktion: Destruktor der Klasse SvLBoxColorString 148 #* 149 #* Input: --- 150 #* 151 #* Output: --- 152 #* 153 #************************************************************************/ 154 155 SvLBoxColorString::~SvLBoxColorString() 156 { 157 DBG_DTOR(SvLBoxColorString,0); 158 } 159 160 161 /************************************************************************* 162 #* Member: SvLBoxColorString Datum:23.10.97 163 #*------------------------------------------------------------------------ 164 #* 165 #* Klasse: SvLBoxColorString 166 #* 167 #* Funktion: Erzeugt einen neuen SvLBoxColorString 168 #* 169 #* Input: --- 170 #* 171 #* Output: SvLBoxColorString 172 #* 173 #************************************************************************/ 174 175 SvLBoxItem* SvLBoxColorString::Create() const 176 { 177 DBG_CHKTHIS(SvLBoxColorString,0); 178 return new SvLBoxColorString; 179 } 180 181 182 183 /************************************************************************* 184 #* Member: SvLBoxColorString Datum:23.10.97 185 #*------------------------------------------------------------------------ 186 #* 187 #* Klasse: SvLBoxColorString 188 #* 189 #* Funktion: Zeichenroutine des SvLBoxColorString. Gezeichnet wird 190 #* der entsprechende Text mit der eingestellten Farbe 191 #* im Ausgabe- Device. 192 #* 193 #* Input: Position, Ausgabe- Device, Flag fuer Selection, 194 #* Zeiger auf den Eintrag 195 #* 196 #* Output: --- 197 #* 198 #************************************************************************/ 199 200 void SvLBoxColorString::Paint( const Point& rPos, SvLBox& rDev, 201 sal_uInt16 nFlags, SvLBoxEntry* pEntry ) 202 { 203 Color aColor=rDev.GetTextColor(); 204 Color a2Color=aColor; 205 if(!(nFlags & SVLISTENTRYFLAG_SELECTED)) 206 { 207 rDev.SetTextColor(aPrivColor); 208 } 209 SvLBoxString::Paint(rPos,rDev,nFlags,pEntry ); 210 rDev.SetTextColor(a2Color); 211 } 212 213 //============================================================================ 214 // class SvxRedlinTable 215 //---------------------------------------------------------------------------- 216 217 SvxRedlinTable::SvxRedlinTable( Window* pParent,WinBits nBits ): 218 SvxSimpleTable(pParent,nBits ) 219 { 220 bAuthor=sal_False; 221 bDate=sal_False; 222 bIsCalc=sal_False; 223 bComment=sal_False; 224 nDatePos=WRITER_DATE; 225 pCommentSearcher=NULL; 226 SetNodeDefaultImages(); 227 } 228 229 SvxRedlinTable::SvxRedlinTable( Window* pParent,const ResId& rResId): 230 SvxSimpleTable(pParent,rResId) 231 { 232 bAuthor=sal_False; 233 bDate=sal_False; 234 bIsCalc=sal_False; 235 bComment=sal_False; 236 nDatePos=WRITER_DATE; 237 pCommentSearcher=NULL; 238 SetNodeDefaultImages(); 239 } 240 241 SvxRedlinTable::~SvxRedlinTable() 242 { 243 if(pCommentSearcher!=NULL) 244 delete pCommentSearcher; 245 } 246 247 StringCompare SvxRedlinTable::ColCompare(SvLBoxEntry* pLeft,SvLBoxEntry* pRight) 248 { 249 StringCompare eCompare=COMPARE_EQUAL; 250 251 if(aColCompareLink.IsSet()) 252 { 253 SvSortData aRedlinCompare; 254 aRedlinCompare.pLeft=pLeft; 255 aRedlinCompare.pRight=pRight; 256 eCompare=(StringCompare) aColCompareLink.Call(&aRedlinCompare); 257 } 258 else 259 { 260 if(nDatePos==GetSortedCol()) 261 { 262 RedlinData *pLeftData=(RedlinData *)(pLeft->GetUserData()); 263 RedlinData *pRightData=(RedlinData *)(pRight->GetUserData()); 264 265 if(pLeftData!=NULL && pRightData!=NULL) 266 { 267 if(pLeftData->aDateTime < pRightData->aDateTime) 268 { 269 eCompare=COMPARE_LESS; 270 } 271 else if(pLeftData->aDateTime > pRightData->aDateTime) 272 { 273 eCompare=COMPARE_GREATER; 274 } 275 } 276 else 277 eCompare=SvxSimpleTable::ColCompare(pLeft,pRight); 278 } 279 else 280 { 281 eCompare=SvxSimpleTable::ColCompare(pLeft,pRight); 282 } 283 284 } 285 286 return eCompare; 287 } 288 void SvxRedlinTable::SetCalcView(sal_Bool bFlag) 289 { 290 bIsCalc=bFlag; 291 if(bFlag) 292 { 293 nDatePos=CALC_DATE; 294 } 295 else 296 { 297 nDatePos=WRITER_DATE; 298 } 299 } 300 301 302 void SvxRedlinTable::UpdateFilterTest() 303 { 304 Date aDateMax; 305 sal_uInt16 nYEAR=aDateMax.GetYear()+100; 306 aDateMax.SetYear(nYEAR); 307 Date aDateMin(1,1,1989); 308 Time aTMin(0); 309 Time aTMax(23,59,59); 310 311 312 DateTime aDTMin(aDateMin); 313 DateTime aDTMax(aDateMax); 314 315 switch(nDaTiMode) 316 { 317 case FLT_DATE_BEFORE: 318 aDaTiFilterFirst=aDTMin; 319 aDaTiFilterLast=aDaTiFirst; 320 break; 321 case FLT_DATE_SAVE: 322 case FLT_DATE_SINCE: 323 aDaTiFilterFirst=aDaTiFirst; 324 aDaTiFilterLast=aDTMax; 325 break; 326 case FLT_DATE_EQUAL: 327 aDaTiFilterFirst=aDaTiFirst; 328 aDaTiFilterLast=aDaTiFirst; 329 aDaTiFilterFirst.SetTime(aTMin.GetTime()); 330 aDaTiFilterLast.SetTime(aTMax.GetTime()); 331 break; 332 case FLT_DATE_NOTEQUAL: 333 aDaTiFilterFirst=aDaTiFirst; 334 aDaTiFilterLast=aDaTiFirst; 335 aDaTiFilterFirst.SetTime(aTMin.GetTime()); 336 aDaTiFilterLast.SetTime(aTMax.GetTime()); 337 break; 338 case FLT_DATE_BETWEEN: 339 aDaTiFilterFirst=aDaTiFirst; 340 aDaTiFilterLast=aDaTiLast; 341 break; 342 } 343 } 344 345 346 void SvxRedlinTable::SetFilterDate(sal_Bool bFlag) 347 { 348 bDate=bFlag; 349 } 350 351 void SvxRedlinTable::SetDateTimeMode(sal_uInt16 nMode) 352 { 353 nDaTiMode=nMode; 354 } 355 356 void SvxRedlinTable::SetFirstDate(const Date& aDate) 357 { 358 aDaTiFirst.SetDate(aDate.GetDate()); 359 } 360 361 void SvxRedlinTable::SetLastDate(const Date& aDate) 362 { 363 aDaTiLast.SetDate(aDate.GetDate()); 364 } 365 366 void SvxRedlinTable::SetFirstTime(const Time& aTime) 367 { 368 aDaTiFirst.SetTime(aTime.GetTime()); 369 } 370 371 void SvxRedlinTable::SetLastTime(const Time& aTime) 372 { 373 aDaTiLast.SetTime(aTime.GetTime()); 374 } 375 376 void SvxRedlinTable::SetFilterAuthor(sal_Bool bFlag) 377 { 378 bAuthor=bFlag; 379 } 380 381 void SvxRedlinTable::SetAuthor(const String &aString) 382 { 383 aAuthor=aString; 384 } 385 386 void SvxRedlinTable::SetFilterComment(sal_Bool bFlag) 387 { 388 bComment=bFlag; 389 } 390 391 void SvxRedlinTable::SetCommentParams( const utl::SearchParam* pSearchPara ) 392 { 393 if(pSearchPara!=NULL) 394 { 395 if(pCommentSearcher!=NULL) delete pCommentSearcher; 396 397 pCommentSearcher=new utl::TextSearch(*pSearchPara, LANGUAGE_SYSTEM ); 398 } 399 } 400 401 sal_Bool SvxRedlinTable::IsValidWriterEntry(const String& rString,RedlinData *pUserData) 402 { 403 sal_Bool nTheFlag=sal_True; 404 String aString=rString.GetToken(WRITER_AUTHOR,'\t'); 405 if(pUserData==NULL) 406 { 407 if(bAuthor) 408 { 409 if(aAuthor.CompareTo(aString)==COMPARE_EQUAL) 410 nTheFlag=sal_True; 411 else 412 nTheFlag=sal_False; 413 } 414 } 415 else 416 { 417 DateTime aDateTime=pUserData->aDateTime; 418 nTheFlag=IsValidEntry(&aString,&aDateTime); 419 } 420 return nTheFlag; 421 } 422 423 sal_Bool SvxRedlinTable::IsValidCalcEntry(const String& rString,RedlinData *pUserData) 424 { 425 sal_Bool nTheFlag=sal_True; 426 String aString=rString.GetToken(CALC_AUTHOR,'\t'); 427 if(pUserData==NULL) 428 { 429 if(bAuthor) 430 { 431 if(aAuthor.CompareTo(aString)==COMPARE_EQUAL) 432 nTheFlag=sal_True; 433 else 434 nTheFlag=sal_False; 435 } 436 } 437 else 438 { 439 DateTime aDateTime=pUserData->aDateTime; 440 nTheFlag=IsValidEntry(&aString,&aDateTime); 441 } 442 return nTheFlag; 443 } 444 445 sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr, 446 const DateTime *pDateTime,const String* pCommentStr) 447 { 448 bool nTheFlag=true; 449 if(bAuthor) 450 { 451 nTheFlag = aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL; 452 } 453 if(bDate && nTheFlag) 454 { 455 if(nDaTiMode!=FLT_DATE_NOTEQUAL) 456 { 457 nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast); 458 } 459 else 460 { 461 nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast)); 462 } 463 } 464 if(bComment && nTheFlag) 465 { 466 xub_StrLen nStartPos = 0; 467 xub_StrLen nEndPos = pCommentStr->Len(); 468 469 nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos); 470 } 471 return nTheFlag; 472 } 473 474 sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,const DateTime *pDateTime) 475 { 476 sal_Bool nTheFlag=sal_True; 477 if(bAuthor) 478 { 479 if(aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL) 480 nTheFlag=sal_True; 481 else 482 nTheFlag=sal_False; 483 } 484 if(bDate && nTheFlag) 485 { 486 if(nDaTiMode!=FLT_DATE_NOTEQUAL) 487 { 488 nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast); 489 } 490 else 491 { 492 nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast)); 493 } 494 } 495 return nTheFlag; 496 } 497 498 sal_Bool SvxRedlinTable::IsValidComment(const String* pCommentStr) 499 { 500 bool nTheFlag=true; 501 502 if(bComment) 503 { 504 xub_StrLen nStartPos = 0; 505 xub_StrLen nEndPos = pCommentStr->Len(); 506 507 nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos); 508 } 509 return nTheFlag; 510 } 511 512 SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData, 513 SvLBoxEntry* pParent,sal_uIntPtr nPos) 514 { 515 aEntryColor=GetTextColor(); 516 if(pUserData!=NULL) 517 { 518 if(pUserData->bDisabled) 519 aEntryColor=Color(COL_GRAY); 520 } 521 522 XubString aStr= rStr; 523 524 XubString aFirstStr( aStr ); 525 xub_StrLen nEnd = aFirstStr.Search( sal_Unicode( '\t' ) ); 526 if( nEnd != STRING_NOTFOUND ) 527 { 528 aFirstStr.Erase( nEnd ); 529 aCurEntry = aStr; 530 aCurEntry.Erase( 0, ++nEnd ); 531 } 532 else 533 aCurEntry.Erase(); 534 535 return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData ); 536 537 } 538 539 SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData,const Color& aColor, 540 SvLBoxEntry* pParent,sal_uIntPtr nPos) 541 { 542 aEntryColor=aColor; 543 544 XubString aStr= rStr; 545 546 XubString aFirstStr( aStr ); 547 xub_StrLen nEnd = aFirstStr.Search( sal_Unicode ( '\t' ) ); 548 if( nEnd != STRING_NOTFOUND ) 549 { 550 aFirstStr.Erase( nEnd ); 551 aCurEntry = aStr; 552 aCurEntry.Erase( 0, ++nEnd ); 553 } 554 else 555 aCurEntry.Erase(); 556 557 return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData ); 558 } 559 560 SvLBoxEntry* SvxRedlinTable::CreateEntry() const 561 { 562 return new SvxRedlinEntry; 563 } 564 565 void SvxRedlinTable::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr, 566 const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind ) 567 { 568 SvLBoxButton* pButton; 569 SvLBoxString* pString; 570 SvLBoxContextBmp* pContextBmp; 571 572 if( nTreeFlags & TREEFLAG_CHKBTN ) 573 { 574 pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData ); 575 pEntry->AddItem( pButton ); 576 } 577 578 pContextBmp= new SvLBoxContextBmp( pEntry,0, rColl,rExp, 579 SVLISTENTRYFLAG_EXPANDED); 580 pEntry->AddItem( pContextBmp ); 581 582 pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor); 583 pEntry->AddItem( pString ); 584 585 XubString aToken; 586 587 xub_Unicode* pCurToken = (xub_Unicode*)aCurEntry.GetBuffer(); 588 sal_uInt16 nCurTokenLen; 589 xub_Unicode* pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen ); 590 sal_uInt16 nCount = TabCount(); nCount--; 591 592 for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ ) 593 { 594 if( pCurToken && nCurTokenLen ) 595 // aToken.Assign( pCurToken, nCurTokenLen ); 596 aToken = XubString( pCurToken, nCurTokenLen ); 597 else 598 aToken.Erase(); 599 600 SvLBoxColorString* pStr = new SvLBoxColorString( pEntry, 0, aToken ,aEntryColor); 601 pEntry->AddItem( pStr ); 602 603 pCurToken = pNextToken; 604 if( pCurToken ) 605 pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen ); 606 else 607 nCurTokenLen = 0; 608 } 609 } 610 611 612 613 614 //============================================================================ 615 // class SvxTPView 616 //---------------------------------------------------------------------------- 617 618 SvxTPView::SvxTPView( Window * pParent) 619 : TabPage( pParent, SVX_RES(SID_REDLIN_VIEW_PAGE)), 620 aViewData ( this, SVX_RES( DG_VIEW) ), 621 PbAccept ( this, SVX_RES(PB_ACCEPT ) ), 622 PbReject ( this, SVX_RES(PB_REJECT ) ), 623 PbAcceptAll ( this, SVX_RES(PB_ACCEPTALL ) ), 624 PbRejectAll ( this, SVX_RES(PB_REJECTALL ) ), 625 PbUndo ( this, SVX_RES(PB_UNDO ) ), 626 aTitle1 ( SVX_RES( STR_TITLE1 ) ), // lokale Resource 627 aTitle2 ( SVX_RES( STR_TITLE2 ) ), 628 aTitle3 ( SVX_RES( STR_TITLE3 ) ), 629 aTitle4 ( SVX_RES( STR_TITLE4 ) ), 630 aTitle5 ( SVX_RES( STR_TITLE5 ) ), 631 aStrMyName ( SVX_RES( STR_VIEW) ) 632 { 633 aViewData.SetAccessibleName(String(SVX_RES(STR_TREE))); 634 FreeResource(); 635 636 aViewData.SetHelpId(HID_REDLINING_VIEW_DG_VIEW_TABLE); 637 aViewData.SetHeaderBarHelpId(HID_REDLINING_VIEW_DG_VIEW_HEADER); 638 639 aMinSize=GetSizePixel(); 640 641 Link aLink=LINK( this, SvxTPView, PbClickHdl); 642 643 PbAccept.SetClickHdl(aLink); 644 PbAcceptAll.SetClickHdl(aLink); 645 PbReject.SetClickHdl(aLink); 646 PbRejectAll.SetClickHdl(aLink); 647 PbUndo.SetClickHdl(aLink); 648 649 nDistance=PbAccept.GetSizePixel().Height()+2*MIN_DISTANCE; 650 aViewData.SetTabs(nStaticTabs); 651 } 652 653 String SvxTPView::GetMyName() const 654 { 655 return aStrMyName; 656 } 657 658 void SvxTPView::Resize() 659 { 660 Size aSize=GetOutputSizePixel(); 661 Point aPos=aViewData.GetPosPixel(); 662 aSize.Height()-=aPos.Y()+nDistance; 663 aSize.Width()-=2*aPos.X(); 664 665 long newY=aPos.Y()+aSize.Height()+MIN_DISTANCE; 666 aPos=PbAccept.GetPosPixel(); 667 aPos.Y()=newY; 668 PbAccept.SetPosPixel(aPos); 669 aPos=PbAcceptAll.GetPosPixel(); 670 aPos.Y()=newY; 671 PbAcceptAll.SetPosPixel(aPos); 672 aPos=PbReject.GetPosPixel(); 673 aPos.Y()=newY; 674 PbReject.SetPosPixel(aPos); 675 aPos=PbRejectAll.GetPosPixel(); 676 aPos.Y()=newY; 677 PbRejectAll.SetPosPixel(aPos); 678 679 if(PbUndo.IsVisible()) 680 { 681 aPos=PbUndo.GetPosPixel(); 682 aPos.Y()=newY; 683 PbUndo.SetPosPixel(aPos); 684 } 685 aViewData.SetSizePixel(aSize); 686 } 687 688 void SvxTPView::InsertWriterHeader() 689 { 690 String aStrTab(sal_Unicode('\t')); 691 String aString(aTitle1); 692 aString+=aStrTab; 693 aString+=aTitle3; 694 aString+=aStrTab; 695 aString+=aTitle4; 696 aString+=aStrTab; 697 aString+=aTitle5; 698 aViewData.ClearHeader(); 699 aViewData.InsertHeaderEntry(aString); 700 } 701 702 void SvxTPView::InsertCalcHeader() 703 { 704 String aStrTab(sal_Unicode('\t')); 705 String aString(aTitle1); 706 aString+=aStrTab; 707 aString+=aTitle2; 708 aString+=aStrTab; 709 aString+=aTitle3; 710 aString+=aStrTab; 711 aString+=aTitle4; 712 aString+=aStrTab; 713 aString+=aTitle5; 714 aViewData.ClearHeader(); 715 aViewData.InsertHeaderEntry(aString); 716 } 717 718 void SvxTPView::EnableAccept(sal_Bool nFlag) 719 { 720 PbAccept.Enable(nFlag); 721 } 722 723 void SvxTPView::EnableAcceptAll(sal_Bool nFlag) 724 { 725 PbAcceptAll.Enable(nFlag); 726 } 727 728 void SvxTPView::EnableReject(sal_Bool nFlag) 729 { 730 PbReject.Enable(nFlag); 731 } 732 733 void SvxTPView::EnableRejectAll(sal_Bool nFlag) 734 { 735 PbRejectAll.Enable(nFlag); 736 } 737 738 void SvxTPView::ShowUndo(sal_Bool nFlag) 739 { 740 PbUndo.Show(nFlag); 741 } 742 743 void SvxTPView::EnableUndo(sal_Bool nFlag) 744 { 745 PbUndo.Enable(nFlag); 746 } 747 748 Size SvxTPView::GetMinSizePixel() 749 { 750 Size aSize=aMinSize; 751 if(PbUndo.IsVisible()) 752 { 753 sal_uIntPtr nSize=PbUndo.GetSizePixel().Width() 754 +PbUndo.GetPosPixel().X() 755 +PbAccept.GetPosPixel().X(); 756 757 aSize.Width()=nSize; 758 } 759 760 return aSize; 761 } 762 763 764 SvxRedlinTable* SvxTPView::GetTableControl() 765 { 766 return &aViewData; 767 } 768 769 IMPL_LINK( SvxTPView, PbClickHdl, PushButton*, pPushB ) 770 { 771 if(pPushB==&PbAccept) 772 { 773 AcceptClickLk.Call(this); 774 } 775 else if(pPushB==&PbAcceptAll) 776 { 777 AcceptAllClickLk.Call(this); 778 } 779 else if(pPushB==&PbReject) 780 { 781 RejectClickLk.Call(this); 782 } 783 else if(pPushB==&PbRejectAll) 784 { 785 RejectAllClickLk.Call(this); 786 } 787 else if(pPushB==&PbUndo) 788 { 789 UndoClickLk.Call(this); 790 } 791 792 return 0; 793 } 794 795 796 797 798 //============================================================================ 799 // class SvxTPFilter 800 //---------------------------------------------------------------------------- 801 802 SvxTPFilter::SvxTPFilter( Window * pParent) 803 : TabPage( pParent, SVX_RES(SID_REDLIN_FILTER_PAGE)), 804 pRedlinTable(NULL), 805 aCbDate ( this, SVX_RES( CB_DATE ) ), 806 aLbDate ( this, SVX_RES( LB_DATE ) ), 807 aDfDate ( this, SVX_RES( DF_DATE ) ), 808 aTfDate ( this, SVX_RES( TF_DATE ) ), 809 aIbClock ( this, SVX_RES( IB_CLOCK ) ), 810 aFtDate2 ( this, SVX_RES( FT_DATE2 ) ), 811 aDfDate2 ( this, SVX_RES( DF_DATE2 ) ), 812 aTfDate2 ( this, SVX_RES( TF_DATE2 ) ), 813 aIbClock2 ( this, SVX_RES( IB_CLOCK2) ), 814 aCbAuthor ( this, SVX_RES( CB_AUTOR ) ), 815 aLbAuthor ( this, SVX_RES( LB_AUTOR ) ), 816 aCbRange ( this, SVX_RES( CB_RANGE ) ), 817 aEdRange ( this, SVX_RES( ED_RANGE ) ), 818 aBtnRange ( this, SVX_RES( BTN_REF ) ), 819 aLbAction ( this, SVX_RES( LB_ACTION ) ), 820 aCbComment ( this, SVX_RES( CB_COMMENT) ), 821 aEdComment ( this, SVX_RES( ED_COMMENT) ), 822 aActionStr ( SVX_RES( STR_ACTION) ), 823 aStrMyName ( SVX_RES( STR_FILTER) ), 824 bModified (sal_False) 825 { 826 aLbDate.SetAccessibleName( String( SVX_RES( STR_DATE_COMBOX) ) ); 827 aDfDate.SetAccessibleName( String( SVX_RES( STR_DATE_SPIN) ) ); 828 aTfDate.SetAccessibleName( String( SVX_RES( STR_DATE_TIME_SPIN) ) ); 829 aDfDate2.SetAccessibleName( String( SVX_RES( STR_DATE_SPIN1) ) ); 830 aTfDate2.SetAccessibleName( String( SVX_RES( STR_DATE_TIME_SPIN1) ) ); 831 aLbAuthor.SetAccessibleName(aCbAuthor.GetText()); 832 aLbAction.SetAccessibleName( String( SVX_RES( STR_ACTION) ) ); 833 aEdComment.SetAccessibleName(aCbComment.GetText()); 834 Image aImgTimeHC( SVX_RES( IMG_TIME_H ) ); 835 FreeResource(); 836 837 aIbClock.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST ); 838 aIbClock2.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST ); 839 840 aDfDate.SetShowDateCentury( sal_True ); 841 aDfDate2.SetShowDateCentury( sal_True ); 842 843 aRangeStr=aCbRange.GetText(); 844 aLbDate.SelectEntryPos(0); 845 aLbDate.SetSelectHdl( LINK( this, SvxTPFilter, SelDateHdl ) ); 846 aIbClock.SetClickHdl( LINK( this, SvxTPFilter, TimeHdl) ); 847 aIbClock2.SetClickHdl( LINK( this, SvxTPFilter,TimeHdl) ); 848 aBtnRange.SetClickHdl( LINK( this, SvxTPFilter, RefHandle)); 849 850 Link aLink=LINK( this, SvxTPFilter, RowEnableHdl) ; 851 aCbDate.SetClickHdl(aLink); 852 aCbAuthor.SetClickHdl(aLink); 853 aCbRange.SetClickHdl(aLink); 854 aCbComment.SetClickHdl(aLink); 855 856 Link a2Link=LINK( this, SvxTPFilter, ModifyDate); 857 aDfDate.SetModifyHdl(a2Link); 858 aTfDate.SetModifyHdl(a2Link); 859 aDfDate2.SetModifyHdl(a2Link); 860 aTfDate2.SetModifyHdl(a2Link); 861 862 Link a3Link=LINK( this, SvxTPFilter, ModifyHdl); 863 aEdRange.SetModifyHdl(a3Link); 864 aEdComment.SetModifyHdl(a3Link); 865 aLbAction.SetSelectHdl(a3Link); 866 aLbAuthor.SetSelectHdl(a3Link); 867 868 RowEnableHdl(&aCbDate); 869 RowEnableHdl(&aCbAuthor); 870 RowEnableHdl(&aCbRange); 871 RowEnableHdl(&aCbComment); 872 873 Date aDate; 874 Time aTime; 875 aDfDate.SetDate(aDate); 876 aTfDate.SetTime(aTime); 877 aDfDate2.SetDate(aDate); 878 aTfDate2.SetTime(aTime); 879 HideRange(); 880 ShowAction(); 881 bModified=sal_False; 882 883 aLbDate.SetAccessibleRelationLabeledBy(&aCbDate); 884 aLbAuthor.SetAccessibleRelationLabeledBy(&aCbAuthor); 885 aLbAction.SetAccessibleRelationLabeledBy(&aCbRange); 886 aEdRange.SetAccessibleRelationLabeledBy(&aCbRange); 887 aBtnRange.SetAccessibleRelationLabeledBy(&aCbRange); 888 aEdComment.SetAccessibleRelationLabeledBy(&aCbComment); 889 aDfDate2.SetAccessibleRelationLabeledBy(&aDfDate2); 890 aTfDate2.SetAccessibleRelationLabeledBy(&aTfDate2); 891 } 892 893 void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable) 894 { 895 pRedlinTable=pTable; 896 } 897 898 String SvxTPFilter::GetMyName() const 899 { 900 return aStrMyName; 901 } 902 903 void SvxTPFilter::DisableRange(sal_Bool bFlag) 904 { 905 if(bFlag) 906 { 907 aCbRange.Disable(); 908 aEdRange.Disable(); 909 aBtnRange.Disable(); 910 } 911 else 912 { 913 aCbRange.Enable(); 914 aEdRange.Enable(); 915 aBtnRange.Enable(); 916 } 917 } 918 919 void SvxTPFilter::ShowDateFields(sal_uInt16 nKind) 920 { 921 String aEmpty; 922 switch(nKind) 923 { 924 case FLT_DATE_BEFORE: 925 EnableDateLine1(sal_True); 926 EnableDateLine2(sal_False); 927 break; 928 case FLT_DATE_SINCE: 929 EnableDateLine1(sal_True); 930 EnableDateLine2(sal_False); 931 break; 932 case FLT_DATE_EQUAL: 933 EnableDateLine1(sal_True); 934 aTfDate.Disable(); 935 aTfDate.SetText(aEmpty); 936 EnableDateLine2(sal_False); 937 break; 938 case FLT_DATE_NOTEQUAL: 939 EnableDateLine1(sal_True); 940 aTfDate.Disable(); 941 aTfDate.SetText(aEmpty); 942 EnableDateLine2(sal_False); 943 break; 944 case FLT_DATE_BETWEEN: 945 EnableDateLine1(sal_True); 946 EnableDateLine2(sal_True); 947 break; 948 case FLT_DATE_SAVE: 949 EnableDateLine1(sal_False); 950 EnableDateLine2(sal_False); 951 break; 952 } 953 } 954 955 void SvxTPFilter::EnableDateLine1(sal_Bool bFlag) 956 { 957 if(bFlag && aCbDate.IsChecked()) 958 { 959 aDfDate.Enable(); 960 aTfDate.Enable(); 961 aIbClock.Enable(); 962 } 963 else 964 { 965 aDfDate.Disable(); 966 aTfDate.Disable(); 967 aIbClock.Disable(); 968 } 969 } 970 void SvxTPFilter::EnableDateLine2(sal_Bool bFlag) 971 { 972 String aEmpty; 973 if(bFlag && aCbDate.IsChecked()) 974 { 975 aFtDate2.Enable(); 976 aDfDate2.Enable(); 977 aTfDate2.Enable(); 978 aIbClock2.Enable(); 979 } 980 else 981 { 982 aFtDate2.Disable(); 983 aDfDate2.Disable(); 984 aDfDate2.SetText(aEmpty); 985 aTfDate2.Disable(); 986 aTfDate2.SetText(aEmpty); 987 aIbClock2.Disable(); 988 } 989 } 990 991 Date SvxTPFilter::GetFirstDate() const 992 { 993 return aDfDate.GetDate(); 994 } 995 996 void SvxTPFilter::SetFirstDate(const Date &aDate) 997 { 998 aDfDate.SetDate(aDate); 999 } 1000 1001 Time SvxTPFilter::GetFirstTime() const 1002 { 1003 return aTfDate.GetTime(); 1004 } 1005 1006 void SvxTPFilter::SetFirstTime(const Time &aTime) 1007 { 1008 aTfDate.SetTime(aTime); 1009 } 1010 1011 1012 Date SvxTPFilter::GetLastDate() const 1013 { 1014 return aDfDate2.GetDate(); 1015 } 1016 1017 void SvxTPFilter::SetLastDate(const Date &aDate) 1018 { 1019 aDfDate2.SetDate(aDate); 1020 } 1021 1022 Time SvxTPFilter::GetLastTime() const 1023 { 1024 return aTfDate2.GetTime(); 1025 } 1026 1027 void SvxTPFilter::SetLastTime(const Time &aTime) 1028 { 1029 aTfDate2.SetTime(aTime); 1030 } 1031 1032 void SvxTPFilter::SetDateMode(sal_uInt16 nMode) 1033 { 1034 aLbDate.SelectEntryPos(nMode); 1035 SelDateHdl(&aLbDate); 1036 } 1037 1038 sal_uInt16 SvxTPFilter::GetDateMode() 1039 { 1040 return (sal_uInt16) aLbDate.GetSelectEntryPos(); 1041 } 1042 void SvxTPFilter::ClearAuthors() 1043 { 1044 aLbAuthor.Clear(); 1045 } 1046 1047 void SvxTPFilter::InsertAuthor( const String& rString, sal_uInt16 nPos) 1048 { 1049 aLbAuthor.InsertEntry(rString,nPos); 1050 } 1051 1052 String SvxTPFilter::GetSelectedAuthor() const 1053 { 1054 return aLbAuthor.GetSelectEntry(); 1055 } 1056 1057 sal_uInt16 SvxTPFilter::GetSelectedAuthorPos() 1058 { 1059 return (sal_uInt16) aLbAuthor.GetSelectEntryPos(); 1060 } 1061 1062 void SvxTPFilter::SelectedAuthorPos(sal_uInt16 nPos) 1063 { 1064 aLbAuthor.SelectEntryPos(nPos); 1065 } 1066 1067 sal_uInt16 SvxTPFilter::SelectAuthor(const String& aString) 1068 { 1069 aLbAuthor.SelectEntry(aString); 1070 return aLbAuthor.GetSelectEntryPos(); 1071 } 1072 1073 void SvxTPFilter::SetRange(const String& rString) 1074 { 1075 aEdRange.SetText(rString); 1076 } 1077 1078 String SvxTPFilter::GetRange() const 1079 { 1080 return aEdRange.GetText(); 1081 } 1082 1083 void SvxTPFilter::SetFocusToRange() 1084 { 1085 aEdRange.GrabFocus(); 1086 } 1087 1088 void SvxTPFilter::HideRange(sal_Bool bHide) 1089 { 1090 if(bHide) 1091 { 1092 aCbRange.Hide(); 1093 aEdRange.Hide(); 1094 aBtnRange.Hide(); 1095 } 1096 else 1097 { 1098 ShowAction(sal_False); 1099 aCbRange.SetText(aRangeStr); 1100 aCbRange.Show(); 1101 aEdRange.Show(); 1102 aBtnRange.Show(); 1103 } 1104 } 1105 1106 void SvxTPFilter::HideClocks(sal_Bool bHide) 1107 { 1108 if(bHide) 1109 { 1110 aIbClock. Hide(); 1111 aIbClock2.Hide(); 1112 } 1113 else 1114 { 1115 aIbClock. Show(); 1116 aIbClock2.Show(); 1117 } 1118 } 1119 1120 void SvxTPFilter::SetComment(const String &rComment) 1121 { 1122 aEdComment.SetText(rComment); 1123 } 1124 String SvxTPFilter::GetComment()const 1125 { 1126 return aEdComment.GetText(); 1127 } 1128 1129 sal_Bool SvxTPFilter::IsDate() 1130 { 1131 return aCbDate.IsChecked(); 1132 } 1133 1134 sal_Bool SvxTPFilter::IsAuthor() 1135 { 1136 return aCbAuthor.IsChecked(); 1137 } 1138 1139 sal_Bool SvxTPFilter::IsRange() 1140 { 1141 return aCbRange.IsChecked(); 1142 } 1143 sal_Bool SvxTPFilter::IsAction() 1144 { 1145 return aCbRange.IsChecked(); 1146 } 1147 1148 sal_Bool SvxTPFilter::IsComment() 1149 { 1150 return aCbComment.IsChecked(); 1151 } 1152 1153 void SvxTPFilter::CheckDate(sal_Bool bFlag) 1154 { 1155 aCbDate.Check(bFlag); 1156 RowEnableHdl(&aCbDate); 1157 bModified=sal_False; 1158 } 1159 1160 void SvxTPFilter::CheckAuthor(sal_Bool bFlag) 1161 { 1162 aCbAuthor.Check(bFlag); 1163 RowEnableHdl(&aCbAuthor); 1164 bModified=sal_False; 1165 } 1166 1167 void SvxTPFilter::CheckRange(sal_Bool bFlag) 1168 { 1169 aCbRange.Check(bFlag); 1170 RowEnableHdl(&aCbRange); 1171 bModified=sal_False; 1172 } 1173 1174 void SvxTPFilter::CheckAction(sal_Bool bFlag) 1175 { 1176 aCbRange.Check(bFlag); 1177 RowEnableHdl(&aCbRange); 1178 bModified=sal_False; 1179 } 1180 1181 void SvxTPFilter::CheckComment(sal_Bool bFlag) 1182 { 1183 aCbComment.Check(bFlag); 1184 RowEnableHdl(&aCbComment); 1185 bModified=sal_False; 1186 } 1187 1188 void SvxTPFilter::ShowAction(sal_Bool bShow) 1189 { 1190 if(!bShow) 1191 { 1192 aCbRange.Hide(); 1193 aLbAction.Hide(); 1194 aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_RANGE); 1195 } 1196 else 1197 { 1198 HideRange(); 1199 aCbRange.SetText(aActionStr); 1200 aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_ACTION); 1201 aCbRange.Show(); 1202 aLbAction.Show(); 1203 1204 } 1205 } 1206 1207 ListBox* SvxTPFilter::GetLbAction() 1208 { 1209 return &aLbAction; 1210 } 1211 1212 IMPL_LINK( SvxTPFilter, SelDateHdl, ListBox*, pLb ) 1213 { 1214 ShowDateFields((sal_uInt16)aLbDate.GetSelectEntryPos()); 1215 ModifyHdl(pLb); 1216 return 0; 1217 } 1218 1219 IMPL_LINK( SvxTPFilter, RowEnableHdl, CheckBox*, pCB ) 1220 { 1221 if(pCB==&aCbDate) 1222 { 1223 aLbDate.Enable(aCbDate.IsChecked()); 1224 aLbDate.Invalidate(); 1225 EnableDateLine1(sal_False); 1226 EnableDateLine2(sal_False); 1227 if(aCbDate.IsChecked()) SelDateHdl(&aLbDate); 1228 } 1229 else if(pCB==&aCbAuthor) 1230 { 1231 aLbAuthor.Enable(aCbAuthor.IsChecked()); 1232 aLbAuthor.Invalidate(); 1233 } 1234 else if(pCB==&aCbRange) 1235 { 1236 aLbAction.Enable(aCbRange.IsChecked()); 1237 aLbAction.Invalidate(); 1238 aEdRange.Enable(aCbRange.IsChecked()); 1239 aBtnRange.Enable(aCbRange.IsChecked()); 1240 } 1241 else if(pCB==&aCbComment) 1242 { 1243 aEdComment.Enable(aCbComment.IsChecked()); 1244 aEdComment.Invalidate(); 1245 } 1246 1247 ModifyHdl(pCB); 1248 return 0; 1249 } 1250 1251 IMPL_LINK( SvxTPFilter, TimeHdl, ImageButton*,pIB ) 1252 { 1253 Date aDate; 1254 Time aTime; 1255 if(pIB==&aIbClock) 1256 { 1257 aDfDate.SetDate(aDate); 1258 aTfDate.SetTime(aTime); 1259 } 1260 else if(pIB==&aIbClock2) 1261 { 1262 aDfDate2.SetDate(aDate); 1263 aTfDate2.SetTime(aTime); 1264 } 1265 ModifyHdl(&aDfDate); 1266 return 0; 1267 } 1268 1269 IMPL_LINK( SvxTPFilter, ModifyHdl, void*, pCtr) 1270 { 1271 if(pCtr!=NULL) 1272 { 1273 if(pCtr==&aCbDate || pCtr==&aLbDate || 1274 pCtr==&aDfDate || pCtr==&aTfDate || 1275 pCtr==&aIbClock || pCtr==&aFtDate2|| 1276 pCtr==&aDfDate2 || pCtr==&aTfDate2|| 1277 pCtr==&aIbClock2) 1278 { 1279 aModifyDateLink.Call(this); 1280 } 1281 else if(pCtr==&aCbAuthor || pCtr==&aLbAuthor) 1282 { 1283 aModifyAuthorLink.Call(this); 1284 } 1285 else if(pCtr==&aCbRange || pCtr==&aEdRange || 1286 pCtr==&aBtnRange ) 1287 { 1288 aModifyRefLink.Call(this); 1289 } 1290 else if(pCtr==&aCbComment || pCtr==&aEdComment) 1291 { 1292 aModifyComLink.Call(this); 1293 } 1294 1295 bModified=sal_True; 1296 aModifyLink.Call(this); 1297 } 1298 return 0; 1299 } 1300 1301 void SvxTPFilter::DeactivatePage() 1302 { 1303 if(bModified) 1304 { 1305 if(pRedlinTable!=NULL) 1306 { 1307 pRedlinTable->SetFilterDate(IsDate()); 1308 pRedlinTable->SetDateTimeMode(GetDateMode()); 1309 pRedlinTable->SetFirstDate(aDfDate.GetDate()); 1310 pRedlinTable->SetLastDate(aDfDate2.GetDate()); 1311 pRedlinTable->SetFirstTime(aTfDate.GetTime()); 1312 pRedlinTable->SetLastTime(aTfDate2.GetTime()); 1313 pRedlinTable->SetFilterAuthor(IsAuthor()); 1314 pRedlinTable->SetAuthor(GetSelectedAuthor()); 1315 1316 pRedlinTable->SetFilterComment(IsComment()); 1317 1318 utl::SearchParam aSearchParam( aEdComment.GetText(), 1319 utl::SearchParam::SRCH_REGEXP,sal_False,sal_False,sal_False ); 1320 1321 pRedlinTable->SetCommentParams(&aSearchParam); 1322 1323 pRedlinTable->UpdateFilterTest(); 1324 } 1325 1326 aReadyLink.Call(this); 1327 } 1328 bModified=sal_False; 1329 TabPage::DeactivatePage(); 1330 } 1331 1332 void SvxTPFilter::Enable( bool bEnable, bool bChild) 1333 { 1334 TabPage::Enable(bEnable,bChild); 1335 if(aCbDate.IsEnabled()) 1336 { 1337 RowEnableHdl(&aCbDate); 1338 RowEnableHdl(&aCbAuthor); 1339 RowEnableHdl(&aCbRange); 1340 RowEnableHdl(&aCbComment); 1341 } 1342 } 1343 void SvxTPFilter::Disable( bool bChild) 1344 { 1345 Enable( false, bChild ); 1346 } 1347 1348 IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) 1349 { 1350 1351 Date aDate; 1352 Time aTime(0); 1353 if(&aDfDate==pTF) 1354 { 1355 if(aDfDate.GetText().Len()==0) 1356 aDfDate.SetDate(aDate); 1357 1358 if(pRedlinTable!=NULL) 1359 pRedlinTable->SetFirstDate(aDfDate.GetDate()); 1360 } 1361 else if(&aDfDate2==pTF) 1362 { 1363 if(aDfDate2.GetText().Len()==0) 1364 aDfDate2.SetDate(aDate); 1365 1366 if(pRedlinTable!=NULL) 1367 pRedlinTable->SetLastDate(aDfDate2.GetDate()); 1368 } 1369 else if(&aTfDate==pTF) 1370 { 1371 if(aTfDate.GetText().Len()==0) 1372 aTfDate.SetTime(aTime); 1373 1374 if(pRedlinTable!=NULL) 1375 pRedlinTable->SetFirstTime(aTfDate.GetTime()); 1376 } 1377 else if(&aTfDate2==pTF) 1378 { 1379 if(aTfDate2.GetText().Len()==0) 1380 aTfDate2.SetTime(aTime); 1381 1382 if(pRedlinTable!=NULL) 1383 pRedlinTable->SetLastTime(aTfDate2.GetTime()); 1384 1385 } 1386 ModifyHdl(&aDfDate); 1387 return 0; 1388 } 1389 1390 IMPL_LINK( SvxTPFilter, RefHandle, PushButton*, pRef ) 1391 { 1392 if(pRef!=NULL) 1393 { 1394 aRefLink.Call(this); 1395 } 1396 return 0; 1397 } 1398 1399 static Size gDiffSize; 1400 //============================================================================ 1401 // class SvxAcceptChgCtr 1402 //---------------------------------------------------------------------------- 1403 1404 SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, WinBits nWinStyle) 1405 : Control(pParent,nWinStyle |WB_DIALOGCONTROL), 1406 aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL) 1407 { 1408 pTPFilter=new SvxTPFilter(&aTCAccept); 1409 pTPView=new SvxTPView(&aTCAccept); 1410 aMinSize=pTPView->GetMinSizePixel(); 1411 1412 aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName()); 1413 aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName()); 1414 aTCAccept.SetTabPage( TP_VIEW, pTPView); 1415 aTCAccept.SetTabPage( TP_FILTER, pTPFilter); 1416 aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL); 1417 1418 aTCAccept.SetTabPageSizePixel(aMinSize); 1419 Size aSize=aTCAccept.GetSizePixel(); 1420 1421 gDiffSize.Height()=aSize.Height()-aMinSize.Height(); 1422 gDiffSize.Width()=aSize.Width()-aMinSize.Width(); 1423 1424 1425 pTPFilter->SetRedlinTable(GetViewTable()); 1426 1427 aTCAccept.Show(); 1428 ShowViewPage(); 1429 } 1430 1431 SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, const ResId& rResId ) 1432 : Control(pParent,rResId ), 1433 aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL) 1434 { 1435 pTPFilter=new SvxTPFilter(&aTCAccept); 1436 pTPView=new SvxTPView(&aTCAccept); 1437 aMinSize=pTPView->GetMinSizePixel(); 1438 1439 aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName()); 1440 aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName()); 1441 aTCAccept.SetTabPage( TP_VIEW, pTPView); 1442 aTCAccept.SetTabPage( TP_FILTER, pTPFilter); 1443 aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL); 1444 1445 aTCAccept.SetTabPageSizePixel(aMinSize); 1446 Size aSize=aTCAccept.GetSizePixel(); 1447 1448 gDiffSize.Height()=aSize.Height()-aMinSize.Height(); 1449 gDiffSize.Width()=aSize.Width()-aMinSize.Width(); 1450 1451 1452 pTPFilter->SetRedlinTable(GetViewTable()); 1453 WinBits nWinStyle=GetStyle()|WB_DIALOGCONTROL; 1454 SetStyle(nWinStyle); 1455 1456 aTCAccept.Show(); 1457 ShowViewPage(); 1458 Resize(); 1459 } 1460 1461 SvxAcceptChgCtr::~SvxAcceptChgCtr() 1462 { 1463 delete pTPView; 1464 delete pTPFilter; 1465 } 1466 1467 void SvxAcceptChgCtr::Resize() 1468 { 1469 aMinSize=pTPView->GetMinSizePixel(); 1470 Size aSize=GetOutputSizePixel(); 1471 sal_Bool bFlag=sal_False; 1472 1473 if(aMinSize.Height()>aSize.Height()) 1474 { 1475 aSize.Height()=aMinSize.Height(); 1476 bFlag=sal_True; 1477 } 1478 if(aMinSize.Width()>aSize.Width()) 1479 { 1480 aSize.Width()=aMinSize.Width(); 1481 bFlag=sal_True; 1482 } 1483 1484 if(bFlag) 1485 { 1486 SetOutputSizePixel(aSize); 1487 aMinSizeLink.Call(this); 1488 } 1489 1490 aSize.Height()-=2; 1491 aSize.Width()-=2; 1492 aTCAccept.SetSizePixel(aSize); 1493 } 1494 1495 Size SvxAcceptChgCtr::GetMinSizePixel() const 1496 { 1497 Size aSize=pTPView->GetMinSizePixel(); 1498 aSize.Height()+=gDiffSize.Height(); 1499 aSize.Width()+=gDiffSize.Width(); 1500 return aSize; 1501 } 1502 1503 void SvxAcceptChgCtr::ShowFilterPage() 1504 { 1505 aTCAccept.SetCurPageId(TP_FILTER); 1506 } 1507 1508 void SvxAcceptChgCtr::ShowViewPage() 1509 { 1510 aTCAccept.SetCurPageId(TP_VIEW); 1511 } 1512 1513 sal_Bool SvxAcceptChgCtr::IsFilterPageVisible() 1514 { 1515 return (aTCAccept.GetCurPageId()==TP_FILTER); 1516 } 1517 1518 sal_Bool SvxAcceptChgCtr::IsViewPageVisible() 1519 { 1520 return (aTCAccept.GetCurPageId()==TP_VIEW); 1521 } 1522 1523 SvxTPFilter* SvxAcceptChgCtr::GetFilterPage() 1524 { 1525 return pTPFilter; 1526 } 1527 1528 SvxTPView* SvxAcceptChgCtr::GetViewPage() 1529 { 1530 return pTPView; 1531 } 1532 1533 SvxRedlinTable* SvxAcceptChgCtr::GetViewTable() 1534 { 1535 if(pTPView!=NULL) 1536 { 1537 return pTPView->GetTableControl(); 1538 } 1539 else 1540 { 1541 return NULL; 1542 } 1543 } 1544 1545 1546