LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - navsh.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 45 0.0 %
Date: 2014-04-14 Functions: 0 7 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             : 
      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           0 : SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
      33             : {
      34           0 : }
      35             : 
      36           0 : SwNavigationShell::SwNavigationShell(SwView &_rView):
      37           0 :   SwBaseShell( _rView )
      38             : 
      39             : {
      40           0 :   SetName(OUString("Navigation"));
      41           0 :   SetHelpId(SW_NAVIGATIONSHELL);
      42           0 : }
      43             : 
      44           0 : void SwNavigationShell::Execute(SfxRequest &rReq)
      45             : {
      46           0 :     SwWrtShell *pSh = &GetShell();
      47           0 :     SdrView*    pSdrView = pSh->GetDrawView();
      48           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
      49           0 :     sal_uInt16      nSlotId = rReq.GetSlot();
      50           0 :     sal_Bool        bChanged = pSdrView->GetModel()->IsChanged();
      51           0 :     pSdrView->GetModel()->SetChanged(false);
      52           0 :     SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
      53             :     const SfxPoolItem* pItem;
      54           0 :     if(pArgs)
      55           0 :         pArgs->GetItemState(nSlotId, false, &pItem);
      56           0 :     switch (nSlotId)
      57             :         {
      58             :         case FN_NAVIGATION_BACK:
      59           0 :             aSwNavigationMgr.goBack();
      60           0 :             break;
      61             : 
      62             :         case FN_NAVIGATION_FORWARD:
      63           0 :             aSwNavigationMgr.goForward();
      64           0 :             break;
      65             :         default:
      66           0 :             break;
      67             :         }
      68           0 :     if (pSdrView->GetModel()->IsChanged())
      69           0 :         GetShell().SetModified();
      70           0 :     else if (bChanged)
      71           0 :         pSdrView->GetModel()->SetChanged(true);
      72           0 : }
      73             : 
      74             : // determine if the buttons should be enabled/disabled
      75             : 
      76           0 : void SwNavigationShell::GetState(SfxItemSet &rSet)
      77             : {
      78           0 :   SwWrtShell *pSh = &GetShell();
      79           0 :   SfxWhichIter aIter( rSet );
      80           0 :   sal_uInt16 nWhich = aIter.FirstWhich();
      81           0 :   SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
      82           0 :   while( nWhich )
      83             :     {
      84           0 :       switch( nWhich )
      85             :     {
      86             :     case FN_NAVIGATION_BACK:
      87             :       {
      88           0 :         if (!aNavigationMgr.backEnabled()) {
      89           0 :           rSet.DisableItem(FN_NAVIGATION_BACK);
      90             :         }
      91             :       }
      92           0 :       break;
      93             :     case FN_NAVIGATION_FORWARD:
      94             :       {
      95           0 :         if (!aNavigationMgr.forwardEnabled())
      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           0 : }
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10