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

Generated by: LCOV version 1.10