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 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 #include "scitems.hxx" 32 #include <editeng/eeitem.hxx> 33 34 35 #include <memory> 36 #include "AccessibleText.hxx" 37 #include "AccessibleCell.hxx" 38 #include "tabvwsh.hxx" 39 #include "editutil.hxx" 40 #include "document.hxx" 41 #include "scmod.hxx" 42 #include "prevwsh.hxx" 43 #include "docsh.hxx" 44 #include "prevloc.hxx" 45 #include "unoguard.hxx" 46 #include "patattr.hxx" 47 #include "inputwin.hxx" 48 #include <editeng/unofored.hxx> 49 #include <editeng/editview.hxx> 50 #include <editeng/unoedhlp.hxx> 51 #include <vcl/virdev.hxx> 52 #include <editeng/editobj.hxx> 53 #include <editeng/adjitem.hxx> 54 #include <svx/svdmodel.hxx> 55 #include <svx/algitem.hxx> 56 57 58 // ============================================================================ 59 60 class ScViewForwarder : public SvxViewForwarder 61 { 62 ScTabViewShell* mpViewShell; 63 ScAddress maCellPos; 64 ScSplitPos meSplitPos; 65 public: 66 ScViewForwarder(ScTabViewShell* pViewShell, ScSplitPos eSplitPos, const ScAddress& rCell); 67 virtual ~ScViewForwarder(); 68 69 virtual sal_Bool IsValid() const; 70 virtual Rectangle GetVisArea() const; 71 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; 72 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; 73 74 void SetInvalid(); 75 }; 76 77 ScViewForwarder::ScViewForwarder(ScTabViewShell* pViewShell, ScSplitPos eSplitPos, const ScAddress& rCell) 78 : 79 mpViewShell(pViewShell), 80 maCellPos(rCell), 81 meSplitPos(eSplitPos) 82 { 83 } 84 85 ScViewForwarder::~ScViewForwarder() 86 { 87 } 88 89 sal_Bool ScViewForwarder::IsValid() const 90 { 91 return mpViewShell != NULL; 92 } 93 94 Rectangle ScViewForwarder::GetVisArea() const 95 { 96 Rectangle aVisArea; 97 if (mpViewShell) 98 { 99 Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); 100 if (pWindow) 101 { 102 aVisArea.SetSize(pWindow->GetSizePixel()); 103 104 ScHSplitPos eWhichH = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_BOTTOMLEFT)) ? 105 SC_SPLIT_LEFT : SC_SPLIT_RIGHT; 106 ScVSplitPos eWhichV = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_TOPRIGHT)) ? 107 SC_SPLIT_TOP : SC_SPLIT_BOTTOM; 108 109 Point aBaseCellPos(mpViewShell->GetViewData()->GetScrPos(mpViewShell->GetViewData()->GetPosX(eWhichH), 110 mpViewShell->GetViewData()->GetPosY(eWhichV), meSplitPos, sal_True)); 111 Point aCellPos(mpViewShell->GetViewData()->GetScrPos(maCellPos.Col(), maCellPos.Row(), meSplitPos, sal_True)); 112 aVisArea.SetPos(aCellPos - aBaseCellPos); 113 } 114 } 115 else 116 { 117 DBG_ERROR("this ViewForwarder is not valid"); 118 } 119 return aVisArea; 120 } 121 122 Point ScViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const 123 { 124 if (mpViewShell) 125 { 126 Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); 127 if (pWindow) 128 return pWindow->LogicToPixel( rPoint, rMapMode ); 129 } 130 else 131 { 132 DBG_ERROR("this ViewForwarder is not valid"); 133 } 134 return Point(); 135 } 136 137 Point ScViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const 138 { 139 if (mpViewShell) 140 { 141 Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); 142 if (pWindow) 143 return pWindow->PixelToLogic( rPoint, rMapMode ); 144 } 145 else 146 { 147 DBG_ERROR("this ViewForwarder is not valid"); 148 } 149 return Point(); 150 } 151 152 void ScViewForwarder::SetInvalid() 153 { 154 mpViewShell = NULL; 155 } 156 157 // ============================================================================ 158 159 class ScEditObjectViewForwarder : public SvxViewForwarder 160 { 161 Window* mpWindow; 162 // --> OD 2005-12-21 #i49561# 163 // - EditView needed for access to its visible area. 164 const EditView* mpEditView; 165 // <-- 166 public: 167 // --> OD 2005-12-21 #i49561# 168 ScEditObjectViewForwarder( Window* pWindow, 169 const EditView* _pEditView); 170 // <-- 171 virtual ~ScEditObjectViewForwarder(); 172 173 virtual sal_Bool IsValid() const; 174 virtual Rectangle GetVisArea() const; 175 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; 176 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; 177 178 void SetInvalid(); 179 }; 180 181 // --> OD 2005-12-21 #i49561# 182 ScEditObjectViewForwarder::ScEditObjectViewForwarder( Window* pWindow, 183 const EditView* _pEditView ) 184 : 185 mpWindow(pWindow), 186 mpEditView( _pEditView ) 187 { 188 } 189 // <-- 190 191 ScEditObjectViewForwarder::~ScEditObjectViewForwarder() 192 { 193 } 194 195 sal_Bool ScEditObjectViewForwarder::IsValid() const 196 { 197 return (mpWindow != NULL); 198 } 199 200 Rectangle ScEditObjectViewForwarder::GetVisArea() const 201 { 202 Rectangle aVisArea; 203 if (mpWindow) 204 { 205 Rectangle aVisRect(mpWindow->GetWindowExtentsRelative(mpWindow->GetAccessibleParentWindow())); 206 207 aVisRect.SetPos(Point(0, 0)); 208 209 aVisArea = aVisRect; 210 } 211 else 212 { 213 DBG_ERROR("this ViewForwarder is not valid"); 214 } 215 return aVisArea; 216 } 217 218 Point ScEditObjectViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const 219 { 220 if (mpWindow) 221 { 222 // --> OD 2005-12-21 #i49561# - consider offset of the visible area 223 // of the EditView before converting point to pixel. 224 Point aPoint( rPoint ); 225 if ( mpEditView ) 226 { 227 Rectangle aEditViewVisArea( mpEditView->GetVisArea() ); 228 aPoint += aEditViewVisArea.TopLeft(); 229 } 230 return mpWindow->LogicToPixel( aPoint, rMapMode ); 231 // <-- 232 } 233 else 234 { 235 DBG_ERROR("this ViewForwarder is not valid"); 236 } 237 return Point(); 238 } 239 240 Point ScEditObjectViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const 241 { 242 if (mpWindow) 243 { 244 // --> OD 2005-12-21 #i49561# - consider offset of the visible area 245 // of the EditView after converting point to logic. 246 Point aPoint( mpWindow->PixelToLogic( rPoint, rMapMode ) ); 247 if ( mpEditView ) 248 { 249 Rectangle aEditViewVisArea( mpEditView->GetVisArea() ); 250 aPoint -= aEditViewVisArea.TopLeft(); 251 } 252 return aPoint; 253 // <-- 254 } 255 else 256 { 257 DBG_ERROR("this ViewForwarder is not valid"); 258 } 259 return Point(); 260 } 261 262 void ScEditObjectViewForwarder::SetInvalid() 263 { 264 mpWindow = NULL; 265 } 266 267 // ============================================================================ 268 269 class ScPreviewViewForwarder : public SvxViewForwarder 270 { 271 protected: 272 ScPreviewShell* mpViewShell; 273 mutable ScPreviewTableInfo* mpTableInfo; 274 public: 275 ScPreviewViewForwarder(ScPreviewShell* pViewShell); 276 virtual ~ScPreviewViewForwarder(); 277 278 virtual sal_Bool IsValid() const; 279 virtual Rectangle GetVisArea() const; 280 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; 281 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; 282 283 void SetInvalid(); 284 285 Rectangle GetVisRect() const; 286 287 // clips the VisArea and calculates with the negativ coordinates 288 Rectangle CorrectVisArea(const Rectangle& rVisArea) const; 289 }; 290 291 ScPreviewViewForwarder::ScPreviewViewForwarder(ScPreviewShell* pViewShell) 292 : 293 mpViewShell(pViewShell), 294 mpTableInfo(NULL) 295 { 296 } 297 298 ScPreviewViewForwarder::~ScPreviewViewForwarder() 299 { 300 delete mpTableInfo; 301 } 302 303 sal_Bool ScPreviewViewForwarder::IsValid() const 304 { 305 return mpViewShell != NULL; 306 } 307 308 Rectangle ScPreviewViewForwarder::GetVisArea() const 309 { 310 Rectangle aVisArea; 311 DBG_ERROR("should be implemented in an abrevated class"); 312 return aVisArea; 313 } 314 315 Point ScPreviewViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const 316 { 317 if (mpViewShell) 318 { 319 Window* pWindow = mpViewShell->GetWindow(); 320 if (pWindow) 321 { 322 MapMode aMapMode(pWindow->GetMapMode().GetMapUnit()); 323 Point aPoint2( OutputDevice::LogicToLogic( rPoint, rMapMode, aMapMode) ); 324 return pWindow->LogicToPixel(aPoint2); 325 } 326 } 327 else 328 { 329 DBG_ERROR("this ViewForwarder is not valid"); 330 } 331 return Point(); 332 } 333 334 Point ScPreviewViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const 335 { 336 if (mpViewShell) 337 { 338 Window* pWindow = mpViewShell->GetWindow(); 339 if (pWindow) 340 { 341 MapMode aMapMode(pWindow->GetMapMode()); 342 aMapMode.SetOrigin(Point()); 343 Point aPoint1( pWindow->PixelToLogic( rPoint ) ); 344 Point aPoint2( OutputDevice::LogicToLogic( aPoint1, 345 aMapMode.GetMapUnit(), 346 rMapMode ) ); 347 return aPoint2; 348 } 349 } 350 else 351 { 352 DBG_ERROR("this ViewForwarder is not valid"); 353 } 354 return Point(); 355 } 356 357 void ScPreviewViewForwarder::SetInvalid() 358 { 359 mpViewShell = NULL; 360 } 361 362 Rectangle ScPreviewViewForwarder::GetVisRect() const 363 { 364 if ( mpViewShell ) 365 { 366 Size aOutputSize; 367 Window* pWindow = mpViewShell->GetWindow(); 368 if ( pWindow ) 369 aOutputSize = pWindow->GetOutputSizePixel(); 370 Point aPoint; 371 Rectangle aVisRect( aPoint, aOutputSize ); 372 return aVisRect; 373 } 374 return Rectangle(); 375 } 376 377 Rectangle ScPreviewViewForwarder::CorrectVisArea(const Rectangle& rVisArea) const 378 { 379 Rectangle aVisArea(rVisArea); 380 Point aPos = aVisArea.TopLeft(); // get first the position to remember negative positions after clipping 381 382 Window* pWin = mpViewShell->GetWindow(); 383 if (pWin) 384 aVisArea = pWin->GetWindowExtentsRelative(pWin).GetIntersection(aVisArea); 385 386 sal_Int32 nX(aPos.getX()); 387 sal_Int32 nY(aPos.getY()); 388 389 if (nX > 0) 390 nX = 0; 391 else if (nX < 0) 392 nX = -nX; 393 if (nY > 0) 394 nY = 0; 395 else if (nY < 0) 396 nY = -nY; 397 aVisArea.SetPos(Point(nX, nY)); 398 399 return aVisArea; 400 } 401 402 // ============================================================================ 403 404 class ScPreviewHeaderFooterViewForwarder : public ScPreviewViewForwarder 405 { 406 sal_Bool mbHeader; 407 public: 408 ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, sal_Bool bHeader); 409 virtual ~ScPreviewHeaderFooterViewForwarder(); 410 411 virtual Rectangle GetVisArea() const; 412 }; 413 414 ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, sal_Bool bHeader) 415 : 416 ScPreviewViewForwarder(pViewShell), 417 mbHeader(bHeader) 418 { 419 } 420 421 ScPreviewHeaderFooterViewForwarder::~ScPreviewHeaderFooterViewForwarder() 422 { 423 } 424 425 Rectangle ScPreviewHeaderFooterViewForwarder::GetVisArea() const 426 { 427 Rectangle aVisArea; 428 if (mpViewShell) 429 { 430 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); 431 if ( mbHeader ) 432 rData.GetHeaderPosition( aVisArea ); 433 else 434 rData.GetFooterPosition( aVisArea ); 435 436 aVisArea = CorrectVisArea(aVisArea); 437 } 438 else 439 { 440 DBG_ERROR("this ViewForwarder is not valid"); 441 } 442 return aVisArea; 443 } 444 445 // ============================================================================ 446 447 class ScPreviewCellViewForwarder : public ScPreviewViewForwarder 448 { 449 ScAddress maCellPos; 450 public: 451 ScPreviewCellViewForwarder(ScPreviewShell* pViewShell, 452 ScAddress aCellPos); 453 virtual ~ScPreviewCellViewForwarder(); 454 455 virtual Rectangle GetVisArea() const; 456 }; 457 458 ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShell, 459 ScAddress aCellPos) 460 : 461 ScPreviewViewForwarder(pViewShell), 462 maCellPos(aCellPos) 463 { 464 } 465 466 ScPreviewCellViewForwarder::~ScPreviewCellViewForwarder() 467 { 468 } 469 470 Rectangle ScPreviewCellViewForwarder::GetVisArea() const 471 { 472 Rectangle aVisArea; 473 if (mpViewShell) 474 { 475 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); 476 aVisArea = rData.GetCellOutputRect(maCellPos); 477 478 aVisArea = CorrectVisArea(aVisArea); 479 } 480 else 481 { 482 DBG_ERROR("this ViewForwarder is not valid"); 483 } 484 return aVisArea; 485 } 486 487 // ============================================================================ 488 489 class ScPreviewHeaderCellViewForwarder : public ScPreviewViewForwarder 490 { 491 ScAddress maCellPos; 492 sal_Bool mbColHeader; 493 sal_Bool mbRowHeader; 494 public: 495 ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell, 496 ScAddress aCellPos, 497 sal_Bool bColHeader, sal_Bool bRowHeader); 498 virtual ~ScPreviewHeaderCellViewForwarder(); 499 500 virtual Rectangle GetVisArea() const; 501 }; 502 503 ScPreviewHeaderCellViewForwarder::ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell, 504 ScAddress aCellPos, 505 sal_Bool bColHeader, sal_Bool bRowHeader) 506 : 507 ScPreviewViewForwarder(pViewShell), 508 maCellPos(aCellPos), 509 mbColHeader(bColHeader), 510 mbRowHeader(bRowHeader) 511 { 512 } 513 514 ScPreviewHeaderCellViewForwarder::~ScPreviewHeaderCellViewForwarder() 515 { 516 } 517 518 Rectangle ScPreviewHeaderCellViewForwarder::GetVisArea() const 519 { 520 Rectangle aVisArea; 521 if (mpViewShell) 522 { 523 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); 524 aVisArea = rData.GetHeaderCellOutputRect(GetVisRect(), maCellPos, mbColHeader); 525 526 aVisArea = CorrectVisArea(aVisArea); 527 } 528 else 529 { 530 DBG_ERROR("this ViewForwarder is not valid"); 531 } 532 return aVisArea; 533 } 534 535 // ============================================================================ 536 537 class ScPreviewNoteViewForwarder : public ScPreviewViewForwarder 538 { 539 ScAddress maCellPos; 540 sal_Bool mbNoteMark; 541 public: 542 ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell, 543 ScAddress aCellPos, 544 sal_Bool bNoteMark); 545 virtual ~ScPreviewNoteViewForwarder(); 546 547 virtual Rectangle GetVisArea() const; 548 }; 549 550 ScPreviewNoteViewForwarder::ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell, 551 ScAddress aCellPos, 552 sal_Bool bNoteMark) 553 : 554 ScPreviewViewForwarder(pViewShell), 555 maCellPos(aCellPos), 556 mbNoteMark(bNoteMark) 557 { 558 } 559 560 ScPreviewNoteViewForwarder::~ScPreviewNoteViewForwarder() 561 { 562 } 563 564 Rectangle ScPreviewNoteViewForwarder::GetVisArea() const 565 { 566 Rectangle aVisArea; 567 if (mpViewShell) 568 { 569 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); 570 aVisArea = rData.GetNoteInRangeOutputRect(GetVisRect(), mbNoteMark, maCellPos); 571 572 aVisArea = CorrectVisArea(aVisArea); 573 } 574 else 575 { 576 DBG_ERROR("this ViewForwarder is not valid"); 577 } 578 return aVisArea; 579 } 580 581 // ============================================================================ 582 583 class ScEditViewForwarder : public SvxEditViewForwarder 584 { 585 EditView* mpEditView; 586 Window* mpWindow; 587 public: 588 ScEditViewForwarder(EditView* pEditView, Window* pWin); 589 virtual ~ScEditViewForwarder(); 590 591 virtual sal_Bool IsValid() const; 592 virtual Rectangle GetVisArea() const; 593 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; 594 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; 595 virtual sal_Bool GetSelection( ESelection& rSelection ) const; 596 virtual sal_Bool SetSelection( const ESelection& rSelection ); 597 virtual sal_Bool Copy(); 598 virtual sal_Bool Cut(); 599 virtual sal_Bool Paste(); 600 601 void GrabFocus(); 602 603 void SetInvalid(); 604 }; 605 606 ScEditViewForwarder::ScEditViewForwarder(EditView* pEditView, Window* pWin) 607 : mpEditView(pEditView), 608 mpWindow(pWin) 609 { 610 GrabFocus(); 611 } 612 613 ScEditViewForwarder::~ScEditViewForwarder() 614 { 615 } 616 617 sal_Bool ScEditViewForwarder::IsValid() const 618 { 619 sal_Bool bResult(sal_False); 620 if (mpWindow && mpEditView) 621 { 622 bResult = sal_True; 623 } 624 return bResult; 625 } 626 627 Rectangle ScEditViewForwarder::GetVisArea() const 628 { 629 Rectangle aVisArea; 630 if (IsValid() && mpEditView->GetEditEngine()) 631 { 632 MapMode aMapMode(mpEditView->GetEditEngine()->GetRefMapMode()); 633 634 aVisArea = mpWindow->LogicToPixel( mpEditView->GetVisArea(), aMapMode ); 635 } 636 else 637 { 638 DBG_ERROR("this EditViewForwarder is no longer valid"); 639 } 640 return aVisArea; 641 } 642 643 Point ScEditViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const 644 { 645 if (mpWindow) 646 return mpWindow->LogicToPixel( rPoint, rMapMode ); 647 else 648 { 649 DBG_ERROR("this ViewForwarder is not valid"); 650 } 651 return Point(); 652 } 653 654 Point ScEditViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const 655 { 656 if (mpWindow) 657 return mpWindow->PixelToLogic( rPoint, rMapMode ); 658 else 659 { 660 DBG_ERROR("this ViewForwarder is not valid"); 661 } 662 return Point(); 663 } 664 665 sal_Bool ScEditViewForwarder::GetSelection( ESelection& rSelection ) const 666 { 667 sal_Bool bResult(sal_False); 668 if (IsValid()) 669 { 670 rSelection = mpEditView->GetSelection(); 671 bResult = sal_True; 672 } 673 else 674 { 675 DBG_ERROR("this ViewForwarder is not valid"); 676 } 677 return bResult; 678 } 679 680 sal_Bool ScEditViewForwarder::SetSelection( const ESelection& rSelection ) 681 { 682 sal_Bool bResult(sal_False); 683 if (IsValid()) 684 { 685 mpEditView->SetSelection(rSelection); 686 bResult = sal_True; 687 } 688 else 689 { 690 DBG_ERROR("this ViewForwarder is not valid"); 691 } 692 return bResult; 693 } 694 695 sal_Bool ScEditViewForwarder::Copy() 696 { 697 sal_Bool bResult(sal_False); 698 if (IsValid()) 699 { 700 mpEditView->Copy(); 701 bResult = sal_True; 702 } 703 else 704 { 705 DBG_ERROR("this ViewForwarder is not valid"); 706 } 707 return bResult; 708 } 709 710 sal_Bool ScEditViewForwarder::Cut() 711 { 712 sal_Bool bResult(sal_False); 713 if (IsValid()) 714 { 715 mpEditView->Cut(); 716 bResult = sal_True; 717 } 718 else 719 { 720 DBG_ERROR("this ViewForwarder is not valid"); 721 } 722 return bResult; 723 } 724 725 sal_Bool ScEditViewForwarder::Paste() 726 { 727 sal_Bool bResult(sal_False); 728 if (IsValid()) 729 { 730 mpEditView->Paste(); 731 bResult = sal_True; 732 } 733 else 734 { 735 DBG_ERROR("this ViewForwarder is not valid"); 736 } 737 return bResult; 738 } 739 740 void ScEditViewForwarder::GrabFocus() 741 { 742 } 743 744 void ScEditViewForwarder::SetInvalid() 745 { 746 mpWindow = NULL; 747 mpEditView = NULL; 748 } 749 750 // ============================================================================ 751 752 // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object 753 754 ScAccessibleCellTextData::ScAccessibleCellTextData(ScTabViewShell* pViewShell, 755 const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell) 756 : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP), 757 mpViewForwarder(NULL), 758 mpEditViewForwarder(NULL), 759 mpViewShell(pViewShell), 760 meSplitPos(eSplitPos), 761 mbViewEditEngine(sal_False), 762 mpAccessibleCell( pAccCell ) 763 { 764 } 765 766 ScAccessibleCellTextData::~ScAccessibleCellTextData() 767 { 768 if (pEditEngine) 769 pEditEngine->SetNotifyHdl(Link()); 770 if (mpViewForwarder) 771 delete mpViewForwarder; 772 if (mpEditViewForwarder) 773 delete mpEditViewForwarder; 774 } 775 776 void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 777 { 778 if ( rHint.ISA( SfxSimpleHint ) ) 779 { 780 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 781 if ( nId == SFX_HINT_DYING ) 782 { 783 mpViewShell = NULL; // invalid now 784 if (mpViewForwarder) 785 mpViewForwarder->SetInvalid(); 786 if (mpEditViewForwarder) 787 mpEditViewForwarder->SetInvalid(); 788 } 789 } 790 ScAccessibleCellBaseTextData::Notify(rBC, rHint); 791 } 792 793 ScAccessibleTextData* ScAccessibleCellTextData::Clone() const 794 { 795 return new ScAccessibleCellTextData( mpViewShell, aCellPos, meSplitPos, mpAccessibleCell ); 796 } 797 798 void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, String& rText) 799 { 800 // #104893#; don't use the input string 801 // ScCellTextData::GetCellText(rCellPos, rText); 802 ScDocument* pDoc = pDocShell->GetDocument(); 803 if (pDoc) 804 { 805 // #104893#; use the displayed string 806 pDoc->GetString(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText); 807 if (mpViewShell) 808 { 809 const ScViewOptions& aOptions = mpViewShell->GetViewData()->GetOptions(); 810 CellType aCellType; 811 pDoc->GetCellType(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), aCellType); 812 if (aCellType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS )) 813 { 814 pDoc->GetFormula( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText); 815 } 816 else if (!aOptions.GetOption( VOPT_NULLVALS )) 817 { 818 if ((aCellType == CELLTYPE_VALUE || aCellType == CELLTYPE_FORMULA) && pDoc->GetValue(rCellPos) == 0.0) 819 rText.Erase(); 820 } 821 } 822 } 823 } 824 825 SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() 826 { 827 /* sal_Bool bHasForwarder(sal_False); 828 if (mpViewShell && mpViewShell->GetViewData() && 829 (mpViewShell->GetViewData()->GetCurPos() == aCellPos) && 830 (mpViewShell->GetViewData()->HasEditView(meSplitPos)) && 831 (mpViewShell->GetViewData()->GetEditViewCol() == aCellPos.Col()) && 832 (mpViewShell->GetViewData()->GetEditViewRow() == aCellPos.Row())) 833 { 834 if (!mbViewEditEngine) 835 { 836 if (pForwarder) 837 DELETEZ( pForwarder ); 838 if (pEditEngine) 839 DELETEZ( pEditEngine ); 840 841 SCCOL nCol; 842 SCROW nRow; 843 EditView* pEditView; 844 mpViewShell->GetViewData()->GetEditView( meSplitPos, pEditView, nCol, nRow ); 845 if (pEditView) 846 { 847 pEditEngine = (ScFieldEditEngine*)pEditView->GetEditEngine(); 848 pForwarder = new SvxEditEngineForwarder(*pEditEngine); 849 bHasForwarder = sal_True; 850 } 851 } 852 else 853 bHasForwarder = sal_True; 854 } 855 else if (mbViewEditEngine) 856 { 857 // remove Forwarder created with EditEngine from EditView 858 if (pForwarder) 859 DELETEZ( pForwarder ); 860 pEditEngine->SetNotifyHdl(Link()); 861 // don't delete, because it is the EditEngine of the EditView 862 pEditEngine = NULL; 863 mbViewEditEngine = sal_False; 864 } 865 866 if (!bHasForwarder)*/ 867 ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine 868 869 ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL ); 870 if ( pDoc && pEditEngine && mpViewShell ) 871 { 872 long nSizeX, nSizeY; 873 mpViewShell->GetViewData()->GetMergeSizePixel( 874 aCellPos.Col(), aCellPos.Row(), nSizeX, nSizeY); 875 876 Size aSize(nSizeX, nSizeY); 877 878 // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 879 long nIndent = 0; 880 const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >( 881 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) ); 882 SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD ); 883 if ( eHorJust == SVX_HOR_JUSTIFY_LEFT ) 884 { 885 const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >( 886 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) ); 887 if ( pIndentItem ) 888 { 889 nIndent = static_cast< long >( pIndentItem->GetValue() ); 890 } 891 } 892 893 const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >( 894 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) ); 895 ScViewData* pViewData = mpViewShell->GetViewData(); 896 double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 ); 897 double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 ); 898 long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 ); 899 long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 ); 900 long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 ); 901 long nBottomM = ( pMarginItem ? static_cast< long >( pMarginItem->GetBottomMargin() * nPPTY ) : 0 ); 902 long nWidth = aSize.getWidth() - nLeftM - nRightM; 903 aSize.setWidth( nWidth ); 904 aSize.setHeight( aSize.getHeight() - nTopM - nBottomM ); 905 906 Window* pWin = mpViewShell->GetWindowByPos( meSplitPos ); 907 if ( pWin ) 908 { 909 aSize = pWin->PixelToLogic( aSize, pEditEngine->GetRefMapMode() ); 910 } 911 912 /* #i19430# Gnopernicus reads text partly if it sticks out of the cell 913 boundaries. This leads to wrong results in cases where the cell text 914 is rotated, because rotation is not taken into account when calcu- 915 lating the visible part of the text. In these cases we will expand 916 the cell size passed as paper size to the edit engine. The function 917 accessibility::AccessibleStaticTextBase::GetParagraphBoundingBox() 918 (see svx/source/accessibility/AccessibleStaticTextBase.cxx) will 919 return the size of the complete text then, which is used to expand 920 the cell bounding box in ScAccessibleCell::GetBoundingBox() 921 (see sc/source/ui/Accessibility/AccessibleCell.cxx). */ 922 const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >( 923 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) ); 924 if( pItem && (pItem->GetValue() != 0) ) 925 { 926 pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) ); 927 long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() ); 928 aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) ); 929 } 930 else 931 { 932 // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 933 const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >( 934 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) ); 935 bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() ); 936 if ( !bLineBreak ) 937 { 938 long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() ); 939 aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) ); 940 } 941 } 942 943 pEditEngine->SetPaperSize( aSize ); 944 945 // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 946 if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) 947 { 948 pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); 949 } 950 951 Size aTextSize; 952 if ( pWin ) 953 { 954 aTextSize = pWin->LogicToPixel( Size( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() ), pEditEngine->GetRefMapMode() ); 955 } 956 long nTextWidth = aTextSize.Width(); 957 long nTextHeight = aTextSize.Height(); 958 959 long nOffsetX = nLeftM; 960 long nDiffX = nTextWidth - nWidth; 961 if ( nDiffX > 0 ) 962 { 963 switch ( eHorJust ) 964 { 965 case SVX_HOR_JUSTIFY_RIGHT: 966 { 967 nOffsetX -= nDiffX; 968 } 969 break; 970 case SVX_HOR_JUSTIFY_CENTER: 971 { 972 nOffsetX -= nDiffX / 2; 973 } 974 break; 975 default: 976 { 977 } 978 break; 979 } 980 } 981 982 long nOffsetY = 0; 983 const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >( 984 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) ); 985 SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD ); 986 switch ( eVerJust ) 987 { 988 case SVX_VER_JUSTIFY_STANDARD: 989 case SVX_VER_JUSTIFY_BOTTOM: 990 { 991 nOffsetY = nSizeY - nBottomM - nTextHeight; 992 } 993 break; 994 case SVX_VER_JUSTIFY_CENTER: 995 { 996 nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM; 997 } 998 break; 999 default: 1000 { 1001 nOffsetY = nTopM; 1002 } 1003 break; 1004 } 1005 1006 if ( mpAccessibleCell ) 1007 { 1008 mpAccessibleCell->SetOffset( Point( nOffsetX, nOffsetY ) ); 1009 } 1010 1011 pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) ); 1012 } 1013 1014 return pForwarder; 1015 } 1016 1017 SvxViewForwarder* ScAccessibleCellTextData::GetViewForwarder() 1018 { 1019 if (!mpViewForwarder) 1020 mpViewForwarder = new ScViewForwarder(mpViewShell, meSplitPos, aCellPos); 1021 return mpViewForwarder; 1022 } 1023 1024 SvxEditViewForwarder* ScAccessibleCellTextData::GetEditViewForwarder( sal_Bool /* bCreate */ ) 1025 { 1026 //#102219#; there should no EditViewForwarder be, because the cell is now readonly in this interface 1027 /* if (!mpEditViewForwarder) 1028 { 1029 SCCOL nCol; 1030 SCROW nRow; 1031 EditView* pEditView; 1032 mpViewShell->GetViewData()->GetEditView( meSplitPos, pEditView, nCol, nRow ); 1033 1034 mpEditViewForwarder = new ScEditViewForwarder(pEditView, mpViewShell->GetWindowByPos(meSplitPos)); 1035 } 1036 else if (bCreate) 1037 mpEditViewForwarder->GrabFocus(); 1038 return mpEditViewForwarder;*/ 1039 return NULL; 1040 } 1041 1042 IMPL_LINK(ScAccessibleCellTextData, NotifyHdl, EENotify*, aNotify) 1043 { 1044 if( aNotify ) 1045 { 1046 ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify ); 1047 1048 if( aHint.get() ) 1049 GetBroadcaster().Broadcast( *aHint.get() ); 1050 } 1051 1052 return 0; 1053 } 1054 1055 ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell) 1056 { 1057 ScDocShell* pDocSh = NULL; 1058 if (pViewShell) 1059 pDocSh = pViewShell->GetViewData()->GetDocShell(); 1060 return pDocSh; 1061 } 1062 1063 1064 // ============================================================================ 1065 1066 ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin) 1067 : 1068 mpViewForwarder(NULL), 1069 mpEditViewForwarder(NULL), 1070 mpEditView(pEditView), 1071 mpEditEngine(pEditView ? pEditView->GetEditEngine() : 0), 1072 mpForwarder(NULL), 1073 mpWindow(pWin) 1074 { 1075 if (mpEditEngine) 1076 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) ); 1077 } 1078 1079 ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData() 1080 { 1081 if (mpEditEngine) 1082 mpEditEngine->SetNotifyHdl(Link()); 1083 if (mpViewForwarder) 1084 delete mpViewForwarder; 1085 if (mpEditViewForwarder) 1086 delete mpEditViewForwarder; 1087 if (mpForwarder) 1088 delete mpForwarder; 1089 } 1090 1091 void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 1092 { 1093 if ( rHint.ISA( SfxSimpleHint ) ) 1094 { 1095 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1096 if ( nId == SFX_HINT_DYING ) 1097 { 1098 mpWindow = NULL; 1099 mpEditView = NULL; 1100 mpEditEngine = NULL; 1101 DELETEZ(mpForwarder); 1102 if (mpViewForwarder) 1103 mpViewForwarder->SetInvalid(); 1104 if (mpEditViewForwarder) 1105 mpEditViewForwarder->SetInvalid(); 1106 } 1107 } 1108 ScAccessibleTextData::Notify(rBC, rHint); 1109 } 1110 1111 ScAccessibleTextData* ScAccessibleEditObjectTextData::Clone() const 1112 { 1113 return new ScAccessibleEditObjectTextData(mpEditView, mpWindow); 1114 } 1115 1116 SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder() 1117 { 1118 if ((!mpForwarder && mpEditView) || (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet())) 1119 { 1120 if (!mpEditEngine) 1121 mpEditEngine = mpEditView->GetEditEngine(); 1122 if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()) 1123 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) ); 1124 if(!mpForwarder) 1125 mpForwarder = new SvxEditEngineForwarder(*mpEditEngine); 1126 } 1127 return mpForwarder; 1128 } 1129 1130 SvxViewForwarder* ScAccessibleEditObjectTextData::GetViewForwarder() 1131 { 1132 if (!mpViewForwarder) 1133 { 1134 // --> OD 2005-12-21 #i49561# 1135 mpViewForwarder = new ScEditObjectViewForwarder( mpWindow, mpEditView ); 1136 // <-- 1137 } 1138 return mpViewForwarder; 1139 } 1140 1141 SvxEditViewForwarder* ScAccessibleEditObjectTextData::GetEditViewForwarder( sal_Bool bCreate ) 1142 { 1143 if (!mpEditViewForwarder && mpEditView) 1144 mpEditViewForwarder = new ScEditViewForwarder(mpEditView, mpWindow); 1145 if (bCreate) 1146 { 1147 if (!mpEditView && mpEditViewForwarder) 1148 { 1149 DELETEZ(mpEditViewForwarder); 1150 } 1151 else if (mpEditViewForwarder) 1152 mpEditViewForwarder->GrabFocus(); 1153 } 1154 return mpEditViewForwarder; 1155 } 1156 1157 IMPL_LINK(ScAccessibleEditObjectTextData, NotifyHdl, EENotify*, aNotify) 1158 { 1159 if( aNotify ) 1160 { 1161 ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify ); 1162 1163 if( aHint.get() ) 1164 GetBroadcaster().Broadcast( *aHint.get() ); 1165 } 1166 1167 return 0; 1168 } 1169 1170 1171 // ============================================================================ 1172 1173 ScAccessibleEditLineTextData::ScAccessibleEditLineTextData(EditView* pEditView, Window* pWin) 1174 : 1175 ScAccessibleEditObjectTextData(pEditView, pWin), 1176 mbEditEngineCreated(sal_False) 1177 { 1178 ScTextWnd* pTxtWnd = (ScTextWnd*)pWin; 1179 1180 if (pTxtWnd) 1181 pTxtWnd->InsertAccessibleTextData( *this ); 1182 } 1183 1184 ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData() 1185 { 1186 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1187 1188 if (pTxtWnd) 1189 pTxtWnd->RemoveAccessibleTextData( *this ); 1190 1191 if (mbEditEngineCreated && mpEditEngine) 1192 { 1193 delete mpEditEngine; 1194 mpEditEngine = NULL; // #103346# don't access in ScAccessibleEditObjectTextData dtor! 1195 } 1196 else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine()) 1197 { 1198 // #103346# the NotifyHdl also has to be removed from the ScTextWnd's EditEngine 1199 // (it's set in ScAccessibleEditLineTextData::GetTextForwarder, and mpEditEngine 1200 // is reset there) 1201 pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link()); 1202 } 1203 } 1204 1205 void ScAccessibleEditLineTextData::Dispose() 1206 { 1207 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1208 1209 if (pTxtWnd) 1210 pTxtWnd->RemoveAccessibleTextData( *this ); 1211 1212 ResetEditMode(); 1213 mpWindow = NULL; 1214 } 1215 1216 ScAccessibleTextData* ScAccessibleEditLineTextData::Clone() const 1217 { 1218 return new ScAccessibleEditLineTextData(mpEditView, mpWindow); 1219 } 1220 1221 SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder() 1222 { 1223 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1224 1225 if (pTxtWnd) 1226 { 1227 mpEditView = pTxtWnd->GetEditView(); 1228 if (mpEditView) 1229 { 1230 if (mbEditEngineCreated && mpEditEngine) 1231 ResetEditMode(); 1232 mbEditEngineCreated = sal_False; 1233 1234 mpEditView = pTxtWnd->GetEditView(); 1235 ScAccessibleEditObjectTextData::GetTextForwarder(); // fill the mpForwarder 1236 mpEditEngine = NULL; 1237 } 1238 else 1239 { 1240 if (mpEditEngine && !mbEditEngineCreated) 1241 ResetEditMode(); 1242 if (!mpEditEngine) 1243 { 1244 SfxItemPool* pEnginePool = EditEngine::CreatePool(); 1245 pEnginePool->FreezeIdRanges(); 1246 mpEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); 1247 mbEditEngineCreated = sal_True; 1248 // currently, GetPortions doesn't work if UpdateMode is sal_False, 1249 // this will be fixed (in EditEngine) by src600 1250 // pEditEngine->SetUpdateMode( sal_False ); 1251 mpEditEngine->EnableUndo( sal_False ); 1252 mpEditEngine->SetRefMapMode( MAP_100TH_MM ); 1253 mpForwarder = new SvxEditEngineForwarder(*mpEditEngine); 1254 1255 mpEditEngine->SetText(pTxtWnd->GetTextString()); 1256 1257 Size aSize(pTxtWnd->GetSizePixel()); 1258 1259 aSize = pTxtWnd->PixelToLogic(aSize, mpEditEngine->GetRefMapMode()); 1260 1261 mpEditEngine->SetPaperSize(aSize); 1262 1263 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) ); 1264 } 1265 } 1266 } 1267 return mpForwarder; 1268 } 1269 1270 SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( sal_Bool bCreate ) 1271 { 1272 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1273 1274 if (pTxtWnd) 1275 { 1276 mpEditView = pTxtWnd->GetEditView(); 1277 if (!mpEditView && bCreate) 1278 { 1279 if ( !pTxtWnd->IsInputActive() ) 1280 { 1281 pTxtWnd->StartEditEngine(); 1282 pTxtWnd->GrabFocus(); 1283 // pTxtWnd->SetTextString( rText ); 1284 // pTxtWnd->GetEditView()->SetSelection( rSel ); 1285 1286 mpEditView = pTxtWnd->GetEditView(); 1287 } 1288 } 1289 } 1290 1291 return ScAccessibleEditObjectTextData::GetEditViewForwarder(bCreate); 1292 } 1293 1294 void ScAccessibleEditLineTextData::ResetEditMode() 1295 { 1296 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1297 1298 if (mbEditEngineCreated && mpEditEngine) 1299 delete mpEditEngine; 1300 else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine()) 1301 pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link()); 1302 mpEditEngine = NULL; 1303 1304 DELETEZ(mpForwarder); 1305 DELETEZ(mpEditViewForwarder); 1306 DELETEZ(mpViewForwarder); 1307 mbEditEngineCreated = sal_False; 1308 } 1309 1310 void ScAccessibleEditLineTextData::TextChanged() 1311 { 1312 if (mbEditEngineCreated && mpEditEngine) 1313 { 1314 ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; 1315 1316 if (pTxtWnd) 1317 mpEditEngine->SetText(pTxtWnd->GetTextString()); 1318 } 1319 } 1320 1321 void ScAccessibleEditLineTextData::StartEdit() 1322 { 1323 ResetEditMode(); 1324 mpEditView = NULL; 1325 1326 // send HINT_BEGEDIT 1327 SdrHint aHint(HINT_BEGEDIT); 1328 GetBroadcaster().Broadcast( aHint ); 1329 } 1330 1331 void ScAccessibleEditLineTextData::EndEdit() 1332 { 1333 // send HINT_ENDEDIT 1334 SdrHint aHint(HINT_ENDEDIT); 1335 GetBroadcaster().Broadcast( aHint ); 1336 1337 ResetEditMode(); 1338 mpEditView = NULL; 1339 } 1340 1341 1342 // ============================================================================ 1343 1344 // ScAccessiblePreviewCellTextData: shared data between sub objects of a accessible cell text object 1345 1346 ScAccessiblePreviewCellTextData::ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell, 1347 const ScAddress& rP) 1348 : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP), 1349 mpViewForwarder(NULL), 1350 mpViewShell(pViewShell) 1351 { 1352 } 1353 1354 ScAccessiblePreviewCellTextData::~ScAccessiblePreviewCellTextData() 1355 { 1356 if (pEditEngine) 1357 pEditEngine->SetNotifyHdl(Link()); 1358 if (mpViewForwarder) 1359 delete mpViewForwarder; 1360 } 1361 1362 void ScAccessiblePreviewCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 1363 { 1364 if ( rHint.ISA( SfxSimpleHint ) ) 1365 { 1366 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1367 if ( nId == SFX_HINT_DYING ) 1368 { 1369 mpViewShell = NULL; // invalid now 1370 if (mpViewForwarder) 1371 mpViewForwarder->SetInvalid(); 1372 } 1373 } 1374 ScAccessibleCellBaseTextData::Notify(rBC, rHint); 1375 } 1376 1377 ScAccessibleTextData* ScAccessiblePreviewCellTextData::Clone() const 1378 { 1379 return new ScAccessiblePreviewCellTextData(mpViewShell, aCellPos); 1380 } 1381 1382 SvxTextForwarder* ScAccessiblePreviewCellTextData::GetTextForwarder() 1383 { 1384 sal_Bool bEditEngineBefore(pEditEngine != NULL); 1385 1386 ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine 1387 1388 if (!bEditEngineBefore && pEditEngine) 1389 { 1390 Size aSize(mpViewShell->GetLocationData().GetCellOutputRect(aCellPos).GetSize()); 1391 Window* pWin = mpViewShell->GetWindow(); 1392 if (pWin) 1393 aSize = pWin->PixelToLogic(aSize, pEditEngine->GetRefMapMode()); 1394 pEditEngine->SetPaperSize(aSize); 1395 } 1396 1397 if (pEditEngine) 1398 pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) ); 1399 1400 return pForwarder; 1401 } 1402 1403 SvxViewForwarder* ScAccessiblePreviewCellTextData::GetViewForwarder() 1404 { 1405 if (!mpViewForwarder) 1406 mpViewForwarder = new ScPreviewCellViewForwarder(mpViewShell, aCellPos); 1407 return mpViewForwarder; 1408 } 1409 1410 //UNUSED2008-05 IMPL_LINK(ScAccessiblePreviewCellTextData, NotifyHdl, EENotify*, aNotify) 1411 //UNUSED2008-05 { 1412 //UNUSED2008-05 if( aNotify ) 1413 //UNUSED2008-05 { 1414 //UNUSED2008-05 ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify); 1415 //UNUSED2008-05 1416 //UNUSED2008-05 if( aHint.get() ) 1417 //UNUSED2008-05 GetBroadcaster().Broadcast( *aHint.get() ); 1418 //UNUSED2008-05 } 1419 //UNUSED2008-05 1420 //UNUSED2008-05 return 0; 1421 //UNUSED2008-05 } 1422 1423 ScDocShell* ScAccessiblePreviewCellTextData::GetDocShell(ScPreviewShell* pViewShell) 1424 { 1425 ScDocShell* pDocSh = NULL; 1426 if (pViewShell && pViewShell->GetDocument()) 1427 pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell(); 1428 return pDocSh; 1429 } 1430 1431 1432 // ============================================================================ 1433 1434 // ScAccessiblePreviewHeaderCellTextData: shared data between sub objects of a accessible cell text object 1435 1436 ScAccessiblePreviewHeaderCellTextData::ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell, 1437 const String& rText, const ScAddress& rP, sal_Bool bColHeader, sal_Bool bRowHeader) 1438 : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP), 1439 mpViewForwarder(NULL), 1440 mpViewShell(pViewShell), 1441 maText(rText), 1442 mbColHeader(bColHeader), 1443 mbRowHeader(bRowHeader) 1444 { 1445 } 1446 1447 ScAccessiblePreviewHeaderCellTextData::~ScAccessiblePreviewHeaderCellTextData() 1448 { 1449 if (pEditEngine) 1450 pEditEngine->SetNotifyHdl(Link()); 1451 if (mpViewForwarder) 1452 delete mpViewForwarder; 1453 } 1454 1455 void ScAccessiblePreviewHeaderCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 1456 { 1457 if ( rHint.ISA( SfxSimpleHint ) ) 1458 { 1459 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1460 if ( nId == SFX_HINT_DYING ) 1461 { 1462 mpViewShell = NULL; // invalid now 1463 if (mpViewForwarder) 1464 mpViewForwarder->SetInvalid(); 1465 } 1466 } 1467 ScAccessibleCellBaseTextData::Notify(rBC, rHint); 1468 } 1469 1470 ScAccessibleTextData* ScAccessiblePreviewHeaderCellTextData::Clone() const 1471 { 1472 return new ScAccessiblePreviewHeaderCellTextData(mpViewShell, maText, aCellPos, mbColHeader, mbRowHeader); 1473 } 1474 1475 SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder() 1476 { 1477 if (!pEditEngine) 1478 { 1479 if ( pDocShell ) 1480 { 1481 ScDocument* pDoc = pDocShell->GetDocument(); 1482 pEditEngine = pDoc->CreateFieldEditEngine(); 1483 } 1484 else 1485 { 1486 SfxItemPool* pEnginePool = EditEngine::CreatePool(); 1487 pEnginePool->FreezeIdRanges(); 1488 pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); 1489 } 1490 // currently, GetPortions doesn't work if UpdateMode is sal_False, 1491 // this will be fixed (in EditEngine) by src600 1492 // pEditEngine->SetUpdateMode( sal_False ); 1493 pEditEngine->EnableUndo( sal_False ); 1494 if (pDocShell) 1495 pEditEngine->SetRefDevice(pDocShell->GetRefDevice()); 1496 else 1497 pEditEngine->SetRefMapMode( MAP_100TH_MM ); 1498 pForwarder = new SvxEditEngineForwarder(*pEditEngine); 1499 } 1500 1501 if (bDataValid) 1502 return pForwarder; 1503 1504 if (maText.Len() && pEditEngine) 1505 { 1506 1507 if ( mpViewShell ) 1508 { 1509 Size aOutputSize; 1510 Window* pWindow = mpViewShell->GetWindow(); 1511 if ( pWindow ) 1512 aOutputSize = pWindow->GetOutputSizePixel(); 1513 Point aPoint; 1514 Rectangle aVisRect( aPoint, aOutputSize ); 1515 Size aSize(mpViewShell->GetLocationData().GetHeaderCellOutputRect(aVisRect, aCellPos, mbColHeader).GetSize()); 1516 if (pWindow) 1517 aSize = pWindow->PixelToLogic(aSize, pEditEngine->GetRefMapMode()); 1518 pEditEngine->SetPaperSize(aSize); 1519 } 1520 pEditEngine->SetText( maText ); 1521 } 1522 1523 bDataValid = sal_True; 1524 1525 if (pEditEngine) 1526 pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) ); 1527 1528 return pForwarder; 1529 } 1530 1531 SvxViewForwarder* ScAccessiblePreviewHeaderCellTextData::GetViewForwarder() 1532 { 1533 if (!mpViewForwarder) 1534 mpViewForwarder = new ScPreviewHeaderCellViewForwarder(mpViewShell, aCellPos, mbColHeader, mbRowHeader); 1535 return mpViewForwarder; 1536 } 1537 1538 //UNUSED2008-05 IMPL_LINK(ScAccessiblePreviewHeaderCellTextData, NotifyHdl, EENotify*, aNotify) 1539 //UNUSED2008-05 { 1540 //UNUSED2008-05 if( aNotify ) 1541 //UNUSED2008-05 { 1542 //UNUSED2008-05 ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify); 1543 //UNUSED2008-05 1544 //UNUSED2008-05 if( aHint.get() ) 1545 //UNUSED2008-05 GetBroadcaster().Broadcast( *aHint.get() ); 1546 //UNUSED2008-05 } 1547 //UNUSED2008-05 1548 //UNUSED2008-05 return 0; 1549 //UNUSED2008-05 } 1550 1551 ScDocShell* ScAccessiblePreviewHeaderCellTextData::GetDocShell(ScPreviewShell* pViewShell) 1552 { 1553 ScDocShell* pDocSh = NULL; 1554 if (pViewShell && pViewShell->GetDocument()) 1555 pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell(); 1556 return pDocSh; 1557 } 1558 1559 1560 // ============================================================================ 1561 1562 ScAccessibleHeaderTextData::ScAccessibleHeaderTextData(ScPreviewShell* pViewShell, 1563 const EditTextObject* pEditObj, sal_Bool bHeader, SvxAdjust eAdjust) 1564 : 1565 mpViewForwarder(NULL), 1566 mpViewShell(pViewShell), 1567 mpEditEngine(NULL), 1568 mpForwarder(NULL), 1569 mpDocSh(NULL), 1570 mpEditObj(pEditObj), 1571 mbHeader(bHeader), 1572 mbDataValid(sal_False), 1573 meAdjust(eAdjust) 1574 { 1575 if (pViewShell && pViewShell->GetDocument()) 1576 mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell(); 1577 if (mpDocSh) 1578 mpDocSh->GetDocument()->AddUnoObject(*this); 1579 } 1580 1581 ScAccessibleHeaderTextData::~ScAccessibleHeaderTextData() 1582 { 1583 ScUnoGuard aGuard; // needed for EditEngine dtor 1584 1585 if (mpDocSh) 1586 mpDocSh->GetDocument()->RemoveUnoObject(*this); 1587 if (mpEditEngine) 1588 mpEditEngine->SetNotifyHdl(Link()); 1589 delete mpEditEngine; 1590 delete mpForwarder; 1591 } 1592 1593 ScAccessibleTextData* ScAccessibleHeaderTextData::Clone() const 1594 { 1595 return new ScAccessibleHeaderTextData(mpViewShell, mpEditObj, mbHeader, meAdjust); 1596 } 1597 1598 void ScAccessibleHeaderTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) 1599 { 1600 if ( rHint.ISA( SfxSimpleHint ) ) 1601 { 1602 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1603 if ( nId == SFX_HINT_DYING ) 1604 { 1605 mpViewShell = NULL;// invalid now 1606 mpDocSh = NULL; 1607 if (mpViewForwarder) 1608 mpViewForwarder->SetInvalid(); 1609 } 1610 } 1611 } 1612 1613 SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() 1614 { 1615 if (!mpEditEngine) 1616 { 1617 SfxItemPool* pEnginePool = EditEngine::CreatePool(); 1618 pEnginePool->FreezeIdRanges(); 1619 ScHeaderEditEngine* pHdrEngine = new ScHeaderEditEngine( pEnginePool, sal_True ); 1620 1621 pHdrEngine->EnableUndo( sal_False ); 1622 pHdrEngine->SetRefMapMode( MAP_TWIP ); 1623 1624 // default font must be set, independently of document 1625 // -> use global pool from module 1626 1627 SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); 1628 const ScPatternAttr& rPattern = (const ScPatternAttr&)SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN); 1629 rPattern.FillEditItemSet( &aDefaults ); 1630 // FillEditItemSet adjusts font height to 1/100th mm, 1631 // but for header/footer twips is needed, as in the PatternAttr: 1632 aDefaults.Put( rPattern.GetItem(ATTR_FONT_HEIGHT), EE_CHAR_FONTHEIGHT ); 1633 aDefaults.Put( rPattern.GetItem(ATTR_CJK_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CJK ); 1634 aDefaults.Put( rPattern.GetItem(ATTR_CTL_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CTL ); 1635 aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) ); 1636 pHdrEngine->SetDefaults( aDefaults ); 1637 1638 ScHeaderFieldData aData; 1639 if (mpViewShell) 1640 mpViewShell->FillFieldData(aData); 1641 else 1642 ScHeaderFooterTextObj::FillDummyFieldData( aData ); 1643 pHdrEngine->SetData( aData ); 1644 1645 mpEditEngine = pHdrEngine; 1646 mpForwarder = new SvxEditEngineForwarder(*mpEditEngine); 1647 } 1648 1649 if (mbDataValid) 1650 return mpForwarder; 1651 1652 if ( mpViewShell ) 1653 { 1654 Rectangle aVisRect; 1655 mpViewShell->GetLocationData().GetHeaderPosition(aVisRect); 1656 Size aSize(aVisRect.GetSize()); 1657 Window* pWin = mpViewShell->GetWindow(); 1658 if (pWin) 1659 aSize = pWin->PixelToLogic(aSize, mpEditEngine->GetRefMapMode()); 1660 mpEditEngine->SetPaperSize(aSize); 1661 } 1662 if (mpEditObj) 1663 mpEditEngine->SetText(*mpEditObj); 1664 1665 mbDataValid = sal_True; 1666 return mpForwarder; 1667 } 1668 1669 SvxViewForwarder* ScAccessibleHeaderTextData::GetViewForwarder() 1670 { 1671 if (!mpViewForwarder) 1672 mpViewForwarder = new ScPreviewHeaderFooterViewForwarder(mpViewShell, mbHeader); 1673 return mpViewForwarder; 1674 } 1675 1676 1677 // ============================================================================ 1678 1679 ScAccessibleNoteTextData::ScAccessibleNoteTextData(ScPreviewShell* pViewShell, 1680 const String& sText, const ScAddress& aCellPos, sal_Bool bMarkNote) 1681 : 1682 mpViewForwarder(NULL), 1683 mpViewShell(pViewShell), 1684 mpEditEngine(NULL), 1685 mpForwarder(NULL), 1686 mpDocSh(NULL), 1687 msText(sText), 1688 maCellPos(aCellPos), 1689 mbMarkNote(bMarkNote), 1690 mbDataValid(sal_False) 1691 { 1692 if (pViewShell && pViewShell->GetDocument()) 1693 mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell(); 1694 if (mpDocSh) 1695 mpDocSh->GetDocument()->AddUnoObject(*this); 1696 } 1697 1698 ScAccessibleNoteTextData::~ScAccessibleNoteTextData() 1699 { 1700 ScUnoGuard aGuard; // needed for EditEngine dtor 1701 1702 if (mpDocSh) 1703 mpDocSh->GetDocument()->RemoveUnoObject(*this); 1704 if (mpEditEngine) 1705 mpEditEngine->SetNotifyHdl(Link()); 1706 delete mpEditEngine; 1707 delete mpForwarder; 1708 } 1709 1710 ScAccessibleTextData* ScAccessibleNoteTextData::Clone() const 1711 { 1712 return new ScAccessibleNoteTextData(mpViewShell, msText, maCellPos, mbMarkNote); 1713 } 1714 1715 void ScAccessibleNoteTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) 1716 { 1717 if ( rHint.ISA( SfxSimpleHint ) ) 1718 { 1719 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1720 if ( nId == SFX_HINT_DYING ) 1721 { 1722 mpViewShell = NULL;// invalid now 1723 mpDocSh = NULL; 1724 if (mpViewForwarder) 1725 mpViewForwarder->SetInvalid(); 1726 } 1727 } 1728 } 1729 1730 SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder() 1731 { 1732 if (!mpEditEngine) 1733 { 1734 if ( mpDocSh ) 1735 { 1736 ScDocument* pDoc = mpDocSh->GetDocument(); 1737 mpEditEngine = pDoc->CreateFieldEditEngine(); 1738 } 1739 else 1740 { 1741 SfxItemPool* pEnginePool = EditEngine::CreatePool(); 1742 pEnginePool->FreezeIdRanges(); 1743 mpEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); 1744 } 1745 // currently, GetPortions doesn't work if UpdateMode is sal_False, 1746 // this will be fixed (in EditEngine) by src600 1747 // pEditEngine->SetUpdateMode( sal_False ); 1748 mpEditEngine->EnableUndo( sal_False ); 1749 if (mpDocSh) 1750 mpEditEngine->SetRefDevice(mpDocSh->GetRefDevice()); 1751 else 1752 mpEditEngine->SetRefMapMode( MAP_100TH_MM ); 1753 mpForwarder = new SvxEditEngineForwarder(*mpEditEngine); 1754 } 1755 1756 if (mbDataValid) 1757 return mpForwarder; 1758 1759 if (msText.Len() && mpEditEngine) 1760 { 1761 1762 if ( mpViewShell ) 1763 { 1764 Size aOutputSize; 1765 Window* pWindow = mpViewShell->GetWindow(); 1766 if ( pWindow ) 1767 aOutputSize = pWindow->GetOutputSizePixel(); 1768 Point aPoint; 1769 Rectangle aVisRect( aPoint, aOutputSize ); 1770 Size aSize(mpViewShell->GetLocationData().GetNoteInRangeOutputRect(aVisRect, mbMarkNote, maCellPos).GetSize()); 1771 if (pWindow) 1772 aSize = pWindow->PixelToLogic(aSize, mpEditEngine->GetRefMapMode()); 1773 mpEditEngine->SetPaperSize(aSize); 1774 } 1775 mpEditEngine->SetText( msText ); 1776 } 1777 1778 mbDataValid = sal_True; 1779 1780 if (mpEditEngine) 1781 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) ); 1782 1783 return mpForwarder; 1784 } 1785 1786 SvxViewForwarder* ScAccessibleNoteTextData::GetViewForwarder() 1787 { 1788 if (!mpViewForwarder) 1789 mpViewForwarder = new ScPreviewNoteViewForwarder(mpViewShell, maCellPos, mbMarkNote); 1790 return mpViewForwarder; 1791 } 1792 1793 1794 // CSV import ================================================================= 1795 1796 class ScCsvViewForwarder : public SvxViewForwarder 1797 { 1798 Rectangle maBoundBox; 1799 Window* mpWindow; 1800 1801 public: 1802 explicit ScCsvViewForwarder( Window* pWindow, const Rectangle& rBoundBox ); 1803 1804 virtual sal_Bool IsValid() const; 1805 virtual Rectangle GetVisArea() const; 1806 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; 1807 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; 1808 1809 void SetInvalid(); 1810 }; 1811 1812 ScCsvViewForwarder::ScCsvViewForwarder( Window* pWindow, const Rectangle& rBoundBox ) : 1813 maBoundBox( rBoundBox ), 1814 mpWindow( pWindow ) 1815 { 1816 } 1817 1818 sal_Bool ScCsvViewForwarder::IsValid() const 1819 { 1820 return mpWindow != NULL; 1821 } 1822 1823 Rectangle ScCsvViewForwarder::GetVisArea() const 1824 { 1825 return maBoundBox; 1826 } 1827 1828 Point ScCsvViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const 1829 { 1830 if( !mpWindow ) return Point(); 1831 return mpWindow->LogicToPixel( rPoint, rMapMode ); 1832 } 1833 1834 Point ScCsvViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const 1835 { 1836 if( !mpWindow ) return Point(); 1837 return mpWindow->PixelToLogic( rPoint, rMapMode ); 1838 } 1839 1840 void ScCsvViewForwarder::SetInvalid() 1841 { 1842 mpWindow = NULL; 1843 } 1844 1845 // ---------------------------------------------------------------------------- 1846 1847 ScAccessibleCsvTextData::ScAccessibleCsvTextData( 1848 Window* pWindow, EditEngine* pEditEngine, 1849 const String& rCellText, const Rectangle& rBoundBox, const Size& rCellSize ) : 1850 mpWindow( pWindow ), 1851 mpEditEngine( pEditEngine ), 1852 maCellText( rCellText ), 1853 maBoundBox( rBoundBox ), 1854 maCellSize( rCellSize ) 1855 { 1856 } 1857 1858 ScAccessibleCsvTextData::~ScAccessibleCsvTextData() 1859 { 1860 } 1861 1862 void ScAccessibleCsvTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 1863 { 1864 if ( rHint.ISA( SfxSimpleHint ) ) 1865 { 1866 sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1867 if( nId == SFX_HINT_DYING ) 1868 { 1869 mpWindow = NULL; 1870 mpEditEngine = NULL; 1871 if (mpViewForwarder.get()) 1872 mpViewForwarder->SetInvalid(); 1873 } 1874 } 1875 ScAccessibleTextData::Notify( rBC, rHint ); 1876 } 1877 1878 ScAccessibleTextData* ScAccessibleCsvTextData::Clone() const 1879 { 1880 return new ScAccessibleCsvTextData( mpWindow, mpEditEngine, maCellText, maBoundBox, maCellSize ); 1881 } 1882 1883 SvxTextForwarder* ScAccessibleCsvTextData::GetTextForwarder() 1884 { 1885 if( mpEditEngine ) 1886 { 1887 mpEditEngine->SetPaperSize( maCellSize ); 1888 mpEditEngine->SetText( maCellText ); 1889 if( !mpTextForwarder.get() ) 1890 mpTextForwarder.reset( new SvxEditEngineForwarder( *mpEditEngine ) ); 1891 } 1892 else 1893 mpTextForwarder.reset( NULL ); 1894 return mpTextForwarder.get(); 1895 } 1896 1897 SvxViewForwarder* ScAccessibleCsvTextData::GetViewForwarder() 1898 { 1899 if( !mpViewForwarder.get() ) 1900 mpViewForwarder.reset( new ScCsvViewForwarder( mpWindow, maBoundBox ) ); 1901 return mpViewForwarder.get(); 1902 } 1903 1904 SvxEditViewForwarder* ScAccessibleCsvTextData::GetEditViewForwarder( sal_Bool /* bCreate */ ) 1905 { 1906 return NULL; 1907 } 1908 1909 1910 // ============================================================================ 1911 1912