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