LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/view - zoomlist.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 6 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             :  * 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             : 
      21             : #include "zoomlist.hxx"
      22             : 
      23             : #include <svx/svxids.hrc>
      24             : #include <sfx2/bindings.hxx>
      25             : #include <sfx2/viewfrm.hxx>
      26             : #include <sfx2/viewsh.hxx>
      27             : 
      28             : #include "ViewShell.hxx"
      29             : 
      30             : namespace sd {
      31             : 
      32             : #define MAX_ENTRYS  10
      33             : 
      34           0 : ZoomList::ZoomList(ViewShell* pViewShell)
      35             : : mpViewShell (pViewShell)
      36           0 : , mnCurPos(0)
      37             : {
      38           0 : }
      39             : 
      40           0 : void ZoomList::InsertZoomRect(const Rectangle& rRect)
      41             : {
      42           0 :     sal_uLong nRectCount = maRectangles.size();
      43             : 
      44           0 :     if (nRectCount >= MAX_ENTRYS)
      45           0 :         maRectangles.erase(maRectangles.begin());
      46           0 :     else if (nRectCount == 0)
      47           0 :         mnCurPos = 0;
      48             :     else
      49           0 :         mnCurPos++;
      50             : 
      51           0 :     maRectangles.insert(maRectangles.begin()+mnCurPos,rRect);
      52             : 
      53           0 :     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
      54           0 :     rBindings.Invalidate( SID_ZOOM_NEXT );
      55           0 :     rBindings.Invalidate( SID_ZOOM_PREV );
      56           0 : }
      57             : 
      58           0 : Rectangle ZoomList::GetNextZoomRect()
      59             : {
      60           0 :     mnCurPos++;
      61           0 :     sal_uLong nRectCount = maRectangles.size();
      62             : 
      63           0 :     if (nRectCount > 0 && mnCurPos > nRectCount - 1)
      64           0 :         mnCurPos = nRectCount - 1;
      65             : 
      66           0 :     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
      67           0 :     rBindings.Invalidate( SID_ZOOM_NEXT );
      68           0 :     rBindings.Invalidate( SID_ZOOM_PREV );
      69             : 
      70           0 :     return maRectangles[mnCurPos];
      71             : }
      72             : 
      73           0 : Rectangle ZoomList::GetPreviousZoomRect()
      74             : {
      75           0 :     if (mnCurPos > 0)
      76           0 :         mnCurPos--;
      77             : 
      78           0 :     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
      79           0 :     rBindings.Invalidate( SID_ZOOM_NEXT );
      80           0 :     rBindings.Invalidate( SID_ZOOM_PREV );
      81             : 
      82           0 :     return maRectangles[mnCurPos];
      83             : }
      84             : 
      85           0 : sal_Bool ZoomList::IsNextPossible() const
      86             : {
      87           0 :     sal_uLong nRectCount = maRectangles.size();
      88             : 
      89           0 :     return nRectCount > 0 && mnCurPos < nRectCount - 1;
      90             : }
      91             : 
      92           0 : sal_Bool ZoomList::IsPreviousPossible() const
      93             : {
      94           0 :     return mnCurPos > 0;
      95             : }
      96             : 
      97             : } // end of namespace sd
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10