LibreOffice Module sc (master) 1
undodraw.cxx
Go to the documentation of this file.
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 <undodraw.hxx>
21#include <docsh.hxx>
22#include <tabvwsh.hxx>
23
24
25ScUndoDraw::ScUndoDraw( std::unique_ptr<SfxUndoAction> pUndo, ScDocShell* pDocSh ) :
26 pDrawUndo( std::move(pUndo) ),
27 pDocShell( pDocSh ),
28 mnViewShellId( -1 )
29{
31 mnViewShellId = pViewShell->GetViewShellId();
32}
33
35{
36}
37
38OUString ScUndoDraw::GetComment() const
39{
40 if (pDrawUndo)
41 return pDrawUndo->GetComment();
42 return OUString();
43}
44
46{
47 return mnViewShellId;
48}
49
50OUString ScUndoDraw::GetRepeatComment(SfxRepeatTarget& rTarget) const
51{
52 if (pDrawUndo)
53 return pDrawUndo->GetRepeatComment(rTarget);
54 return OUString();
55}
56
57bool ScUndoDraw::Merge( SfxUndoAction* pNextAction )
58{
59 if (pDrawUndo)
60 return pDrawUndo->Merge(pNextAction);
61 else
62 return false;
63}
64
66{
67 // #i26822# remove the draw shell if the selected object has been removed
69 if (pViewShell)
70 pViewShell->UpdateDrawShell();
71}
72
74{
75 if (pDrawUndo)
76 {
77 pDrawUndo->Undo();
80 }
81}
82
84{
85 if (pDrawUndo)
86 {
87 pDrawUndo->Redo();
90 }
91}
92
93void ScUndoDraw::Repeat(SfxRepeatTarget& rTarget)
94{
95 if (pDrawUndo)
96 pDrawUndo->Repeat(rTarget);
97}
98
99bool ScUndoDraw::CanRepeat(SfxRepeatTarget& rTarget) const
100{
101 if (pDrawUndo)
102 return pDrawUndo->CanRepeat(rTarget);
103 else
104 return false;
105}
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
Definition: docsh4.cxx:2623
void SetDrawModified()
SetDrawModified - without Formula update.
Definition: docsh.cxx:3046
void UpdateDrawShell()
Definition: tabvwsh4.cxx:571
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1076
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undodraw.cxx:93
virtual void Redo() override
Definition: undodraw.cxx:83
ScDocShell * pDocShell
Definition: undodraw.hxx:30
ViewShellId GetViewShellId() const override
See SfxUndoAction::GetViewShellId().
Definition: undodraw.cxx:45
virtual OUString GetComment() const override
Definition: undodraw.cxx:38
void UpdateSubShell()
Definition: undodraw.cxx:65
virtual void Undo() override
Definition: undodraw.cxx:73
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undodraw.cxx:99
virtual ~ScUndoDraw() override
Definition: undodraw.cxx:34
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: undodraw.cxx:57
std::unique_ptr< SfxUndoAction > pDrawUndo
Definition: undodraw.hxx:29
ViewShellId mnViewShellId
Definition: undodraw.hxx:31
ScUndoDraw(std::unique_ptr< SfxUndoAction > pUndo, ScDocShell *pDocSh)
Definition: undodraw.cxx:25
virtual OUString GetRepeatComment(SfxRepeatTarget &) const override
Definition: undodraw.cxx:50
FilterGroup & rTarget