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