LCOV - code coverage report
Current view: top level - sw/source/uibase/shells - navsh.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 9 46 19.6 %
Date: 2014-11-03 Functions: 7 9 77.8 %
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      158754 : SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
      33             : 
      34          90 : void SwNavigationShell::InitInterface_Impl()
      35             : {
      36          90 : }
      37             : 
      38        4738 : SwNavigationShell::SwNavigationShell(SwView &_rView)
      39        4738 :     : SwBaseShell( _rView )
      40             : {
      41        4738 :     SetName(OUString("Navigation"));
      42        4738 :     SetHelpId(SW_NAVIGATIONSHELL);
      43        4738 : }
      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 :     const sal_uInt16 nSlotId = rReq.GetSlot();
      51           0 :     bool bChanged = pSdrView->GetModel()->IsChanged();
      52           0 :     pSdrView->GetModel()->SetChanged(false);
      53           0 :     SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
      54             :     const SfxPoolItem* pItem;
      55           0 :     if(pArgs)
      56           0 :         pArgs->GetItemState(nSlotId, 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(true);
      73           0 : }
      74             : 
      75             : // determine if the buttons should be enabled/disabled
      76             : 
      77           0 : void SwNavigationShell::GetState(SfxItemSet &rSet)
      78             : {
      79           0 :     SwWrtShell *pSh = &GetShell();
      80           0 :     SfxWhichIter aIter( rSet );
      81           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
      82           0 :     SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
      83           0 :     while( nWhich )
      84             :     {
      85           0 :         switch( nWhich )
      86             :         {
      87             :             case FN_NAVIGATION_BACK:
      88           0 :                 if (!aNavigationMgr.backEnabled())
      89             :                 {
      90           0 :                     rSet.DisableItem(FN_NAVIGATION_BACK);
      91             :                 }
      92           0 :                 break;
      93             :             case FN_NAVIGATION_FORWARD:
      94           0 :                 if (!aNavigationMgr.forwardEnabled())
      95             :                 {
      96           0 :                     rSet.DisableItem(FN_NAVIGATION_FORWARD);
      97             :                 }
      98           0 :                 break;
      99             :             default:
     100           0 :                 break;
     101             :         }
     102           0 :         nWhich = aIter.NextWhich();
     103           0 :     }
     104         270 : }
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10