LCOV - code coverage report
Current view: top level - sd/source/ui/presenter - PresenterHelper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 97 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include <cstddef>
      23             : 
      24             : #include "PresenterHelper.hxx"
      25             : #include "CanvasUpdateRequester.hxx"
      26             : #include "PresenterCanvas.hxx"
      27             : #include "facreg.hxx"
      28             : #include <cppcanvas/vclfactory.hxx>
      29             : #include <com/sun/star/awt/WindowAttribute.hpp>
      30             : #include <com/sun/star/awt/WindowClass.hpp>
      31             : #include <com/sun/star/awt/WindowDescriptor.hpp>
      32             : #include <toolkit/helper/vclunohelper.hxx>
      33             : #include <vcl/svapp.hxx>
      34             : #include <vcl/window.hxx>
      35             : #include <vcl/wrkwin.hxx>
      36             : 
      37             : #include "res_bmp.hrc"
      38             : #include "sdresid.hxx"
      39             : 
      40             : using namespace ::com::sun::star;
      41             : using namespace ::com::sun::star::uno;
      42             : 
      43             : namespace sd { namespace presenter {
      44             : 
      45             : //===== PresenterHelper =======================================================
      46             : 
      47           0 : PresenterHelper::PresenterHelper (
      48             :     const Reference<XComponentContext>& rxContext)
      49             :     : PresenterHelperInterfaceBase(m_aMutex),
      50           0 :       mxComponentContext(rxContext)
      51             : {
      52           0 : }
      53             : 
      54           0 : PresenterHelper::~PresenterHelper()
      55             : {
      56           0 : }
      57             : 
      58             : //----- XInitialize -----------------------------------------------------------
      59             : 
      60           0 : void SAL_CALL PresenterHelper::initialize (const Sequence<Any>& rArguments)
      61             :     throw(Exception,RuntimeException, std::exception)
      62             : {
      63             :     (void)rArguments;
      64           0 : }
      65             : 
      66             : //----- XPaneHelper ----------------------------------------------------
      67             : 
      68           0 : Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
      69             :     const Reference<awt::XWindow>& rxParentWindow,
      70             :     sal_Bool bCreateSystemChildWindow,
      71             :     sal_Bool bInitiallyVisible,
      72             :     sal_Bool bEnableChildTransparentMode,
      73             :     sal_Bool bEnableParentClip)
      74             :     throw (css::uno::RuntimeException, std::exception)
      75             : {
      76           0 :     vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
      77             : 
      78             :     // Create a new window.
      79           0 :     vcl::Window* pWindow = NULL;
      80           0 :     if (bCreateSystemChildWindow)
      81             :     {
      82           0 :         pWindow = VclPtr<WorkWindow>::Create(pParentWindow, WB_SYSTEMCHILDWINDOW);
      83             :     }
      84             :     else
      85             :     {
      86           0 :         pWindow = VclPtr<vcl::Window>::Create(pParentWindow);
      87             :     }
      88           0 :     Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
      89             : 
      90           0 :     if (bEnableChildTransparentMode)
      91             :     {
      92             :         // Make the frame window transparent and make the parent able to
      93             :         // draw behind it.
      94           0 :         if (pParentWindow != NULL)
      95           0 :             pParentWindow->EnableChildTransparentMode(true);
      96             :     }
      97             : 
      98           0 :     pWindow->Show(bInitiallyVisible);
      99             : 
     100           0 :     pWindow->SetMapMode(MAP_PIXEL);
     101           0 :     pWindow->SetBackground();
     102           0 :     if ( ! bEnableParentClip)
     103             :     {
     104           0 :         pWindow->SetParentClipMode(ParentClipMode::NoClip);
     105           0 :         pWindow->SetPaintTransparent(true);
     106             :     }
     107             :     else
     108             :     {
     109           0 :         pWindow->SetParentClipMode(ParentClipMode::Clip);
     110           0 :         pWindow->SetPaintTransparent(false);
     111             :     }
     112             : 
     113           0 :     return xWindow;
     114             : }
     115             : 
     116           0 : Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createSharedCanvas (
     117             :     const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
     118             :     const Reference<awt::XWindow>& rxUpdateWindow,
     119             :     const Reference<rendering::XCanvas>& rxSharedCanvas,
     120             :     const Reference<awt::XWindow>& rxSharedWindow,
     121             :     const Reference<awt::XWindow>& rxWindow)
     122             :     throw (css::uno::RuntimeException, std::exception)
     123             : {
     124           0 :     if ( ! rxSharedCanvas.is()
     125           0 :         || ! rxSharedWindow.is()
     126           0 :         || ! rxWindow.is())
     127             :     {
     128           0 :         throw RuntimeException("illegal argument", static_cast<XWeak*>(this));
     129             :     }
     130             : 
     131           0 :     if (rxWindow == rxSharedWindow)
     132           0 :         return rxSharedCanvas;
     133             :     else
     134             :         return new PresenterCanvas(
     135             :             rxUpdateCanvas,
     136             :             rxUpdateWindow,
     137             :             rxSharedCanvas,
     138             :             rxSharedWindow,
     139           0 :             rxWindow);
     140             : }
     141             : 
     142           0 : Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
     143             :     const Reference<awt::XWindow>& rxWindow,
     144             :     sal_Int16 nRequestedCanvasFeatures,
     145             :     const OUString& rsOptionalCanvasServiceName)
     146             :     throw (css::uno::RuntimeException, std::exception)
     147             : {
     148             :     (void)nRequestedCanvasFeatures;
     149             : 
     150             :     // No shared window is given or an explicit canvas service name is
     151             :     // specified.  Create a new canvas.
     152           0 :     vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
     153           0 :     if (pWindow != NULL)
     154             :     {
     155           0 :         Sequence<Any> aArg (5);
     156             : 
     157             :         // common: first any is VCL pointer to window (for VCL canvas)
     158           0 :         aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
     159           0 :         aArg[1] = Any();
     160           0 :         aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
     161           0 :         aArg[3] = makeAny(sal_False);
     162           0 :         aArg[4] = makeAny(rxWindow);
     163             : 
     164             :         Reference<lang::XMultiServiceFactory> xFactory (
     165           0 :             mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
     166             :         return Reference<rendering::XCanvas>(
     167           0 :             xFactory->createInstanceWithArguments(
     168           0 :                 !rsOptionalCanvasServiceName.isEmpty()
     169             :                     ? rsOptionalCanvasServiceName
     170             :                     : OUString("com.sun.star.rendering.Canvas.VCL"),
     171           0 :                 aArg),
     172           0 :             UNO_QUERY);
     173             :     }
     174             :     else
     175           0 :         throw RuntimeException();
     176             : }
     177             : 
     178           0 : void SAL_CALL PresenterHelper::toTop (
     179             :     const Reference<awt::XWindow>& rxWindow)
     180             :     throw (css::uno::RuntimeException, std::exception)
     181             : {
     182           0 :     vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
     183           0 :     if (pWindow != NULL)
     184             :     {
     185           0 :         pWindow->ToTop();
     186           0 :         pWindow->SetZOrder(NULL, ZOrderFlags::Last);
     187             :     }
     188           0 : }
     189             : 
     190             : namespace {
     191             : 
     192             : struct IdMapEntry {
     193             :     char const * sid;
     194             :     sal_uInt32 nid;
     195             : };
     196             : 
     197             : }
     198             : 
     199           0 : Reference<rendering::XBitmap> SAL_CALL PresenterHelper::loadBitmap (
     200             :     const OUString& id,
     201             :     const Reference<rendering::XCanvas>& rxCanvas)
     202             :     throw (RuntimeException, std::exception)
     203             : {
     204           0 :     if ( ! rxCanvas.is())
     205           0 :         return NULL;
     206             : 
     207             :     static IdMapEntry const map[] = {
     208             :         { "bitmaps/Background.png", BMP_PRESENTERSCREEN_BACKGROUND },
     209             :         { "bitmaps/Animation.png",
     210             :           BMP_PRESENTERSCREEN_ANIMATION },
     211             :         { "bitmaps/Transition.png",
     212             :           BMP_PRESENTERSCREEN_TRANSITION },
     213             :         { "bitmaps/BorderActiveBottom.png",
     214             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM },
     215             :         { "bitmaps/BorderActiveBottomCallout.png",
     216             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_CALLOUT },
     217             :         { "bitmaps/BorderActiveBottomLeft.png",
     218             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_LEFT },
     219             :         { "bitmaps/BorderActiveBottomRight.png",
     220             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_RIGHT },
     221             :         { "bitmaps/BorderActiveLeft.png",
     222             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_LEFT },
     223             :         { "bitmaps/BorderActiveRight.png",
     224             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_RIGHT },
     225             :         { "bitmaps/BorderActiveTop.png",
     226             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP },
     227             :         { "bitmaps/BorderActiveTopLeft.png",
     228             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_LEFT },
     229             :         { "bitmaps/BorderActiveTopRight.png",
     230             :           BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_RIGHT },
     231             :         { "bitmaps/BorderBottom.png", BMP_PRESENTERSCREEN_BORDER_BOTTOM },
     232             :         { "bitmaps/BorderBottomLeft.png",
     233             :           BMP_PRESENTERSCREEN_BORDER_BOTTOM_LEFT },
     234             :         { "bitmaps/BorderBottomRight.png",
     235             :           BMP_PRESENTERSCREEN_BORDER_BOTTOM_RIGHT },
     236             :         { "bitmaps/BorderCurrentSlideBottom.png",
     237             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM },
     238             :         { "bitmaps/BorderCurrentSlideBottomLeft.png",
     239             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_LEFT },
     240             :         { "bitmaps/BorderCurrentSlideBottomRight.png",
     241             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_RIGHT },
     242             :         { "bitmaps/BorderCurrentSlideLeft.png",
     243             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_LEFT },
     244             :         { "bitmaps/BorderCurrentSlideRight.png",
     245             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_RIGHT },
     246             :         { "bitmaps/BorderCurrentSlideTop.png",
     247             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP },
     248             :         { "bitmaps/BorderCurrentSlideTopLeft.png",
     249             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_LEFT },
     250             :         { "bitmaps/BorderCurrentSlideTopRight.png",
     251             :           BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_RIGHT },
     252             :         { "bitmaps/BorderLeft.png", BMP_PRESENTERSCREEN_BORDER_LEFT },
     253             :         { "bitmaps/BorderRight.png", BMP_PRESENTERSCREEN_BORDER_RIGHT },
     254             :         { "bitmaps/BorderToolbarBottom.png",
     255             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_BOTTOM },
     256             :         { "bitmaps/BorderToolbarLeft.png",
     257             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_LEFT },
     258             :         { "bitmaps/BorderToolbarRight.png",
     259             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_RIGHT },
     260             :         { "bitmaps/BorderToolbarTop.png",
     261             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP },
     262             :         { "bitmaps/BorderToolbarTopLeft.png",
     263             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_LEFT },
     264             :         { "bitmaps/BorderToolbarTopRight.png",
     265             :           BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_RIGHT },
     266             :         { "bitmaps/BorderTop.png", BMP_PRESENTERSCREEN_BORDER_TOP },
     267             :         { "bitmaps/BorderTopLeft.png", BMP_PRESENTERSCREEN_BORDER_TOP_LEFT },
     268             :         { "bitmaps/BorderTopRight.png", BMP_PRESENTERSCREEN_BORDER_TOP_RIGHT },
     269             :         { "bitmaps/ButtonEffectNextDisabled.png",
     270             :           BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_DISABLED },
     271             :         { "bitmaps/ButtonEffectNextMouseOver.png",
     272             :           BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_MOUSE_OVER },
     273             :         { "bitmaps/ButtonEffectNextNormal.png",
     274             :           BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_NORMAL },
     275             :         { "bitmaps/ButtonEffectNextSelected.png",
     276             :           BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_SELECTED },
     277             :         { "bitmaps/ButtonFrameCenterMouseOver.png",
     278             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_MOUSE_OVER },
     279             :         { "bitmaps/ButtonFrameCenterNormal.png",
     280             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_NORMAL },
     281             :         { "bitmaps/ButtonFrameLeftMouseOver.png",
     282             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_MOUSE_OVER },
     283             :         { "bitmaps/ButtonFrameLeftNormal.png",
     284             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_NORMAL },
     285             :         { "bitmaps/ButtonFrameRightMouseOver.png",
     286             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_MOUSE_OVER },
     287             :         { "bitmaps/ButtonFrameRightNormal.png",
     288             :           BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_NORMAL },
     289             :         { "bitmaps/ButtonHelpDisabled.png",
     290             :           BMP_PRESENTERSCREEN_BUTTON_HELP_DISABLED },
     291             :         { "bitmaps/ButtonHelpMouseOver.png",
     292             :           BMP_PRESENTERSCREEN_BUTTON_HELP_MOUSE_OVER },
     293             :         { "bitmaps/ButtonHelpNormal.png",
     294             :           BMP_PRESENTERSCREEN_BUTTON_HELP_NORMAL },
     295             :         { "bitmaps/ButtonHelpSelected.png",
     296             :           BMP_PRESENTERSCREEN_BUTTON_HELP_SELECTED },
     297             :         { "bitmaps/ButtonMinusDisabled.png",
     298             :           BMP_PRESENTERSCREEN_BUTTON_MINUS_DISABLED },
     299             :         { "bitmaps/ButtonMinusMouseOver.png",
     300             :           BMP_PRESENTERSCREEN_BUTTON_MINUS_MOUSE_OVER },
     301             :         { "bitmaps/ButtonMinusNormal.png",
     302             :           BMP_PRESENTERSCREEN_BUTTON_MINUS_NORMAL },
     303             :         { "bitmaps/ButtonMinusSelected.png",
     304             :           BMP_PRESENTERSCREEN_BUTTON_MINUS_SELECTED },
     305             :         { "bitmaps/ButtonNotesDisabled.png",
     306             :           BMP_PRESENTERSCREEN_BUTTON_NOTES_DISABLED },
     307             :         { "bitmaps/ButtonNotesMouseOver.png",
     308             :           BMP_PRESENTERSCREEN_BUTTON_NOTES_MOUSE_OVER },
     309             :         { "bitmaps/ButtonNotesNormal.png",
     310             :           BMP_PRESENTERSCREEN_BUTTON_NOTES_NORMAL },
     311             :         { "bitmaps/ButtonNotesSelected.png",
     312             :           BMP_PRESENTERSCREEN_BUTTON_NOTES_SELECTED },
     313             :         { "bitmaps/ButtonPlusDisabled.png",
     314             :           BMP_PRESENTERSCREEN_BUTTON_PLUS_DISABLED },
     315             :         { "bitmaps/ButtonPlusMouseOver.png",
     316             :           BMP_PRESENTERSCREEN_BUTTON_PLUS_MOUSE_OVER },
     317             :         { "bitmaps/ButtonPlusNormal.png",
     318             :           BMP_PRESENTERSCREEN_BUTTON_PLUS_NORMAL },
     319             :         { "bitmaps/ButtonPlusSelected.png",
     320             :           BMP_PRESENTERSCREEN_BUTTON_PLUS_SELECTED },
     321             :         { "bitmaps/ButtonSlideNextDisabled.png",
     322             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_DISABLED },
     323             :         { "bitmaps/ButtonSlideNextMouseOver.png",
     324             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_MOUSE_OVER },
     325             :         { "bitmaps/ButtonSlideNextNormal.png",
     326             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_NORMAL },
     327             :         { "bitmaps/ButtonSlidePreviousDisabled.png",
     328             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_DISABLED },
     329             :         { "bitmaps/ButtonSlidePreviousMouseOver.png",
     330             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_MOUSE_OVER },
     331             :         { "bitmaps/ButtonSlidePreviousNormal.png",
     332             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_NORMAL },
     333             :         { "bitmaps/ButtonSlidePreviousSelected.png",
     334             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_SELECTED },
     335             :         { "bitmaps/ButtonSlideSorterDisabled.png",
     336             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_DISABLED },
     337             :         { "bitmaps/ButtonSlideSorterMouseOver.png",
     338             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_MOUSE_OVER },
     339             :         { "bitmaps/ButtonSlideSorterNormal.png",
     340             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_NORMAL },
     341             :         { "bitmaps/ButtonSlideSorterSelected.png",
     342             :           BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_SELECTED },
     343             :         { "bitmaps/ButtonSwitchMonitorMouseOver.png",
     344             :           BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_MOUSE_OVER },
     345             :         { "bitmaps/ButtonSwitchMonitorNormal.png",
     346             :           BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_NORMAL },
     347             :         { "bitmaps/LabelMouseOverCenter.png",
     348             :           BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_CENTER },
     349             :         { "bitmaps/LabelMouseOverLeft.png",
     350             :           BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_LEFT },
     351             :         { "bitmaps/LabelMouseOverRight.png",
     352             :           BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_RIGHT },
     353             :         { "bitmaps/ScrollbarArrowDownDisabled.png",
     354             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_DISABLED },
     355             :         { "bitmaps/ScrollbarArrowDownMouseOver.png",
     356             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_MOUSE_OVER },
     357             :         { "bitmaps/ScrollbarArrowDownNormal.png",
     358             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_NORMAL },
     359             :         { "bitmaps/ScrollbarArrowDownSelected.png",
     360             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_SELECTED },
     361             :         { "bitmaps/ScrollbarArrowUpDisabled.png",
     362             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_DISABLED },
     363             :         { "bitmaps/ScrollbarArrowUpMouseOver.png",
     364             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_MOUSE_OVER },
     365             :         { "bitmaps/ScrollbarArrowUpNormal.png",
     366             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_NORMAL },
     367             :         { "bitmaps/ScrollbarArrowUpSelected.png",
     368             :           BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_SELECTED },
     369             :         { "bitmaps/ScrollbarPagerMiddleMouseOver.png",
     370             :           BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_MOUSE_OVER },
     371             :         { "bitmaps/ScrollbarPagerMiddleNormal.png",
     372             :           BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_NORMAL },
     373             :         { "bitmaps/ScrollbarThumbBottomMouseOver.png",
     374             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_MOUSE_OVER },
     375             :         { "bitmaps/ScrollbarThumbBottomNormal.png",
     376             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_NORMAL },
     377             :         { "bitmaps/ScrollbarThumbMiddleMouseOver.png",
     378             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_MOUSE_OVER },
     379             :         { "bitmaps/ScrollbarThumbMiddleNormal.png",
     380             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_NORMAL },
     381             :         { "bitmaps/ScrollbarThumbTopMouseOver.png",
     382             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_MOUSE_OVER },
     383             :         { "bitmaps/ScrollbarThumbTopNormal.png",
     384             :           BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_NORMAL },
     385             :         { "bitmaps/ViewBackground.png", BMP_PRESENTERSCREEN_VIEW_BACKGROUND }
     386             :     };
     387           0 :     sal_uInt32 nid = 0;
     388           0 :     for (std::size_t i = 0; i != SAL_N_ELEMENTS(map); ++i) {
     389           0 :         if (id.equalsAscii(map[i].sid)) {
     390           0 :             nid = map[i].nid;
     391           0 :             break;
     392             :         }
     393             :     }
     394           0 :     if (nid == 0) {
     395           0 :         return 0;
     396             :     }
     397             : 
     398           0 :     ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
     399             : 
     400             :     const cppcanvas::CanvasSharedPtr pCanvas (
     401             :         cppcanvas::VCLFactory::createCanvas(
     402           0 :             Reference<css::rendering::XCanvas>(rxCanvas,UNO_QUERY)));
     403             : 
     404           0 :     if (pCanvas.get() != NULL)
     405             :     {
     406           0 :         BitmapEx aBitmapEx = SdResId(nid);
     407             :         cppcanvas::BitmapSharedPtr xBitmap(
     408             :             cppcanvas::VCLFactory::createBitmap(pCanvas,
     409           0 :                 aBitmapEx));
     410           0 :         if (xBitmap.get() == NULL)
     411           0 :             return NULL;
     412           0 :         return xBitmap->getUNOBitmap();
     413             :     }
     414             : 
     415           0 :     return NULL;
     416             : }
     417             : 
     418           0 : void SAL_CALL PresenterHelper::captureMouse (
     419             :     const Reference<awt::XWindow>& rxWindow)
     420             :     throw (RuntimeException, std::exception)
     421             : {
     422           0 :     ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
     423             : 
     424             :     // Capture the mouse (if not already done.)
     425           0 :     vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
     426           0 :     if (pWindow != NULL && ! pWindow->IsMouseCaptured())
     427             :     {
     428           0 :         pWindow->CaptureMouse();
     429           0 :     }
     430           0 : }
     431             : 
     432           0 : void SAL_CALL PresenterHelper::releaseMouse (const Reference<awt::XWindow>& rxWindow)
     433             :     throw (RuntimeException, std::exception)
     434             : {
     435           0 :     ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
     436             : 
     437             :     // Release the mouse (if not already done.)
     438           0 :     vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
     439           0 :     if (pWindow != NULL && pWindow->IsMouseCaptured())
     440             :     {
     441           0 :         pWindow->ReleaseMouse();
     442           0 :     }
     443           0 : }
     444             : 
     445           0 : awt::Rectangle PresenterHelper::getWindowExtentsRelative (
     446             :     const Reference<awt::XWindow>& rxChildWindow,
     447             :     const Reference<awt::XWindow>& rxParentWindow)
     448             :     throw (RuntimeException, std::exception)
     449             : {
     450           0 :     vcl::Window* pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
     451           0 :     vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
     452           0 :     if (pChildWindow!=NULL && pParentWindow!=NULL)
     453             :     {
     454           0 :         Rectangle aBox (pChildWindow->GetWindowExtentsRelative(pParentWindow));
     455           0 :         return awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
     456             :     }
     457             :     else
     458           0 :         return awt::Rectangle();
     459             : }
     460             : 
     461             : } } // end of namespace ::sd::presenter
     462             : 
     463             : 
     464             : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
     465           0 : com_sun_star_comp_Draw_PresenterHelper_get_implementation(::com::sun::star::uno::XComponentContext* context,
     466             :                                                           ::com::sun::star::uno::Sequence<css::uno::Any> const &)
     467             : {
     468           0 :     return cppu::acquire(new sd::presenter::PresenterHelper(context));
     469             : }
     470             : 
     471             : 
     472             : 
     473             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11