bump product version to 4.1.6.2
[LibreOffice.git] / sc / source / ui / undo / undodraw.cxx
blobfc047c117afef50caacfe84a71ee2c9c1a4ea085
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svdundo.hxx>
22 #include "undodraw.hxx"
23 #include "docsh.hxx"
24 #include "tabvwsh.hxx"
26 TYPEINIT1(ScUndoDraw, SfxUndoAction);
28 ScUndoDraw::ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ) :
29 pDrawUndo( pUndo ),
30 pDocShell( pDocSh )
34 ScUndoDraw::~ScUndoDraw()
36 delete pDrawUndo;
39 void ScUndoDraw::ForgetDrawUndo()
41 pDrawUndo = NULL; // do not delete (DrawUndo has to be remembered from outside)
44 OUString ScUndoDraw::GetComment() const
46 if (pDrawUndo)
47 return pDrawUndo->GetComment();
48 return OUString();
51 OUString ScUndoDraw::GetRepeatComment(SfxRepeatTarget& rTarget) const
53 if (pDrawUndo)
54 return pDrawUndo->GetRepeatComment(rTarget);
55 return OUString();
58 sal_uInt16 ScUndoDraw::GetId() const
60 if (pDrawUndo)
61 return pDrawUndo->GetId();
62 else
63 return 0;
66 sal_Bool ScUndoDraw::IsLinked()
68 if (pDrawUndo)
69 return pDrawUndo->IsLinked();
70 else
71 return false;
74 void ScUndoDraw::SetLinked( sal_Bool bIsLinked )
76 if (pDrawUndo)
77 pDrawUndo->SetLinked(bIsLinked);
80 sal_Bool ScUndoDraw::Merge( SfxUndoAction* pNextAction )
82 if (pDrawUndo)
83 return pDrawUndo->Merge(pNextAction);
84 else
85 return false;
88 void ScUndoDraw::UpdateSubShell()
90 // #i26822# remove the draw shell if the selected object has been removed
91 ScTabViewShell* pViewShell = pDocShell->GetBestViewShell();
92 if (pViewShell)
93 pViewShell->UpdateDrawShell();
96 void ScUndoDraw::Undo()
98 if (pDrawUndo)
100 pDrawUndo->Undo();
101 pDocShell->SetDrawModified();
102 UpdateSubShell();
106 void ScUndoDraw::Redo()
108 if (pDrawUndo)
110 pDrawUndo->Redo();
111 pDocShell->SetDrawModified();
112 UpdateSubShell();
116 void ScUndoDraw::Repeat(SfxRepeatTarget& rTarget)
118 if (pDrawUndo)
119 pDrawUndo->Repeat(rTarget);
122 sal_Bool ScUndoDraw::CanRepeat(SfxRepeatTarget& rTarget) const
124 if (pDrawUndo)
125 return pDrawUndo->CanRepeat(rTarget);
126 else
127 return false;
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */