Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/inc/textchain.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
20
#pragma once
21
22
#include <editeng/editdata.hxx>
23
#include <map>
24
25
class SdrTextObj;
26
27
typedef OUString ChainLinkId;
28
29
enum class CursorChainingEvent : sal_uInt8
30
{
31
    TO_NEXT_LINK,
32
    TO_PREV_LINK,
33
    UNCHANGED,
34
    NULL_EVENT
35
};
36
37
class ImpChainLinkProperties
38
{
39
protected:
40
    friend class TextChain;
41
42
0
    ImpChainLinkProperties() = default;
43
44
private:
45
    // NOTE: Remember to set default value in constructor when adding field
46
    ESelection aPreChainingSel;
47
    ESelection aPostChainingSel;
48
    CursorChainingEvent aCursorEvent = CursorChainingEvent::NULL_EVENT;
49
    bool aNilChainingEvent = false;
50
    bool aIsPartOfLastParaInNextLink = false;
51
    bool aSwitchingToNextBox = false;
52
};
53
54
class TextChain
55
{
56
public:
57
    ~TextChain();
58
59
    ImpChainLinkProperties* GetLinkProperties(const SdrTextObj*);
60
61
    // Specific Link Properties
62
    CursorChainingEvent const& GetCursorEvent(const SdrTextObj*);
63
    void SetCursorEvent(const SdrTextObj*, CursorChainingEvent const&);
64
65
    bool GetNilChainingEvent(const SdrTextObj*);
66
    void SetNilChainingEvent(const SdrTextObj*, bool);
67
68
    ESelection const& GetPreChainingSel(const SdrTextObj*);
69
    void SetPreChainingSel(const SdrTextObj*, ESelection const&);
70
71
    ESelection const& GetPostChainingSel(const SdrTextObj*);
72
    void SetPostChainingSel(const SdrTextObj*, ESelection const&);
73
74
    // return whether a paragraph is split between this box and the next
75
    bool GetIsPartOfLastParaInNextLink(const SdrTextObj*);
76
    void SetIsPartOfLastParaInNextLink(const SdrTextObj*, bool);
77
78
    // return whether we are currently moving the cursor to the next box (useful to know whether we should prevent SetOutlinerParaObject invocations in SdrTextObj::EndTextEdit)
79
    bool GetSwitchingToNextBox(const SdrTextObj*);
80
    void SetSwitchingToNextBox(const SdrTextObj*, bool);
81
82
protected:
83
    TextChain();
84
85
private:
86
    std::map<ChainLinkId, ImpChainLinkProperties*> maLinkPropertiesMap;
87
88
    friend class SdrModel;
89
};
90
91
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */