LCOV - code coverage report
Current view: top level - avmedia/source/framework - mediatoolbox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 46 2.2 %
Date: 2012-08-25 Functions: 1 14 7.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 64 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <avmedia/mediatoolbox.hxx>
      30                 :            : #include <avmedia/mediaitem.hxx>
      31                 :            : #include "mediacontrol.hxx"
      32                 :            : 
      33                 :            : #include <sfx2/app.hxx>
      34                 :            : #include <sfx2/bindings.hxx>
      35                 :            : #include <sfx2/dispatch.hxx>
      36                 :            : #include <sfx2/sfxsids.hrc>
      37                 :            : 
      38                 :            : using namespace ::com::sun::star;
      39                 :            : 
      40                 :            : namespace avmedia
      41                 :            : {
      42                 :            : 
      43                 :            : // -----------------------
      44                 :            : // - MediaToolboxControl -
      45                 :            : // -----------------------
      46                 :            : 
      47                 :            : class MediaToolBoxControl_Impl : public MediaControl
      48                 :            : {
      49                 :            : public:
      50                 :            : 
      51                 :            :                             MediaToolBoxControl_Impl( Window& rParent, MediaToolBoxControl& rControl );
      52                 :            :                             ~MediaToolBoxControl_Impl();
      53                 :            : 
      54                 :            :     void                    update();
      55                 :            :     void                    execute( const MediaItem& rItem );
      56                 :            : 
      57                 :            : private:
      58                 :            : 
      59                 :            :     MediaToolBoxControl*    mpToolBoxControl;
      60                 :            : };
      61                 :            : 
      62                 :            : // ---------------------------------------------------------------------
      63                 :            : 
      64                 :          0 : MediaToolBoxControl_Impl::MediaToolBoxControl_Impl( Window& rParent, MediaToolBoxControl& rControl ) :
      65                 :            :     MediaControl( &rParent, MEDIACONTROLSTYLE_SINGLELINE ),
      66                 :          0 :     mpToolBoxControl( &rControl )
      67                 :            : {
      68 [ #  # ][ #  # ]:          0 :     SetSizePixel( getMinSizePixel() );
      69                 :          0 : }
      70                 :            : 
      71                 :            : // ---------------------------------------------------------------------
      72                 :            : 
      73                 :          0 : MediaToolBoxControl_Impl::~MediaToolBoxControl_Impl()
      74                 :            : {
      75         [ #  # ]:          0 : }
      76                 :            : 
      77                 :            : // ---------------------------------------------------------------------
      78                 :            : 
      79                 :          0 : void MediaToolBoxControl_Impl::update()
      80                 :            : {
      81                 :          0 :     mpToolBoxControl->implUpdateMediaControl();
      82                 :          0 : }
      83                 :            : 
      84                 :            : // ---------------------------------------------------------------------
      85                 :            : 
      86                 :          0 : void MediaToolBoxControl_Impl::execute( const MediaItem& rItem )
      87                 :            : {
      88                 :          0 :     mpToolBoxControl->implExecuteMediaControl( rItem );
      89                 :          0 : }
      90                 :            : 
      91                 :            : // -----------------------
      92                 :            : // - MediaToolBoxControl -
      93                 :            : // -----------------------
      94                 :            : 
      95         [ #  # ]:        149 : SFX_IMPL_TOOLBOX_CONTROL( ::avmedia::MediaToolBoxControl, ::avmedia::MediaItem );
      96                 :            : 
      97                 :            : // -----------------------------------------------------------------------------
      98                 :            : 
      99                 :          0 : MediaToolBoxControl::MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
     100                 :          0 :     SfxToolBoxControl( nSlotId, nId, rTbx )
     101                 :            : {
     102         [ #  # ]:          0 :         rTbx.Invalidate();
     103                 :          0 : }
     104                 :            : 
     105                 :            : // -----------------------------------------------------------------------------
     106                 :            : 
     107                 :          0 : MediaToolBoxControl::~MediaToolBoxControl()
     108                 :            : {
     109         [ #  # ]:          0 : }
     110                 :            : 
     111                 :            : // -----------------------------------------------------------------------------
     112                 :            : 
     113                 :          0 : void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
     114                 :            : 
     115                 :            : {
     116                 :          0 :     MediaToolBoxControl_Impl* pCtrl = static_cast< MediaToolBoxControl_Impl* >( GetToolBox().GetItemWindow( GetId() ) );
     117                 :            : 
     118                 :            :     DBG_ASSERT( pCtrl, "MediaToolBoxControl::StateChanged: media control not found" );
     119                 :            : 
     120         [ #  # ]:          0 :     if( eState == SFX_ITEM_DISABLED )
     121                 :            :     {
     122         [ #  # ]:          0 :         pCtrl->Enable( false, false );
     123 [ #  # ][ #  # ]:          0 :         pCtrl->SetText( String() );
                 [ #  # ]
     124                 :            : 
     125         [ #  # ]:          0 :         const MediaItem aEmptyMediaItem( 0, AVMEDIA_SETMASK_ALL );
     126 [ #  # ][ #  # ]:          0 :         pCtrl->setState( aEmptyMediaItem );
     127                 :            :     }
     128                 :            :     else
     129                 :            :     {
     130                 :          0 :         pCtrl->Enable( true, false );
     131                 :            : 
     132 [ #  # ][ #  # ]:          0 :         const MediaItem* pMediaItem = PTR_CAST( MediaItem, pState );
     133                 :            : 
     134 [ #  # ][ #  # ]:          0 :         if( pMediaItem && ( SFX_ITEM_AVAILABLE == eState ) )
     135                 :          0 :             pCtrl->setState( *pMediaItem );
     136                 :            :     }
     137                 :          0 : }
     138                 :            : 
     139                 :            : // -----------------------------------------------------------------------------
     140                 :            : 
     141                 :          0 : Window* MediaToolBoxControl::CreateItemWindow( Window *pParent )
     142                 :            : {
     143 [ #  # ][ #  # ]:          0 :     return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL );
     144                 :            : }
     145                 :            : 
     146                 :            : // -----------------------------------------------------------------------------
     147                 :            : 
     148                 :          0 : void MediaToolBoxControl::implUpdateMediaControl()
     149                 :            : {
     150         [ #  # ]:          0 :     updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AVMediaToolBox" ) ) );
     151                 :          0 : }
     152                 :            : 
     153                 :            : // -----------------------------------------------------------------------------
     154                 :            : 
     155                 :          0 : void MediaToolBoxControl::implExecuteMediaControl( const MediaItem& rItem )
     156                 :            : {
     157         [ #  # ]:          0 :     MediaItem                               aExecItem( SID_AVMEDIA_TOOLBOX );
     158         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue >   aArgs( 1 );
     159                 :          0 :     uno::Any                                aAny;
     160                 :            : 
     161         [ #  # ]:          0 :     aExecItem.merge( rItem );
     162         [ #  # ]:          0 :     aExecItem.QueryValue( aAny );
     163 [ #  # ][ #  # ]:          0 :     aArgs[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AVMediaToolBox" ) );
     164         [ #  # ]:          0 :     aArgs[ 0 ].Value = aAny;
     165                 :            : 
     166 [ #  # ][ #  # ]:          0 :     Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AVMediaToolBox" ) ), aArgs );
         [ #  # ][ #  # ]
     167                 :          0 : }
     168                 :            : 
     169                 :            : }
     170                 :            : 
     171                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10