LibreOffice Module sd (master) 1
sdundogr.cxx
Go to the documentation of this file.
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 <sdundogr.hxx>
21#include <tools/long.hxx>
22
24
26{
27 bool bRet = false;
28
29 if (auto pSdUndoAction = dynamic_cast<SdUndoAction*>(pNextAction))
30 {
31 SdUndoAction* pClone = pSdUndoAction->Clone();
32
33 if (pClone)
34 {
35 AddAction(pClone);
36 bRet = true;
37 }
38 }
39
40 return bRet;
41}
42
47{
48 ::tools::Long nLast = aCtn.size();
49 for (::tools::Long nAction = nLast - 1; nAction >= 0; nAction--)
50 {
51 aCtn[nAction]->Undo();
52 }
53}
54
56{
57 size_t nLast = aCtn.size();
58 for (size_t nAction = 0; nAction < nLast; nAction++)
59 {
60 aCtn[nAction]->Redo();
61 }
62}
63
64void SdUndoGroup::AddAction(SdUndoAction* pAction) { aCtn.emplace_back(pAction); }
65
66/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SdUndoAction * Clone() const
Definition: sdundo.hxx:34
void AddAction(SdUndoAction *pAction)
Definition: sdundogr.cxx:64
virtual void Undo() override
Undo, reverse order of execution.
Definition: sdundogr.cxx:46
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: sdundogr.cxx:25
std::vector< std::unique_ptr< SdUndoAction > > aCtn
Definition: sdundogr.hxx:30
virtual ~SdUndoGroup() override
virtual void Redo() override
Definition: sdundogr.cxx:55
long Long