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 .
20 #ifndef INCLUDED_SW_INC_LIST_HXX
21 #define INCLUDED_SW_INC_LIST_HXX
23 #include <rtl/ustring.hxx>
24 #include "SwNodeNum.hxx"
32 enum class SwListRedlineType
42 SwList( OUString sListId
,
43 SwNumRule
& rDefaultListStyle
,
44 const SwNodes
& rNodes
);
45 ~SwList() COVERITY_NOEXCEPT_FALSE
;
47 const OUString
& GetListId() const { return msListId
; }
49 const OUString
& GetDefaultListStyleName() const { return msDefaultListStyleName
; }
51 void SetDefaultListStyleName(OUString
const&);
53 void InsertListItem(SwNodeNum
& rNodeNum
,
54 SwListRedlineType eRedlines
,
57 static void RemoveListItem(SwNodeNum
& rNodeNum
, const SwDoc
& rDoc
);
59 void InvalidateListTree();
60 void ValidateListTree(const SwDoc
& rDoc
);
62 void MarkListLevel( const int nListLevel
,
65 bool IsListLevelMarked( const int nListLevel
) const;
67 bool HasNodes() const;
70 SwList( const SwList
& ) = delete;
71 SwList
& operator=( const SwList
& ) = delete;
73 void NotifyItemsOnListLevel( const int nLevel
);
75 // unique identifier of the list
76 const OUString msListId
;
77 // default list style for the list items, identified by the list style name
78 OUString msDefaultListStyleName
;
80 // list trees for certain document ranges
81 struct tListTreeForRange
83 /// tree always corresponds to document model
84 std::unique_ptr
<SwNodeNum
> pRoot
;
85 /// Tree that is missing those nodes that are merged or hidden
86 /// by delete redlines; this is only used if there is a layout
87 /// that has IsHideRedlines() enabled.
88 /// A second tree is needed because not only are the numbers in
89 /// the nodes different, the structure of the tree may be different
90 /// as well, if a high-level node is hidden its children go under
91 /// the previous node on the same level.
92 /// The nodes of pRootRLHidden are a subset of the nodes of pRoot.
93 std::unique_ptr
<SwNodeNum
> pRootRLHidden
;
94 /// Tree that is missing those nodes that are merged or hidden
95 /// by insert redlines; this is only used if there is a layout
96 /// that has IsHideRedlines() disabled, and the numbering of the
97 /// original text is also shown.
98 /// A third tree is needed because not only are the numbers in
99 /// the nodes different, the structure of the tree may be different
100 /// The nodes of pRootOrigText are a subset of the nodes of pRoot.
101 std::unique_ptr
<SwNodeNum
> pRootOrigText
;
102 /// top-level SwNodes section
103 std::unique_ptr
<SwPaM
> pSection
;
104 tListTreeForRange(std::unique_ptr
<SwNodeNum
> p1
, std::unique_ptr
<SwNodeNum
> p2
,
105 std::unique_ptr
<SwNodeNum
> p3
, std::unique_ptr
<SwPaM
> p4
)
106 : pRoot(std::move(p1
)), pRootRLHidden(std::move(p2
)),
107 pRootOrigText(std::move(p3
)), pSection(std::move(p4
)) {}
109 std::vector
<tListTreeForRange
> maListTrees
;
111 int mnMarkedListLevel
;
113 #endif // INCLUDED_SW_INC_LIST_HXX
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */