LCOV - code coverage report
Current view: top level - sd/source/ui/view - MediaObjectBar.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 51 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             : 
      21             : #include "MediaObjectBar.hxx"
      22             : #include <avmedia/mediaitem.hxx>
      23             : #include <sfx2/msg.hxx>
      24             : #include <sfx2/app.hxx>
      25             : #include <sfx2/sfxsids.hrc>
      26             : #include <sfx2/request.hxx>
      27             : #include <sfx2/objface.hxx>
      28             : #include <svl/whiter.hxx>
      29             : #include <svl/itempool.hxx>
      30             : #include <svx/svdomedia.hxx>
      31             : #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
      32             : 
      33             : #include "app.hrc"
      34             : #include "res_bmp.hrc"
      35             : #include "glob.hrc"
      36             : #include "strings.hrc"
      37             : #include "DrawDocShell.hxx"
      38             : #include "ViewShell.hxx"
      39             : #include "Window.hxx"
      40             : #include "drawview.hxx"
      41             : #include "sdresid.hxx"
      42             : #include "drawdoc.hxx"
      43             : 
      44             : using namespace sd;
      45             : 
      46             : #define MediaObjectBar
      47             : #include "sdslots.hxx"
      48             : 
      49             : namespace sd {
      50             : 
      51             : 
      52             : // - MediaObjectBar -
      53             : 
      54             : 
      55           0 : TYPEINIT1( MediaObjectBar, SfxShell );
      56             : 
      57             : 
      58             : 
      59           0 : SFX_IMPL_INTERFACE( MediaObjectBar, SfxShell, SdResId( STR_MEDIAOBJECTBARSHELL ) )
      60             : {
      61           0 : }
      62             : 
      63             : 
      64             : 
      65           0 : MediaObjectBar::MediaObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView ) :
      66             :     SfxShell( pSdViewShell->GetViewShell() ),
      67             :     mpView( pSdView ),
      68           0 :     mpViewSh( pSdViewShell )
      69             : {
      70           0 :     DrawDocShell* pDocShell = mpViewSh->GetDocSh();
      71             : 
      72           0 :     SetPool( &pDocShell->GetPool() );
      73           0 :     SetUndoManager( pDocShell->GetUndoManager() );
      74           0 :     SetRepeatTarget( mpView );
      75           0 :     SetHelpId( SD_IF_SDDRAWMEDIAOBJECTBAR );
      76           0 :     SetName(SD_RESSTR(RID_DRAW_MEDIA_TOOLBOX));
      77           0 : }
      78             : 
      79             : 
      80             : 
      81           0 : MediaObjectBar::~MediaObjectBar()
      82             : {
      83           0 :     SetRepeatTarget( NULL );
      84           0 : }
      85             : 
      86             : 
      87             : 
      88           0 : void MediaObjectBar::GetState( SfxItemSet& rSet )
      89             : {
      90           0 :     SfxWhichIter    aIter( rSet );
      91           0 :     sal_uInt16          nWhich = aIter.FirstWhich();
      92             : 
      93           0 :     while( nWhich )
      94             :     {
      95           0 :         if( SID_AVMEDIA_TOOLBOX == nWhich )
      96             :         {
      97           0 :             SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
      98           0 :             bool         bDisable = true;
      99             : 
     100           0 :             if( 1 == pMarkList->GetMarkCount() )
     101             :             {
     102           0 :                 SdrObject* pObj =pMarkList->GetMark( 0 )->GetMarkedSdrObj();
     103             : 
     104           0 :                 if( pObj && pObj->ISA( SdrMediaObj ) )
     105             :                 {
     106           0 :                     ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
     107             : 
     108           0 :                     static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
     109           0 :                     rSet.Put( aItem );
     110           0 :                     bDisable = false;
     111             :                 }
     112             :             }
     113             : 
     114           0 :             if( bDisable )
     115           0 :                 rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
     116             : 
     117           0 :             delete pMarkList;
     118             :         }
     119             : 
     120           0 :         nWhich = aIter.NextWhich();
     121           0 :     }
     122           0 : }
     123             : 
     124             : 
     125             : 
     126           0 : void MediaObjectBar::Execute( SfxRequest& rReq )
     127             : {
     128           0 :     if( SID_AVMEDIA_TOOLBOX == rReq.GetSlot() )
     129             :     {
     130           0 :         const SfxItemSet*   pArgs = rReq.GetArgs();
     131             :         const SfxPoolItem*  pItem;
     132             : 
     133           0 :         if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
     134           0 :             pItem = NULL;
     135             : 
     136           0 :         if( pItem )
     137             :         {
     138           0 :             SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
     139             : 
     140           0 :             if( 1 == pMarkList->GetMarkCount() )
     141             :             {
     142           0 :                 SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
     143             : 
     144           0 :                 if( pObj && pObj->ISA( SdrMediaObj ) )
     145             :                 {
     146           0 :                     static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
     147           0 :                         static_cast< const ::avmedia::MediaItem& >( *pItem ) );
     148             : 
     149             :                     //fdo #32598: after changing playback opts, set document's modified flag
     150           0 :                     SdDrawDocument& rDoc = mpView->GetDoc();
     151           0 :                     rDoc.SetChanged(true);
     152             :                 }
     153             :             }
     154             : 
     155           0 :             delete pMarkList;
     156             :         }
     157             :     }
     158           0 : }
     159             : 
     160             : } // end of namespace sd
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10