1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sdext.hxx" 26 27 #include "PresenterNotesView.hxx" 28 #include "PresenterButton.hxx" 29 #include "PresenterCanvasHelper.hxx" 30 #include "PresenterGeometryHelper.hxx" 31 #include "PresenterPaintManager.hxx" 32 #include "PresenterScrollBar.hxx" 33 #include "PresenterTextView.hxx" 34 #include <com/sun/star/accessibility/AccessibleTextType.hpp> 35 #include <com/sun/star/awt/Key.hpp> 36 #include <com/sun/star/awt/KeyModifier.hpp> 37 #include <com/sun/star/awt/PosSize.hpp> 38 #include <com/sun/star/beans/XPropertySet.hpp> 39 #include <com/sun/star/drawing/framework/XControllerManager.hpp> 40 #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 41 #include <com/sun/star/drawing/framework/XPane.hpp> 42 #include <com/sun/star/lang/XServiceName.hpp> 43 #include <com/sun/star/presentation/XPresentationPage.hpp> 44 #include <com/sun/star/rendering/CompositeOperation.hpp> 45 #include <com/sun/star/rendering/XSpriteCanvas.hpp> 46 #include <com/sun/star/text/XTextRange.hpp> 47 #include <com/sun/star/util/XChangesBatch.hpp> 48 #include <com/sun/star/container/XChild.hpp> 49 #include <boost/bind.hpp> 50 #include <set> 51 52 using namespace ::com::sun::star; 53 using namespace ::com::sun::star::uno; 54 using namespace ::com::sun::star::drawing::framework; 55 using ::rtl::OUString; 56 57 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 58 59 static const sal_Int32 gnSpaceBelowSeparator (10); 60 static const sal_Int32 gnSpaceAboveSeparator (10); 61 static const sal_Int32 gnPartHeight (128); 62 /** Maximal size of memory used for bitmaps which show the notes text. 63 */ 64 static const sal_Int32 gnMaximalCacheSize (8*1024*1024); 65 static const double gnLineScrollFactor (1.2); 66 67 namespace sdext { namespace presenter { 68 69 //===== PresenterNotesView ==================================================== 70 71 PresenterNotesView::PresenterNotesView ( 72 const Reference<XComponentContext>& rxComponentContext, 73 const Reference<XResourceId>& rxViewId, 74 const Reference<frame::XController>& rxController, 75 const ::rtl::Reference<PresenterController>& rpPresenterController) 76 : PresenterNotesViewInterfaceBase(m_aMutex), 77 mxViewId(rxViewId), 78 mpPresenterController(rpPresenterController), 79 mxCanvas(), 80 mxCurrentNotesPage(), 81 mpScrollBar(), 82 mxToolBarWindow(), 83 mxToolBarCanvas(), 84 mpToolBar(), 85 mpCloseButton(), 86 maSeparatorColor(0xffffff), 87 mnSeparatorYLocation(0), 88 maTextBoundingBox(), 89 mpBackground(), 90 mnTop(0), 91 mpFont(), 92 mpTextView() 93 { 94 try 95 { 96 Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW); 97 Reference<XConfigurationController> xCC (xCM->getConfigurationController(), UNO_QUERY_THROW); 98 Reference<XPane> xPane (xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW); 99 100 mxParentWindow = xPane->getWindow(); 101 mxCanvas = xPane->getCanvas(); 102 mpTextView.reset(new PresenterTextView( 103 rxComponentContext, 104 mxCanvas, 105 mpPresenterController->GetPaintManager()->GetInvalidator(mxParentWindow))); 106 107 const OUString sResourceURL (mxViewId->getResourceURL()); 108 mpFont.reset(new PresenterTheme::FontDescriptor( 109 rpPresenterController->GetViewFont(sResourceURL))); 110 maSeparatorColor = mpFont->mnColor; 111 mpTextView->SetFont(mpFont); 112 113 CreateToolBar(rxComponentContext, rpPresenterController); 114 115 mpCloseButton = PresenterButton::Create( 116 rxComponentContext, 117 mpPresenterController, 118 mpPresenterController->GetTheme(), 119 mxParentWindow, 120 mxCanvas, 121 A2S("NotesViewCloser")); 122 123 if (mxParentWindow.is()) 124 { 125 mxParentWindow->addWindowListener(this); 126 mxParentWindow->addPaintListener(this); 127 mxParentWindow->addKeyListener(this); 128 mxParentWindow->setVisible(sal_True); 129 } 130 131 mpScrollBar = new PresenterVerticalScrollBar( 132 rxComponentContext, 133 mxParentWindow, 134 mpPresenterController->GetPaintManager(), 135 ::boost::bind(&PresenterNotesView::SetTop, this, _1)); 136 mpScrollBar->SetBackground( 137 mpPresenterController->GetViewBackground(mxViewId->getResourceURL())); 138 139 mpScrollBar->SetCanvas(mxCanvas); 140 141 Layout(); 142 } 143 catch (RuntimeException&) 144 { 145 PresenterNotesView::disposing(); 146 throw; 147 } 148 } 149 150 151 152 153 PresenterNotesView::~PresenterNotesView (void) 154 { 155 } 156 157 158 159 160 void SAL_CALL PresenterNotesView::disposing (void) 161 { 162 if (mxParentWindow.is()) 163 { 164 mxParentWindow->removeWindowListener(this); 165 mxParentWindow->removePaintListener(this); 166 mxParentWindow->removeKeyListener(this); 167 mxParentWindow = NULL; 168 } 169 170 // Dispose tool bar. 171 { 172 Reference<XComponent> xComponent (static_cast<XWeak*>(mpToolBar.get()), UNO_QUERY); 173 mpToolBar = NULL; 174 if (xComponent.is()) 175 xComponent->dispose(); 176 } 177 { 178 Reference<XComponent> xComponent (mxToolBarCanvas, UNO_QUERY); 179 mxToolBarCanvas = NULL; 180 if (xComponent.is()) 181 xComponent->dispose(); 182 } 183 { 184 Reference<XComponent> xComponent (mxToolBarWindow, UNO_QUERY); 185 mxToolBarWindow = NULL; 186 if (xComponent.is()) 187 xComponent->dispose(); 188 } 189 190 // Dispose close button 191 { 192 Reference<XComponent> xComponent (static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY); 193 mpCloseButton = NULL; 194 if (xComponent.is()) 195 xComponent->dispose(); 196 } 197 198 // Create the tool bar. 199 200 mpScrollBar = NULL; 201 202 mxViewId = NULL; 203 } 204 205 206 207 208 void PresenterNotesView::CreateToolBar ( 209 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 210 const ::rtl::Reference<PresenterController>& rpPresenterController) 211 { 212 if (rpPresenterController.get() == NULL) 213 return; 214 215 Reference<drawing::XPresenterHelper> xPresenterHelper ( 216 rpPresenterController->GetPresenterHelper()); 217 if ( ! xPresenterHelper.is()) 218 return; 219 220 // Create a new window as container of the tool bar. 221 mxToolBarWindow = xPresenterHelper->createWindow( 222 mxParentWindow, 223 sal_False, 224 sal_True, 225 sal_False, 226 sal_False); 227 mxToolBarCanvas = xPresenterHelper->createSharedCanvas ( 228 Reference<rendering::XSpriteCanvas>(mxCanvas, UNO_QUERY), 229 mxParentWindow, 230 mxCanvas, 231 mxParentWindow, 232 mxToolBarWindow); 233 234 // Create the tool bar. 235 mpToolBar = new PresenterToolBar( 236 rxContext, 237 mxToolBarWindow, 238 mxToolBarCanvas, 239 rpPresenterController, 240 PresenterToolBar::Left); 241 mpToolBar->Initialize( 242 A2S("PresenterScreenSettings/ToolBars/NotesToolBar")); 243 } 244 245 246 247 248 void PresenterNotesView::SetSlide (const Reference<drawing::XDrawPage>& rxNotesPage) 249 { 250 static const ::rtl::OUString sNotesShapeName ( 251 A2S("com.sun.star.presentation.NotesShape")); 252 static const ::rtl::OUString sTextShapeName ( 253 A2S("com.sun.star.drawing.TextShape")); 254 255 Reference<container::XIndexAccess> xIndexAccess (rxNotesPage, UNO_QUERY); 256 if (xIndexAccess.is()) 257 { 258 ::rtl::OUString sText; 259 260 // Iterate over all shapes and find the one that holds the text. 261 sal_Int32 nCount (xIndexAccess->getCount()); 262 for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) 263 { 264 265 Reference<lang::XServiceName> xServiceName ( 266 xIndexAccess->getByIndex(nIndex), UNO_QUERY); 267 if (xServiceName.is() 268 && xServiceName->getServiceName().equals(sNotesShapeName)) 269 { 270 Reference<text::XTextRange> xText (xServiceName, UNO_QUERY); 271 if (xText.is()) 272 { 273 sText += xText->getString(); 274 } 275 } 276 else 277 { 278 Reference<drawing::XShapeDescriptor> xShapeDescriptor ( 279 xIndexAccess->getByIndex(nIndex), UNO_QUERY); 280 if (xShapeDescriptor.is()) 281 { 282 ::rtl::OUString sType (xShapeDescriptor->getShapeType()); 283 if (sType.equals(sNotesShapeName) || sType.equals(sTextShapeName)) 284 { 285 Reference<text::XTextRange> xText ( 286 xIndexAccess->getByIndex(nIndex), UNO_QUERY); 287 if (xText.is()) 288 { 289 sText += xText->getString(); 290 mpTextView->SetText(Reference<text::XText>(xText, UNO_QUERY)); 291 } 292 } 293 } 294 } 295 } 296 297 Layout(); 298 299 if (mpScrollBar.get() != NULL) 300 { 301 mpScrollBar->SetThumbPosition(0, false); 302 UpdateScrollBar(); 303 } 304 305 Invalidate(); 306 } 307 } 308 309 310 311 312 //----- lang::XEventListener ------------------------------------------------- 313 314 void SAL_CALL PresenterNotesView::disposing (const lang::EventObject& rEventObject) 315 { 316 if (rEventObject.Source == mxParentWindow) 317 mxParentWindow = NULL; 318 } 319 320 321 322 323 //----- XWindowListener ------------------------------------------------------- 324 325 void SAL_CALL PresenterNotesView::windowResized (const awt::WindowEvent& rEvent) 326 { 327 (void)rEvent; 328 Layout(); 329 } 330 331 332 333 334 void SAL_CALL PresenterNotesView::windowMoved (const awt::WindowEvent& rEvent) 335 { 336 (void)rEvent; 337 } 338 339 340 341 342 void SAL_CALL PresenterNotesView::windowShown (const lang::EventObject& rEvent) 343 { 344 (void)rEvent; 345 } 346 347 348 349 350 void SAL_CALL PresenterNotesView::windowHidden (const lang::EventObject& rEvent) 351 { 352 (void)rEvent; 353 } 354 355 356 357 358 //----- XPaintListener -------------------------------------------------------- 359 360 void SAL_CALL PresenterNotesView::windowPaint (const awt::PaintEvent& rEvent) 361 { 362 ThrowIfDisposed(); 363 364 if ( ! mbIsPresenterViewActive) 365 return; 366 367 ::osl::MutexGuard aSolarGuard (::osl::Mutex::getGlobalMutex()); 368 Paint(rEvent.UpdateRect); 369 } 370 371 372 373 374 //----- XResourceId ----------------------------------------------------------- 375 376 Reference<XResourceId> SAL_CALL PresenterNotesView::getResourceId (void) 377 { 378 return mxViewId; 379 } 380 381 382 383 384 sal_Bool SAL_CALL PresenterNotesView::isAnchorOnly (void) 385 { 386 return false; 387 } 388 389 390 391 392 //----- XDrawView ------------------------------------------------------------- 393 394 void SAL_CALL PresenterNotesView::setCurrentPage (const Reference<drawing::XDrawPage>& rxSlide) 395 { 396 // Get the associated notes page. 397 mxCurrentNotesPage = NULL; 398 try 399 { 400 Reference<presentation::XPresentationPage> xPresentationPage(rxSlide, UNO_QUERY); 401 if (xPresentationPage.is()) 402 mxCurrentNotesPage = xPresentationPage->getNotesPage(); 403 } 404 catch (RuntimeException&) 405 { 406 } 407 408 SetSlide(mxCurrentNotesPage); 409 } 410 411 412 413 414 Reference<drawing::XDrawPage> SAL_CALL PresenterNotesView::getCurrentPage (void) 415 { 416 return NULL; 417 } 418 419 420 421 422 //----- XKeyListener ---------------------------------------------------------- 423 424 void SAL_CALL PresenterNotesView::keyPressed (const awt::KeyEvent& rEvent) 425 { 426 switch (rEvent.KeyCode) 427 { 428 case awt::Key::A: 429 Scroll(-gnLineScrollFactor * mpFont->mnSize); 430 break; 431 432 case awt::Key::Y: 433 case awt::Key::Z: 434 Scroll(+gnLineScrollFactor * mpFont->mnSize); 435 break; 436 437 case awt::Key::S: 438 ChangeFontSize(-1); 439 break; 440 441 case awt::Key::G: 442 ChangeFontSize(+1); 443 break; 444 445 case awt::Key::H: 446 if (mpTextView) 447 mpTextView->MoveCaret( 448 -1, 449 (rEvent.Modifiers == awt::KeyModifier::SHIFT) 450 ? cssa::AccessibleTextType::CHARACTER 451 : cssa::AccessibleTextType::WORD); 452 break; 453 454 case awt::Key::L: 455 if (mpTextView) 456 mpTextView->MoveCaret( 457 +1, 458 (rEvent.Modifiers == awt::KeyModifier::SHIFT) 459 ? cssa::AccessibleTextType::CHARACTER 460 : cssa::AccessibleTextType::WORD); 461 break; 462 } 463 } 464 465 466 467 468 void SAL_CALL PresenterNotesView::keyReleased (const awt::KeyEvent& rEvent) 469 { 470 (void)rEvent; 471 } 472 473 474 475 476 //----------------------------------------------------------------------------- 477 478 void PresenterNotesView::Layout (void) 479 { 480 if ( ! mxParentWindow.is()) 481 return; 482 483 awt::Rectangle aWindowBox (mxParentWindow->getPosSize()); 484 geometry::RealRectangle2D aNewTextBoundingBox (0,0,aWindowBox.Width, aWindowBox.Height); 485 486 // Size the tool bar and the horizontal separator above it. 487 if (mxToolBarWindow.is()) 488 { 489 const geometry::RealSize2D aToolBarSize (mpToolBar->GetMinimalSize()); 490 const sal_Int32 nToolBarHeight = sal_Int32(aToolBarSize.Height + 0.5); 491 mxToolBarWindow->setPosSize(0, aWindowBox.Height - nToolBarHeight, 492 sal_Int32(aToolBarSize.Width + 0.5), nToolBarHeight, 493 awt::PosSize::POSSIZE); 494 aNewTextBoundingBox.Y2 -= nToolBarHeight; 495 496 mnSeparatorYLocation = aWindowBox.Height - nToolBarHeight - gnSpaceBelowSeparator; 497 aNewTextBoundingBox.Y2 = mnSeparatorYLocation - gnSpaceAboveSeparator; 498 499 // Place the close button. 500 if (mpCloseButton.get() != NULL) 501 mpCloseButton->SetCenter(geometry::RealPoint2D( 502 (aWindowBox.Width + aToolBarSize.Width) / 2, 503 aWindowBox.Height - aToolBarSize.Height/2)); 504 } 505 506 // Check whether the vertical scroll bar is necessary. 507 if (mpScrollBar.get() != NULL) 508 { 509 bool bShowVerticalScrollbar (false); 510 try 511 { 512 const double nTextBoxHeight (aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1); 513 const double nHeight (mpTextView->GetTotalTextHeight()); 514 if (nHeight > nTextBoxHeight) 515 { 516 bShowVerticalScrollbar = true; 517 aNewTextBoundingBox.X2 -= mpScrollBar->GetSize(); 518 } 519 mpScrollBar->SetTotalSize(nHeight); 520 } 521 catch(beans::UnknownPropertyException&) 522 { 523 OSL_ASSERT(false); 524 } 525 526 mpScrollBar->SetVisible(bShowVerticalScrollbar); 527 mpScrollBar->SetPosSize( 528 geometry::RealRectangle2D( 529 aNewTextBoundingBox.X2, 530 aNewTextBoundingBox.X1, 531 aNewTextBoundingBox.X2 + mpScrollBar->GetSize(), 532 aNewTextBoundingBox.Y2)); 533 if ( ! bShowVerticalScrollbar) 534 mpScrollBar->SetThumbPosition(0, false); 535 536 UpdateScrollBar(); 537 } 538 539 // Has the text area has changed it position or size? 540 if (aNewTextBoundingBox.X1 != maTextBoundingBox.X1 541 || aNewTextBoundingBox.Y1 != maTextBoundingBox.Y1 542 || aNewTextBoundingBox.X2 != maTextBoundingBox.X2 543 || aNewTextBoundingBox.Y2 != maTextBoundingBox.Y2) 544 { 545 maTextBoundingBox = aNewTextBoundingBox; 546 547 mpTextView->SetLocation( 548 geometry::RealPoint2D( 549 aNewTextBoundingBox.X1, 550 aNewTextBoundingBox.Y1)); 551 mpTextView->SetSize( 552 geometry::RealSize2D( 553 aNewTextBoundingBox.X2 - aNewTextBoundingBox.X1, 554 aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1)); 555 } 556 } 557 558 559 560 561 void PresenterNotesView::Paint (const awt::Rectangle& rUpdateBox) 562 { 563 if ( ! mxParentWindow.is()) 564 return; 565 if ( ! mxCanvas.is()) 566 return; 567 568 if (mpBackground.get() == NULL) 569 mpBackground = mpPresenterController->GetViewBackground(mxViewId->getResourceURL()); 570 571 if (rUpdateBox.Y < maTextBoundingBox.Y2 572 && rUpdateBox.X < maTextBoundingBox.X2) 573 { 574 PaintText(rUpdateBox); 575 } 576 577 mpTextView->Paint(rUpdateBox); 578 579 if (rUpdateBox.Y + rUpdateBox.Height > maTextBoundingBox.Y2) 580 { 581 PaintToolBar(rUpdateBox); 582 } 583 } 584 585 586 587 588 void PresenterNotesView::PaintToolBar (const awt::Rectangle& rUpdateBox) 589 { 590 awt::Rectangle aWindowBox (mxParentWindow->getPosSize()); 591 592 rendering::ViewState aViewState ( 593 geometry::AffineMatrix2D(1,0,0, 0,1,0), 594 NULL); 595 rendering::RenderState aRenderState( 596 geometry::AffineMatrix2D(1,0,0, 0,1,0), 597 NULL, 598 Sequence<double>(4), 599 rendering::CompositeOperation::SOURCE); 600 601 if (mpBackground.get() != NULL) 602 { 603 // Paint the background. 604 mpPresenterController->GetCanvasHelper()->Paint( 605 mpBackground, 606 mxCanvas, 607 rUpdateBox, 608 awt::Rectangle(0,sal_Int32(maTextBoundingBox.Y2),aWindowBox.Width,aWindowBox.Height), 609 awt::Rectangle()); 610 } 611 612 // Paint the horizontal separator. 613 OSL_ASSERT(mxViewId.is()); 614 PresenterCanvasHelper::SetDeviceColor(aRenderState, maSeparatorColor); 615 616 mxCanvas->drawLine( 617 geometry::RealPoint2D(0,mnSeparatorYLocation), 618 geometry::RealPoint2D(aWindowBox.Width,mnSeparatorYLocation), 619 aViewState, 620 aRenderState); 621 } 622 623 624 625 626 void PresenterNotesView::PaintText (const awt::Rectangle& rUpdateBox) 627 { 628 const awt::Rectangle aBox (PresenterGeometryHelper::Intersection(rUpdateBox, 629 PresenterGeometryHelper::ConvertRectangle(maTextBoundingBox))); 630 631 if (aBox.Width <= 0 || aBox.Height <= 0) 632 return; 633 634 rendering::ViewState aViewState ( 635 geometry::AffineMatrix2D(1,0,0, 0,1,0), 636 PresenterGeometryHelper::CreatePolygon(aBox, mxCanvas->getDevice())); 637 rendering::RenderState aRenderState( 638 geometry::AffineMatrix2D(1,0,0, 0,1,0), 639 NULL, 640 Sequence<double>(3), 641 rendering::CompositeOperation::SOURCE); 642 643 if (mpBackground.get() != NULL) 644 { 645 // Paint the background. 646 mpPresenterController->GetCanvasHelper()->Paint( 647 mpBackground, 648 mxCanvas, 649 rUpdateBox, 650 aBox, 651 awt::Rectangle()); 652 } 653 654 Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY); 655 if (xSpriteCanvas.is()) 656 xSpriteCanvas->updateScreen(sal_False); 657 } 658 659 660 661 662 void PresenterNotesView::Invalidate (void) 663 { 664 mpPresenterController->GetPaintManager()->Invalidate( 665 mxParentWindow, 666 PresenterGeometryHelper::ConvertRectangle(maTextBoundingBox)); 667 } 668 669 670 671 672 void PresenterNotesView::Scroll (const double rnDistance) 673 { 674 try 675 { 676 mnTop += rnDistance; 677 mpTextView->SetOffset(0, mnTop); 678 679 UpdateScrollBar(); 680 Invalidate(); 681 } 682 catch (beans::UnknownPropertyException&) 683 {} 684 } 685 686 687 688 689 void PresenterNotesView::SetTop (const double nTop) 690 { 691 try 692 { 693 mnTop = nTop; 694 mpTextView->SetOffset(0, mnTop); 695 696 UpdateScrollBar(); 697 Invalidate(); 698 } 699 catch (beans::UnknownPropertyException&) 700 {} 701 } 702 703 704 705 706 void PresenterNotesView::ChangeFontSize (const sal_Int32 nSizeChange) 707 { 708 const sal_Int32 nNewSize (mpFont->mnSize + nSizeChange); 709 if (nNewSize > 5) 710 { 711 mpFont->mnSize = nNewSize; 712 mpFont->mxFont = NULL; 713 mpTextView->SetFont(mpFont); 714 715 Layout(); 716 UpdateScrollBar(); 717 Invalidate(); 718 719 // Write the new font size to the configuration to make it persistent. 720 try 721 { 722 const OUString sStyleName (mpPresenterController->GetTheme()->GetStyleName( 723 mxViewId->getResourceURL())); 724 ::boost::shared_ptr<PresenterConfigurationAccess> pConfiguration ( 725 mpPresenterController->GetTheme()->GetNodeForViewStyle( 726 sStyleName, 727 PresenterConfigurationAccess::READ_WRITE)); 728 if (pConfiguration.get()==NULL || ! pConfiguration->IsValid()) 729 return; 730 731 pConfiguration->GoToChild(A2S("Font")); 732 pConfiguration->SetProperty(A2S("Size"), Any((sal_Int32)(nNewSize+0.5))); 733 pConfiguration->CommitChanges(); 734 } 735 catch (Exception&) 736 { 737 OSL_ASSERT(false); 738 } 739 } 740 } 741 742 743 744 745 ::boost::shared_ptr<PresenterTextView> PresenterNotesView::GetTextView (void) const 746 { 747 return mpTextView; 748 } 749 750 751 752 753 void PresenterNotesView::UpdateScrollBar (void) 754 { 755 if (mpScrollBar.get() != NULL) 756 { 757 try 758 { 759 mpScrollBar->SetTotalSize(mpTextView->GetTotalTextHeight()); 760 } 761 catch(beans::UnknownPropertyException&) 762 { 763 OSL_ASSERT(false); 764 } 765 766 mpScrollBar->SetLineHeight(mpFont->mnSize*1.2); 767 mpScrollBar->SetThumbPosition(mnTop, false); 768 769 mpScrollBar->SetThumbSize(maTextBoundingBox.Y2 - maTextBoundingBox.Y1); 770 mpScrollBar->CheckValues(); 771 } 772 } 773 774 775 776 777 void PresenterNotesView::ThrowIfDisposed (void) 778 { 779 if (rBHelper.bDisposed || rBHelper.bInDispose) 780 { 781 throw lang::DisposedException ( 782 A2S("PresenterNotesView object has already been disposed"), 783 static_cast<uno::XWeak*>(this)); 784 } 785 } 786 787 788 789 790 } } // end of namespace ::sdext::presenter 791