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>
32 TYPEINIT1(SdPageFormatUndoAction
, SdUndoAction
);
33 TYPEINIT1(SdPageLRUndoAction
, SdUndoAction
);
34 TYPEINIT1(SdPageULUndoAction
, SdUndoAction
);
36 SdPageFormatUndoAction::~SdPageFormatUndoAction()
40 void SdPageFormatUndoAction::Undo()
42 Rectangle
aOldBorderRect(mnOldLeft
, mnOldUpper
, mnOldRight
, mnOldLower
);
43 mpPage
->ScaleObjects(maOldSize
, aOldBorderRect
, mbNewScale
);
44 mpPage
->SetSize(maOldSize
);
45 mpPage
->SetLftBorder(mnOldLeft
);
46 mpPage
->SetRgtBorder(mnOldRight
);
47 mpPage
->SetUppBorder(mnOldUpper
);
48 mpPage
->SetLwrBorder(mnOldLower
);
49 mpPage
->SetOrientation(meOldOrientation
);
50 mpPage
->SetPaperBin( mnOldPaperBin
);
52 mpPage
->SetBackgroundFullSize( mbOldFullSize
);
53 if( !mpPage
->IsMasterPage() )
54 static_cast<SdPage
&>( mpPage
->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize
);
58 void SdPageFormatUndoAction::Redo()
60 Rectangle
aNewBorderRect(mnNewLeft
, mnNewUpper
, mnNewRight
, mnNewLower
);
61 mpPage
->ScaleObjects(maNewSize
, aNewBorderRect
, mbNewScale
);
62 mpPage
->SetSize(maNewSize
);
63 mpPage
->SetLftBorder(mnNewLeft
);
64 mpPage
->SetRgtBorder(mnNewRight
);
65 mpPage
->SetUppBorder(mnNewUpper
);
66 mpPage
->SetLwrBorder(mnNewLower
);
67 mpPage
->SetOrientation(meNewOrientation
);
68 mpPage
->SetPaperBin( mnNewPaperBin
);
70 mpPage
->SetBackgroundFullSize( mbNewFullSize
);
71 if( !mpPage
->IsMasterPage() )
72 static_cast<SdPage
&>( mpPage
->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize
);
76 SdPageLRUndoAction::~SdPageLRUndoAction()
80 void SdPageLRUndoAction::Undo()
82 mpPage
->SetLftBorder(mnOldLeft
);
83 mpPage
->SetRgtBorder(mnOldRight
);
86 void SdPageLRUndoAction::Redo()
88 mpPage
->SetLftBorder(mnNewLeft
);
89 mpPage
->SetRgtBorder(mnNewRight
);
92 SdPageULUndoAction::~SdPageULUndoAction()
96 void SdPageULUndoAction::Undo()
98 mpPage
->SetUppBorder(mnOldUpper
);
99 mpPage
->SetLwrBorder(mnOldLower
);
105 void SdPageULUndoAction::Redo()
107 mpPage
->SetUppBorder(mnNewUpper
);
108 mpPage
->SetLwrBorder(mnNewLower
);
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */