LCOV - code coverage report
Current view: top level - sc/source/ui/undo - undoolk.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 28 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : #include <svx/svdundo.hxx>
      21             : 
      22             : #include "document.hxx"
      23             : #include "drwlayer.hxx"
      24             : 
      25           0 : SdrUndoAction* GetSdrUndoAction( ScDocument* pDoc )
      26             : {
      27           0 :     ScDrawLayer* pLayer = pDoc->GetDrawLayer();
      28           0 :     if (pLayer)
      29           0 :         return pLayer->GetCalcUndo();               // must exist
      30             :     else
      31           0 :         return NULL;
      32             : }
      33             : 
      34           0 : void DoSdrUndoAction( SdrUndoAction* pUndoAction, ScDocument* pDoc )
      35             : {
      36           0 :     if ( pUndoAction )
      37           0 :         pUndoAction->Undo();
      38             :     else
      39             :     {
      40             :         // if no drawing layer existed when the action was created,
      41             :         // but it was created after that, there is no draw undo action,
      42             :         // and after undo there might be a drawing layer with a wrong page count.
      43             :         // The drawing layer must have been empty in that case, so any missing
      44             :         // pages can just be created now.
      45             : 
      46           0 :         ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
      47           0 :         if ( pDrawLayer )
      48             :         {
      49           0 :             SCTAB nTabCount = pDoc->GetTableCount();
      50           0 :             SCTAB nPages = static_cast<SCTAB>(pDrawLayer->GetPageCount());
      51           0 :             while ( nPages < nTabCount )
      52             :             {
      53           0 :                 pDrawLayer->ScAddPage( nPages );
      54           0 :                 ++nPages;
      55             :             }
      56             :         }
      57             :     }
      58           0 : }
      59             : 
      60           0 : void RedoSdrUndoAction( SdrUndoAction* pUndoAction )
      61             : {
      62             :     // DoSdrUndoAction/RedoSdrUndoAction is called even if the pointer is null
      63           0 :     if ( pUndoAction )
      64           0 :         pUndoAction->Redo();
      65           0 : }
      66             : 
      67           0 : void DeleteSdrUndoAction( SdrUndoAction* pUndoAction )
      68             : {
      69           0 :     delete pUndoAction;
      70           0 : }
      71             : 
      72           0 : void EnableDrawAdjust( ScDocument* pDoc, bool bEnable )
      73             : {
      74           0 :     ScDrawLayer* pLayer = pDoc->GetDrawLayer();
      75           0 :     if (pLayer)
      76           0 :         pLayer->EnableAdjust(bEnable);
      77           0 : }
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10