LCOV - code coverage report
Current view: top level - avmedia/source/framework - mediatoolbox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 46 0.0 %
Date: 2014-04-14 Functions: 0 14 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 <avmedia/mediatoolbox.hxx>
      21             : #include <avmedia/mediaitem.hxx>
      22             : #include "mediacontrol.hxx"
      23             : 
      24             : #include <sfx2/app.hxx>
      25             : #include <sfx2/bindings.hxx>
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <sfx2/sfxsids.hrc>
      28             : 
      29             : using namespace ::com::sun::star;
      30             : 
      31             : namespace avmedia
      32             : {
      33             : 
      34             : 
      35             : // - MediaToolboxControl -
      36             : 
      37             : 
      38             : class MediaToolBoxControl_Impl : public MediaControl
      39             : {
      40             : public:
      41             : 
      42             :                             MediaToolBoxControl_Impl( Window& rParent, MediaToolBoxControl& rControl );
      43             :                             virtual ~MediaToolBoxControl_Impl();
      44             : 
      45             :     void                    update() SAL_OVERRIDE;
      46             :     void                    execute( const MediaItem& rItem ) SAL_OVERRIDE;
      47             : 
      48             : private:
      49             : 
      50             :     MediaToolBoxControl*    mpToolBoxControl;
      51             : };
      52             : 
      53             : 
      54             : 
      55           0 : MediaToolBoxControl_Impl::MediaToolBoxControl_Impl( Window& rParent, MediaToolBoxControl& rControl ) :
      56             :     MediaControl( &rParent, MEDIACONTROLSTYLE_SINGLELINE ),
      57           0 :     mpToolBoxControl( &rControl )
      58             : {
      59           0 :     SetSizePixel( getMinSizePixel() );
      60           0 : }
      61             : 
      62             : 
      63             : 
      64           0 : MediaToolBoxControl_Impl::~MediaToolBoxControl_Impl()
      65             : {
      66           0 : }
      67             : 
      68             : 
      69             : 
      70           0 : void MediaToolBoxControl_Impl::update()
      71             : {
      72           0 :     mpToolBoxControl->implUpdateMediaControl();
      73           0 : }
      74             : 
      75             : 
      76             : 
      77           0 : void MediaToolBoxControl_Impl::execute( const MediaItem& rItem )
      78             : {
      79           0 :     mpToolBoxControl->implExecuteMediaControl( rItem );
      80           0 : }
      81             : 
      82             : 
      83             : // - MediaToolBoxControl -
      84             : 
      85             : 
      86           0 : SFX_IMPL_TOOLBOX_CONTROL( ::avmedia::MediaToolBoxControl, ::avmedia::MediaItem );
      87             : 
      88             : 
      89             : 
      90           0 : MediaToolBoxControl::MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      91           0 :     SfxToolBoxControl( nSlotId, nId, rTbx )
      92             : {
      93           0 :         rTbx.Invalidate();
      94           0 : }
      95             : 
      96             : 
      97             : 
      98           0 : MediaToolBoxControl::~MediaToolBoxControl()
      99             : {
     100           0 : }
     101             : 
     102             : 
     103             : 
     104           0 : void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
     105             : 
     106             : {
     107           0 :     MediaToolBoxControl_Impl* pCtrl = static_cast< MediaToolBoxControl_Impl* >( GetToolBox().GetItemWindow( GetId() ) );
     108             : 
     109             :     DBG_ASSERT( pCtrl, "MediaToolBoxControl::StateChanged: media control not found" );
     110             : 
     111           0 :     if( eState == SFX_ITEM_DISABLED )
     112             :     {
     113           0 :         pCtrl->Enable( false, false );
     114           0 :         pCtrl->SetText( OUString() );
     115             : 
     116           0 :         const MediaItem aEmptyMediaItem( 0, AVMEDIA_SETMASK_ALL );
     117           0 :         pCtrl->setState( aEmptyMediaItem );
     118             :     }
     119             :     else
     120             :     {
     121           0 :         pCtrl->Enable( true, false );
     122             : 
     123           0 :         const MediaItem* pMediaItem = PTR_CAST( MediaItem, pState );
     124             : 
     125           0 :         if( pMediaItem && ( SFX_ITEM_AVAILABLE == eState ) )
     126           0 :             pCtrl->setState( *pMediaItem );
     127             :     }
     128           0 : }
     129             : 
     130             : 
     131             : 
     132           0 : Window* MediaToolBoxControl::CreateItemWindow( Window *pParent )
     133             : {
     134           0 :     return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL );
     135             : }
     136             : 
     137             : 
     138             : 
     139           0 : void MediaToolBoxControl::implUpdateMediaControl()
     140             : {
     141           0 :     updateStatus( ".uno:AVMediaToolBox" );
     142           0 : }
     143             : 
     144             : 
     145             : 
     146           0 : void MediaToolBoxControl::implExecuteMediaControl( const MediaItem& rItem )
     147             : {
     148           0 :     MediaItem                               aExecItem( SID_AVMEDIA_TOOLBOX );
     149           0 :     uno::Sequence< beans::PropertyValue >   aArgs( 1 );
     150           0 :     uno::Any                                aAny;
     151             : 
     152           0 :     aExecItem.merge( rItem );
     153           0 :     aExecItem.QueryValue( aAny );
     154           0 :     aArgs[ 0 ].Name = "AVMediaToolBox" ;
     155           0 :     aArgs[ 0 ].Value = aAny;
     156             : 
     157           0 :     Dispatch( ".uno:AVMediaToolBox" , aArgs );
     158           0 : }
     159             : 
     160             : }
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10