1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "undopage.hxx"
22 #include <svx/svxids.hrc>
23 #include <sfx2/bindings.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/viewfrm.hxx>
28 #include "DrawViewShell.hxx"
29 #include "drawview.hxx"
30 #include <svx/svdpagv.hxx>
34 TYPEINIT1(SdPageFormatUndoAction
, SdUndoAction
);
35 TYPEINIT1(SdPageLRUndoAction
, SdUndoAction
);
36 TYPEINIT1(SdPageULUndoAction
, SdUndoAction
);
39 SdPageFormatUndoAction::~SdPageFormatUndoAction()
43 void SdPageFormatUndoAction::Undo()
45 Rectangle
aOldBorderRect(mnOldLeft
, mnOldUpper
, mnOldRight
, mnOldLower
);
46 mpPage
->ScaleObjects(maOldSize
, aOldBorderRect
, mbNewScale
);
47 mpPage
->SetSize(maOldSize
);
48 mpPage
->SetLftBorder(mnOldLeft
);
49 mpPage
->SetRgtBorder(mnOldRight
);
50 mpPage
->SetUppBorder(mnOldUpper
);
51 mpPage
->SetLwrBorder(mnOldLower
);
52 mpPage
->SetOrientation(meOldOrientation
);
53 mpPage
->SetPaperBin( mnOldPaperBin
);
55 mpPage
->SetBackgroundFullSize( mbOldFullSize
);
56 if( !mpPage
->IsMasterPage() )
57 ( (SdPage
&) mpPage
->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize
);
61 void SdPageFormatUndoAction::Redo()
63 Rectangle
aNewBorderRect(mnNewLeft
, mnNewUpper
, mnNewRight
, mnNewLower
);
64 mpPage
->ScaleObjects(maNewSize
, aNewBorderRect
, mbNewScale
);
65 mpPage
->SetSize(maNewSize
);
66 mpPage
->SetLftBorder(mnNewLeft
);
67 mpPage
->SetRgtBorder(mnNewRight
);
68 mpPage
->SetUppBorder(mnNewUpper
);
69 mpPage
->SetLwrBorder(mnNewLower
);
70 mpPage
->SetOrientation(meNewOrientation
);
71 mpPage
->SetPaperBin( mnNewPaperBin
);
73 mpPage
->SetBackgroundFullSize( mbNewFullSize
);
74 if( !mpPage
->IsMasterPage() )
75 ( (SdPage
&) mpPage
->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize
);
79 SdPageLRUndoAction::~SdPageLRUndoAction()
83 void SdPageLRUndoAction::Undo()
85 mpPage
->SetLftBorder(mnOldLeft
);
86 mpPage
->SetRgtBorder(mnOldRight
);
89 void SdPageLRUndoAction::Redo()
91 mpPage
->SetLftBorder(mnNewLeft
);
92 mpPage
->SetRgtBorder(mnNewRight
);
95 SdPageULUndoAction::~SdPageULUndoAction()
99 void SdPageULUndoAction::Undo()
101 mpPage
->SetUppBorder(mnOldUpper
);
102 mpPage
->SetLwrBorder(mnOldLower
);
108 void SdPageULUndoAction::Redo()
110 mpPage
->SetUppBorder(mnNewUpper
);
111 mpPage
->SetLwrBorder(mnNewLower
);
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */