Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/IDocumentSettingAccess.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 <sal/types.h>
23
#include "fldupde.hxx"
24
#include <i18nlangtag/lang.h>
25
#include <memory>
26
27
class SvxForbiddenCharactersTable;
28
namespace com::sun::star::i18n
29
{
30
struct ForbiddenCharacters;
31
}
32
enum class CharCompressType;
33
34
enum class DocumentSettingId
35
{
36
    // COMPATIBILITY FLAGS START
37
    PARA_SPACE_MAX,
38
    PARA_SPACE_MAX_AT_PAGES,
39
40
    TAB_COMPAT,
41
42
    ADD_FLY_OFFSETS,
43
    ADD_VERTICAL_FLY_OFFSETS,
44
45
    OLD_NUMBERING,
46
47
    ADD_EXT_LEADING,
48
    USE_VIRTUAL_DEVICE,
49
    USE_HIRES_VIRTUAL_DEVICE,
50
    OLD_LINE_SPACING,
51
    ADD_PARA_SPACING_TO_TABLE_CELLS,
52
    ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
53
    USE_FORMER_OBJECT_POS,
54
    USE_FORMER_TEXT_WRAPPING,
55
    CONSIDER_WRAP_ON_OBJECT_POSITION,
56
57
    IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
58
    DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
59
    TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
60
    DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
61
    // tdf#159382: MS Word compatible handling of space between footnote number and text
62
    NO_GAP_AFTER_NOTE_NUMBER,
63
64
    DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
65
    TABLE_ROW_KEEP,
66
    IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
67
    IGNORE_HIDDEN_CHARS_FOR_LINE_CALCULATION,
68
    CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME,
69
70
    // tdf#104349 tdf#104668
71
    MS_WORD_COMP_TRAILING_BLANKS,
72
    // tdf#128197 MS Word in some modes can have line height based on shape height, not on font
73
    MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
74
    MS_WORD_COMP_MIN_TEXT_WRAP_GAP,
75
    UNIX_FORCE_ZERO_EXT_LEADING,
76
    TABS_RELATIVE_TO_INDENT,
77
    PROTECT_FORM,
78
    // #i89181#
79
    TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
80
    INVERT_BORDER_SPACING,
81
    COLLAPSE_EMPTY_CELL_PARA,
82
    SMALL_CAPS_PERCENTAGE_66,
83
    TAB_OVERFLOW,
84
    UNBREAKABLE_NUMBERINGS,
85
    CLIPPED_PICTURES,
86
    BACKGROUND_PARA_OVER_DRAWINGS,
87
    TAB_OVER_MARGIN,
88
    TAB_OVER_SPACING,
89
    // MS Word still wraps text around objects with less space than LO would.
90
    SURROUND_TEXT_WRAP_SMALL,
91
    PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
92
    SUBTRACT_FLYS,
93
    // tdf#112443 disable off-page content positioning
94
    DISABLE_OFF_PAGE_POSITIONING,
95
    EMPTY_DB_FIELD_HIDES_PARA,
96
    // tdf#129448: Auto first-line indent should not be effected by line space
97
    AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
98
    HYPHENATE_URLS, ///< tdf#152952
99
    DO_NOT_BREAK_WRAPPED_TABLES,
100
    ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
101
    // tdf#119908 new paragraph justification
102
    JUSTIFY_LINES_WITH_SHRINKING,
103
    APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
104
    APPLY_PARAGRAPH_MARK_FORMAT_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
105
    HIDDEN_PARAGRAPH_MARK_PER_LINE_PROPERTIES,
106
    DO_NOT_MIRROR_RTL_DRAW_OBJS,
107
    // COMPATIBILITY FLAGS END
108
    BROWSE_MODE,
109
    HTML_MODE,
110
    GLOBAL_DOCUMENT,
111
    GLOBAL_DOCUMENT_SAVE_LINKS,
112
    LABEL_DOCUMENT,
113
    PURGE_OLE,
114
    KERN_ASIAN_PUNCTUATION,
115
    MATH_BASELINE_ALIGNMENT,
116
    STYLES_NODEFAULT,
117
    EMBED_FONTS,
118
    EMBED_USED_FONTS,
119
    EMBED_LATIN_SCRIPT_FONTS,
120
    EMBED_ASIAN_SCRIPT_FONTS,
121
    EMBED_COMPLEX_SCRIPT_FONTS,
122
    EMBED_SYSTEM_FONTS,
123
    APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
124
    CONTINUOUS_ENDNOTES,
125
    PROTECT_BOOKMARKS,
126
    PROTECT_FIELDS,
127
    HEADER_SPACING_BELOW_LAST_PARA,
128
    FRAME_AUTOWIDTH_WITH_MORE_PARA,
129
    GUTTER_AT_TOP,
130
    // footnoteContainer default position is the page end instead of the column end
131
    // only if "evenly distributed" is set, and "collected at the end" is not set
132
    FOOTNOTE_IN_COLUMN_TO_PAGEEND,
133
    // Should we display follow by symbol for numbered paragraph if numbering exists, but "None"?
134
    NO_NUMBERING_SHOW_FOLLOWBY,
135
    // drop cap punctuation: smaller dashes, bullet, asterisks, quotation marks etc.
136
    // by extending the rounding box of the glyph to the baseline
137
    DROP_CAP_PUNCTUATION,
138
    // render NBSP as standard-space-width (prettier when justified)
139
    USE_VARIABLE_WIDTH_NBSP,
140
    // overlap background shapes if anchored in body
141
    PAINT_HELL_OVER_HEADER_FOOTER,
142
    // tdf#155229 calculate minimum row height including horizontal border width
143
    MIN_ROW_HEIGHT_INCL_BORDER,
144
    MS_WORD_COMP_GRID_METRICS,
145
    // tdf#161233 pictures with wrap polygon should not be clipped
146
    NO_CLIPPING_WITH_WRAP_POLYGON,
147
    MS_WORD_UL_TRAIL_SPACE,
148
    // tdf#172113: from a visual perspective, consistently put the line spacing gap below the line,
149
    // consistently and interoperably determining line heights for all (first/middle/last) lines.
150
    LINE_SPACING_AS_GAP_BELOW,
151
    // tdf#88908 optionally adjust normal spaces in CJK context to halfwidth
152
    BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES,
153
    // tdf#37153 Word-compatibility: force top-alignment for cells containing a floating shape
154
    FORCE_TOP_ALIGNMENT_IN_CELL_WITH_FLOATING_ANCHOR,
155
    // tdf#167583 optionally apply text grid line height to table contents
156
    ADJUST_TABLE_LINE_HEIGHTS_TO_GRID_HEIGHT,
157
    // tdf#72640 treat list label alignment as literal left/right, rather than start/end
158
    LIST_LABEL_ALIGNMENT_IGNORES_DIRECTION,
159
};
160
161
/** Provides access to settings of a document
162
 */
163
class IDocumentSettingAccess
164
{
165
public:
166
    /** Return the specified document setting.
167
168
       @param id
169
       [in] the identifier of the document setting to be returned.
170
       See above for a list of valid document setting identifiers.
171
172
       @returns
173
       the value of the requested document setting.
174
    */
175
    virtual bool get(/*[in]*/ DocumentSettingId id) const = 0;
176
177
    /** Set the specified document setting.
178
179
        @param id
180
        [in] the identifier of the document setting to be set.
181
        See above for a list of valid document setting identifiers.
182
183
        @param value
184
        [in] the new value of the specified document setting.
185
    */
186
    virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) = 0;
187
188
    /** Return the forbidden characters.
189
190
       @param nLang
191
       [in] the language for which the forbidden character list is returned.
192
193
       @param bLocaleData
194
       [in] if set and there is no user defined forbidden character list for
195
            language lang, the default list for language lang will be returned.
196
197
       @returns
198
       a list of forbidden characters.
199
    */
200
    virtual const css::i18n::ForbiddenCharacters*
201
    getForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ bool bLocaleData) const = 0;
202
203
    /** Set the forbidden characters.
204
205
       @param nLang
206
       [in] the language for which the forbidden character list should be set.
207
208
       @param rForbiddenCharacters
209
       [in] the new list of forbidden characters for language lang.
210
    */
211
    virtual void
212
    setForbiddenCharacters(/*[in]*/ LanguageType nLang,
213
                           /*[in]*/ const css::i18n::ForbiddenCharacters& rForbiddenCharacters)
214
        = 0;
215
216
    /** Get the forbidden character table and creates one if necessary.
217
218
       @returns
219
       the forbidden characters table.
220
    */
221
    virtual std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() = 0;
222
223
    /** Get the forbidden character table.
224
225
       @returns
226
       the forbidden characters table.
227
    */
228
    virtual const std::shared_ptr<SvxForbiddenCharactersTable>&
229
    getForbiddenCharacterTable() const = 0;
230
231
    /** Get the current link update mode.
232
233
       @param bGlobalSettings
234
       [in] if set, the link update mode is obtained from the module,
235
            if it is set to GLOBALSETTING
236
237
       @returns
238
       the current link update mode.
239
    */
240
    virtual sal_uInt16 getLinkUpdateMode(/*[in]*/ bool bGlobalSettings) const = 0;
241
242
    /** Set the current link update mode.
243
244
       @param nMode
245
       [in] the new link update mode.
246
    */
247
    virtual void setLinkUpdateMode(/*[in]*/ sal_uInt16 nMode) = 0;
248
249
    /** Get the current field update mode.
250
251
       @param bGlobalSettings
252
       [in] if set, the field update mode is obtained from the module,
253
            if it is set to GLOBALSETTING
254
255
       @returns
256
       the current field update mode.
257
    */
258
    virtual SwFieldUpdateFlags getFieldUpdateFlags(/*[in]*/ bool bGlobalSettings) const = 0;
259
260
    /** Set the current field update mode.
261
262
       @param nMode
263
       [in] the new field update mode.
264
    */
265
    virtual void setFieldUpdateFlags(/*[in]*/ SwFieldUpdateFlags nMode) = 0;
266
267
    /** Get the character compression type for Asian characters.
268
269
       @returns
270
       the current character compression mode.
271
    */
272
    virtual CharCompressType getCharacterCompressionType() const = 0;
273
274
    /** Set the character compression type for Asian characters.
275
276
       @param nMode
277
       [in] the new character compression type.
278
    */
279
    virtual void setCharacterCompressionType(/*[in]*/ CharCompressType nType) = 0;
280
281
    /** Get the n32DummyCompatibilityOptions1
282
    */
283
    virtual sal_uInt32 Getn32DummyCompatibilityOptions1() const = 0;
284
285
    /** Set the n32DummyCompatibilityOptions1
286
    */
287
    virtual void Setn32DummyCompatibilityOptions1(const sal_uInt32 CompatibilityOptions1) = 0;
288
289
    /** Get the n32DummyCompatibilityOptions2
290
    */
291
    virtual sal_uInt32 Getn32DummyCompatibilityOptions2() const = 0;
292
293
    /** Set the n32DummyCompatibilityOptions2
294
    */
295
    virtual void Setn32DummyCompatibilityOptions2(const sal_uInt32 CompatibilityOptions2) = 0;
296
297
    virtual sal_Int32 getImagePreferredDPI() = 0;
298
    virtual void setImagePreferredDPI(sal_Int32 nValue) = 0;
299
300
protected:
301
80.9k
    virtual ~IDocumentSettingAccess(){};
302
};
303
304
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */