Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/ndnotxt.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
#ifndef INCLUDED_SW_INC_NDNOTXT_HXX
20
#define INCLUDED_SW_INC_NDNOTXT_HXX
21
22
#include <optional>
23
#include <tools/poly.hxx>
24
#include "node.hxx"
25
26
class Size;
27
28
/// Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
29
class SAL_DLLPUBLIC_RTTI SwNoTextNode : public SwContentNode
30
{
31
    friend class SwNodes;
32
    friend class SwNoTextFrame;
33
34
    mutable std::optional<tools::PolyPolygon> m_pContour;
35
    bool m_bAutomaticContour : 1; // automatic contour polygon, not manipulated
36
    mutable bool m_bContourMapModeValid : 1; // contour map mode is not the graphics's
37
                                   // preferred map mode, but either
38
                                      // MM100 or pixel
39
    mutable bool m_bPixelContour : 1;     // contour map mode is invalid and pixel.
40
41
    // Creates for all derivations an AttrSet with ranges for frame- and
42
    // graphics-attributes (only called by SwContentNode).
43
    virtual void NewAttrSet( SwAttrPool& ) override;
44
45
    SwNoTextNode( const SwNoTextNode& ) = delete;
46
    SwNoTextNode &operator=( const SwNoTextNode& ) = delete;
47
48
protected:
49
    SwNoTextNode( const SwNode& rWhere, const SwNodeType nNdType,
50
                SwGrfFormatColl *pGrColl, SwAttrSet const * pAutoAttr );
51
52
public:
53
    virtual ~SwNoTextNode() override;
54
55
    virtual SwContentFrame *MakeFrame( SwFrame* ) override;
56
57
4.00k
    SwGrfFormatColl *GetGrfColl() const { return const_cast<SwGrfFormatColl*>(static_cast<const SwGrfFormatColl*>(GetRegisteredIn())); }
58
59
    virtual Size GetTwipSize() const = 0;
60
61
    virtual bool SavePersistentData();
62
    virtual bool RestorePersistentData();
63
64
    SW_DLLPUBLIC OUString GetTitle() const;
65
    SW_DLLPUBLIC void SetTitle( const OUString& rTitle );
66
    SW_DLLPUBLIC OUString GetDescription() const;
67
    void SetDescription( const OUString& rDescription );
68
69
    SW_DLLPUBLIC void  SetContour( const tools::PolyPolygon *pPoly,
70
                                   bool bAutomatic = false );
71
    SW_DLLPUBLIC const tools::PolyPolygon *HasContour() const;
72
0
    bool               HasContour_() const { return bool(m_pContour); };
73
    void               GetContour( tools::PolyPolygon &rPoly ) const;
74
    void               CreateContour();
75
76
0
    void               SetAutomaticContour( bool bSet ) { m_bAutomaticContour = bSet; }
77
4.92k
    bool               HasAutomaticContour() const { return m_bAutomaticContour; }
78
79
    // set either a MM100 or pixel contour
80
    void               SetContourAPI( const tools::PolyPolygon *pPoly );
81
82
    // get either a MM100 or pixel contour, return false if no contour is set.
83
    bool               GetContourAPI( tools::PolyPolygon &rPoly ) const;
84
85
0
    void               SetPixelContour( bool bSet ) { m_bPixelContour = bSet; }
86
    bool               IsPixelContour() const;
87
88
0
    bool               IsContourMapModeValid() const { return m_bContourMapModeValid; }
89
90
    // Obtains the graphic with SwapIn for GrfNode via GetData for OLE.
91
    SW_DLLPUBLIC Graphic GetGraphic() const;
92
};
93
94
// Inline methods from Node.hxx - we know TextNode only here!!
95
inline SwNoTextNode *SwNode::GetNoTextNode()
96
15.1k
{
97
15.1k
    return SwNodeType::NoTextMask & m_nNodeType ? static_cast<SwNoTextNode*>(this) : nullptr;
98
15.1k
}
99
inline const SwNoTextNode *SwNode::GetNoTextNode() const
100
2.02k
{
101
2.02k
    return SwNodeType::NoTextMask & m_nNodeType ? static_cast<const SwNoTextNode*>(this) : nullptr;
102
2.02k
}
103
104
#endif // INCLUDED_SW_INC_NDNOTXT_HXX
105
106
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */