Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/oox/inc/drawingml/textbody.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_OOX_DRAWINGML_TEXTBODY_HXX
21
#define INCLUDED_OOX_DRAWINGML_TEXTBODY_HXX
22
23
#include <oox/drawingml/drawingmltypes.hxx>
24
#include <drawingml/textbodyproperties.hxx>
25
#include <drawingml/textliststyle.hxx>
26
#include <drawingml/shape3dproperties.hxx>
27
#include <oox/helper/refvector.hxx>
28
29
namespace com::sun::star::text {
30
    class XText;
31
    class XTextCursor;
32
}
33
34
namespace com::sun::star::style {
35
    class XStyle;
36
}
37
38
namespace oox::core { class XmlFilterBase; }
39
40
namespace oox::drawingml {
41
42
class TextParagraph;
43
typedef RefVector< TextParagraph > TextParagraphVector;
44
45
class TextBody
46
{
47
public:
48
    TextBody();
49
    TextBody( const TextBodyPtr& pBody );
50
51
227k
    const TextParagraphVector&          getParagraphs() const { return maParagraphs; }
52
    TextParagraph&                      addParagraph();
53
54
0
    const TextListStyle&                getTextListStyle() const { return maTextListStyle; }
55
154k
    TextListStyle&                      getTextListStyle() { return maTextListStyle; }
56
57
0
    const TextBodyProperties&           getTextProperties() const { return maTextProperties; }
58
795k
    TextBodyProperties&                 getTextProperties() { return maTextProperties; }
59
60
45.9k
    Text3DProperties&                   get3DProperties() { return ma3DProperties; }
61
0
    const Text3DProperties&             get3DProperties() const { return ma3DProperties; }
62
63
    /** insert the text body at the text cursor */
64
    void                insertAt(
65
                            const ::oox::core::XmlFilterBase& rFilterBase,
66
                            const css::uno::Reference < css::text::XText > & xText,
67
                            const css::uno::Reference < css::text::XTextCursor > & xAt,
68
                            const TextCharacterProperties& rTextStyleProperties,
69
                            const TextListStylePtr& pMasterTextListStyle ) const;
70
    bool isEmpty() const;
71
    /// Returns first run of text
72
    OUString toString() const;
73
    /// Returns first paragraph of text
74
    OUString firstParatoString() const;
75
76
    /** Returns whether the textbody had a rPr tag in it that alters it visually
77
     *
78
     *  For instance _lang_ doesn't have a visual effect.
79
     */
80
    bool hasVisualRunProperties() const;
81
82
    /// Returns whether the textbody had a pPr tag in it
83
    bool hasParagraphProperties() const;
84
85
    /// Returns whether the textbody had a non-empty bodyPr tag in it
86
0
    bool hasNoninheritedBodyProperties() const { return mbHasNoninheritedBodyProperties; }
87
    /// Flags textbody as having a non-empty bodyPr tag
88
73.3k
    void setHasNoninheritedBodyProperties() { mbHasNoninheritedBodyProperties = true; }
89
90
    /// Returns whether the textbody had a non-empty lstStyle tag in it
91
0
    bool hasListStyleOnImport() const { return maTextListStyle.hasListStyleOnImport(); }
92
93
    void                ApplyStyleEmpty(
94
                            const ::oox::core::XmlFilterBase& rFilterBase,
95
                            const css::uno::Reference < css::text::XText > & xText,
96
                            const TextCharacterProperties& rTextStyleProperties,
97
                            const TextListStylePtr& pMasterTextListStylePtr) const;
98
99
    /// throws exception
100
    void                ApplyMasterTextStyle(
101
                            const ::oox::core::XmlFilterBase& rFilterBase,
102
                            const css::uno::Reference< css::style::XStyle > & aXStyle,
103
                            const TextCharacterProperties& rTextStyleProperties,
104
                            const TextListStylePtr& pMasterTextListStylePtr, size_t nLevel) const;
105
private:
106
    TextParagraphVector maParagraphs;
107
    TextBodyProperties  maTextProperties;
108
    /// Set if bodyPr tag in this textbody is non-empty during import
109
    bool                mbHasNoninheritedBodyProperties;
110
    TextListStyle       maTextListStyle;
111
    Text3DProperties    ma3DProperties;
112
};
113
114
}
115
116
#endif // INCLUDED_OOX_DRAWINGML_TEXTBODY_HXX
117
118
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */