LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - mediash.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 50 0.0 %
Date: 2014-04-14 Functions: 0 16 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 <sfx2/app.hxx>
      22             : #include <sfx2/objface.hxx>
      23             : #include <sfx2/request.hxx>
      24             : #include <avmedia/mediaitem.hxx>
      25             : #include <svl/whiter.hxx>
      26             : #include <svx/svdomedia.hxx>
      27             : #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
      28             : #include <sfx2/sidebar/EnumContext.hxx>
      29             : 
      30             : #include "mediash.hxx"
      31             : #include "sc.hrc"
      32             : #include "viewdata.hxx"
      33             : #include "drawview.hxx"
      34             : #include "scresid.hxx"
      35             : 
      36             : #define ScMediaShell
      37             : #include "scslots.hxx"
      38             : 
      39           0 : SFX_IMPL_INTERFACE(ScMediaShell, ScDrawShell, ScResId(SCSTR_GRAPHICSHELL) )
      40             : {
      41           0 :     SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, ScResId(RID_MEDIA_OBJECTBAR) );
      42           0 :     SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_MEDIA) );
      43           0 : }
      44             : 
      45           0 : TYPEINIT1( ScMediaShell, ScDrawShell );
      46             : 
      47           0 : ScMediaShell::ScMediaShell(ScViewData* pData) :
      48           0 :     ScDrawShell(pData)
      49             : {
      50           0 :     SetHelpId(HID_SCSHELL_MEDIA);
      51           0 :     SetName( OUString( ScResId( SCSTR_MEDIASHELL ) ) );
      52           0 :     SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
      53           0 : }
      54             : 
      55           0 : ScMediaShell::~ScMediaShell()
      56             : {
      57           0 : }
      58             : 
      59           0 : void ScMediaShell::GetMediaState( SfxItemSet& rSet )
      60             : {
      61           0 :     ScDrawView* pView = GetViewData()->GetScDrawView();
      62             : 
      63           0 :     if( pView )
      64             :     {
      65           0 :         SfxWhichIter    aIter( rSet );
      66           0 :         sal_uInt16          nWhich = aIter.FirstWhich();
      67             : 
      68           0 :         while( nWhich )
      69             :         {
      70           0 :             if( SID_AVMEDIA_TOOLBOX == nWhich )
      71             :             {
      72           0 :                 boost::scoped_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
      73           0 :                 bool            bDisable = true;
      74             : 
      75           0 :                 if( 1 == pMarkList->GetMarkCount() )
      76             :                 {
      77           0 :                     SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
      78             : 
      79           0 :                     if( pObj && pObj->ISA( SdrMediaObj ) )
      80             :                     {
      81           0 :                         ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
      82             : 
      83           0 :                         static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
      84           0 :                         rSet.Put( aItem );
      85           0 :                         bDisable = false;
      86             :                     }
      87             :                 }
      88             : 
      89           0 :                 if( bDisable )
      90           0 :                     rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
      91             :             }
      92             : 
      93           0 :             nWhich = aIter.NextWhich();
      94           0 :         }
      95             :     }
      96           0 : }
      97             : 
      98           0 : void ScMediaShell::ExecuteMedia( SfxRequest& rReq )
      99             : {
     100           0 :     ScDrawView* pView = GetViewData()->GetScDrawView();
     101             : 
     102           0 :     if( pView && SID_AVMEDIA_TOOLBOX == rReq.GetSlot() )
     103             :     {
     104           0 :         const SfxItemSet*   pArgs = rReq.GetArgs();
     105             :         const SfxPoolItem*  pItem;
     106             : 
     107           0 :         if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
     108           0 :             pItem = NULL;
     109             : 
     110           0 :         if( pItem )
     111             :         {
     112           0 :             boost::scoped_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
     113             : 
     114           0 :             if( 1 == pMarkList->GetMarkCount() )
     115             :             {
     116           0 :                 SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
     117             : 
     118           0 :                 if( pObj && pObj->ISA( SdrMediaObj ) )
     119             :                 {
     120           0 :                     static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
     121           0 :                         static_cast< const ::avmedia::MediaItem& >( *pItem ) );
     122             :                 }
     123           0 :             }
     124             :         }
     125             :     }
     126             : 
     127           0 :     Invalidate();
     128           0 : }
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10