Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/svdundo.hxx>
30 : :
31 : : #include "undodraw.hxx"
32 : : #include "docsh.hxx"
33 : : #include "tabvwsh.hxx"
34 : :
35 : :
36 : : // -----------------------------------------------------------------------
37 : :
38 [ + - ][ # # ]: 8 : TYPEINIT1(ScUndoDraw, SfxUndoAction);
39 : :
40 : : // -----------------------------------------------------------------------
41 : :
42 : 70 : ScUndoDraw::ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ) :
43 : : pDrawUndo( pUndo ),
44 : 70 : pDocShell( pDocSh )
45 : : {
46 : 70 : }
47 : :
48 : 70 : ScUndoDraw::~ScUndoDraw()
49 : : {
50 [ + + ][ + - ]: 70 : delete pDrawUndo;
51 [ - + ]: 140 : }
52 : :
53 : 2 : void ScUndoDraw::ForgetDrawUndo()
54 : : {
55 : 2 : pDrawUndo = NULL; // nicht loeschen (Draw-Undo muss dann von aussen gemerkt werden)
56 : 2 : }
57 : :
58 : 51 : rtl::OUString ScUndoDraw::GetComment() const
59 : : {
60 [ + - ]: 51 : if (pDrawUndo)
61 : 51 : return pDrawUndo->GetComment();
62 : 51 : return rtl::OUString();
63 : : }
64 : :
65 : 0 : String ScUndoDraw::GetRepeatComment(SfxRepeatTarget& rTarget) const
66 : : {
67 [ # # ]: 0 : if (pDrawUndo)
68 : 0 : return pDrawUndo->GetRepeatComment(rTarget);
69 : : else
70 : 0 : return String();
71 : : }
72 : :
73 : 0 : sal_uInt16 ScUndoDraw::GetId() const
74 : : {
75 [ # # ]: 0 : if (pDrawUndo)
76 : 0 : return pDrawUndo->GetId();
77 : : else
78 : 0 : return 0;
79 : : }
80 : :
81 : 0 : sal_Bool ScUndoDraw::IsLinked()
82 : : {
83 [ # # ]: 0 : if (pDrawUndo)
84 : 0 : return pDrawUndo->IsLinked();
85 : : else
86 : 0 : return false;
87 : : }
88 : :
89 : 0 : void ScUndoDraw::SetLinked( sal_Bool bIsLinked )
90 : : {
91 [ # # ]: 0 : if (pDrawUndo)
92 : 0 : pDrawUndo->SetLinked(bIsLinked);
93 : 0 : }
94 : :
95 : 0 : sal_Bool ScUndoDraw::Merge( SfxUndoAction* pNextAction )
96 : : {
97 [ # # ]: 0 : if (pDrawUndo)
98 : 0 : return pDrawUndo->Merge(pNextAction);
99 : : else
100 : 0 : return false;
101 : : }
102 : :
103 : 0 : void ScUndoDraw::UpdateSubShell()
104 : : {
105 : : // #i26822# remove the draw shell if the selected object has been removed
106 : 0 : ScTabViewShell* pViewShell = pDocShell->GetBestViewShell();
107 [ # # ]: 0 : if (pViewShell)
108 : 0 : pViewShell->UpdateDrawShell();
109 : 0 : }
110 : :
111 : 0 : void ScUndoDraw::Undo()
112 : : {
113 [ # # ]: 0 : if (pDrawUndo)
114 : : {
115 : 0 : pDrawUndo->Undo();
116 : 0 : pDocShell->SetDrawModified();
117 : 0 : UpdateSubShell();
118 : : }
119 : 0 : }
120 : :
121 : 0 : void ScUndoDraw::Redo()
122 : : {
123 [ # # ]: 0 : if (pDrawUndo)
124 : : {
125 : 0 : pDrawUndo->Redo();
126 : 0 : pDocShell->SetDrawModified();
127 : 0 : UpdateSubShell();
128 : : }
129 : 0 : }
130 : :
131 : 0 : void ScUndoDraw::Repeat(SfxRepeatTarget& rTarget)
132 : : {
133 [ # # ]: 0 : if (pDrawUndo)
134 : 0 : pDrawUndo->Repeat(rTarget);
135 : 0 : }
136 : :
137 : 18 : sal_Bool ScUndoDraw::CanRepeat(SfxRepeatTarget& rTarget) const
138 : : {
139 [ + - ]: 18 : if (pDrawUndo)
140 : 18 : return pDrawUndo->CanRepeat(rTarget);
141 : : else
142 : 18 : return false;
143 : : }
144 : :
145 : :
146 : :
147 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|