Line data Source code
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 <tox.hxx>
25 : #include <section.hxx>
26 :
27 : class SwTOXInternational;
28 : class SwPageDesc;
29 : class SwTxtNode;
30 : class SwTxtFmtColl;
31 : struct SwPosition;
32 : struct SwTOXSortTabBase;
33 :
34 : typedef std::vector<SwTOXSortTabBase*> SwTOXSortTabBases;
35 :
36 : class SwTOXBaseSection : public SwTOXBase, public SwSection
37 : {
38 : SwTOXSortTabBases aSortArr;
39 :
40 : void UpdateMarks( const SwTOXInternational& rIntl,
41 : const SwTxtNode* pOwnChapterNode );
42 : void UpdateOutline( const SwTxtNode* pOwnChapterNode );
43 : void UpdateTemplate( const SwTxtNode* pOwnChapterNode );
44 : void UpdateCntnt( SwTOXElement eType,
45 : const SwTxtNode* pOwnChapterNode );
46 : void UpdateTable( const SwTxtNode* pOwnChapterNode );
47 : void UpdateSequence( const SwTxtNode* pOwnChapterNode );
48 : void UpdateAuthorities( const SwTOXInternational& rIntl );
49 : void UpdateAll();
50 :
51 : // insert sorted into array for creation
52 : void InsertSorted(SwTOXSortTabBase* pBase);
53 :
54 : // insert alpha delimiter at creation
55 : void InsertAlphaDelimitter( const SwTOXInternational& rIntl );
56 :
57 : // generate text body
58 : void GenerateText( sal_uInt16 nArrayIdx,
59 : sal_uInt16 nCount,
60 : const sal_uInt32 _nTOXSectNdIdx,
61 : const SwPageDesc* _pDefaultPageDesc );
62 :
63 : // replace page num placeholder with actual page number
64 : void _UpdatePageNum( SwTxtNode* pNd,
65 : const std::vector<sal_uInt16>& rNums,
66 : const std::vector<SwPageDesc*>& rDescs,
67 : const std::vector<sal_uInt16>* pMainEntryNums,
68 : const SwTOXInternational& rIntl );
69 :
70 : // get section for entering keywords
71 : Range GetKeyRange( const OUString& rStr, const OUString& rStrReading,
72 : const SwTOXSortTabBase& rNew, sal_uInt16 nLevel,
73 : const Range& rRange );
74 :
75 : // return text collection via name/ from format pool
76 : SwTxtFmtColl* GetTxtFmtColl( sal_uInt16 nLevel );
77 :
78 : public:
79 : SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt);
80 : virtual ~SwTOXBaseSection();
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 = 0,
85 : const bool _bNewTOX = false );
86 : void UpdatePageNum(); // insert page numbering
87 : TYPEINFO_OVERRIDE(); // for rtti
88 :
89 0 : SwTOXSortTabBases& GetTOXSortTabBases() { return aSortArr; }
90 :
91 : bool SetPosAtStartEnd( SwPosition& rPos, bool bAtStart = true ) const;
92 : };
93 :
94 : struct SwDefTOXBase_Impl
95 : {
96 : SwTOXBase* pContBase;
97 : SwTOXBase* pIdxBase;
98 : SwTOXBase* pUserBase;
99 : SwTOXBase* pTblBase;
100 : SwTOXBase* pObjBase;
101 : SwTOXBase* pIllBase;
102 : SwTOXBase* pAuthBase;
103 : SwTOXBase* pBiblioBase;
104 :
105 5052 : SwDefTOXBase_Impl() :
106 : pContBase(0),
107 : pIdxBase(0),
108 : pUserBase(0),
109 : pTblBase(0),
110 : pObjBase(0),
111 : pIllBase(0),
112 : pAuthBase(0),
113 5052 : pBiblioBase(0)
114 : {
115 5052 : }
116 5045 : ~SwDefTOXBase_Impl()
117 : {
118 5045 : delete pContBase;
119 5045 : delete pIdxBase;
120 5045 : delete pUserBase;
121 5045 : delete pTblBase;
122 5045 : delete pObjBase;
123 5045 : delete pIllBase;
124 5045 : delete pAuthBase;
125 5045 : delete pBiblioBase;
126 5045 : }
127 :
128 : };
129 :
130 : #endif
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|