Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/textcontentcontrol.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
#pragma once
20
21
#include "txatbase.hxx"
22
23
class SwContentControlManager;
24
25
/// SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
26
class SW_DLLPUBLIC SwTextContentControl final : public SwTextAttrNesting
27
{
28
    SwContentControlManager* m_pManager;
29
30
    SwTextContentControl(SwContentControlManager* pManager, const SfxPoolItemHolder& rAttr,
31
                         sal_Int32 nStart, sal_Int32 nEnd);
32
33
public:
34
    static SwTextContentControl* CreateTextContentControl(SwDoc& rDoc, SwTextNode* pTargetTextNode,
35
                                                          const SfxPoolItemHolder& rHolder,
36
                                                          sal_Int32 nStart, sal_Int32 nEnd,
37
                                                          bool bIsCopy);
38
39
    ~SwTextContentControl() override;
40
41
    void ChgTextNode(SwTextNode* pNode);
42
43
    void Delete(bool bSaveContents);
44
45
    SwTextNode* GetTextNode() const;
46
    /// Get the current (potentially invalid) string from the doc
47
    OUString ToString() const;
48
    void Invalidate();
49
50
    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
51
};
52
53
/// Knows all the text content controls in the document.
54
class SW_DLLPUBLIC SwContentControlManager
55
{
56
    /// Non-owning reference to text content controls.
57
    std::vector<SwTextContentControl*> m_aContentControls;
58
59
public:
60
    SwContentControlManager();
61
    void Insert(SwTextContentControl* pTextContentControl);
62
    void Erase(SwTextContentControl* pTextContentControl);
63
0
    size_t GetCount() const { return m_aContentControls.size(); }
64
0
    bool IsEmpty() const { return m_aContentControls.empty(); }
65
    SwTextContentControl* Get(size_t nIndex);
66
    SwTextContentControl* UnsortedGet(size_t nIndex);
67
    void dumpAsXml(xmlTextWriterPtr pWriter) const;
68
};
69
70
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */