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 0 : SdPageFormatUndoAction::~SdPageFormatUndoAction()
40 : {
41 0 : }
42 :
43 0 : void SdPageFormatUndoAction::Undo()
44 : {
45 0 : Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, mnOldLower);
46 0 : mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
47 0 : mpPage->SetSize(maOldSize);
48 0 : mpPage->SetLftBorder(mnOldLeft);
49 0 : mpPage->SetRgtBorder(mnOldRight);
50 0 : mpPage->SetUppBorder(mnOldUpper);
51 0 : mpPage->SetLwrBorder(mnOldLower);
52 0 : mpPage->SetOrientation(meOldOrientation);
53 0 : mpPage->SetPaperBin( mnOldPaperBin );
54 :
55 0 : mpPage->SetBackgroundFullSize( mbOldFullSize );
56 0 : if( !mpPage->IsMasterPage() )
57 0 : ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize );
58 :
59 0 : }
60 :
61 0 : void SdPageFormatUndoAction::Redo()
62 : {
63 0 : Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, mnNewLower);
64 0 : mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
65 0 : mpPage->SetSize(maNewSize);
66 0 : mpPage->SetLftBorder(mnNewLeft);
67 0 : mpPage->SetRgtBorder(mnNewRight);
68 0 : mpPage->SetUppBorder(mnNewUpper);
69 0 : mpPage->SetLwrBorder(mnNewLower);
70 0 : mpPage->SetOrientation(meNewOrientation);
71 0 : mpPage->SetPaperBin( mnNewPaperBin );
72 :
73 0 : mpPage->SetBackgroundFullSize( mbNewFullSize );
74 0 : if( !mpPage->IsMasterPage() )
75 0 : ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize );
76 :
77 0 : }
78 :
79 0 : SdPageLRUndoAction::~SdPageLRUndoAction()
80 : {
81 0 : }
82 :
83 0 : void SdPageLRUndoAction::Undo()
84 : {
85 0 : mpPage->SetLftBorder(mnOldLeft);
86 0 : mpPage->SetRgtBorder(mnOldRight);
87 0 : }
88 :
89 0 : void SdPageLRUndoAction::Redo()
90 : {
91 0 : mpPage->SetLftBorder(mnNewLeft);
92 0 : mpPage->SetRgtBorder(mnNewRight);
93 0 : }
94 :
95 0 : SdPageULUndoAction::~SdPageULUndoAction()
96 : {
97 0 : }
98 :
99 0 : void SdPageULUndoAction::Undo()
100 : {
101 0 : mpPage->SetUppBorder(mnOldUpper);
102 0 : mpPage->SetLwrBorder(mnOldLower);
103 0 : }
104 :
105 : /**
106 : * UL-Redo()
107 : */
108 0 : void SdPageULUndoAction::Redo()
109 : {
110 0 : mpPage->SetUppBorder(mnNewUpper);
111 0 : mpPage->SetLwrBorder(mnNewLower);
112 0 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|