LibreOffice Module sw (master) 1
DocumentListItemsManager.cxx
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
21
22#include <SwNodeNum.hxx>
23#include <txtfrm.hxx>
24#include <ndtxt.hxx>
25#include <osl/diagnose.h>
26
27namespace sw
28{
29
31{
32}
33
35 const SwNodeNum* pNodeNumTwo ) const
36{
37 return pNodeNumOne->LessThan( *pNodeNumTwo );
38}
39
41{
42 if ( mpListItemsList == nullptr )
43 {
44 return;
45 }
46
47 const bool bAlreadyInserted(
48 mpListItemsList->insert( &rNodeNum ).second );
49 OSL_ENSURE( bAlreadyInserted,
50 "<DocumentListItemsManager::addListItem(..)> - <SwNodeNum> instance already registered as numbered item!" );
51}
52
54{
55 if ( mpListItemsList == nullptr )
56 {
57 return;
58 }
59
60 const tImplSortedNodeNumList::size_type nDeleted = mpListItemsList->erase( &rNodeNum );
61 if ( nDeleted > 1 )
62 {
63 OSL_FAIL( "<DocumentListItemsManager::removeListItem(..)> - <SwNodeNum> was registered more than once as numbered item!" );
64 }
65}
66
68 SwRootFrame const& rLayout) const
69{
70 SwTextNode const*const pNode(rNodeNum.GetTextNode());
71 assert(pNode);
72 return sw::GetExpandTextMerged(&rLayout, *pNode, true, true, ExpandMode::ExpandFootnote);
73}
74
76 SwNodeNum const& rNodeNum, // note: this is the non-hidden Num ...
77 SwRootFrame const& rLayout) const
78{
79 return sw::IsParaPropsNode(rLayout, *rNodeNum.GetTextNode());
80}
81
83{
84 orNodeNumList.clear();
85 orNodeNumList.reserve( mpListItemsList->size() );
86
87 for ( const SwNodeNum* pNodeNum : *mpListItemsList )
88 {
89 if ( pNodeNum->IsCounted() &&
90 pNodeNum->GetTextNode() && pNodeNum->GetTextNode()->HasNumber() )
91 {
92 orNodeNumList.push_back( pNodeNum );
93 }
94 }
95}
96
98{
99}
100
101
102}
103
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< const SwNodeNum * > tSortedNodeNumList
virtual bool LessThan(const SwNumberTreeNode &rNode) const override
Returns if this node is less than another node.
Definition: SwNodeNum.cxx:216
SwTextNode * GetTextNode() const
Definition: SwNodeNum.hxx:40
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
std::set< const SwNodeNum *, lessThanNodeNum > tImplSortedNodeNumList
bool isNumberedInLayout(SwNodeNum const &rNodeNum, SwRootFrame const &rLayout) const override
void addListItem(const SwNodeNum &rNodeNum) override
std::unique_ptr< tImplSortedNodeNumList > mpListItemsList
OUString getListItemText(const SwNodeNum &rNodeNum, SwRootFrame const &rLayout) const override
void getNumItems(IDocumentListItems::tSortedNodeNumList &orNodeNumList) const override
get vector of all list items, which are numbered
void removeListItem(const SwNodeNum &rNodeNum) override
Dialog to specify the properties of date form field.
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:313
OUString GetExpandTextMerged(SwRootFrame const *const pLayout, SwTextNode const &rNode, bool const bWithNumber, bool const bWithSpacesForLevel, ExpandMode const i_mode)
bool operator()(const SwNodeNum *pNodeNumOne, const SwNodeNum *pNodeNumTwo) const