LCOV - code coverage report
Current view: top level - sc/source/ui/undo - undoolk.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 28 71.4 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 14 57.1 %

           Branch data     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                 :            : 
      26                 :            : // STATIC DATA -----------------------------------------------------------
      27                 :            : 
      28                 :            : // -----------------------------------------------------------------------
      29                 :            : 
      30                 :        159 : SdrUndoAction* GetSdrUndoAction( ScDocument* pDoc )
      31                 :            : {
      32                 :        159 :     ScDrawLayer* pLayer = pDoc->GetDrawLayer();
      33         [ +  + ]:        159 :     if (pLayer)
      34                 :        150 :         return pLayer->GetCalcUndo();               // muss vorhanden sein
      35                 :            :     else
      36                 :        159 :         return NULL;
      37                 :            : }
      38                 :            : 
      39                 :          3 : void DoSdrUndoAction( SdrUndoAction* pUndoAction, ScDocument* pDoc )
      40                 :            : {
      41         [ -  + ]:          3 :     if ( pUndoAction )
      42                 :          0 :         pUndoAction->Undo();
      43                 :            :     else
      44                 :            :     {
      45                 :            :         // if no drawing layer existed when the action was created,
      46                 :            :         // but it was created after that, there is no draw undo action,
      47                 :            :         // and after undo there might be a drawing layer with a wrong page count.
      48                 :            :         // The drawing layer must have been empty in that case, so any missing
      49                 :            :         // pages can just be created now.
      50                 :            : 
      51                 :          3 :         ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
      52         [ -  + ]:          3 :         if ( pDrawLayer )
      53                 :            :         {
      54                 :          0 :             SCTAB nTabCount = pDoc->GetTableCount();
      55                 :          0 :             SCTAB nPages = static_cast<SCTAB>(pDrawLayer->GetPageCount());
      56         [ #  # ]:          0 :             while ( nPages < nTabCount )
      57                 :            :             {
      58                 :          0 :                 pDrawLayer->ScAddPage( nPages );
      59                 :          0 :                 ++nPages;
      60                 :            :             }
      61                 :            :         }
      62                 :            :     }
      63                 :          3 : }
      64                 :            : 
      65                 :            : 
      66                 :          3 : void RedoSdrUndoAction( SdrUndoAction* pUndoAction )
      67                 :            : {
      68                 :            :     // DoSdrUndoAction/RedoSdrUndoAction is called even if the pointer is null
      69                 :            : 
      70         [ -  + ]:          3 :     if ( pUndoAction )
      71                 :          0 :         pUndoAction->Redo();
      72                 :          3 : }
      73                 :            : 
      74                 :        183 : void DeleteSdrUndoAction( SdrUndoAction* pUndoAction )
      75                 :            : {
      76         [ +  + ]:        183 :     delete pUndoAction;
      77                 :        183 : }
      78                 :            : 
      79                 :         12 : void EnableDrawAdjust( ScDocument* pDoc, sal_Bool bEnable )
      80                 :            : {
      81                 :         12 :     ScDrawLayer* pLayer = pDoc->GetDrawLayer();
      82         [ -  + ]:         12 :     if (pLayer)
      83                 :          0 :         pLayer->EnableAdjust(bEnable);
      84                 :         12 : }
      85                 :            : 
      86                 :            : 
      87                 :            : 
      88                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10