Outliner.cxx (cdf0e10c) | Outliner.cxx (967189ef) |
---|---|
1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * --- 135 unchanged lines hidden (view full) --- 144|* 145\************************************************************************/ 146 147Outliner::Outliner( SdDrawDocument* pDoc, sal_uInt16 nMode ) 148 : SdrOutliner( &pDoc->GetItemPool(), nMode ), 149 mpImpl(new Implementation()), 150 meMode(SEARCH), 151 mpView(NULL), | 1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * --- 135 unchanged lines hidden (view full) --- 144|* 145\************************************************************************/ 146 147Outliner::Outliner( SdDrawDocument* pDoc, sal_uInt16 nMode ) 148 : SdrOutliner( &pDoc->GetItemPool(), nMode ), 149 mpImpl(new Implementation()), 150 meMode(SEARCH), 151 mpView(NULL), |
152 mpViewShell(), | 152 mpWeakViewShell(), |
153 mpWindow(NULL), 154 mpDrawDocument(pDoc), 155 mnConversionLanguage(LANGUAGE_NONE), 156 mnIgnoreCurrentPageChangesLevel(0), 157 mbStringFound(sal_False), 158 mbMatchMayExist(false), 159 mnPageCount(0), 160 mnObjectCount(0), --- 17 unchanged lines hidden (view full) --- 178 mpSearchItem(NULL), 179 maObjectIterator(), 180 maCurrentPosition(), 181 maSearchStartPosition(), 182 maLastValidPosition(), 183 mbSelectionHasChanged(false), 184 mbExpectingSelectionChangeEvent(false), 185 mbWholeDocumentProcessed(false), | 153 mpWindow(NULL), 154 mpDrawDocument(pDoc), 155 mnConversionLanguage(LANGUAGE_NONE), 156 mnIgnoreCurrentPageChangesLevel(0), 157 mbStringFound(sal_False), 158 mbMatchMayExist(false), 159 mnPageCount(0), 160 mnObjectCount(0), --- 17 unchanged lines hidden (view full) --- 178 mpSearchItem(NULL), 179 maObjectIterator(), 180 maCurrentPosition(), 181 maSearchStartPosition(), 182 maLastValidPosition(), 183 mbSelectionHasChanged(false), 184 mbExpectingSelectionChangeEvent(false), 185 mbWholeDocumentProcessed(false), |
186 mbPrepareSpellingPending(true), 187 mbViewShellValid(true) | 186 mbPrepareSpellingPending(true) |
188{ 189 SetStyleSheetPool((SfxStyleSheetPool*) mpDrawDocument->GetStyleSheetPool()); 190 SetEditTextObjectPool( &pDoc->GetItemPool() ); 191 SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); 192 SetForbiddenCharsTable( pDoc->GetForbiddenCharsTable() ); 193 194 sal_uLong nCntrl = GetControlWord(); 195 nCntrl |= EE_CNTRL_ALLOWBIGOBJS; --- 77 unchanged lines hidden (view full) --- 273 <li>When the current shell is a <type>SdOutlineViewShell</type> then 274 directly operate on it. No switching into other views takes place.</li> 275 276 <li>For a <type>SlideViewShell</type> no action is performed.</li> 277 </ol> 278*/ 279void Outliner::PrepareSpelling (void) 280{ | 187{ 188 SetStyleSheetPool((SfxStyleSheetPool*) mpDrawDocument->GetStyleSheetPool()); 189 SetEditTextObjectPool( &pDoc->GetItemPool() ); 190 SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); 191 SetForbiddenCharsTable( pDoc->GetForbiddenCharsTable() ); 192 193 sal_uLong nCntrl = GetControlWord(); 194 nCntrl |= EE_CNTRL_ALLOWBIGOBJS; --- 77 unchanged lines hidden (view full) --- 272 <li>When the current shell is a <type>SdOutlineViewShell</type> then 273 directly operate on it. No switching into other views takes place.</li> 274 275 <li>For a <type>SlideViewShell</type> no action is performed.</li> 276 </ol> 277*/ 278void Outliner::PrepareSpelling (void) 279{ |
281 if (mbViewShellValid) 282 { 283 mbPrepareSpellingPending = false; | 280 mbPrepareSpellingPending = false; |
284 | 281 |
285 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 286 if (pBase != NULL) 287 SetViewShell (pBase->GetMainViewShell()); 288 SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); | 282 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 283 if (pBase != NULL) 284 SetViewShell (pBase->GetMainViewShell()); 285 SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); |
289 | 286 |
290 if (mpViewShell.get() != NULL) 291 { 292 mbStringFound = sal_False; | 287 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 288 if (pViewShell) 289 { 290 mbStringFound = sal_False; |
293 | 291 |
294 mbWholeDocumentProcessed = false; 295 // Supposed that we are not located at the very beginning/end of 296 // the document then there may be a match in the document 297 // prior/after the current position. 298 mbMatchMayExist = sal_True; | 292 mbWholeDocumentProcessed = false; 293 // Supposed that we are not located at the very beginning/end of 294 // the document then there may be a match in the document 295 // prior/after the current position. 296 mbMatchMayExist = sal_True; |
299 | 297 |
300 maObjectIterator = ::sd::outliner::Iterator(); 301 maSearchStartPosition = ::sd::outliner::Iterator(); 302 RememberStartPosition(); | 298 maObjectIterator = ::sd::outliner::Iterator(); 299 maSearchStartPosition = ::sd::outliner::Iterator(); 300 RememberStartPosition(); |
303 | 301 |
304 mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow); | 302 mpImpl->ProvideOutlinerView(*this, pViewShell, mpWindow); |
305 | 303 |
306 HandleChangedSelection (); 307 } 308 ClearModifyFlag(); | 304 HandleChangedSelection (); |
309 } | 305 } |
306 ClearModifyFlag(); |
|
310} 311 312 313 314 315 316void Outliner::StartSpelling (void) 317{ --- 8 unchanged lines hidden (view full) --- 326 SdrOutliner::StartSpelling( rView, c ); 327} 328 329/** Free all resources acquired during the search/spell check. After a 330 spell check the start position is restored here. 331*/ 332void Outliner::EndSpelling (void) 333{ | 307} 308 309 310 311 312 313void Outliner::StartSpelling (void) 314{ --- 8 unchanged lines hidden (view full) --- 323 SdrOutliner::StartSpelling( rView, c ); 324} 325 326/** Free all resources acquired during the search/spell check. After a 327 spell check the start position is restored here. 328*/ 329void Outliner::EndSpelling (void) 330{ |
334 if (mbViewShellValid) 335 { 336 // Keep old view shell alive until we release the outliner view. 337 ::boost::shared_ptr<ViewShell> pOldViewShell (mpViewShell); | 331 // Keep old view shell alive until we release the outliner view. 332 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 333 ::boost::shared_ptr<ViewShell> pOldViewShell (pViewShell); |
338 | 334 |
339 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 340 if (pBase != NULL) 341 mpViewShell = pBase->GetMainViewShell(); 342 else 343 mpViewShell.reset(); | 335 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 336 if (pBase != NULL) 337 pViewShell = pBase->GetMainViewShell(); 338 else 339 pViewShell.reset(); 340 mpWeakViewShell = pViewShell; |
344 | 341 |
345 // When in <member>PrepareSpelling()</member> a new outline view has 346 // been created then delete it here. 347 sal_Bool bViewIsDrawViewShell(mpViewShell.get()!=NULL 348 && mpViewShell->ISA(DrawViewShell)); 349 if (bViewIsDrawViewShell) 350 { 351 SetStatusEventHdl(Link()); 352 mpView = mpViewShell->GetView(); 353 mpView->UnmarkAllObj (mpView->GetSdrPageView()); 354 mpView->SdrEndTextEdit(); 355 // Make FuSelection the current function. 356 mpViewShell->GetDispatcher()->Execute( 357 SID_OBJECT_SELECT, 358 SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD); | 342 // When in <member>PrepareSpelling()</member> a new outline view has 343 // been created then delete it here. 344 sal_Bool bViewIsDrawViewShell(pViewShell && pViewShell->ISA(DrawViewShell)); 345 if (bViewIsDrawViewShell) 346 { 347 SetStatusEventHdl(Link()); 348 mpView = pViewShell->GetView(); 349 mpView->UnmarkAllObj (mpView->GetSdrPageView()); 350 mpView->SdrEndTextEdit(); 351 // Make FuSelection the current function. 352 pViewShell->GetDispatcher()->Execute( 353 SID_OBJECT_SELECT, 354 SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD); |
359 | 355 |
360 // Remove and, if previously created by us, delete the outline 361 // view. 362 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 363 if (pOutlinerView != NULL) 364 { 365 RemoveView(pOutlinerView); 366 mpImpl->ReleaseOutlinerView(); 367 } 368 369 SetUpdateMode(sal_True); 370 } 371 372 // #95811# Before clearing the modify flag use it as a hint that 373 // changes were done at SpellCheck 374 if(IsModified()) | 356 // Remove and, if previously created by us, delete the outline 357 // view. 358 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 359 if (pOutlinerView != NULL) |
375 { | 360 { |
376 if(mpView && mpView->ISA(OutlineView)) 377 static_cast<OutlineView*>(mpView)->PrepareClose(sal_False); 378 if(mpDrawDocument && !mpDrawDocument->IsChanged()) 379 mpDrawDocument->SetChanged(sal_True); | 361 RemoveView(pOutlinerView); 362 mpImpl->ReleaseOutlinerView(); |
380 } 381 | 363 } 364 |
382 // #95811# now clear the modify flag to have a specified state of 383 // Outliner 384 ClearModifyFlag(); | 365 SetUpdateMode(sal_True); 366 } |
385 | 367 |
386 // When spell checking then restore the start position. 387 if (meMode==SPELL || meMode==TEXT_CONVERSION) 388 RestoreStartPosition (); | 368 // #95811# Before clearing the modify flag use it as a hint that 369 // changes were done at SpellCheck 370 if(IsModified()) 371 { 372 if(mpView && mpView->ISA(OutlineView)) 373 static_cast<OutlineView*>(mpView)->PrepareClose(sal_False); 374 if(mpDrawDocument && !mpDrawDocument->IsChanged()) 375 mpDrawDocument->SetChanged(sal_True); |
389 } 390 | 376 } 377 |
391 mpViewShell.reset(); | 378 // #95811# now clear the modify flag to have a specified state of 379 // Outliner 380 ClearModifyFlag(); 381 382 // When spell checking then restore the start position. 383 if (meMode==SPELL || meMode==TEXT_CONVERSION) 384 RestoreStartPosition (); 385 386 mpWeakViewShell.reset(); |
392 mpView = NULL; 393 mpWindow = NULL; 394} 395 396 397 398 399sal_Bool Outliner::SpellNextDocument (void) 400{ | 387 mpView = NULL; 388 mpWindow = NULL; 389} 390 391 392 393 394sal_Bool Outliner::SpellNextDocument (void) 395{ |
401 if (mpViewShell->ISA(OutlineViewShell)) | 396 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 397 if (pViewShell->ISA(OutlineViewShell)) |
402 { 403 // When doing a spell check in the outline view then there is 404 // only one document. 405 mbEndOfSearch = true; 406 EndOfSearch (); 407 } 408 else 409 { 410 if (mpView->ISA(OutlineView)) 411 ((OutlineView*)mpView)->PrepareClose(sal_False); 412 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 413 414 Initialize (true); 415 | 398 { 399 // When doing a spell check in the outline view then there is 400 // only one document. 401 mbEndOfSearch = true; 402 EndOfSearch (); 403 } 404 else 405 { 406 if (mpView->ISA(OutlineView)) 407 ((OutlineView*)mpView)->PrepareClose(sal_False); 408 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 409 410 Initialize (true); 411 |
416 mpWindow = mpViewShell->GetActiveWindow(); | 412 mpWindow = pViewShell->GetActiveWindow(); |
417 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 418 if (pOutlinerView != NULL) 419 pOutlinerView->SetWindow(mpWindow); 420 ProvideNextTextObject (); 421 422 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); 423 ClearModifyFlag(); 424 } --- 55 unchanged lines hidden (view full) --- 480 481 482/** Go to next match. 483*/ 484bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) 485{ 486 sal_Bool bEndOfSearch = sal_True; 487 | 413 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 414 if (pOutlinerView != NULL) 415 pOutlinerView->SetWindow(mpWindow); 416 ProvideNextTextObject (); 417 418 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); 419 ClearModifyFlag(); 420 } --- 55 unchanged lines hidden (view full) --- 476 477 478/** Go to next match. 479*/ 480bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) 481{ 482 sal_Bool bEndOfSearch = sal_True; 483 |
488 if (mbViewShellValid) | 484 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 485 if (mbPrepareSpellingPending) 486 PrepareSpelling(); 487 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 488 // Determine whether we have to abort the search. This is necessary 489 // when the main view shell does not support searching. 490 bool bAbort = false; 491 if (pBase != NULL) |
489 { | 492 { |
490 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 491 if (mbPrepareSpellingPending) 492 PrepareSpelling(); 493 ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); 494 // Determine whether we have to abort the search. This is necessary 495 // when the main view shell does not support searching. 496 bool bAbort = false; 497 if (pBase != NULL) 498 { 499 ::boost::shared_ptr<ViewShell> pShell (pBase->GetMainViewShell()); 500 SetViewShell(pShell); 501 if (pShell.get() == NULL) 502 bAbort = true; 503 else 504 switch (pShell->GetShellType()) 505 { 506 case ViewShell::ST_DRAW: 507 case ViewShell::ST_IMPRESS: 508 case ViewShell::ST_NOTES: 509 case ViewShell::ST_HANDOUT: 510 case ViewShell::ST_OUTLINE: 511 bAbort = false; 512 break; 513 default: 514 bAbort = true; 515 break; 516 } 517 } | 493 ::boost::shared_ptr<ViewShell> pShell (pBase->GetMainViewShell()); 494 SetViewShell(pShell); 495 if (pShell.get() == NULL) 496 bAbort = true; 497 else 498 switch (pShell->GetShellType()) 499 { 500 case ViewShell::ST_DRAW: 501 case ViewShell::ST_IMPRESS: 502 case ViewShell::ST_NOTES: 503 case ViewShell::ST_HANDOUT: 504 case ViewShell::ST_OUTLINE: 505 bAbort = false; 506 break; 507 default: 508 bAbort = true; 509 break; 510 } 511 } |
518 | 512 |
519 if ( ! bAbort) 520 { 521 meMode = SEARCH; 522 mpSearchItem = pSearchItem; | 513 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 514 if ( ! pViewShell) 515 { 516 OSL_ASSERT(pViewShell); 517 return true; 518 } |
523 | 519 |
524 mbFoundObject = sal_False; | 520 if ( ! bAbort) 521 { 522 meMode = SEARCH; 523 mpSearchItem = pSearchItem; |
525 | 524 |
526 Initialize ( ! mpSearchItem->GetBackward()); | 525 mbFoundObject = sal_False; |
527 | 526 |
528 sal_uInt16 nCommand = mpSearchItem->GetCommand(); 529 if (nCommand == SVX_SEARCHCMD_REPLACE_ALL) 530 bEndOfSearch = SearchAndReplaceAll (); | 527 Initialize ( ! mpSearchItem->GetBackward()); 528 529 sal_uInt16 nCommand = mpSearchItem->GetCommand(); 530 if (nCommand == SVX_SEARCHCMD_REPLACE_ALL) 531 bEndOfSearch = SearchAndReplaceAll (); 532 else 533 { 534 RememberStartPosition (); 535 bEndOfSearch = SearchAndReplaceOnce (); 536 //#107233# restore start position if nothing was found 537 if(!mbStringFound) 538 RestoreStartPosition (); |
531 else | 539 else |
532 { 533 RememberStartPosition (); 534 bEndOfSearch = SearchAndReplaceOnce (); 535 //#107233# restore start position if nothing was found 536 if(!mbStringFound) 537 RestoreStartPosition (); 538 else 539 mnStartPageIndex = (sal_uInt16)-1; 540 } | 540 mnStartPageIndex = (sal_uInt16)-1; |
541 } | 541 } |
542 else 543 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); | |
544 } | 542 } |
543 else 544 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); |
|
545 546 return bEndOfSearch; 547} 548 549 550 551 552void Outliner::Initialize (bool bDirectionIsForward) 553{ 554 const bool bIsAtEnd (maObjectIterator == ::sd::outliner::OutlinerContainer(this).end()); 555 const bool bOldDirectionIsForward = mbDirectionIsForward; 556 mbDirectionIsForward = bDirectionIsForward; 557 558 if (maObjectIterator == ::sd::outliner::Iterator()) 559 { 560 // Initialize a new search. 561 maObjectIterator = ::sd::outliner::OutlinerContainer(this).current(); 562 maCurrentPosition = *maObjectIterator; 563 | 545 546 return bEndOfSearch; 547} 548 549 550 551 552void Outliner::Initialize (bool bDirectionIsForward) 553{ 554 const bool bIsAtEnd (maObjectIterator == ::sd::outliner::OutlinerContainer(this).end()); 555 const bool bOldDirectionIsForward = mbDirectionIsForward; 556 mbDirectionIsForward = bDirectionIsForward; 557 558 if (maObjectIterator == ::sd::outliner::Iterator()) 559 { 560 // Initialize a new search. 561 maObjectIterator = ::sd::outliner::OutlinerContainer(this).current(); 562 maCurrentPosition = *maObjectIterator; 563 |
564 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 565 if ( ! pViewShell) 566 { 567 OSL_ASSERT(pViewShell); 568 return; 569 } 570 |
|
564 // In case we are searching in an outline view then first remove the 565 // current selection and place cursor at its start or end. | 571 // In case we are searching in an outline view then first remove the 572 // current selection and place cursor at its start or end. |
566 if (mpViewShell->ISA(OutlineViewShell)) | 573 if (pViewShell->ISA(OutlineViewShell)) |
567 { 568 ESelection aSelection = mpImpl->GetOutlinerView()->GetSelection (); 569 if (mbDirectionIsForward) 570 { 571 aSelection.nEndPara = aSelection.nStartPara; 572 aSelection.nEndPos = aSelection.nStartPos; 573 } 574 else --- 38 unchanged lines hidden (view full) --- 613 614 615bool Outliner::SearchAndReplaceAll (void) 616{ 617 // Save the current position to be restored after having replaced all 618 // matches. 619 RememberStartPosition (); 620 | 574 { 575 ESelection aSelection = mpImpl->GetOutlinerView()->GetSelection (); 576 if (mbDirectionIsForward) 577 { 578 aSelection.nEndPara = aSelection.nStartPara; 579 aSelection.nEndPos = aSelection.nStartPos; 580 } 581 else --- 38 unchanged lines hidden (view full) --- 620 621 622bool Outliner::SearchAndReplaceAll (void) 623{ 624 // Save the current position to be restored after having replaced all 625 // matches. 626 RememberStartPosition (); 627 |
621 if (mpViewShell->ISA(OutlineViewShell)) | 628 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 629 if ( ! pViewShell) |
622 { | 630 { |
631 OSL_ASSERT(pViewShell); 632 return true; 633 } 634 635 if (pViewShell->ISA(OutlineViewShell)) 636 { |
|
623 // Put the cursor to the beginning/end of the outliner. 624 mpImpl->GetOutlinerView()->SetSelection (GetSearchStartPosition ()); 625 626 // The outliner does all the work for us when we are in this mode. 627 SearchAndReplaceOnce(); 628 } | 637 // Put the cursor to the beginning/end of the outliner. 638 mpImpl->GetOutlinerView()->SetSelection (GetSearchStartPosition ()); 639 640 // The outliner does all the work for us when we are in this mode. 641 SearchAndReplaceOnce(); 642 } |
629 else if (mpViewShell->ISA(DrawViewShell)) | 643 else if (pViewShell->ISA(DrawViewShell)) |
630 { 631 // Go to beginning/end of document. 632 maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); 633 // Switch to the current object only if it is a valid text object. 634 ::sd::outliner::IteratorPosition aNewPosition (*maObjectIterator); 635 if (IsValidTextObject (aNewPosition)) 636 { 637 maCurrentPosition = aNewPosition; --- 23 unchanged lines hidden (view full) --- 661 662 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 663 DBG_ASSERT(pOutlinerView!=NULL && GetEditEngine().HasView( &pOutlinerView->GetEditView() ), 664 "SearchAndReplace without valid view!" ); 665 666 if( NULL == pOutlinerView || !GetEditEngine().HasView( &pOutlinerView->GetEditView() ) ) 667 return true; 668 | 644 { 645 // Go to beginning/end of document. 646 maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); 647 // Switch to the current object only if it is a valid text object. 648 ::sd::outliner::IteratorPosition aNewPosition (*maObjectIterator); 649 if (IsValidTextObject (aNewPosition)) 650 { 651 maCurrentPosition = aNewPosition; --- 23 unchanged lines hidden (view full) --- 675 676 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 677 DBG_ASSERT(pOutlinerView!=NULL && GetEditEngine().HasView( &pOutlinerView->GetEditView() ), 678 "SearchAndReplace without valid view!" ); 679 680 if( NULL == pOutlinerView || !GetEditEngine().HasView( &pOutlinerView->GetEditView() ) ) 681 return true; 682 |
669 if (mpViewShell != NULL) | 683 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 684 if (pViewShell != NULL) |
670 { | 685 { |
671 mpView = mpViewShell->GetView(); 672 mpWindow = mpViewShell->GetActiveWindow(); | 686 mpView = pViewShell->GetView(); 687 mpWindow = pViewShell->GetActiveWindow(); |
673 pOutlinerView->SetWindow(mpWindow); 674 | 688 pOutlinerView->SetWindow(mpWindow); 689 |
675 if (mpViewShell->ISA(DrawViewShell) ) | 690 if (pViewShell->ISA(DrawViewShell) ) |
676 { 677 // When replacing we first check if there is a selection 678 // indicating a match. If there is then replace it. The 679 // following call to StartSearchAndReplace will then search for 680 // the next match. 681 if (meMode == SEARCH 682 && mpSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE) 683 if (pOutlinerView->GetSelection().HasRange()) --- 28 unchanged lines hidden (view full) --- 712 return true; 713 } 714 715 if (meMode == SEARCH) 716 nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem); 717 } 718 } 719 } | 691 { 692 // When replacing we first check if there is a selection 693 // indicating a match. If there is then replace it. The 694 // following call to StartSearchAndReplace will then search for 695 // the next match. 696 if (meMode == SEARCH 697 && mpSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE) 698 if (pOutlinerView->GetSelection().HasRange()) --- 28 unchanged lines hidden (view full) --- 727 return true; 728 } 729 730 if (meMode == SEARCH) 731 nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem); 732 } 733 } 734 } |
720 else if (mpViewShell->ISA(OutlineViewShell)) | 735 else if (pViewShell->ISA(OutlineViewShell)) |
721 { 722 mpDrawDocument->GetDocSh()->SetWaitCursor (sal_False); 723 // The following loop is executed more then once only when a 724 // wrap arround search is done. 725 while (true) 726 { 727 int nResult = pOutlinerView->StartSearchAndReplace(*mpSearchItem); 728 if (nResult == 0) --- 21 unchanged lines hidden (view full) --- 750 751/** Try to detect whether the document or the view (shell) has changed since 752 the last time <member>StartSearchAndReplace()</member> has been called. 753*/ 754void Outliner::DetectChange (void) 755{ 756 ::sd::outliner::IteratorPosition aPosition (maCurrentPosition); 757 | 736 { 737 mpDrawDocument->GetDocSh()->SetWaitCursor (sal_False); 738 // The following loop is executed more then once only when a 739 // wrap arround search is done. 740 while (true) 741 { 742 int nResult = pOutlinerView->StartSearchAndReplace(*mpSearchItem); 743 if (nResult == 0) --- 21 unchanged lines hidden (view full) --- 765 766/** Try to detect whether the document or the view (shell) has changed since 767 the last time <member>StartSearchAndReplace()</member> has been called. 768*/ 769void Outliner::DetectChange (void) 770{ 771 ::sd::outliner::IteratorPosition aPosition (maCurrentPosition); 772 |
773 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); |
|
758 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( | 774 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( |
759 ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell)); | 775 ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); |
760 761 // Detect whether the view has been switched from the outside. 762 if (pDrawViewShell.get() != NULL 763 && (aPosition.meEditMode != pDrawViewShell->GetEditMode() 764 || aPosition.mePageKind != pDrawViewShell->GetPageKind())) 765 { 766 // Either the edit mode or the page kind has changed. 767 SetStatusEventHdl(Link()); --- 79 unchanged lines hidden (view full) --- 847 return bSelectionHasChanged; 848} 849 850 851 852 853void Outliner::RememberStartPosition (void) 854{ | 776 777 // Detect whether the view has been switched from the outside. 778 if (pDrawViewShell.get() != NULL 779 && (aPosition.meEditMode != pDrawViewShell->GetEditMode() 780 || aPosition.mePageKind != pDrawViewShell->GetPageKind())) 781 { 782 // Either the edit mode or the page kind has changed. 783 SetStatusEventHdl(Link()); --- 79 unchanged lines hidden (view full) --- 863 return bSelectionHasChanged; 864} 865 866 867 868 869void Outliner::RememberStartPosition (void) 870{ |
855 if (mpViewShell->ISA(DrawViewShell)) | 871 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 872 if ( ! pViewShell) |
856 { | 873 { |
874 OSL_ASSERT(pViewShell); 875 return; 876 } 877 878 if (pViewShell->ISA(DrawViewShell)) 879 { |
|
857 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( | 880 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( |
858 ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell)); | 881 ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); |
859 if (pDrawViewShell.get() != NULL) 860 { 861 meStartViewMode = pDrawViewShell->GetPageKind(); 862 meStartEditMode = pDrawViewShell->GetEditMode(); 863 mnStartPageIndex = pDrawViewShell->GetCurPageId() - 1; 864 } 865 866 if (mpView != NULL) --- 8 unchanged lines hidden (view full) --- 875 if (pOutliner!=NULL && pOutliner->GetViewCount()>0) 876 { 877 OutlinerView* pOutlinerView = pOutliner->GetView(0); 878 maStartSelection = pOutlinerView->GetSelection(); 879 } 880 } 881 } 882 } | 882 if (pDrawViewShell.get() != NULL) 883 { 884 meStartViewMode = pDrawViewShell->GetPageKind(); 885 meStartEditMode = pDrawViewShell->GetEditMode(); 886 mnStartPageIndex = pDrawViewShell->GetCurPageId() - 1; 887 } 888 889 if (mpView != NULL) --- 8 unchanged lines hidden (view full) --- 898 if (pOutliner!=NULL && pOutliner->GetViewCount()>0) 899 { 900 OutlinerView* pOutlinerView = pOutliner->GetView(0); 901 maStartSelection = pOutlinerView->GetSelection(); 902 } 903 } 904 } 905 } |
883 else if (mpViewShell->ISA(OutlineViewShell)) | 906 else if (pViewShell->ISA(OutlineViewShell)) |
884 { 885 // Remember the current cursor position. 886 OutlinerView* pView = GetView(0); 887 if (pView != NULL) 888 pView->GetSelection(); 889 } 890 else 891 { --- 6 unchanged lines hidden (view full) --- 898 899void Outliner::RestoreStartPosition (void) 900{ 901 bool bRestore = true; 902 // Take a negative start page index as inidicator that restoring the 903 // start position is not requested. 904 if (mnStartPageIndex == (sal_uInt16)-1 ) 905 bRestore = false; | 907 { 908 // Remember the current cursor position. 909 OutlinerView* pView = GetView(0); 910 if (pView != NULL) 911 pView->GetSelection(); 912 } 913 else 914 { --- 6 unchanged lines hidden (view full) --- 921 922void Outliner::RestoreStartPosition (void) 923{ 924 bool bRestore = true; 925 // Take a negative start page index as inidicator that restoring the 926 // start position is not requested. 927 if (mnStartPageIndex == (sal_uInt16)-1 ) 928 bRestore = false; |
906 // Dont't resore when the view shell is not valid. 907 if (mpViewShell == NULL) | 929 // Dont't restore when the view shell is not valid. 930 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 931 if (pViewShell == NULL) |
908 bRestore = false; | 932 bRestore = false; |
909 if ( ! mbViewShellValid) 910 bRestore = false; | |
911 912 if (bRestore) 913 { | 933 934 if (bRestore) 935 { |
914 if (mpViewShell->ISA(DrawViewShell)) | 936 if (pViewShell->ISA(DrawViewShell)) |
915 { 916 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( | 937 { 938 ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( |
917 ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell)); | 939 ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); |
918 SetViewMode (meStartViewMode); 919 if (pDrawViewShell.get() != NULL) 920 SetPage (meStartEditMode, mnStartPageIndex); 921 922 923 if (mpStartEditedObject != NULL) 924 { 925 // Turn on the text toolbar as it is done in FuText so that 926 // undo manager setting/restoring in 927 // sd::View::{Beg,End}TextEdit() works on the same view shell. | 940 SetViewMode (meStartViewMode); 941 if (pDrawViewShell.get() != NULL) 942 SetPage (meStartEditMode, mnStartPageIndex); 943 944 945 if (mpStartEditedObject != NULL) 946 { 947 // Turn on the text toolbar as it is done in FuText so that 948 // undo manager setting/restoring in 949 // sd::View::{Beg,End}TextEdit() works on the same view shell. |
928 mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell( | 950 pViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell( |
929 ToolBarManager::TBG_FUNCTION, 930 RID_DRAW_TEXT_TOOLBOX); 931 932 mpView->SdrBeginTextEdit(mpStartEditedObject); 933 ::Outliner* pOutliner = 934 static_cast<DrawView*>(mpView)->GetTextEditOutliner(); 935 if (pOutliner!=NULL && pOutliner->GetViewCount()>0) 936 { 937 OutlinerView* pOutlinerView = pOutliner->GetView(0); 938 pOutlinerView->SetSelection(maStartSelection); 939 } 940 } 941 } | 951 ToolBarManager::TBG_FUNCTION, 952 RID_DRAW_TEXT_TOOLBOX); 953 954 mpView->SdrBeginTextEdit(mpStartEditedObject); 955 ::Outliner* pOutliner = 956 static_cast<DrawView*>(mpView)->GetTextEditOutliner(); 957 if (pOutliner!=NULL && pOutliner->GetViewCount()>0) 958 { 959 OutlinerView* pOutlinerView = pOutliner->GetView(0); 960 pOutlinerView->SetSelection(maStartSelection); 961 } 962 } 963 } |
942 else if (mpViewShell->ISA(OutlineViewShell)) | 964 else if (pViewShell->ISA(OutlineViewShell)) |
943 { 944 // Set cursor to its old position. 945 OutlinerView* pView = GetView(0); 946 if (pView != NULL) 947 pView->SetSelection (maStartSelection); 948 } 949 } 950} --- 47 unchanged lines hidden (view full) --- 998 mpObj = SetObject (maCurrentPosition); 999 } 1000 ++maObjectIterator; 1001 1002 if (mpObj != NULL) 1003 { 1004 PutTextIntoOutliner (); 1005 | 965 { 966 // Set cursor to its old position. 967 OutlinerView* pView = GetView(0); 968 if (pView != NULL) 969 pView->SetSelection (maStartSelection); 970 } 971 } 972} --- 47 unchanged lines hidden (view full) --- 1020 mpObj = SetObject (maCurrentPosition); 1021 } 1022 ++maObjectIterator; 1023 1024 if (mpObj != NULL) 1025 { 1026 PutTextIntoOutliner (); 1027 |
1006 if (mpViewShell != NULL) | 1028 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1029 if (pViewShell != NULL) |
1007 switch (meMode) 1008 { 1009 case SEARCH: 1010 PrepareSearchAndReplace (); 1011 break; 1012 case SPELL: 1013 PrepareSpellCheck (); 1014 break; --- 12 unchanged lines hidden (view full) --- 1027 while ( ! (mbFoundObject || mbEndOfSearch)); 1028} 1029 1030 1031 1032 1033void Outliner::EndOfSearch (void) 1034{ | 1030 switch (meMode) 1031 { 1032 case SEARCH: 1033 PrepareSearchAndReplace (); 1034 break; 1035 case SPELL: 1036 PrepareSpellCheck (); 1037 break; --- 12 unchanged lines hidden (view full) --- 1050 while ( ! (mbFoundObject || mbEndOfSearch)); 1051} 1052 1053 1054 1055 1056void Outliner::EndOfSearch (void) 1057{ |
1058 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1059 if ( ! pViewShell) 1060 { 1061 OSL_ASSERT(pViewShell); 1062 return; 1063 } 1064 |
|
1035 // Before we display a dialog we first jump to where the last valid text 1036 // object was found. All page and view mode switching since then was 1037 // temporary and should not be visible to the user. | 1065 // Before we display a dialog we first jump to where the last valid text 1066 // object was found. All page and view mode switching since then was 1067 // temporary and should not be visible to the user. |
1038 if ( ! mpViewShell->ISA(OutlineViewShell)) | 1068 if ( ! pViewShell->ISA(OutlineViewShell)) |
1039 SetObject (maLastValidPosition); 1040 1041 if (mbRestrictSearchToSelection) 1042 ShowEndOfSearchDialog (); 1043 else 1044 { 1045 // When no match has been found so far then terminate the search. 1046 if ( ! mbMatchMayExist) 1047 { 1048 ShowEndOfSearchDialog (); 1049 mbEndOfSearch = sal_True; 1050 } 1051 // Ask the user whether to wrap arround and continue the search or 1052 // to terminate. 1053 else if (meMode==TEXT_CONVERSION || ShowWrapArroundDialog ()) 1054 { 1055 mbMatchMayExist = false; 1056 // Everything back to beginning (or end?) of the document. 1057 maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); | 1069 SetObject (maLastValidPosition); 1070 1071 if (mbRestrictSearchToSelection) 1072 ShowEndOfSearchDialog (); 1073 else 1074 { 1075 // When no match has been found so far then terminate the search. 1076 if ( ! mbMatchMayExist) 1077 { 1078 ShowEndOfSearchDialog (); 1079 mbEndOfSearch = sal_True; 1080 } 1081 // Ask the user whether to wrap arround and continue the search or 1082 // to terminate. 1083 else if (meMode==TEXT_CONVERSION || ShowWrapArroundDialog ()) 1084 { 1085 mbMatchMayExist = false; 1086 // Everything back to beginning (or end?) of the document. 1087 maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); |
1058 if (mpViewShell->ISA(OutlineViewShell)) | 1088 if (pViewShell->ISA(OutlineViewShell)) |
1059 { 1060 // Set cursor to first character of the document. 1061 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1062 if (pOutlinerView != NULL) 1063 pOutlinerView->SetSelection (GetSearchStartPosition ()); 1064 } 1065 1066 mbEndOfSearch = false; --- 172 unchanged lines hidden (view full) --- 1239 } 1240} 1241 1242 1243 1244 1245void Outliner::SetViewMode (PageKind ePageKind) 1246{ | 1089 { 1090 // Set cursor to first character of the document. 1091 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1092 if (pOutlinerView != NULL) 1093 pOutlinerView->SetSelection (GetSearchStartPosition ()); 1094 } 1095 1096 mbEndOfSearch = false; --- 172 unchanged lines hidden (view full) --- 1269 } 1270} 1271 1272 1273 1274 1275void Outliner::SetViewMode (PageKind ePageKind) 1276{ |
1277 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); |
|
1247 ::boost::shared_ptr<DrawViewShell> pDrawViewShell( | 1278 ::boost::shared_ptr<DrawViewShell> pDrawViewShell( |
1248 ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell)); | 1279 ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); |
1249 if (pDrawViewShell.get()!=NULL && ePageKind != pDrawViewShell->GetPageKind()) 1250 { 1251 // Restore old edit mode. 1252 pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, sal_False); 1253 1254 SetStatusEventHdl(Link()); 1255 ::rtl::OUString sViewURL; 1256 switch (ePageKind) --- 9 unchanged lines hidden (view full) --- 1266 sViewURL = framework::FrameworkHelper::msHandoutViewURL; 1267 break; 1268 } 1269 // The text object iterator is destroyed when the shells are 1270 // switched but we need it so save it and restore it afterwards. 1271 ::sd::outliner::Iterator aIterator (maObjectIterator); 1272 bool bMatchMayExist = mbMatchMayExist; 1273 | 1280 if (pDrawViewShell.get()!=NULL && ePageKind != pDrawViewShell->GetPageKind()) 1281 { 1282 // Restore old edit mode. 1283 pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, sal_False); 1284 1285 SetStatusEventHdl(Link()); 1286 ::rtl::OUString sViewURL; 1287 switch (ePageKind) --- 9 unchanged lines hidden (view full) --- 1297 sViewURL = framework::FrameworkHelper::msHandoutViewURL; 1298 break; 1299 } 1300 // The text object iterator is destroyed when the shells are 1301 // switched but we need it so save it and restore it afterwards. 1302 ::sd::outliner::Iterator aIterator (maObjectIterator); 1303 bool bMatchMayExist = mbMatchMayExist; 1304 |
1274 ViewShellBase& rBase = mpViewShell->GetViewShellBase(); | 1305 ViewShellBase& rBase = pViewShell->GetViewShellBase(); |
1275 SetViewShell(::boost::shared_ptr<ViewShell>()); 1276 framework::FrameworkHelper::Instance(rBase)->RequestView( 1277 sViewURL, 1278 framework::FrameworkHelper::msCenterPaneURL); 1279 1280 // Force (well, request) a synchronous update of the configuration. 1281 // In a better world we would handle the asynchronous view update 1282 // instead. But that would involve major restucturing of the --- 10 unchanged lines hidden (view full) --- 1293 // to. 1294 mnPageCount = mpDrawDocument->GetSdPageCount(ePageKind); 1295 1296 maObjectIterator = aIterator; 1297 mbMatchMayExist = bMatchMayExist; 1298 1299 // Save edit mode so that it can be restored when switching the view 1300 // shell again. | 1306 SetViewShell(::boost::shared_ptr<ViewShell>()); 1307 framework::FrameworkHelper::Instance(rBase)->RequestView( 1308 sViewURL, 1309 framework::FrameworkHelper::msCenterPaneURL); 1310 1311 // Force (well, request) a synchronous update of the configuration. 1312 // In a better world we would handle the asynchronous view update 1313 // instead. But that would involve major restucturing of the --- 10 unchanged lines hidden (view full) --- 1324 // to. 1325 mnPageCount = mpDrawDocument->GetSdPageCount(ePageKind); 1326 1327 maObjectIterator = aIterator; 1328 mbMatchMayExist = bMatchMayExist; 1329 1330 // Save edit mode so that it can be restored when switching the view 1331 // shell again. |
1301 pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell); | 1332 pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell); |
1302 OSL_ASSERT(pDrawViewShell.get()!=NULL); 1303 if (pDrawViewShell.get() != NULL) 1304 mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode(); 1305 } 1306} 1307 1308 1309 1310 1311void Outliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex) 1312{ 1313 if ( ! mbRestrictSearchToSelection) 1314 { | 1333 OSL_ASSERT(pDrawViewShell.get()!=NULL); 1334 if (pDrawViewShell.get() != NULL) 1335 mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode(); 1336 } 1337} 1338 1339 1340 1341 1342void Outliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex) 1343{ 1344 if ( ! mbRestrictSearchToSelection) 1345 { |
1346 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); |
|
1315 ::boost::shared_ptr<DrawViewShell> pDrawViewShell( | 1347 ::boost::shared_ptr<DrawViewShell> pDrawViewShell( |
1316 ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell)); | 1348 ::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); |
1317 OSL_ASSERT(pDrawViewShell.get()!=NULL); 1318 if (pDrawViewShell.get() != NULL) 1319 { 1320 pDrawViewShell->ChangeEditMode(eEditMode, sal_False); 1321 pDrawViewShell->SwitchPage(nPageIndex); 1322 } 1323 } 1324} 1325 1326 1327 1328 1329void Outliner::EnterEditMode (sal_Bool bGrabFocus) 1330{ 1331 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); | 1349 OSL_ASSERT(pDrawViewShell.get()!=NULL); 1350 if (pDrawViewShell.get() != NULL) 1351 { 1352 pDrawViewShell->ChangeEditMode(eEditMode, sal_False); 1353 pDrawViewShell->SwitchPage(nPageIndex); 1354 } 1355 } 1356} 1357 1358 1359 1360 1361void Outliner::EnterEditMode (sal_Bool bGrabFocus) 1362{ 1363 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); |
1332 if (mbViewShellValid && pOutlinerView != NULL) | 1364 if (pOutlinerView != NULL) |
1333 { 1334 pOutlinerView->SetOutputArea( Rectangle( Point(), Size(1, 1))); 1335 SetPaperSize( mpTextObj->GetLogicRect().GetSize() ); 1336 SdrPageView* pPV = mpView->GetSdrPageView(); 1337 1338 // Make FuText the current function. 1339 SfxUInt16Item aItem (SID_TEXTEDIT, 1); | 1365 { 1366 pOutlinerView->SetOutputArea( Rectangle( Point(), Size(1, 1))); 1367 SetPaperSize( mpTextObj->GetLogicRect().GetSize() ); 1368 SdrPageView* pPV = mpView->GetSdrPageView(); 1369 1370 // Make FuText the current function. 1371 SfxUInt16Item aItem (SID_TEXTEDIT, 1); |
1340 mpViewShell->GetDispatcher()-> | 1372 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1373 pViewShell->GetDispatcher()-> |
1341 Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON | 1342 SFX_CALLMODE_RECORD, &aItem, 0L); 1343 1344 // To be consistent with the usual behaviour in the Office the text 1345 // object that is put into edit mode would have also to be selected. 1346 // Starting the text edit mode is not enough so we do it here by 1347 // hand. 1348 mbExpectingSelectionChangeEvent = true; --- 115 unchanged lines hidden (view full) --- 1464 return rPosition.mxObject.get(); 1465} 1466 1467 1468 1469 1470void Outliner::SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell) 1471{ | 1374 Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON | 1375 SFX_CALLMODE_RECORD, &aItem, 0L); 1376 1377 // To be consistent with the usual behaviour in the Office the text 1378 // object that is put into edit mode would have also to be selected. 1379 // Starting the text edit mode is not enough so we do it here by 1380 // hand. 1381 mbExpectingSelectionChangeEvent = true; --- 115 unchanged lines hidden (view full) --- 1497 return rPosition.mxObject.get(); 1498} 1499 1500 1501 1502 1503void Outliner::SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell) 1504{ |
1472 if (mpViewShell != rpViewShell) | 1505 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1506 if (pViewShell != rpViewShell) |
1473 { 1474 // Set the new view shell. | 1507 { 1508 // Set the new view shell. |
1475 mpViewShell = rpViewShell; | 1509 mpWeakViewShell = rpViewShell; |
1476 // When the outline view is not owned by us then we have to clear 1477 // that pointer so that the current one for the new view shell will 1478 // be used (in ProvideOutlinerView). 1479 // if ( ! mbOwnOutlineView) 1480 // mpOutlineView = NULL; | 1510 // When the outline view is not owned by us then we have to clear 1511 // that pointer so that the current one for the new view shell will 1512 // be used (in ProvideOutlinerView). 1513 // if ( ! mbOwnOutlineView) 1514 // mpOutlineView = NULL; |
1481 if (mpViewShell.get() != NULL) | 1515 if (rpViewShell) |
1482 { | 1516 { |
1483 mpView = mpViewShell->GetView(); | 1517 mpView = rpViewShell->GetView(); |
1484 | 1518 |
1485 mpWindow = mpViewShell->GetActiveWindow(); | 1519 mpWindow = rpViewShell->GetActiveWindow(); |
1486 | 1520 |
1487 mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow); | 1521 mpImpl->ProvideOutlinerView(*this, rpViewShell, mpWindow); |
1488 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1489 if (pOutlinerView != NULL) 1490 pOutlinerView->SetWindow(mpWindow); 1491 } 1492 else 1493 { 1494 mpView = NULL; 1495 mpWindow = NULL; --- 28 unchanged lines hidden (view full) --- 1524 1525 1526 1527 1528 1529void Outliner::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage, 1530 const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive ) 1531{ | 1522 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1523 if (pOutlinerView != NULL) 1524 pOutlinerView->SetWindow(mpWindow); 1525 } 1526 else 1527 { 1528 mpView = NULL; 1529 mpWindow = NULL; --- 28 unchanged lines hidden (view full) --- 1558 1559 1560 1561 1562 1563void Outliner::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage, 1564 const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive ) 1565{ |
1532 sal_Bool bMultiDoc = mpViewShell->ISA(DrawViewShell); | 1566 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1567 sal_Bool bMultiDoc = pViewShell->ISA(DrawViewShell); |
1533 1534 meMode = TEXT_CONVERSION; 1535 mbDirectionIsForward = true; 1536 mpSearchItem = NULL; 1537 mnConversionLanguage = nSourceLanguage; 1538 1539 BeginConversion(); 1540 --- 46 unchanged lines hidden (view full) --- 1587void Outliner::BeginConversion (void) 1588{ 1589 SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); 1590 1591 ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current()); 1592 if (pBase != NULL) 1593 SetViewShell (pBase->GetMainViewShell()); 1594 | 1568 1569 meMode = TEXT_CONVERSION; 1570 mbDirectionIsForward = true; 1571 mpSearchItem = NULL; 1572 mnConversionLanguage = nSourceLanguage; 1573 1574 BeginConversion(); 1575 --- 46 unchanged lines hidden (view full) --- 1622void Outliner::BeginConversion (void) 1623{ 1624 SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); 1625 1626 ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current()); 1627 if (pBase != NULL) 1628 SetViewShell (pBase->GetMainViewShell()); 1629 |
1595 if (mpViewShell != NULL) | 1630 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1631 if (pViewShell) |
1596 { 1597 mbStringFound = sal_False; 1598 1599 // Supposed that we are not located at the very beginning/end of the 1600 // document then there may be a match in the document prior/after 1601 // the current position. 1602 mbMatchMayExist = sal_True; 1603 1604 maObjectIterator = ::sd::outliner::Iterator(); 1605 maSearchStartPosition = ::sd::outliner::Iterator(); 1606 RememberStartPosition(); 1607 | 1632 { 1633 mbStringFound = sal_False; 1634 1635 // Supposed that we are not located at the very beginning/end of the 1636 // document then there may be a match in the document prior/after 1637 // the current position. 1638 mbMatchMayExist = sal_True; 1639 1640 maObjectIterator = ::sd::outliner::Iterator(); 1641 maSearchStartPosition = ::sd::outliner::Iterator(); 1642 RememberStartPosition(); 1643 |
1608 mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow); | 1644 mpImpl->ProvideOutlinerView(*this, pViewShell, mpWindow); |
1609 1610 HandleChangedSelection (); 1611 } 1612 ClearModifyFlag(); 1613} 1614 1615 1616 1617 1618void Outliner::EndConversion() 1619{ 1620 EndSpelling(); 1621} 1622 1623 1624 1625 1626sal_Bool Outliner::ConvertNextDocument() 1627{ | 1645 1646 HandleChangedSelection (); 1647 } 1648 ClearModifyFlag(); 1649} 1650 1651 1652 1653 1654void Outliner::EndConversion() 1655{ 1656 EndSpelling(); 1657} 1658 1659 1660 1661 1662sal_Bool Outliner::ConvertNextDocument() 1663{ |
1628 if( mpViewShell && mpViewShell->ISA(OutlineViewShell) ) | 1664 ::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); 1665 if (pViewShell && pViewShell->ISA(OutlineViewShell) ) |
1629 return false; 1630 1631 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 1632 1633 Initialize ( true ); 1634 1635 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1636 if (pOutlinerView != NULL) 1637 { | 1666 return false; 1667 1668 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True ); 1669 1670 Initialize ( true ); 1671 1672 OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); 1673 if (pOutlinerView != NULL) 1674 { |
1638 mpWindow = mpViewShell->GetActiveWindow(); | 1675 mpWindow = pViewShell->GetActiveWindow(); |
1639 pOutlinerView->SetWindow(mpWindow); 1640 } 1641 ProvideNextTextObject (); 1642 1643 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); 1644 ClearModifyFlag(); 1645 1646 // for text conversion we automaticly wrap around one --- 182 unchanged lines hidden --- | 1676 pOutlinerView->SetWindow(mpWindow); 1677 } 1678 ProvideNextTextObject (); 1679 1680 mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); 1681 ClearModifyFlag(); 1682 1683 // for text conversion we automaticly wrap around one --- 182 unchanged lines hidden --- |