LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - mediash.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 67 0.0 %
Date: 2014-04-14 Functions: 0 9 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 <cmdid.h>
      21             : #include <hintids.hxx>
      22             : #include <vcl/msgbox.hxx>
      23             : #include <svl/stritem.hxx>
      24             : #include <svl/whiter.hxx>
      25             : #include <svl/urihelper.hxx>
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <editeng/sizeitem.hxx>
      28             : #include <editeng/protitem.hxx>
      29             : #include <sfx2/request.hxx>
      30             : #include <svl/srchitem.hxx>
      31             : #include <sfx2/htmlmode.hxx>
      32             : #include <svx/sdgluitm.hxx>
      33             : #include <svx/sdgcoitm.hxx>
      34             : #include <svx/sdggaitm.hxx>
      35             : #include <svx/sdgtritm.hxx>
      36             : #include <svx/sdginitm.hxx>
      37             : #include <svx/sdgmoitm.hxx>
      38             : #include <editeng/brushitem.hxx>
      39             : #include <svx/grfflt.hxx>
      40             : #include <fmturl.hxx>
      41             : #include <view.hxx>
      42             : #include <wrtsh.hxx>
      43             : #include <viewopt.hxx>
      44             : #include <swmodule.hxx>
      45             : #include <frmatr.hxx>
      46             : #include <swundo.hxx>
      47             : #include <uitool.hxx>
      48             : #include <docsh.hxx>
      49             : #include <mediash.hxx>
      50             : #include <frmmgr.hxx>
      51             : #include <frmdlg.hxx>
      52             : #include <frmfmt.hxx>
      53             : #include <grfatr.hxx>
      54             : #include <usrpref.hxx>
      55             : #include <edtwin.hxx>
      56             : #include <swwait.hxx>
      57             : #include <shells.hrc>
      58             : #include <popup.hrc>
      59             : 
      60             : #include <sfx2/objface.hxx>
      61             : #include <sfx2/sidebar/EnumContext.hxx>
      62             : #include <svx/svdomedia.hxx>
      63             : #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
      64             : #include <avmedia/mediaitem.hxx>
      65             : 
      66             : #define SwMediaShell
      67             : #include <sfx2/msg.hxx>
      68             : #include "swslots.hxx"
      69             : #include "swabstdlg.hxx"
      70             : 
      71           0 : SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell, SW_RES(STR_SHELLNAME_MEDIA))
      72             : {
      73           0 :     SFX_POPUPMENU_REGISTRATION(SW_RES(MN_MEDIA_POPUPMENU));
      74           0 :     SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_MEDIA_TOOLBOX));
      75           0 : }
      76             : 
      77           0 : void SwMediaShell::ExecMedia(SfxRequest &rReq)
      78             : {
      79           0 :     SwWrtShell* pSh = &GetShell();
      80           0 :     SdrView*    pSdrView = pSh->GetDrawView();
      81             : 
      82           0 :     if( pSdrView )
      83             :     {
      84           0 :         const SfxItemSet*   pArgs = rReq.GetArgs();
      85           0 :         sal_uInt16              nSlotId = rReq.GetSlot();
      86           0 :         sal_Bool                bChanged = pSdrView->GetModel()->IsChanged();
      87             : 
      88           0 :         pSdrView->GetModel()->SetChanged( false );
      89             : 
      90           0 :         switch( nSlotId )
      91             :         {
      92             :             case SID_DELETE:
      93             :             {
      94           0 :                 if( pSh->IsObjSelected() )
      95             :                 {
      96           0 :                     pSh->SetModified();
      97           0 :                     pSh->DelSelectedObj();
      98             : 
      99           0 :                     if( pSh->IsSelFrmMode() )
     100           0 :                         pSh->LeaveSelFrmMode();
     101             : 
     102           0 :                     GetView().AttrChangedNotify( pSh );
     103             :                 }
     104             :             }
     105           0 :             break;
     106             : 
     107             :             case( SID_AVMEDIA_TOOLBOX ):
     108             :             {
     109           0 :                 if( pSh->IsObjSelected() )
     110             :                 {
     111             :                     const SfxPoolItem*  pItem;
     112             : 
     113           0 :                     if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
     114           0 :                         pItem = NULL;
     115             : 
     116           0 :                     if( pItem )
     117             :                     {
     118           0 :                         SdrMarkList* pMarkList = new SdrMarkList( pSdrView->GetMarkedObjectList() );
     119             : 
     120           0 :                         if( 1 == pMarkList->GetMarkCount() )
     121             :                         {
     122           0 :                             SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
     123             : 
     124           0 :                             if( pObj && pObj->ISA( SdrMediaObj ) )
     125             :                             {
     126           0 :                                 static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
     127           0 :                                     static_cast< const ::avmedia::MediaItem& >( *pItem ) );
     128             :                             }
     129             :                         }
     130             : 
     131           0 :                         delete pMarkList;
     132             :                     }
     133             :                 }
     134             :             }
     135           0 :             break;
     136             : 
     137             :             default:
     138           0 :             break;
     139             :         }
     140             : 
     141           0 :         if( pSdrView->GetModel()->IsChanged() )
     142           0 :             GetShell().SetModified();
     143           0 :         else if( bChanged )
     144           0 :             pSdrView->GetModel()->SetChanged(true);
     145             :     }
     146           0 : }
     147             : 
     148           0 : void SwMediaShell::GetMediaState(SfxItemSet &rSet)
     149             : {
     150           0 :     SfxWhichIter    aIter( rSet );
     151           0 :     sal_uInt16          nWhich = aIter.FirstWhich();
     152             : 
     153           0 :     while( nWhich )
     154             :     {
     155           0 :         if( SID_AVMEDIA_TOOLBOX == nWhich )
     156             :         {
     157           0 :             SwWrtShell& rSh = GetShell();
     158           0 :             SdrView*    pView = rSh.GetDrawView();
     159             : 
     160           0 :             if( pView )
     161             :             {
     162           0 :                 bool bDisable = true;
     163           0 :                 SdrMarkList* pMarkList = new SdrMarkList( pView->GetMarkedObjectList() );
     164             : 
     165           0 :                 if( 1 == pMarkList->GetMarkCount() )
     166             :                 {
     167           0 :                     SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
     168             : 
     169           0 :                     if( pObj && pObj->ISA( SdrMediaObj ) )
     170             :                     {
     171           0 :                         ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
     172             : 
     173           0 :                         static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
     174           0 :                         rSet.Put( aItem );
     175           0 :                         bDisable = false;
     176             :                     }
     177             :                 }
     178             : 
     179           0 :                 if( bDisable )
     180           0 :                     rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
     181             : 
     182           0 :                 delete pMarkList;
     183             :             }
     184             :         }
     185             : 
     186           0 :         nWhich = aIter.NextWhich();
     187           0 :     }
     188           0 : }
     189             : 
     190           0 : SwMediaShell::SwMediaShell(SwView &_rView) :
     191           0 :     SwBaseShell(_rView)
     192             : 
     193             : {
     194           0 :     SetName(OUString("Media Playback"));
     195           0 :     SetHelpId(SW_MEDIASHELL);
     196           0 :     SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
     197           0 : }
     198             : 
     199             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10