Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/textdata.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
#ifndef INCLUDED_VCL_TEXTDATA_HXX
21
#define INCLUDED_VCL_TEXTDATA_HXX
22
23
#include <sal/types.h>
24
#include <rtl/ustring.hxx>
25
#include <svl/hint.hxx>
26
#include <vcl/dllapi.h>
27
#include <memory>
28
29
enum class ExtTextInputAttr;
30
31
// for Notify, if all paragraphs were deleted
32
0
#define TEXT_PARA_ALL               SAL_MAX_UINT32
33
0
#define TEXT_INDEX_ALL              SAL_MAX_INT32
34
35
class TextPaM
36
{
37
private:
38
    sal_uInt32          mnPara;
39
    sal_Int32           mnIndex;
40
41
public:
42
0
                    TextPaM() : mnPara(0), mnIndex(0) {}
43
0
                    TextPaM( sal_uInt32 nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {}
44
45
0
    sal_uInt32          GetPara() const     { return mnPara; }
46
0
    sal_uInt32&         GetPara()           { return mnPara; }
47
48
0
    sal_Int32           GetIndex() const    { return mnIndex; }
49
0
    sal_Int32&          GetIndex()          { return mnIndex; }
50
51
    inline bool     operator == ( const TextPaM& rPaM ) const;
52
    inline bool     operator != ( const TextPaM& rPaM ) const;
53
    inline bool     operator < ( const TextPaM& rPaM ) const;
54
    inline bool     operator > ( const TextPaM& rPaM ) const;
55
};
56
57
inline bool TextPaM::operator == ( const TextPaM& rPaM ) const
58
0
{
59
0
    return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex );
60
0
}
61
62
inline bool TextPaM::operator != ( const TextPaM& rPaM ) const
63
0
{
64
0
    return !( *this == rPaM );
65
0
}
66
67
inline bool TextPaM::operator < ( const TextPaM& rPaM ) const
68
0
{
69
0
    return ( mnPara < rPaM.mnPara ) ||
70
0
           ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex );
71
0
}
72
73
inline bool TextPaM::operator > ( const TextPaM& rPaM ) const
74
0
{
75
0
    return ( mnPara > rPaM.mnPara ) ||
76
0
           ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex );
77
0
}
78
79
class VCL_DLLPUBLIC TextSelection
80
{
81
private:
82
    TextPaM         maStartPaM;
83
    TextPaM         maEndPaM;
84
85
public:
86
                    TextSelection();
87
                    TextSelection( const TextPaM& rPaM );
88
                    TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
89
90
0
    const TextPaM&  GetStart() const    { return maStartPaM; }
91
0
    TextPaM&        GetStart()          { return maStartPaM; }
92
93
0
    const TextPaM&  GetEnd() const      { return maEndPaM; }
94
0
    TextPaM&        GetEnd()            { return maEndPaM; }
95
96
    void            Justify();
97
98
0
    bool            HasRange() const    { return maStartPaM != maEndPaM; }
99
100
    inline bool     operator == ( const TextSelection& rSel ) const;
101
    inline bool     operator != ( const TextSelection& rSel ) const;
102
};
103
104
inline bool TextSelection::operator == ( const TextSelection& rSel ) const
105
0
{
106
0
    return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
107
0
}
108
109
inline bool TextSelection::operator != ( const TextSelection& rSel ) const
110
0
{
111
0
    return !( *this == rSel );
112
0
}
113
114
class VCL_DLLPUBLIC TextHint : public SfxHint
115
{
116
private:
117
    sal_Int32   mnValue;
118
119
public:
120
    TextHint( SfxHintId nId );
121
    TextHint( SfxHintId nId, sal_Int32 nValue );
122
123
0
    sal_Int32   GetValue() const        { return mnValue; }
124
};
125
126
struct TEIMEInfos
127
{
128
    OUString    aOldTextAfterStartPos;
129
    std::unique_ptr<ExtTextInputAttr[]> pAttribs;
130
    TextPaM     aPos;
131
    sal_Int32   nLen;
132
    bool        bWasCursorOverwrite;
133
134
    TEIMEInfos(const TextPaM& rPos, OUString aOldTextAfterStartPos);
135
    ~TEIMEInfos();
136
137
    void CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL);
138
    void DestroyAttribs();
139
};
140
141
#endif // INCLUDED_VCL_TEXTDATA_HXX
142
143
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */