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