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 "PresenterPaneBase.hxx" 32*cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx" 33*cdf0e10cSrcweir #include "PresenterController.hxx" 34*cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx" 35*cdf0e10cSrcweir #include "PresenterPaintManager.hxx" 36*cdf0e10cSrcweir #include "PresenterTextView.hxx" 37*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow2.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/CanvasFeature.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/rendering/TexturingMode.hpp> 44*cdf0e10cSrcweir #include <osl/mutex.hxx> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir using namespace ::com::sun::star; 47*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 48*cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 49*cdf0e10cSrcweir using ::rtl::OUString; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace sdext { namespace presenter { 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //===== PresenterPaneBase ===================================================== 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir PresenterPaneBase::PresenterPaneBase ( 56*cdf0e10cSrcweir const Reference<XComponentContext>& rxContext, 57*cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController) 58*cdf0e10cSrcweir : PresenterPaneBaseInterfaceBase(m_aMutex), 59*cdf0e10cSrcweir mpPresenterController(rpPresenterController), 60*cdf0e10cSrcweir mxParentWindow(), 61*cdf0e10cSrcweir mxBorderWindow(), 62*cdf0e10cSrcweir mxBorderCanvas(), 63*cdf0e10cSrcweir mxContentWindow(), 64*cdf0e10cSrcweir mxContentCanvas(), 65*cdf0e10cSrcweir mxPaneId(), 66*cdf0e10cSrcweir mxBorderPainter(), 67*cdf0e10cSrcweir mxPresenterHelper(), 68*cdf0e10cSrcweir msTitle(), 69*cdf0e10cSrcweir mxComponentContext(rxContext), 70*cdf0e10cSrcweir mpViewBackground(), 71*cdf0e10cSrcweir mbHasCallout(false), 72*cdf0e10cSrcweir maCalloutAnchor() 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir if (mpPresenterController.get() != NULL) 75*cdf0e10cSrcweir mxPresenterHelper = mpPresenterController->GetPresenterHelper(); 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir PresenterPaneBase::~PresenterPaneBase (void) 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir void PresenterPaneBase::disposing (void) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir if (mxBorderWindow.is()) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir mxBorderWindow->removeWindowListener(this); 93*cdf0e10cSrcweir mxBorderWindow->removePaintListener(this); 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir Reference<XComponent> xComponent (mxContentCanvas, UNO_QUERY); 98*cdf0e10cSrcweir mxContentCanvas = NULL; 99*cdf0e10cSrcweir if (xComponent.is()) 100*cdf0e10cSrcweir xComponent->dispose(); 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir Reference<XComponent> xComponent (mxContentWindow, UNO_QUERY); 105*cdf0e10cSrcweir mxContentWindow = NULL; 106*cdf0e10cSrcweir if (xComponent.is()) 107*cdf0e10cSrcweir xComponent->dispose(); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir Reference<XComponent> xComponent (mxBorderCanvas, UNO_QUERY); 112*cdf0e10cSrcweir mxBorderCanvas = NULL; 113*cdf0e10cSrcweir if (xComponent.is()) 114*cdf0e10cSrcweir xComponent->dispose(); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir Reference<XComponent> xComponent (mxBorderWindow, UNO_QUERY); 119*cdf0e10cSrcweir mxBorderWindow = NULL; 120*cdf0e10cSrcweir if (xComponent.is()) 121*cdf0e10cSrcweir xComponent->dispose(); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir mxComponentContext = NULL; 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void PresenterPaneBase::SetTitle (const OUString& rsTitle) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir msTitle = rsTitle; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir OSL_ASSERT(mpPresenterController.get()!=NULL); 135*cdf0e10cSrcweir OSL_ASSERT(mpPresenterController->GetPaintManager().get()!=NULL); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(mxBorderWindow); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir ::rtl::OUString PresenterPaneBase::GetTitle (void) const 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir return msTitle; 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir Reference<drawing::framework::XPaneBorderPainter> 152*cdf0e10cSrcweir PresenterPaneBase::GetPaneBorderPainter (void) const 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir return mxBorderPainter; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir void PresenterPaneBase::SetCalloutAnchor (const css::awt::Point& rCalloutAnchor) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir mbHasCallout = true; 163*cdf0e10cSrcweir // Anchor is given in the coorindate system of the parent window. 164*cdf0e10cSrcweir // Transform it into the local coordinate system. 165*cdf0e10cSrcweir maCalloutAnchor = rCalloutAnchor; 166*cdf0e10cSrcweir const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); 167*cdf0e10cSrcweir maCalloutAnchor.X -= aBorderBox.X; 168*cdf0e10cSrcweir maCalloutAnchor.Y -= aBorderBox.Y; 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // Move the bottom of the border window so that it goes through the 171*cdf0e10cSrcweir // callout anchor (special case for bottom callout). 172*cdf0e10cSrcweir sal_Int32 nHeight (rCalloutAnchor.Y - aBorderBox.Y); 173*cdf0e10cSrcweir if (mxBorderPainter.is() && mxPaneId.is()) 174*cdf0e10cSrcweir nHeight += mxBorderPainter->getCalloutOffset(mxPaneId->getResourceURL()).Y; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir if (nHeight != aBorderBox.Height) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir mxBorderWindow->setPosSize( 179*cdf0e10cSrcweir aBorderBox.X, 180*cdf0e10cSrcweir aBorderBox.Y, 181*cdf0e10cSrcweir aBorderBox.Width, 182*cdf0e10cSrcweir nHeight, 183*cdf0e10cSrcweir awt::PosSize::HEIGHT); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(mxBorderWindow); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir awt::Point PresenterPaneBase::GetCalloutAnchor (void) const 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir return maCalloutAnchor; 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView> PresenterPaneBase::GetTextViewForTitle (void) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView> pTextView( 203*cdf0e10cSrcweir new PresenterTextView( 204*cdf0e10cSrcweir mxComponentContext, 205*cdf0e10cSrcweir mxBorderCanvas)); 206*cdf0e10cSrcweir pTextView->SetText(msTitle); 207*cdf0e10cSrcweir return pTextView; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir //----- XInitialization ------------------------------------------------------- 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments) 216*cdf0e10cSrcweir throw (Exception, RuntimeException) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir ThrowIfDisposed(); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir if ( ! mxComponentContext.is()) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir throw RuntimeException( 223*cdf0e10cSrcweir OUString::createFromAscii("PresenterSpritePane: missing component context"), 224*cdf0e10cSrcweir static_cast<XWeak*>(this)); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir if (rArguments.getLength() == 5 || rArguments.getLength() == 6) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir try 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir // Get the resource id from the first argument. 232*cdf0e10cSrcweir if ( ! (rArguments[0] >>= mxPaneId)) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir throw lang::IllegalArgumentException( 235*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid pane id"), 236*cdf0e10cSrcweir static_cast<XWeak*>(this), 237*cdf0e10cSrcweir 0); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir if ( ! (rArguments[1] >>= mxParentWindow)) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir throw lang::IllegalArgumentException( 243*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid parent window"), 244*cdf0e10cSrcweir static_cast<XWeak*>(this), 245*cdf0e10cSrcweir 1); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> xParentCanvas; 249*cdf0e10cSrcweir if ( ! (rArguments[2] >>= xParentCanvas)) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir throw lang::IllegalArgumentException( 252*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid parent canvas"), 253*cdf0e10cSrcweir static_cast<XWeak*>(this), 254*cdf0e10cSrcweir 2); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir if ( ! (rArguments[3] >>= msTitle)) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir throw lang::IllegalArgumentException( 260*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid title"), 261*cdf0e10cSrcweir static_cast<XWeak*>(this), 262*cdf0e10cSrcweir 3); 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir if ( ! (rArguments[4] >>= mxBorderPainter)) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir throw lang::IllegalArgumentException( 268*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid border painter"), 269*cdf0e10cSrcweir static_cast<XWeak*>(this), 270*cdf0e10cSrcweir 4); 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir bool bIsWindowVisibleOnCreation (true); 274*cdf0e10cSrcweir if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation)) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir throw lang::IllegalArgumentException( 277*cdf0e10cSrcweir OUString::createFromAscii("PresenterPane: invalid window visibility flag"), 278*cdf0e10cSrcweir static_cast<XWeak*>(this), 279*cdf0e10cSrcweir 5); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir if (mxBorderWindow.is()) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir mxBorderWindow->addWindowListener(this); 287*cdf0e10cSrcweir mxBorderWindow->addPaintListener(this); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir CreateCanvases(mxParentWindow, xParentCanvas); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir // Raise new windows. 293*cdf0e10cSrcweir ToTop(); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir catch (Exception&) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir mxContentWindow = NULL; 298*cdf0e10cSrcweir mxComponentContext = NULL; 299*cdf0e10cSrcweir throw; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir else 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir throw RuntimeException( 305*cdf0e10cSrcweir OUString::createFromAscii("PresenterSpritePane: invalid number of arguments"), 306*cdf0e10cSrcweir static_cast<XWeak*>(this)); 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir //----- XResourceId ----------------------------------------------------------- 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir Reference<XResourceId> SAL_CALL PresenterPaneBase::getResourceId (void) 316*cdf0e10cSrcweir throw (RuntimeException) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir ThrowIfDisposed(); 319*cdf0e10cSrcweir return mxPaneId; 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir sal_Bool SAL_CALL PresenterPaneBase::isAnchorOnly (void) 326*cdf0e10cSrcweir throw (RuntimeException) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir return true; 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir //----- XWindowListener ------------------------------------------------------- 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowResized (const awt::WindowEvent& rEvent) 337*cdf0e10cSrcweir throw (RuntimeException) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir (void)rEvent; 340*cdf0e10cSrcweir ThrowIfDisposed(); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowMoved (const awt::WindowEvent& rEvent) 348*cdf0e10cSrcweir throw (RuntimeException) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir (void)rEvent; 351*cdf0e10cSrcweir ThrowIfDisposed(); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowShown (const lang::EventObject& rEvent) 358*cdf0e10cSrcweir throw (RuntimeException) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir (void)rEvent; 361*cdf0e10cSrcweir ThrowIfDisposed(); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowHidden (const lang::EventObject& rEvent) 368*cdf0e10cSrcweir throw (RuntimeException) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir (void)rEvent; 371*cdf0e10cSrcweir ThrowIfDisposed(); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir //----- lang::XEventListener -------------------------------------------------- 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::disposing (const lang::EventObject& rEvent) 380*cdf0e10cSrcweir throw (RuntimeException) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir if (rEvent.Source == mxBorderWindow) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir mxBorderWindow = NULL; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir //----------------------------------------------------------------------------- 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir void PresenterPaneBase::CreateWindows ( 395*cdf0e10cSrcweir const Reference<awt::XWindow>& rxParentWindow, 396*cdf0e10cSrcweir const bool bIsWindowVisibleOnCreation) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir if (mxPresenterHelper.is() && rxParentWindow.is()) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir mxBorderWindow = mxPresenterHelper->createWindow( 402*cdf0e10cSrcweir rxParentWindow, 403*cdf0e10cSrcweir sal_False, 404*cdf0e10cSrcweir bIsWindowVisibleOnCreation, 405*cdf0e10cSrcweir sal_False, 406*cdf0e10cSrcweir sal_False); 407*cdf0e10cSrcweir mxContentWindow = mxPresenterHelper->createWindow( 408*cdf0e10cSrcweir mxBorderWindow, 409*cdf0e10cSrcweir sal_False, 410*cdf0e10cSrcweir bIsWindowVisibleOnCreation, 411*cdf0e10cSrcweir sal_False, 412*cdf0e10cSrcweir sal_False); 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir Reference<awt::XWindow> PresenterPaneBase::GetBorderWindow (void) const 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir return mxBorderWindow; 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir void PresenterPaneBase::ToTop (void) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir if (mxPresenterHelper.is()) 430*cdf0e10cSrcweir mxPresenterHelper->toTop(mxContentWindow); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir void PresenterPaneBase::SetBackground (const SharedBitmapDescriptor& rpBackground) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir mpViewBackground = rpBackground; 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir void PresenterPaneBase::PaintBorderBackground ( 445*cdf0e10cSrcweir const awt::Rectangle& rBorderBox, 446*cdf0e10cSrcweir const awt::Rectangle& rUpdateBox) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir (void)rBorderBox; 449*cdf0e10cSrcweir (void)rUpdateBox; 450*cdf0e10cSrcweir /* 451*cdf0e10cSrcweir // The outer box of the border is given. We need the center and inner 452*cdf0e10cSrcweir // box as well. 453*cdf0e10cSrcweir awt::Rectangle aCenterBox ( 454*cdf0e10cSrcweir mxBorderPainter->removeBorder( 455*cdf0e10cSrcweir mxPaneId->getResourceURL(), 456*cdf0e10cSrcweir rBorderBox, 457*cdf0e10cSrcweir drawing::framework::BorderType_OUTER_BORDER)); 458*cdf0e10cSrcweir awt::Rectangle aInnerBox ( 459*cdf0e10cSrcweir mxBorderPainter->removeBorder( 460*cdf0e10cSrcweir mxPaneId->getResourceURL(), 461*cdf0e10cSrcweir rBorderBox, 462*cdf0e10cSrcweir drawing::framework::BorderType_TOTAL_BORDER)); 463*cdf0e10cSrcweir mpPresenterController->GetCanvasHelper()->Paint( 464*cdf0e10cSrcweir mpViewBackground, 465*cdf0e10cSrcweir mxBorderCanvas, 466*cdf0e10cSrcweir rUpdateBox, 467*cdf0e10cSrcweir aCenterBox, 468*cdf0e10cSrcweir aInnerBox); 469*cdf0e10cSrcweir */ 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir void PresenterPaneBase::PaintBorder (const awt::Rectangle& rUpdateBox) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir OSL_ASSERT(mxPaneId.is()); 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir if (mxBorderPainter.is() && mxBorderWindow.is() && mxBorderCanvas.is()) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); 482*cdf0e10cSrcweir awt::Rectangle aLocalBorderBox (0,0, aBorderBox.Width, aBorderBox.Height); 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir PaintBorderBackground(aLocalBorderBox, rUpdateBox); 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir if (mbHasCallout) 487*cdf0e10cSrcweir mxBorderPainter->paintBorderWithCallout( 488*cdf0e10cSrcweir mxPaneId->getResourceURL(), 489*cdf0e10cSrcweir mxBorderCanvas, 490*cdf0e10cSrcweir aLocalBorderBox, 491*cdf0e10cSrcweir rUpdateBox, 492*cdf0e10cSrcweir msTitle, 493*cdf0e10cSrcweir maCalloutAnchor); 494*cdf0e10cSrcweir else 495*cdf0e10cSrcweir mxBorderPainter->paintBorder( 496*cdf0e10cSrcweir mxPaneId->getResourceURL(), 497*cdf0e10cSrcweir mxBorderCanvas, 498*cdf0e10cSrcweir aLocalBorderBox, 499*cdf0e10cSrcweir rUpdateBox, 500*cdf0e10cSrcweir msTitle); 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir void PresenterPaneBase::LayoutContextWindow (void) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir OSL_ASSERT(mxPaneId.is()); 510*cdf0e10cSrcweir OSL_ASSERT(mxBorderWindow.is()); 511*cdf0e10cSrcweir OSL_ASSERT(mxContentWindow.is()); 512*cdf0e10cSrcweir if (mxBorderPainter.is() && mxPaneId.is() && mxBorderWindow.is() && mxContentWindow.is()) 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); 515*cdf0e10cSrcweir const awt::Rectangle aInnerBox (mxBorderPainter->removeBorder( 516*cdf0e10cSrcweir mxPaneId->getResourceURL(), 517*cdf0e10cSrcweir aBorderBox, 518*cdf0e10cSrcweir drawing::framework::BorderType_TOTAL_BORDER)); 519*cdf0e10cSrcweir mxContentWindow->setPosSize( 520*cdf0e10cSrcweir aInnerBox.X - aBorderBox.X, 521*cdf0e10cSrcweir aInnerBox.Y - aBorderBox.Y, 522*cdf0e10cSrcweir aInnerBox.Width, 523*cdf0e10cSrcweir aInnerBox.Height, 524*cdf0e10cSrcweir awt::PosSize::POSSIZE); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir bool PresenterPaneBase::IsVisible (void) const 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir Reference<awt::XWindow2> xWindow2 (mxBorderPainter, UNO_QUERY); 534*cdf0e10cSrcweir if (xWindow2.is()) 535*cdf0e10cSrcweir return xWindow2->isVisible(); 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir return false; 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir void PresenterPaneBase::ThrowIfDisposed (void) 544*cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir throw lang::DisposedException ( 549*cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 550*cdf0e10cSrcweir "PresenterPane object has already been disposed")), 551*cdf0e10cSrcweir static_cast<uno::XWeak*>(this)); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir } } // end of namespace ::sd::presenter 559