LibreOffice Module sw (master)  1
list.hxx
Go to the documentation of this file.
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_SW_INC_LIST_HXX
21 #define INCLUDED_SW_INC_LIST_HXX
22 
23 #include <o3tl/deleter.hxx>
24 #include <rtl/ustring.hxx>
25 #include "SwNodeNum.hxx"
26 #include "pam.hxx"
27 #include <memory>
28 
29 #include "swdllapi.h"
30 
31 class SwDoc;
32 class SwNumRule;
33 class SwNodes;
34 
35 class SwList
36 {
37  public:
38  SwList( const OUString& sListId,
39  SwNumRule& rDefaultListStyle,
40  const SwNodes& rNodes );
41  ~SwList() COVERITY_NOEXCEPT_FALSE;
42 
43  const OUString & GetListId() const { return msListId; }
44 
45  const OUString & GetDefaultListStyleName() const { return msDefaultListStyleName; }
46 
47  void SetDefaultListStyleName(OUString const&);
48 
49  void InsertListItem(SwNodeNum& rNodeNum,
50  bool isHiddenRedlines,
51  const int nLevel,
52  const SwDoc& rDoc);
53  static void RemoveListItem(SwNodeNum& rNodeNum, const SwDoc& rDoc);
54 
55  void InvalidateListTree();
56  void ValidateListTree(const SwDoc& rDoc);
57 
58  void MarkListLevel( const int nListLevel,
59  const bool bValue );
60 
61  bool IsListLevelMarked( const int nListLevel ) const;
62 
63  bool HasNodes() const;
64 
65  private:
66  SwList( const SwList& ) = delete;
67  SwList& operator=( const SwList& ) = delete;
68 
69  void NotifyItemsOnListLevel( const int nLevel );
70 
71  // unique identifier of the list
72  const OUString msListId;
73  // default list style for the list items, identified by the list style name
75 
76  // list trees for certain document ranges
78  {
80  std::unique_ptr<SwNodeNum> pRoot;
89  std::unique_ptr<SwNodeNum> pRootRLHidden;
91  std::unique_ptr<SwPaM> pSection;
92  tListTreeForRange(std::unique_ptr<SwNodeNum> p1, std::unique_ptr<SwNodeNum> p2, std::unique_ptr<SwPaM> p3)
93  : pRoot(std::move(p1)), pRootRLHidden(std::move(p2)), pSection(std::move(p3)) {}
94  };
95  std::vector<tListTreeForRange> maListTrees;
96 
98 };
99 #endif // INCLUDED_SW_INC_LIST_HXX
100 
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString msDefaultListStyleName
Definition: list.hxx:74
SwList(const OUString &sListId, SwNumRule &rDefaultListStyle, const SwNodes &rNodes)
Definition: list.cxx:27
Definition: list.hxx:35
Definition: doc.hxx:188
~SwList() COVERITY_NOEXCEPT_FALSE
Definition: list.cxx:56
void NotifyItemsOnListLevel(const int nLevel)
Definition: list.cxx:160
tListTreeForRange(std::unique_ptr< SwNodeNum > p1, std::unique_ptr< SwNodeNum > p2, std::unique_ptr< SwPaM > p3)
Definition: list.hxx:92
void SetDefaultListStyleName(OUString const &)
Definition: list.cxx:169
std::unique_ptr< SwNodeNum > pRootRLHidden
Tree that is missing those nodes that are merged or hidden by delete redlines; this is only used if t...
Definition: list.hxx:89
std::unique_ptr< SwNodeNum > pRoot
tree always corresponds to document model
Definition: list.hxx:80
const OUString & GetListId() const
Definition: list.hxx:43
void MarkListLevel(const int nListLevel, const bool bValue)
Definition: list.cxx:124
const OUString msListId
Definition: list.hxx:72
std::vector< tListTreeForRange > maListTrees
Definition: list.hxx:95
bool IsListLevelMarked(const int nListLevel) const
Definition: list.cxx:155
void InvalidateListTree()
Definition: list.cxx:106
void ValidateListTree(const SwDoc &rDoc)
Definition: list.cxx:115
SwList & operator=(const SwList &)=delete
void InsertListItem(SwNodeNum &rNodeNum, bool isHiddenRedlines, const int nLevel, const SwDoc &rDoc)
Definition: list.cxx:77
bool HasNodes() const
Definition: list.cxx:65
std::unique_ptr< SwPaM > pSection
top-level SwNodes section
Definition: list.hxx:91
int mnMarkedListLevel
Definition: list.hxx:97
const OUString & GetDefaultListStyleName() const
Definition: list.hxx:45
static void RemoveListItem(SwNodeNum &rNodeNum, const SwDoc &rDoc)
Definition: list.cxx:101