1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26
27
28 #include "unprlout.hxx"
29
30 #include "strings.hrc"
31 #include "sdpage.hxx"
32 #include "drawdoc.hxx"
33 #include "sdresid.hxx"
34
35
36 TYPEINIT1(SdPresentationLayoutUndoAction, SdUndoAction);
37
38
39
40 /*************************************************************************
41 |*
42 |* Konstruktor
43 |*
44 \************************************************************************/
45
SdPresentationLayoutUndoAction(SdDrawDocument * pTheDoc,String aTheOldLayoutName,String aTheNewLayoutName,AutoLayout eTheOldAutoLayout,AutoLayout eTheNewAutoLayout,sal_Bool bSet,SdPage * pThePage)46 SdPresentationLayoutUndoAction::SdPresentationLayoutUndoAction(
47 SdDrawDocument* pTheDoc,
48 String aTheOldLayoutName,
49 String aTheNewLayoutName,
50 AutoLayout eTheOldAutoLayout,
51 AutoLayout eTheNewAutoLayout,
52 sal_Bool bSet,
53 SdPage* pThePage):
54 SdUndoAction(pTheDoc)
55 {
56 aOldLayoutName = aTheOldLayoutName;
57 aNewLayoutName = aTheNewLayoutName;
58 eOldAutoLayout = eTheOldAutoLayout;
59 eNewAutoLayout = eTheNewAutoLayout;
60 bSetAutoLayout = bSet;
61
62 DBG_ASSERT(pThePage, "keine Page gesetzt!");
63 pPage = pThePage;
64 aComment = String(SdResId(STR_UNDO_SET_PRESLAYOUT));
65 }
66
67 /*************************************************************************
68 |*
69 |* Undo()
70 |*
71 \************************************************************************/
72
Undo()73 void SdPresentationLayoutUndoAction::Undo()
74 {
75 pPage->SetPresentationLayout(aOldLayoutName, sal_True, sal_True, sal_True);
76 if (bSetAutoLayout)
77 pPage->SetAutoLayout(eOldAutoLayout, sal_True);
78 }
79
80 /*************************************************************************
81 |*
82 |* Redo()
83 |*
84 \************************************************************************/
85
Redo()86 void SdPresentationLayoutUndoAction::Redo()
87 {
88 pPage->SetPresentationLayout(aNewLayoutName);
89 if (bSetAutoLayout)
90 pPage->SetAutoLayout(eNewAutoLayout, sal_True);
91 }
92
93 /*************************************************************************
94 |*
95 |* Destruktor
96 |*
97 \************************************************************************/
98
~SdPresentationLayoutUndoAction()99 SdPresentationLayoutUndoAction::~SdPresentationLayoutUndoAction()
100 {
101 }
102
103 /*************************************************************************
104 |*
105 |* Kommentar liefern
106 |*
107 \************************************************************************/
108
GetComment() const109 String SdPresentationLayoutUndoAction::GetComment() const
110 {
111 return aComment;
112 }
113
114
115
116