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

Generated by: LCOV version 1.10