LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/shells - navsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 45 48.9 %
Date: 2013-07-09 Functions: 8 9 88.9 %
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             : 
      10             : #include "cmdid.h"
      11             : #include <svx/svdview.hxx>
      12             : #include <svl/srchitem.hxx>
      13             : #include <svl/eitem.hxx>
      14             : #include <svl/whiter.hxx>
      15             : #include <svx/svdopath.hxx>
      16             : #include <sfx2/request.hxx>
      17             : #include <sfx2/dispatch.hxx>
      18             : #include <sfx2/objface.hxx>
      19             : #include "wrtsh.hxx"
      20             : #include "view.hxx"
      21             : #include "edtwin.hxx"
      22             : #include "helpid.h"
      23             : #include "globals.hrc"
      24             : #include "navsh.hxx"
      25             : #include "popup.hrc"
      26             : #include "shells.hrc"
      27             : #define SwNavigationShell
      28             : #include "swslots.hxx"
      29             : #include <unomid.h>
      30             : #include "navmgr.hxx"
      31             : 
      32             : 
      33       58811 : SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
      34             : {
      35          33 : }
      36             : 
      37         794 : SwNavigationShell::SwNavigationShell(SwView &_rView):
      38         794 :   SwBaseShell( _rView )
      39             : 
      40             : {
      41         794 :   SetName(OUString("Navigation"));
      42         794 :   SetHelpId(SW_NAVIGATIONSHELL);
      43         794 : }
      44             : 
      45           0 : void SwNavigationShell::Execute(SfxRequest &rReq)
      46             : {
      47           0 :     SwWrtShell *pSh = &GetShell();
      48           0 :     SdrView*    pSdrView = pSh->GetDrawView();
      49           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
      50           0 :     sal_uInt16      nSlotId = rReq.GetSlot();
      51           0 :     sal_Bool        bChanged = pSdrView->GetModel()->IsChanged();
      52           0 :     pSdrView->GetModel()->SetChanged(sal_False);
      53           0 :     SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
      54             :     const SfxPoolItem* pItem;
      55           0 :     if(pArgs)
      56           0 :         pArgs->GetItemState(nSlotId, sal_False, &pItem);
      57           0 :     switch (nSlotId)
      58             :         {
      59             :         case FN_NAVIGATION_BACK:
      60           0 :             aSwNavigationMgr.goBack();
      61           0 :             break;
      62             : 
      63             :         case FN_NAVIGATION_FORWARD:
      64           0 :             aSwNavigationMgr.goForward();
      65           0 :             break;
      66             :         default:
      67           0 :             break;
      68             :         }
      69           0 :     if (pSdrView->GetModel()->IsChanged())
      70           0 :         GetShell().SetModified();
      71           0 :     else if (bChanged)
      72           0 :         pSdrView->GetModel()->SetChanged(sal_True);
      73           0 : }
      74             : 
      75             : // determine if the buttons should be enabled/disabled
      76             : 
      77           2 : void SwNavigationShell::GetState(SfxItemSet &rSet)
      78             : {
      79           2 :   SwWrtShell *pSh = &GetShell();
      80           2 :   SfxWhichIter aIter( rSet );
      81           2 :   sal_uInt16 nWhich = aIter.FirstWhich();
      82           2 :   SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
      83           6 :   while( nWhich )
      84             :     {
      85           2 :       switch( nWhich )
      86             :     {
      87             :     case FN_NAVIGATION_BACK:
      88             :       {
      89           1 :         if (!aNavigationMgr.backEnabled()) {
      90           0 :           rSet.DisableItem(FN_NAVIGATION_BACK);
      91             :         }
      92             :       }
      93           1 :       break;
      94             :     case FN_NAVIGATION_FORWARD:
      95             :       {
      96           1 :         if (!aNavigationMgr.forwardEnabled())
      97           1 :           rSet.DisableItem(FN_NAVIGATION_FORWARD);
      98             :       }
      99           1 :       break;
     100             :     default:
     101           0 :       break;
     102             :     }
     103           2 :       nWhich = aIter.NextWhich();
     104           2 :     }
     105         101 : }
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10