LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/undo - undodraw.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 60 1.7 %
Date: 2012-12-27 Functions: 2 22 9.1 %
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           0 : TYPEINIT1(ScUndoDraw, SfxUndoAction);
      27             : 
      28           0 : ScUndoDraw::ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ) :
      29             :     pDrawUndo( pUndo ),
      30           0 :     pDocShell( pDocSh )
      31             : {
      32           0 : }
      33             : 
      34           0 : ScUndoDraw::~ScUndoDraw()
      35             : {
      36           0 :     delete pDrawUndo;
      37           0 : }
      38             : 
      39           0 : void ScUndoDraw::ForgetDrawUndo()
      40             : {
      41           0 :     pDrawUndo = NULL;   // do not delete (DrawUndo has to be remembered from outside)
      42           0 : }
      43             : 
      44           0 : rtl::OUString ScUndoDraw::GetComment() const
      45             : {
      46           0 :     if (pDrawUndo)
      47           0 :         return pDrawUndo->GetComment();
      48           0 :     return rtl::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 : sal_Bool ScUndoDraw::IsLinked()
      67             : {
      68           0 :     if (pDrawUndo)
      69           0 :         return pDrawUndo->IsLinked();
      70             :     else
      71           0 :         return false;
      72             : }
      73             : 
      74           0 : void ScUndoDraw::SetLinked( sal_Bool bIsLinked )
      75             : {
      76           0 :     if (pDrawUndo)
      77           0 :         pDrawUndo->SetLinked(bIsLinked);
      78           0 : }
      79             : 
      80           0 : sal_Bool  ScUndoDraw::Merge( SfxUndoAction* pNextAction )
      81             : {
      82           0 :     if (pDrawUndo)
      83           0 :         return pDrawUndo->Merge(pNextAction);
      84             :     else
      85           0 :         return false;
      86             : }
      87             : 
      88           0 : void ScUndoDraw::UpdateSubShell()
      89             : {
      90             :     // #i26822# remove the draw shell if the selected object has been removed
      91           0 :     ScTabViewShell* pViewShell = pDocShell->GetBestViewShell();
      92           0 :     if (pViewShell)
      93           0 :         pViewShell->UpdateDrawShell();
      94           0 : }
      95             : 
      96           0 : void ScUndoDraw::Undo()
      97             : {
      98           0 :     if (pDrawUndo)
      99             :     {
     100           0 :         pDrawUndo->Undo();
     101           0 :         pDocShell->SetDrawModified();
     102           0 :         UpdateSubShell();
     103             :     }
     104           0 : }
     105             : 
     106           0 : void ScUndoDraw::Redo()
     107             : {
     108           0 :     if (pDrawUndo)
     109             :     {
     110           0 :         pDrawUndo->Redo();
     111           0 :         pDocShell->SetDrawModified();
     112           0 :         UpdateSubShell();
     113             :     }
     114           0 : }
     115             : 
     116           0 : void ScUndoDraw::Repeat(SfxRepeatTarget& rTarget)
     117             : {
     118           0 :     if (pDrawUndo)
     119           0 :         pDrawUndo->Repeat(rTarget);
     120           0 : }
     121             : 
     122           0 : sal_Bool ScUndoDraw::CanRepeat(SfxRepeatTarget& rTarget) const
     123             : {
     124           0 :     if (pDrawUndo)
     125           0 :         return pDrawUndo->CanRepeat(rTarget);
     126             :     else
     127           0 :         return false;
     128          15 : }
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10