LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/view - drviewsg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 87 1.1 %
Date: 2012-12-27 Functions: 2 6 33.3 %
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 "DrawViewShell.hxx"
      22             : #include "ViewShellImplementation.hxx"
      23             : 
      24             : #include <svx/svxids.hrc>
      25             : #include <svx/imapdlg.hxx>
      26             : #include <sfx2/request.hxx>
      27             : #include <sfx2/dispatch.hxx>
      28             : #include <sfx2/viewfrm.hxx>
      29             : #include <svx/svdograf.hxx>
      30             : #include <svx/svdoole2.hxx>
      31             : 
      32             : 
      33             : #include "app.hrc"
      34             : 
      35             : #include "drawdoc.hxx"
      36             : #include "slideshow.hxx"
      37             : #include "imapinfo.hxx"
      38             : #include "sdmod.hxx"
      39             : #include "optsitem.hxx"
      40             : #ifndef SD_FRAME_VIEW
      41             : #include "FrameView.hxx"
      42             : #endif
      43             : #include "drawview.hxx"
      44             : 
      45             : #include "fupoor.hxx"
      46             : 
      47             : namespace sd {
      48             : 
      49           0 : void DrawViewShell::ExecIMap( SfxRequest& rReq )
      50             : {
      51             :     // waehrend einer Diashow wird nichts ausgefuehrt!
      52           0 :     if(HasCurrentFunction(SID_PRESENTATION) )
      53           0 :         return;
      54             : 
      55           0 :     if ( rReq.GetSlot() == SID_IMAP_EXEC )
      56             :     {
      57           0 :         SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
      58             : 
      59           0 :         if ( pMark )
      60             :         {
      61           0 :             SdrObject*  pSdrObj = pMark->GetMarkedSdrObj();
      62           0 :             SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
      63             : 
      64           0 :             if ( pDlg->GetEditingObject() == (void*) pSdrObj )
      65             :             {
      66           0 :                 const ImageMap& rImageMap = pDlg->GetImageMap();
      67           0 :                 SdIMapInfo*     pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
      68             : 
      69           0 :                 if ( !pIMapInfo )
      70           0 :                     pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
      71             :                 else
      72           0 :                     pIMapInfo->SetImageMap( rImageMap );
      73             : 
      74           0 :                 GetDoc()->SetChanged( sal_True );
      75             :             }
      76             :         }
      77             :     }
      78             : }
      79             : 
      80           0 : void DrawViewShell::GetIMapState( SfxItemSet& rSet )
      81             : {
      82           0 :     sal_Bool bDisable = sal_True;
      83             : 
      84           0 :     if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
      85             :     {
      86           0 :         const SdrMarkList&  rMarkList = mpDrawView->GetMarkedObjectList();
      87           0 :         const SdrObject*    pObj = NULL;
      88           0 :         sal_uLong               nMarkCount = rMarkList.GetMarkCount();
      89             : 
      90           0 :         if ( nMarkCount == 1 )
      91             :         {
      92           0 :             pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
      93             : 
      94           0 :             SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
      95           0 :             if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
      96             :                 && pImageMapDialog!=NULL
      97           0 :                 && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
      98             :             {
      99           0 :                 bDisable = sal_False;
     100             :             }
     101             :         }
     102             :     }
     103             : 
     104           0 :     rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
     105           0 : }
     106             : 
     107             : /*************************************************************************
     108             : |*
     109             : |*  Execute-Methode der Optionsleiste
     110             : |*
     111             : \************************************************************************/
     112             : 
     113           0 : void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
     114             : {
     115             :     // waehrend einer Diashow wird nichts ausgefuehrt!
     116           0 :     if(HasCurrentFunction(SID_PRESENTATION))
     117           0 :         return;
     118             : 
     119           0 :     sal_Bool   bDefault = sal_False;
     120           0 :     sal_uInt16 nSlot = rReq.GetSlot();
     121             : 
     122           0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
     123             : 
     124           0 :     switch( nSlot )
     125             :     {
     126             :         case SID_SOLID_CREATE:
     127           0 :             pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
     128           0 :         break;
     129             : 
     130             : 
     131             :         // Raster- / Hilfslinien-Optionen
     132             :         case SID_GRID_VISIBLE: // noch nicht hier !
     133             :         {
     134           0 :             pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
     135             :         }
     136           0 :         break;
     137             : 
     138             :         case SID_GRID_USE:
     139             :         {
     140           0 :             pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
     141             :         }
     142           0 :         break;
     143             : 
     144             :         case SID_HELPLINES_VISIBLE: // noch nicht hier !
     145             :         {
     146           0 :             pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
     147             :         }
     148           0 :         break;
     149             : 
     150             :         case SID_HELPLINES_USE:
     151             :         {
     152           0 :             pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
     153             :         }
     154           0 :         break;
     155             : 
     156             :         case SID_HELPLINES_MOVE:
     157             :         {
     158           0 :             pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
     159             :         }
     160           0 :         break;
     161             : 
     162             : 
     163             :         case SID_SNAP_BORDER:
     164             :         {
     165           0 :             pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
     166             :         }
     167           0 :         break;
     168             : 
     169             :         case SID_SNAP_FRAME:
     170             :         {
     171           0 :             pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
     172             :         }
     173           0 :         break;
     174             : 
     175             :         case SID_SNAP_POINTS:
     176             :         {
     177           0 :             pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
     178             :         }
     179           0 :         break;
     180             : 
     181             : 
     182             :         case SID_QUICKEDIT:
     183             :         {
     184           0 :             pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
     185             :         }
     186           0 :         break;
     187             : 
     188             :         case SID_PICK_THROUGH:
     189             :         {
     190             :             pOptions->SetPickThrough(
     191           0 :                 !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
     192             :         }
     193           0 :         break;
     194             : 
     195             :         case SID_DOUBLECLICK_TEXTEDIT:
     196             :         {
     197           0 :             pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
     198             :         }
     199           0 :         break;
     200             : 
     201             :         case SID_CLICK_CHANGE_ROTATION:
     202             :         {
     203           0 :             pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
     204             :         }
     205           0 :         break;
     206             : 
     207             :         default:
     208           0 :             bDefault = sal_True;
     209           0 :         break;
     210             :     }
     211             : 
     212           0 :     if( !bDefault )
     213             :     {
     214           0 :         pOptions->StoreConfig();
     215             : 
     216             :         // Speichert die Konfiguration SOFORT
     217             :         // SFX_APP()->SaveConfiguration();
     218           0 :         WriteFrameViewData();
     219             : 
     220           0 :         mpFrameView->Update( pOptions );
     221           0 :         ReadFrameViewData( mpFrameView );
     222             : 
     223           0 :         Invalidate( nSlot );
     224           0 :         rReq.Done();
     225             :     }
     226             : 
     227             : }
     228             : 
     229             : 
     230             : /*************************************************************************
     231             : |*
     232             : |*  State-Methode der Optionsleiste
     233             : |*
     234             : \************************************************************************/
     235             : 
     236           0 : void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
     237             : {
     238           0 :     rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
     239           0 :     rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
     240           0 :     rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
     241           0 :     rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
     242           0 :     rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
     243           0 :     rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
     244             : 
     245           0 :     rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
     246           0 :     rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
     247           0 :     rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
     248             : 
     249           0 :     rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
     250             :     rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (sal_Bool)
     251           0 :                 mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
     252             : 
     253           0 :     rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
     254           0 :     rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
     255           0 : }
     256             : 
     257           9 : } // end of namespace sd
     258             : 
     259             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10