Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/editstat.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_EDITENG_EDITSTAT_HXX
21
#define INCLUDED_EDITENG_EDITSTAT_HXX
22
23
#include <rtl/ustring.hxx>
24
#include <o3tl/typed_flags_set.hxx>
25
#include <utility>
26
27
enum class EEControlBits
28
{
29
    NONE               = 0x00000000,
30
    USECHARATTRIBS     = 0x00000001,  // Use of hard character attributes
31
    DOIDLEFORMAT       = 0x00000008,  // Formatting idle
32
    PASTESPECIAL       = 0x00000010,  // Allow PasteSpecial
33
    AUTOINDENTING      = 0x00000020,  // Automatic indenting
34
    UNDOATTRIBS        = 0x00000040,  // Undo for Attributes...
35
    ONECHARPERLINE     = 0x00000080,  // One character per line (used in calc)
36
    NOCOLORS           = 0x00000100,  // Engine: No Color
37
    OUTLINER           = 0x00000200,  // Special treatment Outliner/Outline mode
38
    OUTLINER2          = 0x00000400,  // Special treatment Outliner/Page
39
    ALLOWBIGOBJS       = 0x00000800,  // Portion info in text object
40
    ONLINESPELLING     = 0x00001000,  // During the edit Spelling
41
    STRETCHING         = 0x00002000,  // Stretch mode
42
    MARKNONURLFIELDS   = 0x00004000,  // Mark fields other than URL with color
43
    MARKURLFIELDS      = 0x00008000,  // Mark URL fields with color
44
    MARKFIELDS         = (MARKNONURLFIELDS | MARKURLFIELDS),
45
    RTFSTYLESHEETS     = 0x00020000,  // Use Stylesheets when imported
46
    AUTOCORRECT        = 0x00080000,  // AutoCorrect
47
    AUTOCOMPLETE       = 0x00100000,  // AutoComplete
48
    AUTOPAGESIZEX      = 0x00200000,  // Adjust paper width to Text
49
    AUTOPAGESIZEY      = 0x00400000,  // Adjust paper height to Text
50
    AUTOPAGESIZE       = (AUTOPAGESIZEX | AUTOPAGESIZEY),
51
    ULSPACESUMMATION   = 0x01000000,  // MS Compat: sum SA and SB, not maximum value
52
    SINGLELINE         = 0x02000000,  // One line for all text
53
    STACKED            = 0x04000000,  // Same as ONECHARPERLINE (used in impress)
54
};
55
namespace o3tl
56
{
57
    template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x07ffffff> {};
58
}
59
60
enum class EVControlBits
61
{
62
    AUTOSCROLL         = 0x0001,  // Auto scrolling horizontally
63
    ENABLEPASTE        = 0x0004,  // Enable Paste
64
    SINGLELINEPASTE    = 0x0008,  // View: Paste in input line ...
65
    OVERWRITE          = 0x0010,  // Overwrite mode
66
    INVONEMORE         = 0x0020,  // Invalidate one pixel more
67
    AUTOSIZEX          = 0x0040,  // Automatically adapt to text width
68
    AUTOSIZEY          = 0x0080,  // Automatically adapt to Text width
69
    AUTOSIZE           = (AUTOSIZEX|AUTOSIZEY)
70
};
71
namespace o3tl
72
{
73
    template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xfd> {};
74
}
75
76
enum class EditStatusFlags
77
{
78
    NONE                = 0x0000,
79
    HSCROLL             = 0x0001,
80
    VSCROLL             = 0x0002,
81
    CURSOROUT           = 0x0004,
82
    TEXTWIDTHCHANGED    = 0x0010,
83
    TextHeightChanged   = 0x0020,
84
    WRONGWORDCHANGED    = 0x0040
85
};
86
namespace o3tl
87
{
88
    template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0x77> {};
89
}
90
91
inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn )
92
0
{
93
0
    if ( bOn )
94
0
        rBits |= nMask;
95
0
    else
96
0
        rBits &= ~nMask;
97
0
}
98
99
class EditStatus
100
{
101
protected:
102
    EditStatusFlags nStatusBits;
103
    EEControlBits   nControlBits;
104
105
public:
106
628k
            EditStatus()                { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; }
107
108
0
    void    Clear()                     { nStatusBits = EditStatusFlags::NONE; }
109
110
0
    EditStatusFlags  GetStatusWord() const       { return nStatusBits; }
111
803k
    EditStatusFlags& GetStatusWord()             { return nStatusBits; }
112
113
21.0M
    EEControlBits& GetControlWord()            { return nControlBits; }
114
};
115
116
enum class SpellCallbackCommand
117
{
118
    IGNOREWORD          = 0x0001,
119
    STARTSPELLDLG       = 0x0002,
120
    ADDTODICTIONARY     = 0x0003,
121
    WORDLANGUAGE        = 0x0004,
122
    PARALANGUAGE        = 0x0005,
123
    AUTOCORRECT_OPTIONS = 0x0006,
124
};
125
126
struct SpellCallbackInfo
127
{
128
    SpellCallbackCommand nCommand;
129
    OUString        aWord;
130
131
    SpellCallbackInfo( SpellCallbackCommand nCMD, OUString _aWord )
132
0
        : aWord(std::move( _aWord ))
133
0
    {
134
0
        nCommand = nCMD;
135
0
    }
136
137
    SpellCallbackInfo( SpellCallbackCommand nCMD )
138
0
    {
139
0
        nCommand = nCMD;
140
0
    }
141
};
142
143
#endif // INCLUDED_EDITENG_EDITSTAT_HXX
144
145
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */