LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/contact - sdrmediawindow.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 67 0.0 %
Date: 2012-12-27 Functions: 0 12 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             : 
      21             : #include "sdrmediawindow.hxx"
      22             : #include <svtools/transfer.hxx>
      23             : 
      24             : #include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
      25             : #include <vcl/window.hxx>
      26             : 
      27             : namespace sdr { namespace contact {
      28             : 
      29             : // ------------------
      30             : // - SdrMediaWindow -
      31             : // ------------------
      32             : 
      33           0 : SdrMediaWindow::SdrMediaWindow( Window* pParent, ViewObjectContactOfSdrMediaObj& rViewObjContact ) :
      34             :     ::avmedia::MediaWindow( pParent, false ),
      35           0 :     mrViewObjectContactOfSdrMediaObj( rViewObjContact )
      36             : {
      37           0 : }
      38             : 
      39             : // ------------------------------------------------------------------------------
      40             : 
      41           0 : SdrMediaWindow::~SdrMediaWindow()
      42             : {
      43           0 : }
      44             : 
      45             : // ------------------------------------------------------------------------------
      46             : 
      47           0 : void SdrMediaWindow::MouseMove( const MouseEvent& rMEvt )
      48             : {
      49           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
      50             : 
      51           0 :     if( pWindow && getWindow() )
      52             :     {
      53           0 :         const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
      54           0 :                                               rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
      55             : 
      56           0 :         pWindow->MouseMove( aTransformedEvent );
      57           0 :         setPointer( pWindow->GetPointer() );
      58             :     }
      59           0 : }
      60             : 
      61             : // ------------------------------------------------------------------------------
      62             : 
      63           0 : void SdrMediaWindow::MouseButtonDown( const MouseEvent& rMEvt )
      64             : {
      65           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
      66             : 
      67           0 :     if( pWindow && getWindow() )
      68             :     {
      69           0 :         const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
      70           0 :                                               rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
      71             : 
      72           0 :         pWindow->MouseButtonDown( aTransformedEvent );
      73             :     }
      74           0 : }
      75             : 
      76             : // ------------------------------------------------------------------------------
      77             : 
      78           0 : void SdrMediaWindow::MouseButtonUp( const MouseEvent& rMEvt )
      79             : {
      80           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
      81             : 
      82           0 :     if( pWindow && getWindow() )
      83             :     {
      84           0 :         const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
      85           0 :                                               rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
      86             : 
      87           0 :         pWindow->MouseButtonUp( aTransformedEvent );
      88             :     }
      89           0 : }
      90             : 
      91             : // ------------------------------------------------------------------------------
      92             : 
      93           0 : void SdrMediaWindow::KeyInput( const KeyEvent& rKEvt )
      94             : {
      95           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
      96             : 
      97           0 :     if( pWindow )
      98           0 :         pWindow->KeyInput( rKEvt );
      99           0 : }
     100             : 
     101             : // ------------------------------------------------------------------------------
     102             : 
     103           0 : void SdrMediaWindow::KeyUp( const KeyEvent& rKEvt )
     104             : {
     105           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
     106             : 
     107           0 :     if( pWindow )
     108           0 :         pWindow->KeyUp( rKEvt );
     109           0 : }
     110             : 
     111             : // ------------------------------------------------------------------------------
     112             : 
     113           0 : void SdrMediaWindow::Command( const CommandEvent& rCEvt )
     114             : {
     115           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
     116             : 
     117           0 :     if( pWindow && getWindow() )
     118             :     {
     119           0 :         const CommandEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
     120           0 :                                                 rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
     121             : 
     122           0 :         pWindow->Command( aTransformedEvent );
     123             :     }
     124           0 : }
     125             : 
     126             : // ------------------------------------------------------------------------------
     127             : 
     128           0 : sal_Int8 SdrMediaWindow::AcceptDrop( const AcceptDropEvent& rEvt )
     129             : {
     130           0 :     Window*     pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
     131           0 :     sal_Int8    nRet = DND_ACTION_NONE;
     132             : 
     133           0 :     if( pWindow )
     134             :     {
     135           0 :         DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
     136             : 
     137           0 :         if( pDropTargetHelper )
     138             :         {
     139           0 :             nRet = pDropTargetHelper->AcceptDrop( rEvt );
     140             :         }
     141             :     }
     142             : 
     143           0 :     return( nRet );
     144             : }
     145             : 
     146             : // ------------------------------------------------------------------------------
     147             : 
     148           0 : sal_Int8 SdrMediaWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
     149             : {
     150           0 :     Window*     pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
     151           0 :     sal_Int8    nRet = DND_ACTION_NONE;
     152             : 
     153           0 :     if( pWindow )
     154             :     {
     155           0 :         DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
     156             : 
     157           0 :         if( pDropTargetHelper )
     158             :         {
     159           0 :             nRet = pDropTargetHelper->ExecuteDrop( rEvt );
     160             :         }
     161             :     }
     162             : 
     163           0 :     return( nRet );
     164             : }
     165             : 
     166             : // ------------------------------------------------------------------------------
     167             : 
     168           0 : void SdrMediaWindow::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
     169             : {
     170           0 :     Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
     171             : 
     172           0 :     if( pWindow )
     173             :     {
     174           0 :         DragSourceHelper* pDragSourceHelper = dynamic_cast< DragSourceHelper* >( pWindow );
     175             : 
     176           0 :         if( pDragSourceHelper )
     177             :         {
     178           0 :             pDragSourceHelper->StartDrag( nAction, rPosPixel );
     179             :         }
     180             :     }
     181           0 : }
     182             : 
     183             : } }
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10