Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/editobj.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_EDITOBJ_HXX
21
#define INCLUDED_EDITENG_EDITOBJ_HXX
22
23
#include <svl/style.hxx>
24
#include <editeng/editengdllapi.h>
25
#include <editeng/macros.hxx>
26
#include <svl/languageoptions.hxx>
27
#include <tools/lineend.hxx>
28
29
#include <com/sun/star/text/textfield/Type.hpp>
30
31
#include <vector>
32
#include <memory>
33
34
class SfxItemPool;
35
class SfxItemSet;
36
class SvxFieldItem;
37
class SvxFieldData;
38
enum class OutlinerMode;
39
struct EECharAttrib;
40
typedef struct _xmlTextWriter* xmlTextWriterPtr;
41
42
namespace editeng {
43
44
class FieldUpdater;
45
struct Section;
46
47
}
48
49
namespace svl {
50
51
class SharedString;
52
class SharedStringPool;
53
54
}
55
56
enum class TextRotation { NONE, TOPTOBOTTOM, BOTTOMTOTOP };
57
58
class EDITENG_DLLPUBLIC EditTextObject
59
{
60
public:
61
    virtual ~EditTextObject();
62
63
    /**
64
     * Set paragraph strings to the shared string pool.
65
     *
66
     * @param rPool shared string pool.
67
     */
68
    virtual void NormalizeString( svl::SharedStringPool& rPool ) = 0;
69
70
    virtual std::vector<svl::SharedString> GetSharedStrings() const = 0;
71
72
    virtual const SfxItemPool* GetPool() const = 0;
73
    virtual OutlinerMode GetUserType() const = 0;    // For OutlinerMode, it can however not save in compatible format
74
    virtual void SetUserType( OutlinerMode n ) = 0;
75
76
    virtual bool IsEffectivelyVertical() const = 0;
77
    virtual bool GetVertical() const = 0;
78
    virtual bool IsTopToBottom() const = 0;
79
    virtual void SetVertical( bool bVertical ) = 0;
80
    virtual void SetRotation( TextRotation nRotation ) = 0;
81
    virtual TextRotation    GetRotation() const = 0;
82
83
    virtual SvtScriptType GetScriptType() const = 0;
84
85
    virtual std::unique_ptr<EditTextObject> Clone() const = 0;
86
87
    virtual sal_Int32 GetParagraphCount() const = 0;
88
89
    virtual OUString GetText(sal_Int32 nPara) const = 0;
90
91
    virtual OUString GetText(LineEnd eEnd = LINEEND_LF) const = 0;
92
93
    virtual sal_Int32 GetTextLen(sal_Int32 nPara) const = 0;
94
95
350k
    bool HasText(sal_Int32 nPara) const { return GetTextLen(nPara) > 0; }
96
97
    virtual void ClearPortionInfo() = 0;
98
99
    virtual bool HasOnlineSpellErrors() const = 0;
100
101
    virtual void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const = 0;
102
103
    virtual bool RemoveCharAttribs( sal_uInt16 nWhich ) = 0;
104
105
    /**
106
     * Get all text sections in this content.  Sections are non-overlapping
107
     * segments of text split either by paragraph boundaries or format
108
     * boundaries.  Each section object contains all applied formats and/or a
109
     * field item.
110
     */
111
    virtual void GetAllSections( std::vector<editeng::Section>& rAttrs ) const = 0;
112
113
    virtual bool IsFieldObject() const = 0;
114
    virtual const SvxFieldItem* GetField() const = 0;
115
    virtual const SvxFieldData* GetFieldData(sal_Int32 nPara, size_t nPos, sal_Int32 nType) const = 0;
116
    virtual bool HasField( sal_Int32 nType = css::text::textfield::Type::UNSPECIFIED ) const = 0;
117
118
    virtual const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const = 0;
119
120
    virtual void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const = 0;
121
    virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily) = 0;
122
    virtual bool ChangeStyleSheets(
123
        std::u16string_view rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily) = 0;
124
    virtual void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString& rNewName) = 0;
125
126
    virtual editeng::FieldUpdater GetFieldUpdater() = 0;
127
128
    virtual bool operator==( const EditTextObject& rCompare ) const = 0;
129
130
    /** Compare, ignoring SfxItemPool pointer.
131
     */
132
    bool Equals( const EditTextObject& rCompare ) const;
133
134
    // #i102062#
135
    virtual bool isWrongListEqual(const EditTextObject& rCompare) const = 0;
136
137
#if DEBUG_EDIT_ENGINE
138
    virtual void Dump() const = 0;
139
#endif
140
    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0;
141
};
142
143
#endif // INCLUDED_EDITENG_EDITOBJ_HXX
144
145
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */