1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sdext.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterSlidePreview.hxx" 32*cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx" 33*cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx" 34*cdf0e10cSrcweir #include "PresenterPaintManager.hxx" 35*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir using namespace ::com::sun::star; 44*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 45*cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 46*cdf0e10cSrcweir using ::rtl::OUString; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir namespace 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir // Use a super sample factor greater than 1 to achive a poor mans 51*cdf0e10cSrcweir // antialiasing effect for slide previews. 52*cdf0e10cSrcweir const sal_Int16 gnSuperSampleFactor = 2; 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir namespace sdext { namespace presenter { 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir //===== PresenterSlidePreview ================================================= 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir PresenterSlidePreview::PresenterSlidePreview ( 60*cdf0e10cSrcweir const Reference<XComponentContext>& rxContext, 61*cdf0e10cSrcweir const Reference<XResourceId>& rxViewId, 62*cdf0e10cSrcweir const Reference<XPane>& rxAnchorPane, 63*cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController) 64*cdf0e10cSrcweir : PresenterSlidePreviewInterfaceBase(m_aMutex), 65*cdf0e10cSrcweir mpPresenterController(rpPresenterController), 66*cdf0e10cSrcweir mxPane(rxAnchorPane), 67*cdf0e10cSrcweir mxViewId(rxViewId), 68*cdf0e10cSrcweir mxPreviewRenderer(), 69*cdf0e10cSrcweir mxPreview(), 70*cdf0e10cSrcweir mxCurrentSlide(), 71*cdf0e10cSrcweir mnSlideAspectRatio(28.0 / 21.0), 72*cdf0e10cSrcweir mxWindow(), 73*cdf0e10cSrcweir mxCanvas() 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir if ( ! rxContext.is() 76*cdf0e10cSrcweir || ! rxViewId.is() 77*cdf0e10cSrcweir || ! rxAnchorPane.is() 78*cdf0e10cSrcweir || ! rpPresenterController.is()) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir throw RuntimeException( 81*cdf0e10cSrcweir OUString::createFromAscii( 82*cdf0e10cSrcweir "PresenterSlidePreview can not be constructed due to empty argument"), 83*cdf0e10cSrcweir static_cast<XWeak*>(this)); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir mxWindow = rxAnchorPane->getWindow(); 87*cdf0e10cSrcweir mxCanvas = rxAnchorPane->getCanvas(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir if (mxWindow.is()) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir mxWindow->addWindowListener(this); 92*cdf0e10cSrcweir mxWindow->addPaintListener(this); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir Reference<awt::XWindowPeer> xPeer (mxWindow, UNO_QUERY); 95*cdf0e10cSrcweir if (xPeer.is()) 96*cdf0e10cSrcweir xPeer->setBackground(util::Color(0xff000000)); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir mxWindow->setVisible(sal_True); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir if (mpPresenterController.get() != NULL) 102*cdf0e10cSrcweir mnSlideAspectRatio = mpPresenterController->GetSlideAspectRatio(); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager(), UNO_QUERY); 105*cdf0e10cSrcweir if (xFactory.is()) 106*cdf0e10cSrcweir mxPreviewRenderer = Reference<drawing::XSlideRenderer>( 107*cdf0e10cSrcweir xFactory->createInstanceWithContext( 108*cdf0e10cSrcweir OUString::createFromAscii("com.sun.star.drawing.SlideRenderer"), 109*cdf0e10cSrcweir rxContext), 110*cdf0e10cSrcweir UNO_QUERY); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir Resize(); 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir PresenterSlidePreview::~PresenterSlidePreview (void) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::disposing (void) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir if (mxWindow.is()) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir mxWindow->removeWindowListener(this); 130*cdf0e10cSrcweir mxWindow->removePaintListener(this); 131*cdf0e10cSrcweir mxWindow = NULL; 132*cdf0e10cSrcweir mxCanvas = NULL; 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir Reference<lang::XComponent> xComponent (mxPreviewRenderer, UNO_QUERY); 136*cdf0e10cSrcweir if (xComponent.is()) 137*cdf0e10cSrcweir xComponent->dispose(); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir //----- XResourceId ----------------------------------------------------------- 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir Reference<XResourceId> SAL_CALL PresenterSlidePreview::getResourceId (void) 146*cdf0e10cSrcweir throw (RuntimeException) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir return mxViewId; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_Bool SAL_CALL PresenterSlidePreview::isAnchorOnly (void) 155*cdf0e10cSrcweir throw (RuntimeException) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir return false; 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir //----- XWindowListener ------------------------------------------------------- 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::windowResized (const awt::WindowEvent& rEvent) 166*cdf0e10cSrcweir throw (RuntimeException) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir (void)rEvent; 169*cdf0e10cSrcweir ThrowIfDisposed(); 170*cdf0e10cSrcweir ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex()); 171*cdf0e10cSrcweir Resize(); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::windowMoved (const awt::WindowEvent& rEvent) 179*cdf0e10cSrcweir throw (RuntimeException) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir (void)rEvent; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::windowShown (const lang::EventObject& rEvent) 188*cdf0e10cSrcweir throw (RuntimeException) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir (void)rEvent; 191*cdf0e10cSrcweir ThrowIfDisposed(); 192*cdf0e10cSrcweir ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex()); 193*cdf0e10cSrcweir Resize(); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::windowHidden (const lang::EventObject& rEvent) 200*cdf0e10cSrcweir throw (RuntimeException) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir (void)rEvent; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir //----- XPaintListener -------------------------------------------------------- 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::windowPaint (const awt::PaintEvent& rEvent) 211*cdf0e10cSrcweir throw (RuntimeException) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir ThrowIfDisposed(); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex()); 216*cdf0e10cSrcweir if (mxWindow.is()) 217*cdf0e10cSrcweir Paint(awt::Rectangle( 218*cdf0e10cSrcweir rEvent.UpdateRect.X, 219*cdf0e10cSrcweir rEvent.UpdateRect.Y, 220*cdf0e10cSrcweir rEvent.UpdateRect.Width, 221*cdf0e10cSrcweir rEvent.UpdateRect.Height)); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir //----- lang::XEventListener -------------------------------------------------- 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::disposing (const lang::EventObject& rEvent) 230*cdf0e10cSrcweir throw (RuntimeException) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if (rEvent.Source == mxWindow) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir mxWindow = NULL; 235*cdf0e10cSrcweir mxCanvas = NULL; 236*cdf0e10cSrcweir mxPreview = NULL; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir //----- XDrawView ------------------------------------------------------------- 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir void SAL_CALL PresenterSlidePreview::setCurrentPage (const Reference<drawing::XDrawPage>& rxSlide) 246*cdf0e10cSrcweir throw (RuntimeException) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir ThrowIfDisposed(); 249*cdf0e10cSrcweir ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex()); 250*cdf0e10cSrcweir SetSlide(rxSlide); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir Reference<drawing::XDrawPage> SAL_CALL PresenterSlidePreview::getCurrentPage (void) 257*cdf0e10cSrcweir throw (RuntimeException) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir ThrowIfDisposed(); 260*cdf0e10cSrcweir return NULL; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir //----------------------------------------------------------------------------- 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir void PresenterSlidePreview::SetSlide (const Reference<drawing::XDrawPage>& rxPage) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir mxCurrentSlide = rxPage; 271*cdf0e10cSrcweir mxPreview = NULL; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir Reference<beans::XPropertySet> xPropertySet (mxCurrentSlide, UNO_QUERY); 274*cdf0e10cSrcweir if (xPropertySet.is()) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir awt::Size aSlideSize; 277*cdf0e10cSrcweir try 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir xPropertySet->getPropertyValue( 280*cdf0e10cSrcweir OUString::createFromAscii("Width")) >>= aSlideSize.Width; 281*cdf0e10cSrcweir xPropertySet->getPropertyValue( 282*cdf0e10cSrcweir OUString::createFromAscii("Height")) >>= aSlideSize.Height; 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir catch (beans::UnknownPropertyException&) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir OSL_ASSERT(false); 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir // The preview is not transparent, therefore only this window, not its 291*cdf0e10cSrcweir // parent, has to be invalidated. 292*cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(mxWindow); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir void PresenterSlidePreview::Paint (const awt::Rectangle& rBoundingBox) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir (void)rBoundingBox; 301*cdf0e10cSrcweir if ( ! mxWindow.is()) 302*cdf0e10cSrcweir return; 303*cdf0e10cSrcweir if ( ! mxCanvas.is()) 304*cdf0e10cSrcweir return; 305*cdf0e10cSrcweir if ( ! mxPreviewRenderer.is()) 306*cdf0e10cSrcweir return; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir // Make sure that a preview in the correct size exists. 309*cdf0e10cSrcweir awt::Rectangle aWindowBox (mxWindow->getPosSize()); 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir if ( ! mxPreview.is() && mxCurrentSlide.is()) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir // Create a new preview bitmap. 314*cdf0e10cSrcweir mxPreview = mxPreviewRenderer->createPreviewForCanvas( 315*cdf0e10cSrcweir mxCurrentSlide, 316*cdf0e10cSrcweir awt::Size(aWindowBox.Width, aWindowBox.Height), 317*cdf0e10cSrcweir gnSuperSampleFactor, 318*cdf0e10cSrcweir mxCanvas); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir // Determine the bounding box of the preview. 322*cdf0e10cSrcweir awt::Rectangle aPreviewBox; 323*cdf0e10cSrcweir if (mxPreview.is()) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir const geometry::IntegerSize2D aPreviewSize (mxPreview->getSize()); 326*cdf0e10cSrcweir aPreviewBox = awt::Rectangle( 327*cdf0e10cSrcweir (aWindowBox.Width - aPreviewSize.Width)/2, 328*cdf0e10cSrcweir (aWindowBox.Height - aPreviewSize.Height)/2, 329*cdf0e10cSrcweir aPreviewSize.Width, 330*cdf0e10cSrcweir aPreviewSize.Height); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir else 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir if (mnSlideAspectRatio > 0) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir const awt::Size aPreviewSize (mxPreviewRenderer->calculatePreviewSize( 337*cdf0e10cSrcweir mnSlideAspectRatio,awt::Size(aWindowBox.Width, aWindowBox.Height))); 338*cdf0e10cSrcweir aPreviewBox = awt::Rectangle( 339*cdf0e10cSrcweir (aWindowBox.Width - aPreviewSize.Width)/2, 340*cdf0e10cSrcweir (aWindowBox.Height - aPreviewSize.Height)/2, 341*cdf0e10cSrcweir aPreviewSize.Width, 342*cdf0e10cSrcweir aPreviewSize.Height); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir // Paint the background. 347*cdf0e10cSrcweir mpPresenterController->GetCanvasHelper()->Paint( 348*cdf0e10cSrcweir mpPresenterController->GetViewBackground(mxViewId->getResourceURL()), 349*cdf0e10cSrcweir mxCanvas, 350*cdf0e10cSrcweir rBoundingBox, 351*cdf0e10cSrcweir awt::Rectangle(0,0,aWindowBox.Width,aWindowBox.Height), 352*cdf0e10cSrcweir aPreviewBox); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir // Paint the preview. 355*cdf0e10cSrcweir const rendering::ViewState aViewState( 356*cdf0e10cSrcweir geometry::AffineMatrix2D(1,0,0, 0,1,0), 357*cdf0e10cSrcweir NULL); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir Sequence<double> aBackgroundColor(4); 360*cdf0e10cSrcweir rendering::RenderState aRenderState ( 361*cdf0e10cSrcweir geometry::AffineMatrix2D(1, 0, aPreviewBox.X, 0, 1, aPreviewBox.Y), 362*cdf0e10cSrcweir NULL, 363*cdf0e10cSrcweir aBackgroundColor, 364*cdf0e10cSrcweir rendering::CompositeOperation::SOURCE); 365*cdf0e10cSrcweir PresenterCanvasHelper::SetDeviceColor(aRenderState, 0x00000000); 366*cdf0e10cSrcweir if (mxPreview.is()) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir mxCanvas->drawBitmap(mxPreview, aViewState, aRenderState); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir else 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir if (mnSlideAspectRatio > 0) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir Reference<rendering::XPolyPolygon2D> xPolygon ( 375*cdf0e10cSrcweir PresenterGeometryHelper::CreatePolygon(aPreviewBox, mxCanvas->getDevice())); 376*cdf0e10cSrcweir if (xPolygon.is()) 377*cdf0e10cSrcweir mxCanvas->fillPolyPolygon(xPolygon, aViewState, aRenderState); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY); 382*cdf0e10cSrcweir if (xSpriteCanvas.is()) 383*cdf0e10cSrcweir xSpriteCanvas->updateScreen(sal_False); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir void PresenterSlidePreview::Resize (void) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir if (mxPreviewRenderer.is() && mxPreview.is()) 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir const awt::Rectangle aWindowBox (mxWindow->getPosSize()); 394*cdf0e10cSrcweir const awt::Size aNewPreviewSize (mxPreviewRenderer->calculatePreviewSize( 395*cdf0e10cSrcweir mnSlideAspectRatio, 396*cdf0e10cSrcweir awt::Size(aWindowBox.Width, aWindowBox.Height))); 397*cdf0e10cSrcweir const geometry::IntegerSize2D aPreviewSize (mxPreview->getSize()); 398*cdf0e10cSrcweir if (aNewPreviewSize.Width==aPreviewSize.Width 399*cdf0e10cSrcweir && aNewPreviewSize.Height==aPreviewSize.Height) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir // The size of the window may have changed but the preview would 402*cdf0e10cSrcweir // be painted in the same size (but not necessarily at the same 403*cdf0e10cSrcweir // position.) 404*cdf0e10cSrcweir return; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir SetSlide(mxCurrentSlide); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir void PresenterSlidePreview::ThrowIfDisposed (void) 414*cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir if (PresenterSlidePreviewInterfaceBase::rBHelper.bDisposed || PresenterSlidePreviewInterfaceBase::rBHelper.bInDispose) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir throw lang::DisposedException ( 419*cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 420*cdf0e10cSrcweir "PresenterSlidePreview object has already been disposed")), 421*cdf0e10cSrcweir static_cast<uno::XWeak*>(this)); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir } } // end of namespace ::sd::presenter 427*cdf0e10cSrcweir 428