1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "txatbase.hxx"
23 class SwContentControlManager
;
24 class SwFormatContentControl
;
26 /// SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
27 class SW_DLLPUBLIC SwTextContentControl final
: public SwTextAttrNesting
29 SwContentControlManager
* m_pManager
;
31 SwTextContentControl(SwContentControlManager
* pManager
, SwFormatContentControl
& rAttr
,
32 sal_Int32 nStart
, sal_Int32 nEnd
);
35 static SwTextContentControl
* CreateTextContentControl(SwDoc
& rDoc
, SwTextNode
* pTargetTextNode
,
36 SwFormatContentControl
& rAttr
,
37 sal_Int32 nStart
, sal_Int32 nEnd
,
40 ~SwTextContentControl() override
;
42 void ChgTextNode(SwTextNode
* pNode
);
44 void Delete(bool bSaveContents
);
46 SwTextNode
* GetTextNode() const;
47 /// Get the current (potentially invalid) string from the doc
48 OUString
ToString() const;
51 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
54 /// Knows all the text content controls in the document.
55 class SW_DLLPUBLIC SwContentControlManager
57 /// Non-owning reference to text content controls.
58 std::vector
<SwTextContentControl
*> m_aContentControls
;
61 SwContentControlManager();
62 void Insert(SwTextContentControl
* pTextContentControl
);
63 void Erase(SwTextContentControl
* pTextContentControl
);
64 size_t GetCount() const { return m_aContentControls
.size(); }
65 bool IsEmpty() const { return m_aContentControls
.empty(); }
66 SwTextContentControl
* Get(size_t nIndex
);
67 SwTextContentControl
* UnsortedGet(size_t nIndex
);
68 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */