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 SwTextNode;
30 : class SwTextFormatColl;
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 SwTextNode* pOwnChapterNode );
42 : void UpdateOutline( const SwTextNode* pOwnChapterNode );
43 : void UpdateTemplate( const SwTextNode* pOwnChapterNode );
44 : void UpdateContent( SwTOXElement eType,
45 : const SwTextNode* pOwnChapterNode );
46 : void UpdateTable( const SwTextNode* pOwnChapterNode );
47 : void UpdateSequence( const SwTextNode* 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( SwTextNode* 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 : SwTextFormatColl* GetTextFormatColl( sal_uInt16 nLevel );
77 :
78 : public:
79 : SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFormat & rFormat);
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 : SwTOXSortTabBases& GetTOXSortTabBases() { return aSortArr; }
90 0 : const SwTOXSortTabBases& GetTOXSortTabBases() const { return aSortArr; }
91 :
92 : bool SetPosAtStartEnd( SwPosition& rPos, bool bAtStart = true ) const;
93 : };
94 :
95 : struct SwDefTOXBase_Impl
96 : {
97 : SwTOXBase* pContBase;
98 : SwTOXBase* pIdxBase;
99 : SwTOXBase* pUserBase;
100 : SwTOXBase* pTableBase;
101 : SwTOXBase* pObjBase;
102 : SwTOXBase* pIllBase;
103 : SwTOXBase* pAuthBase;
104 : SwTOXBase* pBiblioBase;
105 :
106 2958 : SwDefTOXBase_Impl() :
107 : pContBase(0),
108 : pIdxBase(0),
109 : pUserBase(0),
110 : pTableBase(0),
111 : pObjBase(0),
112 : pIllBase(0),
113 : pAuthBase(0),
114 2958 : pBiblioBase(0)
115 : {
116 2958 : }
117 2949 : ~SwDefTOXBase_Impl()
118 : {
119 2949 : delete pContBase;
120 2949 : delete pIdxBase;
121 2949 : delete pUserBase;
122 2949 : delete pTableBase;
123 2949 : delete pObjBase;
124 2949 : delete pIllBase;
125 2949 : delete pAuthBase;
126 2949 : delete pBiblioBase;
127 2949 : }
128 :
129 : };
130 :
131 : #endif
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|