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