xref: /aoo41x/main/sd/source/ui/func/undopage.cxx (revision cdf0e10c)
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_sd.hxx"
30 
31 
32 #include "undopage.hxx"
33 
34 #include <svx/svxids.hrc>
35 #include <sfx2/bindings.hxx>
36 #include <sfx2/dispatch.hxx>
37 #include <sfx2/viewfrm.hxx>
38 
39 #include "sdpage.hxx"
40 #include "DrawViewShell.hxx"
41 #include "drawview.hxx"
42 #include <svx/svdpagv.hxx>
43 
44 
45 
46 TYPEINIT1(SdPageFormatUndoAction, SdUndoAction);
47 TYPEINIT1(SdPageLRUndoAction, SdUndoAction);
48 TYPEINIT1(SdPageULUndoAction, SdUndoAction);
49 
50 
51 /*************************************************************************
52 |*
53 |* Destruktor
54 |*
55 \************************************************************************/
56 
57 SdPageFormatUndoAction::~SdPageFormatUndoAction()
58 {
59 }
60 
61 /*************************************************************************
62 |*
63 |* Undo()
64 |*
65 \************************************************************************/
66 
67 void SdPageFormatUndoAction::Undo()
68 {
69 	Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, mnOldLower);
70 	mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
71 	mpPage->SetSize(maOldSize);
72 	mpPage->SetLftBorder(mnOldLeft);
73 	mpPage->SetRgtBorder(mnOldRight);
74 	mpPage->SetUppBorder(mnOldUpper);
75 	mpPage->SetLwrBorder(mnOldLower);
76 	mpPage->SetOrientation(meOldOrientation);
77 	mpPage->SetPaperBin( mnOldPaperBin );
78 
79 	mpPage->SetBackgroundFullSize( mbOldFullSize );
80 	if( !mpPage->IsMasterPage() )
81 		( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize );
82 
83 }
84 
85 void SdPageFormatUndoAction::Redo()
86 {
87 	Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, mnNewLower);
88 	mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
89 	mpPage->SetSize(maNewSize);
90 	mpPage->SetLftBorder(mnNewLeft);
91 	mpPage->SetRgtBorder(mnNewRight);
92 	mpPage->SetUppBorder(mnNewUpper);
93 	mpPage->SetLwrBorder(mnNewLower);
94 	mpPage->SetOrientation(meNewOrientation);
95 	mpPage->SetPaperBin( mnNewPaperBin );
96 
97 	mpPage->SetBackgroundFullSize( mbNewFullSize );
98 	if( !mpPage->IsMasterPage() )
99 		( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize );
100 
101 }
102 
103 SdPageLRUndoAction::~SdPageLRUndoAction()
104 {
105 }
106 
107 void SdPageLRUndoAction::Undo()
108 {
109 	mpPage->SetLftBorder(mnOldLeft);
110 	mpPage->SetRgtBorder(mnOldRight);
111 }
112 
113 void SdPageLRUndoAction::Redo()
114 {
115 	mpPage->SetLftBorder(mnNewLeft);
116 	mpPage->SetRgtBorder(mnNewRight);
117 }
118 
119 SdPageULUndoAction::~SdPageULUndoAction()
120 {
121 }
122 
123 void SdPageULUndoAction::Undo()
124 {
125 	mpPage->SetUppBorder(mnOldUpper);
126 	mpPage->SetLwrBorder(mnOldLower);
127 }
128 
129 /*************************************************************************
130 |*
131 |* UL-Redo()
132 |*
133 \************************************************************************/
134 
135 void SdPageULUndoAction::Redo()
136 {
137 	mpPage->SetUppBorder(mnNewUpper);
138 	mpPage->SetLwrBorder(mnNewLower);
139 }
140 
141