LibreOffice Module sw (master)  1
doctxm.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_SOURCE_CORE_INC_DOCTXM_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DOCTXM_HXX
22 
23 #include <tools/gen.hxx>
24 #include <hints.hxx>
25 #include <tox.hxx>
26 #include <section.hxx>
27 
28 class SwTOXInternational;
29 class SwPageDesc;
30 class SwTextNode;
31 class SwTextFormatColl;
32 struct SwPosition;
33 struct SwTOXSortTabBase;
34 
35 class SwTOXBaseSection final : public SwTOXBase, public SwSection
36 {
37  std::vector<std::unique_ptr<SwTOXSortTabBase>> m_aSortArr;
38 
39  void UpdateMarks( const SwTOXInternational& rIntl,
40  const SwTextNode* pOwnChapterNode,
41  SwRootFrame const* pLayout );
42  void UpdateOutline( const SwTextNode* pOwnChapterNode,
43  SwRootFrame const* pLayout );
44  void UpdateTemplate( const SwTextNode* pOwnChapterNode,
45  SwRootFrame const* pLayout );
46  void UpdateContent( SwTOXElement eType,
47  const SwTextNode* pOwnChapterNode,
48  SwRootFrame const* pLayout );
49  void UpdateTable( const SwTextNode* pOwnChapterNode,
50  SwRootFrame const* pLayout );
51  void UpdateSequence( const SwTextNode* pOwnChapterNode,
52  SwRootFrame const* pLayout );
53  void UpdateAuthorities( const SwTOXInternational& rIntl,
54  SwRootFrame const* pLayout );
55 
56  // insert sorted into array for creation
57  void InsertSorted(std::unique_ptr<SwTOXSortTabBase> pBase);
58 
59  // insert alpha delimiter at creation
60  void InsertAlphaDelimiter( const SwTOXInternational& rIntl );
61 
62  // replace page num placeholder with actual page number
63  void UpdatePageNum_( SwTextNode* pNd,
64  const std::vector<sal_uInt16>& rNums,
65  const std::vector<SwPageDesc*>& rDescs,
66  const std::vector<sal_uInt16>* pMainEntryNums,
67  const SwTOXInternational& rIntl );
68 
69  // get section for entering keywords
70  Range GetKeyRange( const OUString& rStr, const OUString& rStrReading,
71  const SwTOXSortTabBase& rNew, sal_uInt16 nLevel,
72  const Range& rRange );
73 
74  // return text collection via name/ from format pool
76  virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) override;
77 
78 public:
79  SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFormat & rFormat);
80  virtual ~SwTOXBaseSection() override;
81 
82  // <_bNewTOX> : distinguish between the creation of a new table-of-content
83  // (true) or an update of a table-of-content (false)
84  void Update( const SfxItemSet* pAttr = nullptr,
85  SwRootFrame const* pLayout = nullptr,
86  const bool _bNewTOX = false );
87  void UpdatePageNum(); // insert page numbering
88 
89  bool SetPosAtStartEnd( SwPosition& rPos ) const;
90  bool IsVisible() const override
91  {
92  SwPtrMsgPoolItem aInfo(RES_CONTENT_VISIBLE, nullptr);
93  return GetFormat() && GetFormat()->GetInfo(aInfo);
94  }
95 };
96 
98 {
99  std::unique_ptr<SwTOXBase> pContBase;
100  std::unique_ptr<SwTOXBase> pIdxBase;
101  std::unique_ptr<SwTOXBase> pUserBase;
102  std::unique_ptr<SwTOXBase> pTableBase;
103  std::unique_ptr<SwTOXBase> pObjBase;
104  std::unique_ptr<SwTOXBase> pIllBase;
105  std::unique_ptr<SwTOXBase> pAuthBase;
106  std::unique_ptr<SwTOXBase> pBiblioBase;
107 
109  {
110  }
111 };
112 
113 #endif
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
std::unique_ptr< SwTOXBase > pContBase
Definition: doctxm.hxx:99
Marks a position in the document model.
Definition: pam.hxx:35
std::unique_ptr< SwTOXBase > pTableBase
Definition: doctxm.hxx:102
std::unique_ptr< SwTOXBase > pBiblioBase
Definition: doctxm.hxx:106
bool IsVisible() const override
Definition: doctxm.hxx:90
void InsertAlphaDelimiter(const SwTOXInternational &rIntl)
Definition: doctxm.cxx:1078
void UpdateTemplate(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate table of contents from template areas.
Definition: doctxm.cxx:1262
SwSectionFormat * GetFormat()
Definition: section.hxx:336
sal_uInt16 nLevel
Definition: tox.hxx:443
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(183)
std::unique_ptr< SwTOXBase > pUserBase
Definition: doctxm.hxx:101
std::unique_ptr< SwTOXBase > pAuthBase
Definition: doctxm.hxx:105
void UpdatePageNum()
Calculate PageNumber and insert after formatting.
Definition: doctxm.cxx:1587
Range GetKeyRange(const OUString &rStr, const OUString &rStrReading, const SwTOXSortTabBase &rNew, sal_uInt16 nLevel, const Range &rRange)
Find Key Range and insert if possible.
Definition: doctxm.cxx:1958
std::vector< std::unique_ptr< SwTOXSortTabBase > > m_aSortArr
Definition: doctxm.hxx:37
SwTOXBaseSection(SwTOXBase const &rBase, SwSectionFormat &rFormat)
Definition: doctxm.cxx:743
SwTOXElement
Definition: tox.hxx:365
void UpdateOutline(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate table of contents from outline.
Definition: doctxm.cxx:1235
virtual void SwClientNotify(const SwModify &rModify, const SfxHint &rHint) override
Definition: doctxm.cxx:1170
bool SetPosAtStartEnd(SwPosition &rPos) const
Definition: doctxm.cxx:755
void UpdateTable(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Collect table entries.
Definition: doctxm.cxx:1534
SwTextFormatColl * GetTextFormatColl(sal_uInt16 nLevel)
Evaluate Template.
Definition: doctxm.cxx:1121
std::unique_ptr< SwTOXBase > pIdxBase
Definition: doctxm.hxx:100
void UpdateAuthorities(const SwTOXInternational &rIntl, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1349
std::unique_ptr< SwTOXBase > pObjBase
Definition: doctxm.hxx:103
virtual ~SwTOXBaseSection() override
Definition: doctxm.cxx:751
void UpdateSequence(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate content from sequence fields.
Definition: doctxm.cxx:1305
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
void InsertSorted(std::unique_ptr< SwTOXSortTabBase > pBase)
Definition: doctxm.cxx:1871
void Update(const SfxItemSet *pAttr=nullptr, SwRootFrame const *pLayout=nullptr, const bool _bNewTOX=false)
Collect table of contents content.
Definition: doctxm.cxx:770
void UpdatePageNum_(SwTextNode *pNd, const std::vector< sal_uInt16 > &rNums, const std::vector< SwPageDesc * > &rDescs, const std::vector< sal_uInt16 > *pMainEntryNums, const SwTOXInternational &rIntl)
Definition: doctxm.cxx:1713
void UpdateMarks(const SwTOXInternational &rIntl, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Create from Marks.
Definition: doctxm.cxx:1196
virtual bool GetInfo(SfxPoolItem &) const override
Definition: section.cxx:837
Class for sorting directories.
Definition: txmsrt.hxx:120
void UpdateContent(SwTOXElement eType, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1428
std::unique_ptr< SwTOXBase > pIllBase
Definition: doctxm.hxx:104