xref: /trunk/main/starmath/source/action.cxx (revision d107581f)
1*d107581fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d107581fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d107581fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d107581fSAndrew Rist  * distributed with this work for additional information
6*d107581fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d107581fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d107581fSAndrew Rist  * "License"); you may not use this file except in compliance
9*d107581fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d107581fSAndrew Rist  *
11*d107581fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d107581fSAndrew Rist  *
13*d107581fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d107581fSAndrew Rist  * software distributed under the License is distributed on an
15*d107581fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d107581fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*d107581fSAndrew Rist  * specific language governing permissions and limitations
18*d107581fSAndrew Rist  * under the License.
19*d107581fSAndrew Rist  *
20*d107581fSAndrew Rist  *************************************************************/
21*d107581fSAndrew Rist 
22*d107581fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_starmath.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "action.hxx"
29cdf0e10cSrcweir #include "smdll.hxx"
30cdf0e10cSrcweir #include "document.hxx"
31cdf0e10cSrcweir #include "starmath.hrc"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
SmFormatAction(SmDocShell * pDocSh,const SmFormat & rOldFormat,const SmFormat & rNewFormat)34cdf0e10cSrcweir SmFormatAction::SmFormatAction(SmDocShell *pDocSh,
35cdf0e10cSrcweir 							   const SmFormat& rOldFormat,
36cdf0e10cSrcweir 							   const SmFormat& rNewFormat) :
37cdf0e10cSrcweir 	pDoc( pDocSh ),
38cdf0e10cSrcweir 	aOldFormat( rOldFormat ),
39cdf0e10cSrcweir 	aNewFormat( rNewFormat )
40cdf0e10cSrcweir {
41cdf0e10cSrcweir }
42cdf0e10cSrcweir 
Undo()43cdf0e10cSrcweir void SmFormatAction::Undo()
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 	pDoc->SetFormat(aOldFormat);
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
Redo()48cdf0e10cSrcweir void SmFormatAction::Redo()
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	pDoc->SetFormat(aNewFormat);
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
Repeat(SfxRepeatTarget & rDocSh)53cdf0e10cSrcweir void SmFormatAction::Repeat(SfxRepeatTarget& rDocSh)
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     dynamic_cast< SmDocShell & >(rDocSh).SetFormat(aNewFormat);
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
GetComment() const58cdf0e10cSrcweir UniString SmFormatAction::GetComment() const
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	return (SmResId(RID_UNDOFORMATNAME));
61cdf0e10cSrcweir }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64