Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/vcl/source/edit/textundo.hxx
Line
Count
Source (jump to first uncovered line)
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
#pragma once
20
21
#include <svl/undo.hxx>
22
#include <vcl/texteng.hxx>
23
24
class TextView;
25
class TextSelection;
26
class TextDoc;
27
class TEParaPortions;
28
29
class TextUndoManager : public SfxUndoManager
30
{
31
    TextEngine*     mpTextEngine;
32
33
protected:
34
35
    void            UndoRedoStart();
36
    void            UndoRedoEnd();
37
38
0
    TextView*       GetView() const { return mpTextEngine->GetActiveView(); }
39
40
public:
41
    explicit TextUndoManager( TextEngine* pTextEngine );
42
    virtual ~TextUndoManager() override;
43
44
    using SfxUndoManager::Undo;
45
    virtual bool Undo() override;
46
    using SfxUndoManager::Redo;
47
    virtual bool Redo() override;
48
49
};
50
51
class TextUndo : public SfxUndoAction
52
{
53
private:
54
    TextEngine*         mpTextEngine;
55
56
protected:
57
58
0
    TextView*           GetView() const { return mpTextEngine->GetActiveView(); }
59
    void                SetSelection( const TextSelection& rSel );
60
61
0
    TextDoc*            GetDoc() const { return mpTextEngine->mpDoc.get(); }
62
0
    TEParaPortions*     GetTEParaPortions() const { return mpTextEngine->mpTEParaPortions.get(); }
63
64
public:
65
    explicit            TextUndo( TextEngine* pTextEngine );
66
    virtual             ~TextUndo() override;
67
68
0
    TextEngine*         GetTextEngine() const   { return mpTextEngine; }
69
70
    virtual void        Undo() override      = 0;
71
    virtual void        Redo() override      = 0;
72
73
    virtual OUString GetComment() const override;
74
};
75
76
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */