LCOV - code coverage report
Current view: top level - sc/source/ui/view - tabvwsh9.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 96 0.0 %
Date: 2014-04-14 Functions: 0 10 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 <svx/svdmark.hxx>
      21             : #include <svx/svdview.hxx>
      22             : #include <svx/galbrws.hxx>
      23             : #include <svx/gallery.hxx>
      24             : #include <svx/hlnkitem.hxx>
      25             : #include <sfx2/bindings.hxx>
      26             : #include <sfx2/request.hxx>
      27             : #include <sfx2/viewfrm.hxx>
      28             : #include <sfx2/dispatch.hxx>
      29             : #include <svl/whiter.hxx>
      30             : 
      31             : #include "tabvwsh.hxx"
      32             : #include "viewdata.hxx"
      33             : #include "tabview.hxx"
      34             : #include "drwlayer.hxx"
      35             : #include "userdat.hxx"
      36             : #include "docsh.hxx"
      37             : 
      38             : #include <svx/galleryitem.hxx>
      39             : #include <com/sun/star/gallery/GalleryItemType.hpp>
      40             : 
      41             : class SvxIMapDlg;
      42             : 
      43             : sal_uInt16          ScIMapChildWindowId();
      44             : SvxIMapDlg*     ScGetIMapDlg();
      45             : const void*     ScIMapDlgGetObj( SvxIMapDlg* pDlg );
      46             : const ImageMap& ScIMapDlgGetMap( SvxIMapDlg* pDlg );
      47             : 
      48           0 : void ScTabViewShell::ExecChildWin(SfxRequest& rReq)
      49             : {
      50           0 :     sal_uInt16 nSlot = rReq.GetSlot();
      51           0 :     switch(nSlot)
      52             :     {
      53             :         case SID_GALLERY:
      54             :         {
      55           0 :             SfxViewFrame* pThisFrame = GetViewFrame();
      56           0 :             pThisFrame->ToggleChildWindow( GalleryChildWindow::GetChildWindowId() );
      57           0 :             pThisFrame->GetBindings().Invalidate( SID_GALLERY );
      58           0 :             rReq.Ignore();
      59             :         }
      60           0 :         break;
      61             :     }
      62           0 : }
      63             : 
      64           0 : void ScTabViewShell::GetChildWinState( SfxItemSet& rSet )
      65             : {
      66           0 :     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GALLERY ) )
      67             :     {
      68           0 :         sal_uInt16 nId = GalleryChildWindow::GetChildWindowId();
      69           0 :         rSet.Put( SfxBoolItem( SID_GALLERY, GetViewFrame()->HasChildWindow( nId ) ) );
      70             :     }
      71           0 : }
      72             : 
      73           0 : void ScTabViewShell::ExecGallery( SfxRequest& rReq )
      74             : {
      75           0 :     const SfxItemSet* pArgs = rReq.GetArgs();
      76             : 
      77           0 :     SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, false );
      78           0 :     if ( !pGalleryItem )
      79           0 :         return;
      80             : 
      81           0 :     sal_Int8 nType( pGalleryItem->GetType() );
      82           0 :     if ( nType == com::sun::star::gallery::GalleryItemType::GRAPHIC )
      83             :     {
      84           0 :         MakeDrawLayer();
      85             : 
      86           0 :         Graphic aGraphic( pGalleryItem->GetGraphic() );
      87           0 :         Point   aPos     = GetInsertPos();
      88             : 
      89           0 :         OUString aPath, aFilter;
      90           0 :         PasteGraphic( aPos, aGraphic, aPath, aFilter );
      91             :     }
      92           0 :     else if ( nType == com::sun::star::gallery::GalleryItemType::MEDIA )
      93             :     {
      94             :         //  for sounds (linked or not), insert a hyperlink button,
      95             :         //  like in Impress and Writer
      96           0 :         const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
      97           0 :         GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
      98             :     }
      99             : }
     100             : 
     101           0 : void ScTabViewShell::GetGalleryState( SfxItemSet& /* rSet */ )
     102             : {
     103           0 : }
     104             : 
     105           0 : ScInputHandler* ScTabViewShell::GetInputHandler() const
     106             : {
     107           0 :     return pInputHandler;
     108             : }
     109             : 
     110           0 : OUString ScTabViewShell::GetDescription() const
     111             : {
     112           0 :     return OUString(" ** Test ** ");
     113             : }
     114             : 
     115           0 : void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
     116             : {
     117           0 :     sal_uInt16 nSlot = rReq.GetSlot();
     118           0 :     switch(nSlot)
     119             :     {
     120             :         case SID_IMAP:
     121             :         {
     122           0 :             SfxViewFrame* pThisFrame = GetViewFrame();
     123           0 :             sal_uInt16 nId = ScIMapChildWindowId();
     124           0 :             pThisFrame->ToggleChildWindow( nId );
     125           0 :             GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
     126             : 
     127           0 :             if ( pThisFrame->HasChildWindow( nId ) )
     128             :             {
     129           0 :                 SvxIMapDlg* pDlg = ScGetIMapDlg();
     130           0 :                 if ( pDlg )
     131             :                 {
     132           0 :                     SdrView* pDrView = GetSdrView();
     133           0 :                     if ( pDrView )
     134             :                     {
     135           0 :                         const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
     136           0 :                         if ( rMarkList.GetMarkCount() == 1 )
     137           0 :                             UpdateIMap( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
     138             :                     }
     139             :                 }
     140             :             }
     141             : 
     142           0 :             rReq.Ignore();
     143             :         }
     144           0 :         break;
     145             : 
     146             :         case SID_IMAP_EXEC:
     147             :         {
     148           0 :             SdrView* pDrView = GetSdrView();
     149           0 :             SdrMark* pMark = pDrView ? pDrView->GetMarkedObjectList().GetMark(0) : 0;
     150             : 
     151           0 :             if ( pMark )
     152             :             {
     153           0 :                 SdrObject*  pSdrObj = pMark->GetMarkedSdrObj();
     154           0 :                 SvxIMapDlg* pDlg = ScGetIMapDlg();
     155             : 
     156           0 :                 if ( ScIMapDlgGetObj(pDlg) == (void*) pSdrObj )
     157             :                 {
     158           0 :                     const ImageMap& rImageMap = ScIMapDlgGetMap(pDlg);
     159           0 :                     ScIMapInfo*     pIMapInfo = ScDrawLayer::GetIMapInfo( pSdrObj );
     160             : 
     161           0 :                     if ( !pIMapInfo )
     162           0 :                         pSdrObj->AppendUserData( new ScIMapInfo( rImageMap ) );
     163             :                     else
     164           0 :                         pIMapInfo->SetImageMap( rImageMap );
     165             : 
     166           0 :                     GetViewData()->GetDocShell()->SetDrawModified();
     167             :                 }
     168             :             }
     169             :         }
     170           0 :         break;
     171             :     }
     172           0 : }
     173             : 
     174           0 : void ScTabViewShell::GetImageMapState( SfxItemSet& rSet )
     175             : {
     176           0 :     SfxWhichIter aIter(rSet);
     177           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     178           0 :     while ( nWhich )
     179             :     {
     180           0 :         switch ( nWhich )
     181             :         {
     182             :             case SID_IMAP:
     183             :                 {
     184             :                     //  Disabled wird nicht mehr...
     185             : 
     186           0 :                     sal_Bool bThere = false;
     187           0 :                     SfxViewFrame* pThisFrame = GetViewFrame();
     188           0 :                     sal_uInt16 nId = ScIMapChildWindowId();
     189           0 :                     if ( pThisFrame->KnowsChildWindow(nId) )
     190           0 :                         if ( pThisFrame->HasChildWindow(nId) )
     191           0 :                             bThere = sal_True;
     192             : 
     193           0 :                     ObjectSelectionType eType=GetCurObjectSelectionType();
     194           0 :                     sal_Bool bEnable=(eType==OST_OleObject) ||(eType==OST_Graphic);
     195           0 :                     if(!bThere && !bEnable)
     196             :                     {
     197           0 :                        rSet.DisableItem( nWhich );
     198             :                     }
     199             :                     else
     200             :                     {
     201           0 :                         rSet.Put( SfxBoolItem( nWhich, bThere ) );
     202             :                     }
     203             :                 }
     204           0 :                 break;
     205             : 
     206             :             case SID_IMAP_EXEC:
     207             :                 {
     208           0 :                     sal_Bool bDisable = sal_True;
     209             : 
     210           0 :                     SdrView* pDrView = GetSdrView();
     211           0 :                     if ( pDrView )
     212             :                     {
     213           0 :                         const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
     214           0 :                         if ( rMarkList.GetMarkCount() == 1 )
     215           0 :                             if ( ScIMapDlgGetObj(ScGetIMapDlg()) ==
     216           0 :                                         (void*) rMarkList.GetMark(0)->GetMarkedSdrObj() )
     217           0 :                                 bDisable = false;
     218             :                     }
     219             : 
     220           0 :                     rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
     221             :                 }
     222           0 :                 break;
     223             :         }
     224             : 
     225           0 :         nWhich = aIter.NextWhich();
     226           0 :     }
     227           0 : }
     228             : 
     229             : 
     230             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10