/src/libreoffice/include/svx/sdrundomanager.hxx
Line | Count | Source |
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 | | #ifndef INCLUDED_SVX_SDRUNDOMANAGER_HXX |
20 | | #define INCLUDED_SVX_SDRUNDOMANAGER_HXX |
21 | | |
22 | | #include <svx/svxdllapi.h> |
23 | | #include <editeng/editund2.hxx> |
24 | | #include <tools/link.hxx> |
25 | | |
26 | | class SfxObjectShell; |
27 | | |
28 | | class SVXCORE_DLLPUBLIC SdrUndoManager : public EditUndoManager |
29 | | { |
30 | | private: |
31 | | using EditUndoManager::Undo; |
32 | | using EditUndoManager::Redo; |
33 | | |
34 | | Link<SdrUndoManager*, void> maEndTextEditHdl; |
35 | | SfxUndoAction* mpLastUndoActionBeforeTextEdit; |
36 | | size_t mnRedoActionCountBeforeTextEdit; |
37 | | bool mbEndTextEditTriggeredFromUndo; |
38 | | |
39 | | SfxObjectShell* m_pDocSh; |
40 | | |
41 | | protected: |
42 | | // call to check for TextEdit active |
43 | | bool isTextEditActive() const; |
44 | | virtual void EmptyActionsChanged() override; |
45 | | |
46 | | public: |
47 | | SdrUndoManager(); |
48 | | virtual ~SdrUndoManager() override; |
49 | | |
50 | | /// react depending on edit mode and if no more undo is possible |
51 | | virtual bool Undo() override; |
52 | | virtual bool Redo() override; |
53 | | |
54 | | // #i123350# |
55 | | virtual void Clear() override; |
56 | | |
57 | | // Call for the view which starts the interactive text edit. Use link to |
58 | | // activate (start text edit) and empty link to reset (end text edit). On |
59 | | // reset all text edit actions will be removed from this undo manager to |
60 | | // restore the state before activation |
61 | | void SetEndTextEditHdl(const Link<SdrUndoManager*, void>& rLink); |
62 | | |
63 | | // check from outside if we are inside a callback for ending text edit. This |
64 | | // is needed to detect inside end text edit if it is a regular one or triggered |
65 | | // by a last undo during text edit |
66 | 0 | bool isEndTextEditTriggeredFromUndo() const { return mbEndTextEditTriggeredFromUndo; } |
67 | | void SetDocShell(SfxObjectShell* pDocShell); |
68 | 0 | size_t GetRedoActionCountBeforeTextEdit() const { return mnRedoActionCountBeforeTextEdit; } |
69 | | }; |
70 | | |
71 | | #endif // INCLUDED_SVX_SDRUNDOMANAGER_HXX |
72 | | |
73 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |