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 "drawdoc.hxx"
21 : #include "unoaprms.hxx"
22 : #include "anminfo.hxx"
23 :
24 :
25 0 : TYPEINIT1(SdAnimationPrmsUndoAction, SdUndoAction);
26 :
27 :
28 0 : void SdAnimationPrmsUndoAction::Undo()
29 : {
30 : // no new info created: restore data
31 0 : if (!bInfoCreated)
32 : {
33 0 : SdDrawDocument* pDoc = (SdDrawDocument*)pObject->GetModel();
34 0 : if( pDoc )
35 : {
36 0 : SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pObject );
37 :
38 0 : pInfo->mbActive = bOldActive;
39 0 : pInfo->meEffect = eOldEffect;
40 0 : pInfo->meTextEffect = eOldTextEffect;
41 0 : pInfo->meSpeed = eOldSpeed;
42 0 : pInfo->mbDimPrevious = bOldDimPrevious;
43 0 : pInfo->maDimColor = aOldDimColor;
44 0 : pInfo->mbDimHide = bOldDimHide;
45 0 : pInfo->mbSoundOn = bOldSoundOn;
46 0 : pInfo->maSoundFile = aOldSoundFile;
47 0 : pInfo->mbPlayFull = bOldPlayFull;
48 0 : pInfo->meClickAction = eOldClickAction;
49 0 : pInfo->SetBookmark( aOldBookmark );
50 0 : pInfo->mnVerb = nOldVerb;
51 0 : pInfo->mnPresOrder = nOldPresOrder;
52 :
53 0 : pInfo->meSecondEffect = eOldSecondEffect;
54 0 : pInfo->meSecondSpeed = eOldSecondSpeed;
55 0 : pInfo->mbSecondSoundOn = bOldSecondSoundOn;
56 0 : pInfo->mbSecondPlayFull = bOldSecondPlayFull;
57 : }
58 : }
59 : // info was created by action: delete info
60 : else
61 : {
62 0 : pObject->DeleteUserData(0);
63 : }
64 : // force ModelHasChanged() in order to update effect window (animation order)
65 0 : pObject->SetChanged();
66 0 : pObject->BroadcastObjectChange();
67 0 : }
68 :
69 0 : void SdAnimationPrmsUndoAction::Redo()
70 : {
71 0 : SdAnimationInfo* pInfo = NULL;
72 :
73 0 : pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
74 :
75 0 : pInfo->mbActive = bNewActive;
76 0 : pInfo->meEffect = eNewEffect;
77 0 : pInfo->meTextEffect = eNewTextEffect;
78 0 : pInfo->meSpeed = eNewSpeed;
79 0 : pInfo->mbDimPrevious = bNewDimPrevious;
80 0 : pInfo->maDimColor = aNewDimColor;
81 0 : pInfo->mbDimHide = bNewDimHide;
82 0 : pInfo->mbSoundOn = bNewSoundOn;
83 0 : pInfo->maSoundFile = aNewSoundFile;
84 0 : pInfo->mbPlayFull = bNewPlayFull;
85 0 : pInfo->meClickAction = eNewClickAction;
86 0 : pInfo->SetBookmark( aNewBookmark );
87 0 : pInfo->mnVerb = nNewVerb;
88 0 : pInfo->mnPresOrder = nNewPresOrder;
89 :
90 0 : pInfo->meSecondEffect = eNewSecondEffect;
91 0 : pInfo->meSecondSpeed = eNewSecondSpeed;
92 0 : pInfo->mbSecondSoundOn = bNewSecondSoundOn;
93 0 : pInfo->mbSecondPlayFull = bNewSecondPlayFull;
94 :
95 : // force ModelHasChanged() in order to update effect window (animation order)
96 0 : pObject->SetChanged();
97 0 : pObject->BroadcastObjectChange();
98 0 : }
99 :
100 0 : SdAnimationPrmsUndoAction::~SdAnimationPrmsUndoAction()
101 : {
102 0 : }
103 :
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|