xref: /aoo41x/main/sd/source/ui/func/undopage.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 
28 #include "undopage.hxx"
29 
30 #include <svx/svxids.hrc>
31 #include <sfx2/bindings.hxx>
32 #include <sfx2/dispatch.hxx>
33 #include <sfx2/viewfrm.hxx>
34 
35 #include "sdpage.hxx"
36 #include "DrawViewShell.hxx"
37 #include "drawview.hxx"
38 #include <svx/svdpagv.hxx>
39 
40 
41 
42 TYPEINIT1(SdPageFormatUndoAction, SdUndoAction);
43 TYPEINIT1(SdPageLRUndoAction, SdUndoAction);
44 TYPEINIT1(SdPageULUndoAction, SdUndoAction);
45 
46 
47 /*************************************************************************
48 |*
49 |* Destruktor
50 |*
51 \************************************************************************/
52 
~SdPageFormatUndoAction()53 SdPageFormatUndoAction::~SdPageFormatUndoAction()
54 {
55 }
56 
57 /*************************************************************************
58 |*
59 |* Undo()
60 |*
61 \************************************************************************/
62 
Undo()63 void SdPageFormatUndoAction::Undo()
64 {
65 	Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, mnOldLower);
66 	mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
67 	mpPage->SetSize(maOldSize);
68 	mpPage->SetLftBorder(mnOldLeft);
69 	mpPage->SetRgtBorder(mnOldRight);
70 	mpPage->SetUppBorder(mnOldUpper);
71 	mpPage->SetLwrBorder(mnOldLower);
72 	mpPage->SetOrientation(meOldOrientation);
73 	mpPage->SetPaperBin( mnOldPaperBin );
74 
75 	mpPage->SetBackgroundFullSize( mbOldFullSize );
76 	if( !mpPage->IsMasterPage() )
77 		( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize );
78 
79 }
80 
Redo()81 void SdPageFormatUndoAction::Redo()
82 {
83 	Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, mnNewLower);
84 	mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
85 	mpPage->SetSize(maNewSize);
86 	mpPage->SetLftBorder(mnNewLeft);
87 	mpPage->SetRgtBorder(mnNewRight);
88 	mpPage->SetUppBorder(mnNewUpper);
89 	mpPage->SetLwrBorder(mnNewLower);
90 	mpPage->SetOrientation(meNewOrientation);
91 	mpPage->SetPaperBin( mnNewPaperBin );
92 
93 	mpPage->SetBackgroundFullSize( mbNewFullSize );
94 	if( !mpPage->IsMasterPage() )
95 		( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize );
96 
97 }
98 
~SdPageLRUndoAction()99 SdPageLRUndoAction::~SdPageLRUndoAction()
100 {
101 }
102 
Undo()103 void SdPageLRUndoAction::Undo()
104 {
105 	mpPage->SetLftBorder(mnOldLeft);
106 	mpPage->SetRgtBorder(mnOldRight);
107 }
108 
Redo()109 void SdPageLRUndoAction::Redo()
110 {
111 	mpPage->SetLftBorder(mnNewLeft);
112 	mpPage->SetRgtBorder(mnNewRight);
113 }
114 
~SdPageULUndoAction()115 SdPageULUndoAction::~SdPageULUndoAction()
116 {
117 }
118 
Undo()119 void SdPageULUndoAction::Undo()
120 {
121 	mpPage->SetUppBorder(mnOldUpper);
122 	mpPage->SetLwrBorder(mnOldLower);
123 }
124 
125 /*************************************************************************
126 |*
127 |* UL-Redo()
128 |*
129 \************************************************************************/
130 
Redo()131 void SdPageULUndoAction::Redo()
132 {
133 	mpPage->SetUppBorder(mnNewUpper);
134 	mpPage->SetLwrBorder(mnNewLower);
135 }
136 
137