LCOV - code coverage report
Current view: top level - sc/source/ui/undo - undodraw.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 57 59.6 %
Date: 2015-06-13 12:38:46 Functions: 14 21 66.7 %
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 "undodraw.hxx"
      23             : #include "docsh.hxx"
      24             : #include "tabvwsh.hxx"
      25             : 
      26          12 : TYPEINIT1(ScUndoDraw, SfxUndoAction);
      27             : 
      28          71 : ScUndoDraw::ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ) :
      29             :     pDrawUndo( pUndo ),
      30          71 :     pDocShell( pDocSh )
      31             : {
      32          71 : }
      33             : 
      34         201 : ScUndoDraw::~ScUndoDraw()
      35             : {
      36          67 :     delete pDrawUndo;
      37         134 : }
      38             : 
      39           3 : void ScUndoDraw::ForgetDrawUndo()
      40             : {
      41           3 :     pDrawUndo = NULL;   // do not delete (DrawUndo has to be remembered from outside)
      42           3 : }
      43             : 
      44          92 : OUString ScUndoDraw::GetComment() const
      45             : {
      46          92 :     if (pDrawUndo)
      47          92 :         return pDrawUndo->GetComment();
      48           0 :     return OUString();
      49             : }
      50             : 
      51           0 : OUString ScUndoDraw::GetRepeatComment(SfxRepeatTarget& rTarget) const
      52             : {
      53           0 :     if (pDrawUndo)
      54           0 :         return pDrawUndo->GetRepeatComment(rTarget);
      55           0 :     return OUString();
      56             : }
      57             : 
      58           0 : sal_uInt16 ScUndoDraw::GetId() const
      59             : {
      60           0 :     if (pDrawUndo)
      61           0 :         return pDrawUndo->GetId();
      62             :     else
      63           0 :         return 0;
      64             : }
      65             : 
      66           0 : void ScUndoDraw::SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction)
      67             : {
      68           0 :     if (pDrawUndo)
      69           0 :         pDrawUndo->SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction);
      70             :     else
      71           0 :         SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction);
      72           0 : }
      73             : 
      74           0 : bool  ScUndoDraw::Merge( SfxUndoAction* pNextAction )
      75             : {
      76           0 :     if (pDrawUndo)
      77           0 :         return pDrawUndo->Merge(pNextAction);
      78             :     else
      79           0 :         return false;
      80             : }
      81             : 
      82           4 : void ScUndoDraw::UpdateSubShell()
      83             : {
      84             :     // #i26822# remove the draw shell if the selected object has been removed
      85           4 :     ScTabViewShell* pViewShell = pDocShell->GetBestViewShell();
      86           4 :     if (pViewShell)
      87           4 :         pViewShell->UpdateDrawShell();
      88           4 : }
      89             : 
      90           2 : void ScUndoDraw::Undo()
      91             : {
      92           2 :     if (pDrawUndo)
      93             :     {
      94           2 :         pDrawUndo->Undo();
      95           2 :         pDocShell->SetDrawModified();
      96           2 :         UpdateSubShell();
      97             :     }
      98           2 : }
      99             : 
     100           2 : void ScUndoDraw::Redo()
     101             : {
     102           2 :     if (pDrawUndo)
     103             :     {
     104           2 :         pDrawUndo->Redo();
     105           2 :         pDocShell->SetDrawModified();
     106           2 :         UpdateSubShell();
     107             :     }
     108           2 : }
     109             : 
     110           0 : void ScUndoDraw::Repeat(SfxRepeatTarget& rTarget)
     111             : {
     112           0 :     if (pDrawUndo)
     113           0 :         pDrawUndo->Repeat(rTarget);
     114           0 : }
     115             : 
     116          20 : bool ScUndoDraw::CanRepeat(SfxRepeatTarget& rTarget) const
     117             : {
     118          20 :     if (pDrawUndo)
     119          20 :         return pDrawUndo->CanRepeat(rTarget);
     120             :     else
     121           0 :         return false;
     122         156 : }
     123             : 
     124             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11