LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/shells - navsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 45 15.6 %
Date: 2012-12-27 Functions: 5 7 71.4 %
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             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4             :  *
       5             :  * The contents of this file are subject to the Mozilla Public License Version
       6             :  * 1.1 (the "License"); you may not use this file except in compliance with
       7             :  * the License. You may obtain a copy of the License at
       8             :  * http://www.mozilla.org/MPL/
       9             :  *
      10             :  * Software distributed under the License is distributed on an "AS IS" basis,
      11             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12             :  * for the specific language governing rights and limitations under the
      13             :  * License.
      14             :  *
      15             :  * The Initial Developer of the Original Code is
      16             :  *       [ Maja Djordjevic < ovcica@gmail.com > ]
      17             :  * Portions created by the Initial Developer are Copyright (C) 2010 the
      18             :  * Initial Developer. All Rights Reserved.
      19             :  *
      20             :  * Contributor(s): Cédric Bosdonnat <cbosdonnat@novell.com>
      21             :  *                 Caolan McNamara <caolanm@redhat.com>
      22             :  *
      23             :  * Alternatively, the contents of this file may be used under the terms of
      24             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      25             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      26             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      27             :  * instead of those above.
      28             :  */
      29             : 
      30             : 
      31             : 
      32             : #include "cmdid.h"
      33             : #include <svx/svdview.hxx>
      34             : #include <svl/srchitem.hxx>
      35             : #include <svl/eitem.hxx>
      36             : #include <svl/whiter.hxx>
      37             : #include <svx/svdopath.hxx>
      38             : #include <sfx2/request.hxx>
      39             : #include <sfx2/dispatch.hxx>
      40             : #include <sfx2/objface.hxx>
      41             : 
      42             : #include "wrtsh.hxx"
      43             : #include "view.hxx"
      44             : #include "edtwin.hxx"
      45             : #include "helpid.h"
      46             : #include "globals.hrc"
      47             : 
      48             : #include "navsh.hxx"
      49             : 
      50             : 
      51             : #include "popup.hrc"
      52             : #include "shells.hrc"
      53             : #define SwNavigationShell
      54             : #include "swslots.hxx"
      55             : 
      56             : #include <unomid.h>
      57             : 
      58             : #include "navmgr.hxx"
      59             : 
      60             : 
      61        4020 : SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
      62             : {
      63          10 : }
      64             : 
      65         238 : SwNavigationShell::SwNavigationShell(SwView &_rView):
      66         238 :   SwBaseShell( _rView )
      67             : 
      68             : {
      69         238 :   SetName(rtl::OUString("Navigation"));
      70         238 :   SetHelpId(SW_NAVIGATIONSHELL);
      71         238 : }
      72             : 
      73           0 : void SwNavigationShell::Execute(SfxRequest &rReq)
      74             : {
      75           0 :     SwWrtShell *pSh = &GetShell();
      76           0 :     SdrView*    pSdrView = pSh->GetDrawView();
      77           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
      78           0 :     sal_uInt16      nSlotId = rReq.GetSlot();
      79           0 :     sal_Bool        bChanged = pSdrView->GetModel()->IsChanged();
      80           0 :     pSdrView->GetModel()->SetChanged(sal_False);
      81           0 :     SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
      82             :     const SfxPoolItem* pItem;
      83           0 :     if(pArgs)
      84           0 :         pArgs->GetItemState(nSlotId, sal_False, &pItem);
      85           0 :     switch (nSlotId)
      86             :         {
      87             :         case FN_NAVIGATION_BACK:
      88           0 :             aSwNavigationMgr.goBack();
      89           0 :             break;
      90             : 
      91             :         case FN_NAVIGATION_FORWARD:
      92           0 :             aSwNavigationMgr.goForward();
      93           0 :             break;
      94             :         default:
      95           0 :             break;
      96             :         }
      97           0 :     if (pSdrView->GetModel()->IsChanged())
      98           0 :         GetShell().SetModified();
      99           0 :     else if (bChanged)
     100           0 :         pSdrView->GetModel()->SetChanged(sal_True);
     101           0 : }
     102             : 
     103             : /*--------------------------------------------------------------------
     104             :   determine if the buttons should be enabled/disabled
     105             :   --------------------------------------------------------------------*/
     106             : 
     107             : 
     108           0 : void SwNavigationShell::GetState(SfxItemSet &rSet)
     109             : {
     110           0 :   SwWrtShell *pSh = &GetShell();
     111           0 :   SfxWhichIter aIter( rSet );
     112           0 :   sal_uInt16 nWhich = aIter.FirstWhich();
     113           0 :   SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
     114           0 :   while( nWhich )
     115             :     {
     116           0 :       switch( nWhich )
     117             :     {
     118             :     case FN_NAVIGATION_BACK:
     119             :       {
     120           0 :         if (!aNavigationMgr.backEnabled()) {
     121           0 :           rSet.DisableItem(FN_NAVIGATION_BACK);
     122             :         }
     123             :       }
     124           0 :       break;
     125             :     case FN_NAVIGATION_FORWARD:
     126             :       {
     127           0 :         if (!aNavigationMgr.forwardEnabled())
     128           0 :           rSet.DisableItem(FN_NAVIGATION_FORWARD);
     129             :       }
     130           0 :       break;
     131             :     default:
     132           0 :       break;
     133             :     }
     134           0 :       nWhich = aIter.NextWhich();
     135           0 :     }
     136           0 : }
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10