LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofsdrmediaobj.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 43 0.0 %
Date: 2014-04-11 Functions: 0 7 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 <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
      22             : #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
      23             : #include <svx/sdr/contact/displayinfo.hxx>
      24             : #include <svx/sdr/contact/objectcontact.hxx>
      25             : #include <svx/svdomedia.hxx>
      26             : #include <svx/svdpagv.hxx>
      27             : #include <vcl/outdev.hxx>
      28             : #include <vcl/window.hxx>
      29             : #include <avmedia/mediaitem.hxx>
      30             : #include "sdrmediawindow.hxx"
      31             : 
      32             : 
      33             : 
      34             : namespace sdr { namespace contact {
      35             : 
      36             : 
      37             : // - ViewObjectContactOfSdrMediaObj -
      38             : 
      39             : 
      40           0 : ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& rObjectContact,
      41             :                                                                 ViewContact& rViewContact,
      42             :                                                                 const ::avmedia::MediaItem& rMediaItem ) :
      43             :     ViewObjectContactOfSdrObj( rObjectContact, rViewContact ),
      44           0 :     mpMediaWindow( NULL )
      45             : {
      46           0 :     Window* pWindow = getWindow();
      47             : 
      48           0 :     if( pWindow )
      49             :     {
      50           0 :         mpMediaWindow = new SdrMediaWindow( pWindow, *this );
      51           0 :         mpMediaWindow->hide();
      52           0 :         executeMediaItem( rMediaItem );
      53             :     }
      54           0 : }
      55             : 
      56             : 
      57             : 
      58           0 : ViewObjectContactOfSdrMediaObj::~ViewObjectContactOfSdrMediaObj()
      59             : {
      60           0 :     delete mpMediaWindow;
      61           0 :     mpMediaWindow = NULL;
      62           0 : }
      63             : 
      64             : 
      65             : 
      66           0 : Window* ViewObjectContactOfSdrMediaObj::getWindow() const
      67             : {
      68           0 :     Window* pRetval = 0;
      69             : 
      70           0 :     boost::optional<const OutputDevice&> oPageOutputDev = getPageViewOutputDevice();
      71           0 :     if( oPageOutputDev )
      72             :     {
      73           0 :         if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType())
      74             :         {
      75           0 :             pRetval = static_cast< Window* >(&const_cast<OutputDevice&>(oPageOutputDev.get()));
      76             :         }
      77             :     }
      78             : 
      79           0 :     return pRetval;
      80             : }
      81             : 
      82             : 
      83             : 
      84           0 : Size ViewObjectContactOfSdrMediaObj::getPreferredSize() const
      85             : {
      86           0 :     Size aRet;
      87             : 
      88           0 :     if( mpMediaWindow )
      89           0 :         aRet = mpMediaWindow->getPreferredSize();
      90             : 
      91           0 :     return aRet;
      92             : }
      93             : 
      94             : 
      95             : 
      96           0 : void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
      97             : {
      98           0 :     if( mpMediaWindow )
      99             :     {
     100           0 :         mpMediaWindow->updateMediaItem( rItem );
     101             : 
     102             :         // show/hide is now dependent of play state
     103           0 :         if(avmedia::MEDIASTATE_STOP == rItem.getState())
     104             :         {
     105           0 :             mpMediaWindow->hide();
     106             :         }
     107             :         else
     108             :         {
     109           0 :             basegfx::B2DRange aViewRange(getObjectRange());
     110           0 :             aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation());
     111             : 
     112             :             const Rectangle aViewRectangle(
     113           0 :                 (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()),
     114           0 :                 (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY()));
     115             : 
     116           0 :             mpMediaWindow->setPosSize(aViewRectangle);
     117           0 :             mpMediaWindow->show();
     118             :         }
     119             :     }
     120           0 : }
     121             : 
     122             : 
     123             : 
     124           0 : void ViewObjectContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
     125             : {
     126           0 :     if( mpMediaWindow )
     127             :     {
     128           0 :         ::avmedia::MediaItem aUpdatedItem;
     129             : 
     130           0 :         mpMediaWindow->executeMediaItem( rItem );
     131             : 
     132             :         // query new properties after trying to set the new properties
     133           0 :         updateMediaItem( aUpdatedItem );
     134           0 :         static_cast< ViewContactOfSdrMediaObj& >( GetViewContact() ).mediaPropertiesChanged( aUpdatedItem );
     135             :     }
     136           0 : }
     137             : 
     138             : 
     139             : 
     140             : }} // end of namespace sdr::contact
     141             : 
     142             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10