LibreOffice Module sw (master) 1
doctxm.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
20#include <limits.h>
21#include <hintids.hxx>
24#include <o3tl/string_view.hxx>
25#include <docsh.hxx>
26#include <ndole.hxx>
27#include <txttxmrk.hxx>
28#include <fmtpdsc.hxx>
29#include <frmatr.hxx>
30#include <pagedesc.hxx>
31#include <doc.hxx>
32#include <IDocumentUndoRedo.hxx>
36#include <IDocumentState.hxx>
39#include <pagefrm.hxx>
40#include <ndtxt.hxx>
41#include <swtable.hxx>
42#include <doctxm.hxx>
43#include <txmsrt.hxx>
44#include <rolbck.hxx>
45#include <poolfmt.hxx>
46#include <txtfrm.hxx>
47#include <rootfrm.hxx>
48#include <UndoAttribute.hxx>
49#include <UndoSection.hxx>
50#include <swundo.hxx>
51#include <mdiexp.hxx>
52#include <docary.hxx>
53#include <charfmt.hxx>
54#include <fchrfmt.hxx>
55#include <fldbas.hxx>
56#include <fmtfld.hxx>
57#include <txtfld.hxx>
58#include <expfld.hxx>
59#include <mvsave.hxx>
60#include <node2lay.hxx>
61#include <SwStyleNameMapper.hxx>
62#include <breakit.hxx>
63#include <calbck.hxx>
64#include <ToxTextGenerator.hxx>
66#include <frameformats.hxx>
68#include <tools/globname.hxx>
69#include <com/sun/star/embed/XEmbeddedObject.hpp>
70#include <o3tl/safeint.hxx>
71#include <osl/diagnose.h>
72
73#include <memory>
74
75using namespace ::com::sun::star;
76
77template<typename T, typename... Args> static
78typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
79MakeSwTOXSortTabBase(SwRootFrame const*const pLayout, Args&& ... args)
80{
81 std::unique_ptr<T> pRet(new T(std::forward<Args>(args)...));
82 pRet->InitText(pLayout); // ensure it's expanded with the layout
83 return pRet;
84}
85
86void SwDoc::GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr,
87 SwRootFrame const& rLayout) const
88{
89 rArr.clear();
90
91 // Look up all Primary and Secondary via the Pool
92 for (const SfxPoolItem* pPoolItem : GetAttrPool().GetItemSurrogates(RES_TXTATR_TOXMARK))
93 {
94 const SwTOXMark* pItem = dynamic_cast<const SwTOXMark*>(pPoolItem);
95 if( !pItem )
96 continue;
97 const SwTOXType* pTOXType = pItem->GetTOXType();
98 if ( !pTOXType || pTOXType->GetType()!=TOX_INDEX )
99 continue;
100 const SwTextTOXMark* pMark = pItem->GetTextTOXMark();
101 if ( pMark && pMark->GetpTextNd() &&
102 pMark->GetpTextNd()->GetNodes().IsDocNodes() &&
103 (!rLayout.IsHideRedlines()
104 || !sw::IsMarkHintHidden(rLayout, *pMark->GetpTextNd(), *pMark)))
105 {
106 const OUString sStr = TOI_PRIMARY == eTyp
107 ? pItem->GetPrimaryKey()
108 : pItem->GetSecondaryKey();
109
110 if( !sStr.isEmpty() )
111 rArr.push_back( sStr );
112 }
113 }
114}
115
117sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
118 SwTOXMarks& rArr )
119{
120 // search on Position rPos for all SwTOXMarks
121 SwTextNode *const pTextNd = rPos.GetNode().GetTextNode();
122 if( !pTextNd || !pTextNd->GetpSwpHints() )
123 return 0;
124
125 const SwpHints & rHts = *pTextNd->GetpSwpHints();
126 sal_Int32 nSttIdx;
127 const sal_Int32 *pEndIdx;
128
129 const sal_Int32 nCurrentPos = rPos.GetContentIndex();
130
131 for( size_t n = 0; n < rHts.Count(); ++n )
132 {
133 const SwTextAttr* pHt = rHts.Get(n);
134 if( RES_TXTATR_TOXMARK != pHt->Which() )
135 continue;
136 if( ( nSttIdx = pHt->GetStart() ) < nCurrentPos )
137 {
138 // also check the end
139 pEndIdx = pHt->End();
140 if( nullptr == pEndIdx || *pEndIdx <= nCurrentPos )
141 continue; // keep searching
142 }
143 else if( nSttIdx > nCurrentPos )
144 // If Hint's Start is greater than rPos, break, because
145 // the attributes are sorted by Start!
146 break;
147
148 SwTOXMark* pTMark = const_cast<SwTOXMark*>(&pHt->GetTOXMark());
149 rArr.push_back( pTMark );
150 }
151 return rArr.size();
152}
153
155void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
156{
157 const SwTextTOXMark* pTextTOXMark = pTOXMark->GetTextTOXMark();
158 assert(pTextTOXMark);
159
160 SwTextNode& rTextNd = const_cast<SwTextNode&>(pTextTOXMark->GetTextNode());
161 assert(rTextNd.GetpSwpHints());
162
163 if (pTextTOXMark->HasDummyChar())
164 {
165 // tdf#106377 don't use SwUndoResetAttr, it uses NOTXTATRCHR
166 SwPaM tmp(rTextNd, pTextTOXMark->GetStart(),
167 rTextNd, pTextTOXMark->GetStart()+1);
168 assert(rTextNd.GetText()[pTextTOXMark->GetStart()] == CH_TXTATR_INWORD);
170 }
171 else
172 {
173 std::unique_ptr<SwRegHistory> aRHst;
174 if (GetIDocumentUndoRedo().DoesUndo())
175 {
176 // save attributes for Undo
177 SwUndoResetAttr* pUndo = new SwUndoResetAttr(
178 SwPosition( rTextNd, pTextTOXMark->GetStart() ),
180 GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
181
182 aRHst.reset(new SwRegHistory(rTextNd, &pUndo->GetHistory()));
183 rTextNd.GetpSwpHints()->Register(aRHst.get());
184 }
185
186 rTextNd.DeleteAttribute( const_cast<SwTextTOXMark*>(pTextTOXMark) );
187
188 if (GetIDocumentUndoRedo().DoesUndo())
189 {
190 if( rTextNd.GetpSwpHints() )
191 rTextNd.GetpSwpHints()->DeRegister();
192 }
193 }
194
196}
197
198namespace {
199
201class CompareNodeContent
202{
203 SwNodeOffset m_nNode;
204 sal_Int32 m_nContent;
205public:
206 CompareNodeContent( SwNodeOffset nNd, sal_Int32 nCnt )
207 : m_nNode( nNd ), m_nContent( nCnt ) {}
208
209 bool operator==( const CompareNodeContent& rCmp ) const
210 { return m_nNode == rCmp.m_nNode && m_nContent == rCmp.m_nContent; }
211 bool operator!=( const CompareNodeContent& rCmp ) const
212 { return m_nNode != rCmp.m_nNode || m_nContent != rCmp.m_nContent; }
213 bool operator< ( const CompareNodeContent& rCmp ) const
214 { return m_nNode < rCmp.m_nNode ||
215 ( m_nNode == rCmp.m_nNode && m_nContent < rCmp.m_nContent); }
216 bool operator<=( const CompareNodeContent& rCmp ) const
217 { return m_nNode < rCmp.m_nNode ||
218 ( m_nNode == rCmp.m_nNode && m_nContent <= rCmp.m_nContent); }
219 bool operator> ( const CompareNodeContent& rCmp ) const
220 { return m_nNode > rCmp.m_nNode ||
221 ( m_nNode == rCmp.m_nNode && m_nContent > rCmp.m_nContent); }
222 bool operator>=( const CompareNodeContent& rCmp ) const
223 { return m_nNode > rCmp.m_nNode ||
224 ( m_nNode == rCmp.m_nNode && m_nContent >= rCmp.m_nContent); }
225};
226
227}
228
229const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark,
230 SwTOXSearch eDir, bool bInReadOnly )
231{
232 const SwTextTOXMark* pMark = rCurTOXMark.GetTextTOXMark();
233
234 CompareNodeContent aAbsIdx(pMark ? pMark->GetpTextNd()->GetIndex() : SwNodeOffset(0), pMark ? pMark->GetStart() : 0);
235 CompareNodeContent aPrevPos( SwNodeOffset(0), 0 );
236 CompareNodeContent aNextPos( NODE_OFFSET_MAX, SAL_MAX_INT32 );
237 CompareNodeContent aMax( SwNodeOffset(0), 0 );
238 CompareNodeContent aMin( NODE_OFFSET_MAX, SAL_MAX_INT32 );
239
240 const SwTOXMark* pNew = nullptr;
241 const SwTOXMark* pMax = &rCurTOXMark;
242 const SwTOXMark* pMin = &rCurTOXMark;
243
244 const SwTOXType* pType = rCurTOXMark.GetTOXType();
245 SwTOXMarks aMarks;
246 pType->CollectTextMarks(aMarks);
247
248 for(SwTOXMark* pTOXMark : aMarks)
249 {
250 if ( pTOXMark == &rCurTOXMark )
251 continue;
252
253 pMark = pTOXMark->GetTextTOXMark();
254 if (!pMark)
255 continue;
256
257 SwTextNode const*const pTOXSrc = pMark->GetpTextNd();
258 if (!pTOXSrc)
259 continue;
260
261 Point aPt;
262 std::pair<Point, bool> const tmp(aPt, false);
263 const SwContentFrame* pCFrame = pTOXSrc->getLayoutFrame(
264 getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp);
265 if (!pCFrame)
266 continue;
267
268 if ( bInReadOnly || !pCFrame->IsProtected() )
269 {
270 CompareNodeContent aAbsNew( pTOXSrc->GetIndex(), pMark->GetStart() );
271 switch( eDir )
272 {
273 // The following (a bit more complicated) statements make it
274 // possible to also travel across Entries on the same (!)
275 // position. If someone has time, please feel free to optimize.
276 case TOX_SAME_PRV:
277 if (pTOXMark->GetText(nullptr) != rCurTOXMark.GetText(nullptr))
278 break;
279 [[fallthrough]];
280 case TOX_PRV:
281 if ( (aAbsNew < aAbsIdx && aAbsNew > aPrevPos) ||
282 (aAbsIdx == aAbsNew &&
283 (reinterpret_cast<sal_uLong>(&rCurTOXMark) > reinterpret_cast<sal_uLong>(pTOXMark) &&
284 (!pNew || aPrevPos < aAbsIdx || reinterpret_cast<sal_uLong>(pNew) < reinterpret_cast<sal_uLong>(pTOXMark) ) )) ||
285 (aPrevPos == aAbsNew && aAbsIdx != aAbsNew &&
286 reinterpret_cast<sal_uLong>(pTOXMark) > reinterpret_cast<sal_uLong>(pNew)) )
287 {
288 pNew = pTOXMark;
289 aPrevPos = aAbsNew;
290 if ( aAbsNew >= aMax )
291 {
292 aMax = aAbsNew;
293 pMax = pTOXMark;
294 }
295 }
296 break;
297
298 case TOX_SAME_NXT:
299 if (pTOXMark->GetText(nullptr) != rCurTOXMark.GetText(nullptr))
300 break;
301 [[fallthrough]];
302 case TOX_NXT:
303 if ( (aAbsNew > aAbsIdx && aAbsNew < aNextPos) ||
304 (aAbsIdx == aAbsNew &&
305 (reinterpret_cast<sal_uLong>(&rCurTOXMark) < reinterpret_cast<sal_uLong>(pTOXMark) &&
306 (!pNew || aNextPos > aAbsIdx || reinterpret_cast<sal_uLong>(pNew) > reinterpret_cast<sal_uLong>(pTOXMark)) )) ||
307 (aNextPos == aAbsNew && aAbsIdx != aAbsNew &&
308 reinterpret_cast<sal_uLong>(pTOXMark) < reinterpret_cast<sal_uLong>(pNew)) )
309 {
310 pNew = pTOXMark;
311 aNextPos = aAbsNew;
312 if ( aAbsNew <= aMin )
313 {
314 aMin = aAbsNew;
315 pMin = pTOXMark;
316 }
317 }
318 break;
319 }
320 }
321 }
322
323 // We couldn't find a successor
324 // Use minimum or maximum
325 if(!pNew)
326 {
327 switch(eDir)
328 {
329 case TOX_PRV:
330 case TOX_SAME_PRV:
331 pNew = pMax;
332 break;
333 case TOX_NXT:
334 case TOX_SAME_NXT:
335 pNew = pMin;
336 break;
337 default:
338 pNew = &rCurTOXMark;
339 }
340 }
341 return *pNew;
342}
343
345 const SwTOXBase& rTOX,
346 const SfxItemSet* pSet,
347 bool bExpand,
348 SwRootFrame const*const pLayout)
349{
350 SwPaM aPam( rPos );
351 return InsertTableOf( aPam, rTOX, pSet, bExpand, pLayout );
352}
353
355 const SwTOXBase& rTOX,
356 const SfxItemSet* pSet,
357 bool bExpand,
358 SwRootFrame const*const pLayout )
359{
360 assert(!bExpand || pLayout != nullptr);
362
363 OUString sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), rTOX.GetTOXName() );
364 SwSectionData aSectionData( SectionType::ToxContent, sSectNm );
365
366 std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const tmp(
367 &rTOX,
368 pLayout && pLayout->IsHideRedlines()
371 pLayout ? pLayout->GetFieldmarkMode() : sw::FieldmarkMode::ShowBoth);
372 SwTOXBaseSection *const pNewSection = dynamic_cast<SwTOXBaseSection *>(
373 InsertSwSection(aPam, aSectionData, & tmp, pSet, false));
374 if (pNewSection)
375 {
376 SwSectionNode *const pSectNd = pNewSection->GetFormat()->GetSectionNode();
377 pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
378
379 if( bExpand )
380 {
381 // add value for 2nd parameter = true to
382 // indicate, that a creation of a new table of content has to be performed.
383 // Value of 1st parameter = default value.
384 pNewSection->Update( nullptr, pLayout, true );
385 }
386 else if( rTOX.GetTitle().getLength()==1 && IsInReading() )
387 // insert title of TOX
388 {
389 // then insert the headline section
390 SwNodeIndex aIdx( *pSectNd, +1 );
391
392 SwTextNode* pHeadNd = GetNodes().MakeTextNode( aIdx.GetNode(),
393 getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ) );
394
395 SwSectionData headerData( SectionType::ToxHeader, pNewSection->GetTOXName()+"_Head" );
396
397 --aIdx;
398 SwSectionFormat* pSectFormat = MakeSectionFormat();
400 *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx.GetNode(), true, false);
401 }
402 }
403
405
406 return pNewSection;
407}
408
410 const SwTOXBase& rTOX,
411 const SfxItemSet* pSet )
412{
413 // check for recursive TOX
414 SwNode* pNd = GetNodes()[ nSttNd ];
415 SwSectionNode* pSectNd = pNd->FindSectionNode();
416 while( pSectNd )
417 {
418 SectionType eT = pSectNd->GetSection().GetType();
420 return;
421 pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
422 }
423
424 const OUString sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), rTOX.GetTOXName());
425
426 SwSectionData aSectionData( SectionType::ToxContent, sSectNm );
427
428 SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
430 if(pSet)
431 pFormat->SetFormatAttr(*pSet);
432
433 SwSectionNode *const pNewSectionNode =
434 GetNodes().InsertTextSection(aStt.GetNode(), *pFormat, aSectionData, &rTOX, &aEnd.GetNode());
435 if (!pNewSectionNode)
436 {
437 DelSectionFormat( pFormat );
438 return;
439 }
440
441 SwTOXBaseSection *const pNewSection(
442 dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
443 if (pNewSection)
444 pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
445}
446
449{
450 SwNode& rNd = rPos.GetNode();
451 SwSectionNode* pSectNd = rNd.FindSectionNode();
452 while( pSectNd )
453 {
454 SectionType eT = pSectNd->GetSection().GetType();
455 if( SectionType::ToxContent == eT )
456 {
457 assert( dynamic_cast< const SwTOXBaseSection *>( &pSectNd->GetSection()) &&
458 "no TOXBaseSection!" );
459 SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(
460 pSectNd->GetSection());
461 return &rTOXSect;
462 }
463 pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
464 }
465 return nullptr;
466}
467
469{
470 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
471 const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase);
472 SwSectionFormat const * pFormat = rTOXSect.GetFormat();
473 OSL_ENSURE( pFormat, "invalid TOXBaseSection!" );
474 return pFormat->GetAttrSet();
475}
476
477const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, bool bCreate )
478{
479 std::unique_ptr<SwTOXBase>* prBase = nullptr;
480 switch(eTyp)
481 {
482 case TOX_CONTENT: prBase = &mpDefTOXBases->pContBase; break;
483 case TOX_INDEX: prBase = &mpDefTOXBases->pIdxBase; break;
484 case TOX_USER: prBase = &mpDefTOXBases->pUserBase; break;
485 case TOX_TABLES: prBase = &mpDefTOXBases->pTableBase; break;
486 case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break;
487 case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
488 case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
489 case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
490 case TOX_CITATION: break;
491 }
492 if (!prBase)
493 return nullptr;
494 if(!(*prBase) && bCreate)
495 {
496 SwForm aForm(eTyp);
497 const SwTOXType* pType = GetTOXType(eTyp, 0);
498 prBase->reset(new SwTOXBase(pType, aForm, SwTOXElement::NONE, pType->GetTypeName()));
499 }
500 return prBase->get();
501}
502
504{
505 std::unique_ptr<SwTOXBase>* prBase = nullptr;
506 switch(rBase.GetType())
507 {
508 case TOX_CONTENT: prBase = &mpDefTOXBases->pContBase; break;
509 case TOX_INDEX: prBase = &mpDefTOXBases->pIdxBase; break;
510 case TOX_USER: prBase = &mpDefTOXBases->pUserBase; break;
511 case TOX_TABLES: prBase = &mpDefTOXBases->pTableBase; break;
512 case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break;
513 case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
514 case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
515 case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
516 case TOX_CITATION: break;
517 }
518 if (!prBase)
519 return;
520 prBase->reset(new SwTOXBase(rBase));
521}
522
524bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes )
525{
526 // We only delete the TOX, not the Nodes
527 bool bRet = false;
528 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
529
530 const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase);
531 SwSectionFormat const * pFormat = rTOXSect.GetFormat();
532 /* Save the start node of the TOX' section. */
533 SwSectionNode const * pMyNode = pFormat ? pFormat->GetSectionNode() : nullptr;
534 if (pMyNode)
535 {
537
538 /* Save start node of section's surrounding. */
539 SwNode const * pStartNd = pMyNode->StartOfSectionNode();
540
541 /* Look for the point where to move the cursors in the area to
542 delete to. This is done by first searching forward from the
543 end of the TOX' section. If no content node is found behind
544 the TOX one is searched before it. If this is not
545 successful, too, insert new text node behind the end of
546 the TOX' section. The cursors from the TOX' section will be
547 moved to the content node found or the new text node. */
548
549 /* Set PaM to end of TOX' section and search following content node.
550 aSearchPam will contain the point where to move the cursors
551 to. */
552 SwPaM aSearchPam(*pMyNode->EndOfSectionNode());
553 SwPosition aEndPos(*pStartNd->EndOfSectionNode());
554 if (! aSearchPam.Move() /* no content node found */
555 || *aSearchPam.GetPoint() >= aEndPos /* content node found
556 outside surrounding */
557 )
558 {
559 /* Set PaM to beginning of TOX' section and search previous
560 content node */
561 SwPaM aTmpPam(*pMyNode);
562 aSearchPam = aTmpPam;
563 SwPosition aStartPos(*pStartNd);
564
565 if ( ! aSearchPam.Move(fnMoveBackward) /* no content node found */
566 || *aSearchPam.GetPoint() <= aStartPos /* content node
567 found outside
568 surrounding */
569 )
570 {
571 /* There is no content node in the surrounding of
572 TOX'. Append text node behind TOX' section. */
573
574 SwPosition aInsPos(*pMyNode->EndOfSectionNode());
576
577 SwPaM aTmpPam1(aInsPos);
578 aSearchPam = aTmpPam1;
579 }
580 }
581
582 /* PaM containing the TOX. */
583 SwPaM aPam(*pMyNode->EndOfSectionNode(), *pMyNode);
584
585 /* Move cursors contained in TOX to the above calculated point. */
586 PaMCorrAbs(aPam, *aSearchPam.GetPoint());
587
588 if( !bDelNodes )
589 {
590 SwSections aArr( 0 );
591 pFormat->GetChildSections( aArr, SectionSort::Not, false );
592 for( const auto pSect : aArr )
593 {
594 if( SectionType::ToxHeader == pSect->GetType() )
595 {
596 DelSectionFormat( pSect->GetFormat(), bDelNodes );
597 }
598 }
599 }
600
601 DelSectionFormat( const_cast<SwSectionFormat *>(pFormat), bDelNodes );
602
604 bRet = true;
605 }
606
607 return bRet;
608}
609
611sal_uInt16 SwDoc::GetTOXTypeCount(TOXTypes eTyp) const
612{
613 sal_uInt16 nCnt = 0;
614 for( auto const & pTOXType : *mpTOXTypes )
615 if( eTyp == pTOXType->GetType() )
616 ++nCnt;
617 return nCnt;
618}
619
620const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const
621{
622 sal_uInt16 nCnt = 0;
623 for( auto const & pTOXType : *mpTOXTypes )
624 if( eTyp == pTOXType->GetType() && nCnt++ == nId )
625 return pTOXType.get();
626 return nullptr;
627}
628
630{
631 SwTOXType * pNew = new SwTOXType(rTyp);
632 mpTOXTypes->emplace_back( pNew );
633 return pNew;
634}
635
637 const OUString& sChkStr ) const
638{
639 if( IsInMailMerge())
640 {
641 OUString newName = "MailMergeTOX"
642 + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
643 + OUString::number( mpSectionFormatTable->size() + 1 );
644 if( !sChkStr.isEmpty())
645 newName += sChkStr;
646 return newName;
647 }
648
649 bool bUseChkStr = !sChkStr.isEmpty();
650 const OUString& aName( rType.GetTypeName() );
651 const sal_Int32 nNmLen = aName.getLength();
652
654 const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) +2;
655 std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
656 memset( pSetFlags.get(), 0, nFlagSize );
657
658 for( auto pSectionFormat : *mpSectionFormatTable )
659 {
660 const SwSectionNode *pSectNd = pSectionFormat->GetSectionNode();
661 if ( !pSectNd )
662 continue;
663
664 const SwSection& rSect = pSectNd->GetSection();
665 if (rSect.GetType()==SectionType::ToxContent)
666 {
667 const OUString& rNm = rSect.GetSectionName();
668 if ( rNm.startsWith(aName) )
669 {
670 // Calculate number and set the Flag
671 nNum = o3tl::toInt32(rNm.subView( nNmLen ));
672 if( nNum-- && nNum < mpSectionFormatTable->size() )
673 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
674 }
675 if ( bUseChkStr && sChkStr==rNm )
676 bUseChkStr = false;
677 }
678 }
679
680 if( !bUseChkStr )
681 {
682 // All Numbers have been flagged accordingly, so get the right Number
683 nNum = mpSectionFormatTable->size();
684 for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
685 {
686 sal_uInt8 nTmp = pSetFlags[ n ];
687 if( nTmp != 0xff )
688 {
689 // so get the Number
690 nNum = n * 8;
691 while( nTmp & 1 )
692 {
693 ++nNum;
694 nTmp >>= 1;
695 }
696 break;
697 }
698 }
699 }
700 if ( bUseChkStr )
701 return sChkStr;
702 return aName + OUString::number( ++nNum );
703}
704
705bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName)
706{
707 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
708 SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOXBase));
709
710 if (GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), rName) == rName)
711 {
712 pTOX->SetTOXName(rName);
713 pTOX->SetSectionName(rName);
715 return true;
716 }
717 return false;
718}
719
720static const SwTextNode* lcl_FindChapterNode( const SwNode& rNd,
721 SwRootFrame const*const pLayout, sal_uInt8 const nLvl = 0 )
722{
723 const SwNode* pNd = &rNd;
724 if( pNd->GetNodes().GetEndOfExtras().GetIndex() > pNd->GetIndex() )
725 {
726 // then find the "Anchor" (Body) position
727 Point aPt;
728 SwNode2Layout aNode2Layout( *pNd, pNd->GetIndex() );
729 const SwFrame* pFrame = aNode2Layout.GetFrame( &aPt );
730
731 if( pFrame )
732 {
733 SwPosition aPos( *pNd );
734 pNd = GetBodyTextNode( pNd->GetDoc(), aPos, *pFrame );
735 OSL_ENSURE( pNd, "Where's the paragraph?" );
736 }
737 }
738 return pNd ? pNd->FindOutlineNodeOfLevel(nLvl, pLayout) : nullptr;
739}
740
741static bool IsHeadingContained(const SwTextNode* pChptrNd, const SwNode& rNd)
742{
743 const SwNode* pNd = &rNd;
744 const SwOutlineNodes& rONds = pNd->GetNodes().GetOutLineNds();
745 bool bIsHeadingContained = false;
746 if (!rONds.empty())
747 {
748 bool bCheckFirst = false;
750
751 if (!rONds.Seek_Entry(const_cast<SwNode*>(pNd), &nPos))
752 {
753 if (nPos == 0)
754 bCheckFirst = true;
755 else
756 nPos--;
757 }
758
759 if (bCheckFirst)
760 {
761 const SwContentNode* pCNd = pNd->GetContentNode();
762
763 Point aPt(0, 0);
764 std::pair<Point, bool> const tmp(aPt, false);
765
766 const SwFrame* pChptrFrame = pChptrNd ? pChptrNd->getLayoutFrame(
767 pChptrNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
768 const SwPageFrame* pChptrPgFrame = pChptrFrame ? pChptrFrame->FindPageFrame() : nullptr;
769 const SwFrame* pNdFrame
770 = pCNd ? pCNd->getLayoutFrame(
771 pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)
772 : nullptr;
773
774 // Check if the one asking doesn't precede the page of the specified chapter note
775 bIsHeadingContained
776 = pNdFrame && pChptrPgFrame
777 && pChptrPgFrame->getFrameArea().Top() <= pNdFrame->getFrameArea().Top();
778 // Check if the one asking doesn't succeed the specified chapter note
779 if (bIsHeadingContained)
780 {
781 const SwNode* aChptrNd = pChptrNd;
782 if (!rONds.Seek_Entry(const_cast<SwNode*>(aChptrNd), &nPos) && nPos)
783 nPos--;
784 // Search for the next outline node with a larger level than the specified chapter node
785 while (nPos < rONds.size() - 1
786 && pChptrNd->GetAttrOutlineLevel()
787 < rONds[nPos + 1]->GetTextNode()->GetAttrOutlineLevel())
788 nPos++;
789 // If there exists such an outline node, check if the one asking doesn't succeed
790 // the specified chapter node
791 if (nPos < rONds.size() - 1) {
792 nPos++;
793 const auto aONdsTxtNd = rONds[nPos]->GetTextNode();
794 pChptrFrame = aONdsTxtNd->getLayoutFrame(
795 aONdsTxtNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr,
796 &tmp);
797 pChptrPgFrame = pChptrFrame ? pChptrFrame->FindPageFrame() : nullptr;
798 bIsHeadingContained
799 = pNdFrame && pChptrPgFrame
800 && pChptrPgFrame->getFrameArea().Top() >= pNdFrame->getFrameArea().Top();
801 }
802 }
803 }
804 else
805 {
806 // Search for the next outline node which lies not within the current chapter node
807 while (nPos > 0
808 && pChptrNd->GetAttrOutlineLevel()
809 < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
810 nPos--;
811 bIsHeadingContained = pChptrNd == rONds[nPos]->GetTextNode();
812 }
813 }
814 else
815 {
816 // If there are no outline nodes, consider the heading contained,
817 // otherwise the _XDocumentIndex._update() test fails
818 bIsHeadingContained = true;
819 }
820 return bIsHeadingContained;
821}
822
823// Table of contents class
825 : SwTOXBase( rBase )
826 , SwSection( SectionType::ToxContent, OUString(), rFormat )
827{
828 SetProtect( rBase.IsProtected() );
830}
831
833{
834}
835
837{
838 bool bRet = false;
839 const SwSectionNode* pSectNd = GetFormat()->GetSectionNode();
840 if( pSectNd )
841 {
842 rPos.Assign(*pSectNd);
843 pSectNd->GetDoc().GetNodes().GoNext( &rPos );
844 bRet = true;
845 }
846 return bRet;
847}
848
851 SwRootFrame const*const pLayout,
852 const bool _bNewTOX)
853{
854 if (!GetFormat())
855 return;
856 SwSectionNode const*const pSectNd(GetFormat()->GetSectionNode());
857 if (nullptr == pSectNd ||
858 !pSectNd->GetNodes().IsDocNodes() ||
859 IsHiddenFlag() ||
860 (pLayout->HasMergedParas() && pSectNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden))
861 {
862 return;
863 }
864
865 if ( !mbKeepExpression )
866 {
867 maMSTOCExpression.clear();
868 }
869
870 SwDoc& rDoc = const_cast<SwDoc&>(pSectNd->GetDoc());
871
872 if (pAttr && GetFormat())
873 rDoc.ChgFormat(*GetFormat(), *pAttr);
874
875 // determine default page description, which will be used by the content nodes,
876 // if no appropriate one is found.
877 const SwPageDesc* pDefaultPageDesc;
878 {
879 pDefaultPageDesc =
881 if ( !_bNewTOX && !pDefaultPageDesc )
882 {
883 // determine page description of table-of-content
884 SwNodeOffset nPgDescNdIdx = pSectNd->GetIndex() + 1;
885 SwNodeOffset* pPgDescNdIdx = &nPgDescNdIdx;
886 pDefaultPageDesc = pSectNd->FindPageDesc( pPgDescNdIdx );
887 if ( nPgDescNdIdx < pSectNd->GetIndex() )
888 {
889 pDefaultPageDesc = nullptr;
890 }
891 }
892 // consider end node of content section in the node array.
893 if ( !pDefaultPageDesc &&
894 ( pSectNd->EndOfSectionNode()->GetIndex() <
895 (pSectNd->GetNodes().GetEndOfContent().GetIndex() - 1) )
896 )
897 {
898 // determine page description of content after table-of-content
899 SwNodeIndex aIdx( *(pSectNd->EndOfSectionNode()) );
900 const SwContentNode* pNdAfterTOX = pSectNd->GetNodes().GoNext( &aIdx );
901 const SwAttrSet& aNdAttrSet = pNdAfterTOX->GetSwAttrSet();
902 const SvxBreak eBreak = aNdAttrSet.GetBreak().GetBreak();
903 if ( eBreak != SvxBreak::PageBefore && eBreak != SvxBreak::PageBoth )
904 {
905 pDefaultPageDesc = pNdAfterTOX->FindPageDesc();
906 }
907 }
908 // consider start node of content section in the node array.
909 if ( !pDefaultPageDesc &&
910 ( pSectNd->GetIndex() >
911 (pSectNd->GetNodes().GetEndOfContent().StartOfSectionIndex() + 1) )
912 )
913 {
914 // determine page description of content before table-of-content
915 SwNodeIndex aIdx( *pSectNd );
916 SwContentNode* pTmp = SwNodes::GoPrevious( &aIdx );
917 assert(pTmp); // make coverity happy
918 pDefaultPageDesc = pTmp->FindPageDesc();
919
920 }
921 if ( !pDefaultPageDesc )
922 {
923 // determine default page description
924 pDefaultPageDesc = &rDoc.GetPageDesc( 0 );
925 }
926 }
927
929
930 // get current Language
935
936 m_aSortArr.clear();
937
938 // find the first layout node for this TOX, if it only find the content
939 // in his own chapter
940 const SwSectionNode* pChapterSectNd = IsFromChapter() ? pSectNd->FindSectionNode() : nullptr;
941 const SwTextNode* pOwnChapterNode = pChapterSectNd
942 ? ::lcl_FindChapterNode( *pSectNd, pLayout, pChapterSectNd->GetSectionLevel() + 1 )
943 : nullptr;
944
945 SwNode2LayoutSaveUpperFrames aN2L(*pSectNd);
946 const_cast<SwSectionNode*>(pSectNd)->DelFrames();
947
948 // This would be a good time to update the Numbering
949 rDoc.UpdateNumRule();
950
952 UpdateMarks( aIntl, pOwnChapterNode, pLayout );
953
955 UpdateOutline( pOwnChapterNode, pLayout );
956
958 UpdateTemplate( pOwnChapterNode, pLayout );
959
962 UpdateContent( SwTOXElement::Ole, pOwnChapterNode, pLayout );
963
966 UpdateTable( pOwnChapterNode, pLayout );
967
970 UpdateContent( SwTOXElement::Graphic, pOwnChapterNode, pLayout );
971
972 if( !GetSequenceName().isEmpty() && !IsFromObjectNames() &&
975 UpdateSequence( pOwnChapterNode, pLayout );
976
978 UpdateContent( SwTOXElement::Frame, pOwnChapterNode, pLayout );
979
981 UpdateAuthorities( aIntl, pLayout );
982
983 // Insert AlphaDelimiters if needed (just for keywords)
984 if( TOX_INDEX == SwTOXBase::GetType() &&
986 InsertAlphaDelimiter( aIntl );
987
988 // remove old content an insert one empty textnode (to hold the layout!)
989 SwTextNode* pFirstEmptyNd;
990
991 SwUndoUpdateIndex * pUndo(nullptr);
992 {
993 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pSectNd, true, RedlineType::Any );
994
995 SwNodeIndex aSttIdx( *pSectNd, +1 );
996 SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
997 pFirstEmptyNd = rDoc.GetNodes().MakeTextNode( aEndIdx.GetNode(),
999
1000 {
1001 // Task 70995 - save and restore PageDesc and Break Attributes
1002 SwNodeIndex aNxtIdx( aSttIdx );
1003 const SwContentNode* pCNd = aNxtIdx.GetNode().GetContentNode();
1004 if( !pCNd )
1005 pCNd = rDoc.GetNodes().GoNext( &aNxtIdx );
1006 assert(pCNd != pFirstEmptyNd);
1007 assert(pCNd->GetIndex() < pFirstEmptyNd->GetIndex());
1008 if( pCNd->HasSwAttrSet() )
1009 {
1010 SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
1011 aBrkSet.Put( *pCNd->GetpSwAttrSet() );
1012 if( aBrkSet.Count() )
1013 pFirstEmptyNd->SetAttr( aBrkSet );
1014 }
1015 }
1016
1017 if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1018 {
1019 // note: this will first append a SwUndoDelSection from the ctor...
1020 pUndo = new SwUndoUpdateIndex(*this);
1021 // tdf#123313 insert Undo *after* all CrossRefBookmark Undos have
1022 // been inserted by the Update*() functions
1023 rDoc.GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndoUpdateIndex>(pUndo));
1024 }
1025 else
1026 {
1027 --aEndIdx;
1028 SwPosition aPos( aEndIdx, pFirstEmptyNd, 0 );
1029 SwDoc::CorrAbs( aSttIdx, aEndIdx, aPos, true );
1030
1031 // delete flys in whole range including start node which requires
1032 // giving the node before start node as Mark parameter, hence -1.
1033 // (flys must be deleted because the anchor nodes are removed)
1034 DelFlyInRange( SwNodeIndex(aSttIdx, -1).GetNode(), aEndIdx.GetNode() );
1035
1036 rDoc.GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
1037 }
1038 }
1039
1040 // insert title of TOX
1041 if ( !GetTitle().isEmpty() )
1042 {
1043 // then insert the headline section
1044 SwNodeIndex aIdx( *pSectNd, +1 );
1045
1046 SwTextNode* pHeadNd = rDoc.GetNodes().MakeTextNode( aIdx.GetNode(),
1048 pHeadNd->InsertText( GetTitle(), SwContentIndex( pHeadNd ) );
1049
1050 SwSectionData headerData( SectionType::ToxHeader, GetTOXName()+"_Head" );
1051
1052 --aIdx;
1053 SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
1055 *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx.GetNode(), true, false);
1056
1057 if (pUndo)
1058 {
1059 pUndo->TitleSectionInserted(*pSectFormat);
1060 }
1061 }
1062
1063 // Sort the List of all TOC Marks and TOC Sections
1064 std::vector<SwTextFormatColl*> aCollArr( GetTOXForm().GetFormMax(), nullptr );
1065 std::unordered_map<OUString, int> markURLs;
1066 SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
1067 for( size_t nCnt = 0; nCnt < m_aSortArr.size(); ++nCnt )
1068 {
1069 ::SetProgressState( 0, rDoc.GetDocShell() );
1070
1071 // Put the Text into the TOC
1072 sal_uInt16 nLvl = m_aSortArr[ nCnt ]->GetLevel();
1073 SwTextFormatColl* pColl = aCollArr[ nLvl ];
1074 if( !pColl )
1075 {
1076 pColl = GetTextFormatColl( nLvl );
1077 aCollArr[ nLvl ] = pColl;
1078 }
1079
1080 // Generate: Set dynamic TabStops
1081 SwTextNode* pTOXNd = rDoc.GetNodes().MakeTextNode( aInsPos.GetNode() , pColl );
1082 m_aSortArr[ nCnt ]->pTOXNd = pTOXNd;
1083
1084 // Generate: Evaluate Form and insert the place holder for the
1085 // page number. If it is a TOX_INDEX and the SwForm IsCommaSeparated()
1086 // then a range of entries must be generated into one paragraph
1087 size_t nRange = 1;
1088 if(TOX_INDEX == SwTOXBase::GetType() &&
1089 GetTOXForm().IsCommaSeparated() &&
1090 m_aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
1091 {
1092 const SwTOXMark& rMark = m_aSortArr[nCnt]->pTextMark->GetTOXMark();
1093 const OUString& sPrimKey = rMark.GetPrimaryKey();
1094 const OUString& sSecKey = rMark.GetSecondaryKey();
1095 const SwTOXMark* pNextMark = nullptr;
1096 while(m_aSortArr.size() > (nCnt + nRange) &&
1097 m_aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX )
1098 {
1099 pNextMark = &(m_aSortArr[nCnt + nRange]->pTextMark->GetTOXMark());
1100 if( !pNextMark ||
1101 pNextMark->GetPrimaryKey() != sPrimKey ||
1102 pNextMark->GetSecondaryKey() != sSecKey)
1103 break;
1104 nRange++;
1105 }
1106 }
1107 // pass node index of table-of-content section and default page description
1108 // to method <GenerateText(..)>.
1109 ::SetProgressState( 0, rDoc.GetDocShell() );
1110
1111 std::shared_ptr<sw::ToxTabStopTokenHandler> tabStopTokenHandler =
1112 std::make_shared<sw::DefaultToxTabStopTokenHandler>(
1113 pSectNd->GetIndex(), *pDefaultPageDesc, GetTOXForm().IsRelTabPos(),
1117 sw::ToxTextGenerator ttgn(GetTOXForm(), tabStopTokenHandler);
1118 ttgn.GenerateText(GetFormat()->GetDoc(), markURLs, m_aSortArr, nCnt, nRange, pLayout);
1119 nCnt += nRange - 1;
1120 }
1121
1122 // delete the first dummy node and remove all Cursor into the previous node
1123 aInsPos = *pFirstEmptyNd;
1124 {
1125 SwPaM aCorPam( *pFirstEmptyNd );
1126 aCorPam.GetPoint()->nContent.Assign( pFirstEmptyNd, 0 );
1127 if( !aCorPam.Move( fnMoveForward ) )
1128 aCorPam.Move( fnMoveBackward );
1129 SwNodeIndex aEndIdx( aInsPos, 1 );
1130 SwDoc::CorrAbs( aInsPos, aEndIdx, *aCorPam.GetPoint(), true );
1131
1132 // Task 70995 - save and restore PageDesc and Break Attributes
1133 if( pFirstEmptyNd->HasSwAttrSet() )
1134 {
1135 if( !GetTitle().isEmpty() )
1136 aEndIdx = *pSectNd;
1137 else
1138 aEndIdx = *pFirstEmptyNd;
1139 SwContentNode* pCNd = rDoc.GetNodes().GoNext( &aEndIdx );
1140 if( pCNd ) // Robust against defect documents, e.g. i60336
1141 pCNd->SetAttr( *pFirstEmptyNd->GetpSwAttrSet() );
1142 }
1143 }
1144
1145 // now create the new Frames
1146 SwNodeOffset nIdx = pSectNd->GetIndex();
1147 // don't delete if index is empty
1148 if(nIdx + SwNodeOffset(2) < pSectNd->EndOfSectionIndex())
1149 rDoc.GetNodes().Delete( aInsPos );
1150
1151 aN2L.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 );
1153 for ( const auto& rpLayout : aAllLayouts )
1154 {
1155 SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(rpLayout->Lower()) );
1156 }
1157
1159}
1160
1162{
1163 SwDoc* pDoc = GetFormat()->GetDoc();
1164 OUString sLastDeli;
1165 size_t i = 0;
1166 while( i < m_aSortArr.size() )
1167 {
1168 ::SetProgressState( 0, pDoc->GetDocShell() );
1169
1170 sal_uInt16 nLevel = m_aSortArr[i]->GetLevel();
1171
1172 // Skip AlphaDelimiter
1174 continue;
1175
1176 const OUString sDeli = rIntl.GetIndexKey( m_aSortArr[i]->GetText(),
1177 m_aSortArr[i]->GetLocale() );
1178
1179 // Do we already have a Delimiter?
1180 if( !sDeli.isEmpty() && sLastDeli != sDeli )
1181 {
1182 // We skip all that are less than a small Blank (these are special characters)
1183 if( ' ' <= sDeli[0] )
1184 {
1185 std::unique_ptr<SwTOXCustom> pCst(
1186 MakeSwTOXSortTabBase<SwTOXCustom>(nullptr,
1187 TextAndReading(sDeli, OUString()),
1189 rIntl, m_aSortArr[i]->GetLocale() ));
1190 m_aSortArr.insert( m_aSortArr.begin() + i, std::move(pCst));
1191 i++;
1192 }
1193 sLastDeli = sDeli;
1194 }
1195
1196 // Skip until we get to the same or a lower Level
1197 do {
1198 i++;
1199 } while (i < m_aSortArr.size() && m_aSortArr[i]->GetLevel() > nLevel);
1200 }
1201}
1202
1205{
1206 SwDoc* pDoc = GetFormat()->GetDoc();
1207 const OUString& rName = GetTOXForm().GetTemplate( nLevel );
1208 SwTextFormatColl* pColl = !rName.isEmpty() ? pDoc->FindTextFormatCollByName(rName) :nullptr;
1209 if( !pColl )
1210 {
1211 sal_uInt16 nPoolFormat = 0;
1212 const TOXTypes eMyType = SwTOXBase::GetType();
1213 switch( eMyType )
1214 {
1215 case TOX_INDEX: nPoolFormat = RES_POOLCOLL_TOX_IDXH; break;
1216 case TOX_USER:
1217 if( nLevel < 6 )
1218 nPoolFormat = RES_POOLCOLL_TOX_USERH;
1219 else
1220 nPoolFormat = RES_POOLCOLL_TOX_USER6 - 6;
1221 break;
1222 case TOX_ILLUSTRATIONS: nPoolFormat = RES_POOLCOLL_TOX_ILLUSH; break;
1223 case TOX_OBJECTS: nPoolFormat = RES_POOLCOLL_TOX_OBJECTH; break;
1224 case TOX_TABLES: nPoolFormat = RES_POOLCOLL_TOX_TABLESH; break;
1225 case TOX_AUTHORITIES:
1226 case TOX_BIBLIOGRAPHY:
1227 nPoolFormat = RES_POOLCOLL_TOX_AUTHORITIESH; break;
1228 case TOX_CITATION: break;
1229 case TOX_CONTENT:
1230 // There's a jump in the ContentArea!
1231 if( nLevel < 6 )
1232 nPoolFormat = RES_POOLCOLL_TOX_CNTNTH;
1233 else
1234 nPoolFormat = RES_POOLCOLL_TOX_CNTNT6 - 6;
1235 break;
1236 }
1237
1238 if(eMyType == TOX_AUTHORITIES && nLevel)
1239 nPoolFormat = nPoolFormat + 1;
1240 else if(eMyType == TOX_INDEX && nLevel)
1241 {
1242 // pool: Level 1,2,3, Delimiter
1243 // SwForm: Delimiter, Level 1,2,3
1244 nPoolFormat += 1 == nLevel ? nLevel + 3 : nLevel - 1;
1245 }
1246 else
1247 nPoolFormat = nPoolFormat + nLevel;
1248 pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolFormat );
1249 }
1250 return pColl;
1251}
1252
1253void SwTOXBaseSection::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
1254{
1255 if (auto pFindHint = dynamic_cast<const sw::FindContentFrameHint*>(&rHint))
1256 {
1257 if(pFindHint->m_rpContentFrame)
1258 return;
1259 auto pSectFormat = GetFormat();
1260 if(!pSectFormat)
1261 return;
1262 const SwSectionNode* pSectNd = pSectFormat->GetSectionNode();
1263 if(!pSectNd)
1264 return;
1265 SwNodeIndex aIdx(*pSectNd, 1);
1266 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
1267 if(!pCNd)
1268 pCNd = pFindHint->m_rDoc.GetNodes().GoNext(&aIdx);
1269 if(!pCNd)
1270 return;
1271 if(pCNd->EndOfSectionIndex() >= pSectNd->EndOfSectionIndex())
1272 return;
1273 pFindHint->m_rpContentFrame = pCNd->getLayoutFrame(&pFindHint->m_rLayout);
1274 } else
1275 SwTOXBase::SwClientNotify(rModify, rHint);
1276}
1277
1280 const SwTextNode* pOwnChapterNode,
1281 SwRootFrame const*const pLayout)
1282{
1283 const auto pType = static_cast<SwTOXType*>(SwTOXBase::GetRegisteredIn());
1284 auto pShell = GetFormat()->GetDoc()->GetDocShell();
1285 const TOXTypes eTOXTyp = GetTOXType()->GetType();
1286 std::vector<std::reference_wrapper<SwTextTOXMark>> vMarks;
1287 pType->CollectTextTOXMarksForLayout(vMarks, pLayout);
1288 for(auto& rMark: vMarks)
1289 {
1290 ::SetProgressState(0, pShell);
1291 auto& rNode = rMark.get().GetTextNode();
1292 if(IsFromChapter() && !IsHeadingContained(pOwnChapterNode, rNode))
1293 continue;
1294 auto rTOXMark = rMark.get().GetTOXMark();
1295 if(TOX_INDEX == eTOXTyp)
1296 {
1297 // index entry mark
1298 assert(g_pBreakIt);
1299 lang::Locale aLocale = g_pBreakIt->GetLocale(rNode.GetLang(rMark.get().GetStart()));
1300 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_ENTRY, rIntl, aLocale));
1301 if(GetOptions() & SwTOIOptions::KeyAsEntry && !rTOXMark.GetPrimaryKey().isEmpty())
1302 {
1303 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale));
1304 if (!rTOXMark.GetSecondaryKey().isEmpty())
1305 {
1306 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale));
1307 }
1308 }
1309 }
1310 else if(TOX_USER == eTOXTyp || rTOXMark.GetLevel() <= GetLevel())
1311 { // table of content mark, also used for user marks
1312 InsertSorted(MakeSwTOXSortTabBase<SwTOXContent>(pLayout, rNode, &rMark.get(), rIntl));
1313 }
1314 }
1315}
1316
1318void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode,
1319 SwRootFrame const*const pLayout)
1320{
1321 SwDoc* pDoc = GetFormat()->GetDoc();
1322 SwNodes& rNds = pDoc->GetNodes();
1323
1324 const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1325 for( auto pOutlineNode : rOutlNds )
1326 {
1327 ::SetProgressState( 0, pDoc->GetDocShell() );
1328 SwTextNode* pTextNd = pOutlineNode->GetTextNode();
1329 if( pTextNd && pTextNd->Len() && pTextNd->HasWriterListeners() &&
1331 pTextNd->getLayoutFrame(pLayout) &&
1332 !pTextNd->IsHiddenByParaField() &&
1333 !pTextNd->HasHiddenCharAttribute( true ) &&
1334 (!pLayout || !pLayout->HasMergedParas()
1335 || static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) &&
1336 ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd) ))
1337 {
1338 InsertSorted(MakeSwTOXSortTabBase<SwTOXPara>(pLayout, *pTextNd, SwTOXElement::OutlineLevel));
1339 }
1340 }
1341}
1342
1345 SwRootFrame const*const pLayout)
1346{
1347 SwDoc* pDoc = GetFormat()->GetDoc();
1348 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1349 {
1350 const OUString sTmpStyleNames = GetStyleNames(i);
1351 if (sTmpStyleNames.isEmpty())
1352 continue;
1353
1354 sal_Int32 nIndex = 0;
1355 while (nIndex >= 0)
1356 {
1358 sTmpStyleNames.getToken( 0, TOX_STYLE_DELIMITER, nIndex ));
1359 //TODO: no outline Collections in content indexes if OutlineLevels are already included
1360 if( !pColl ||
1364 continue;
1365
1367 for( SwTextNode* pTextNd = aIter.First(); pTextNd; pTextNd = aIter.Next() )
1368 {
1369 ::SetProgressState( 0, pDoc->GetDocShell() );
1370
1371 if (pTextNd->GetText().getLength() &&
1372 pTextNd->getLayoutFrame(pLayout) &&
1373 pTextNd->GetNodes().IsDocNodes() &&
1374 (!pLayout || !pLayout->HasMergedParas()
1375 || static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) &&
1376 (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd)))
1377 {
1378 InsertSorted(MakeSwTOXSortTabBase<SwTOXPara>(pLayout, *pTextNd, SwTOXElement::Template, i + 1));
1379 }
1380 }
1381 }
1382 }
1383}
1384
1387 SwRootFrame const*const pLayout)
1388{
1389 SwDoc* pDoc = GetFormat()->GetDoc();
1391 if(!pSeqField)
1392 return;
1393
1394 std::vector<SwFormatField*> vFields;
1395 pSeqField->GatherFields(vFields);
1396 for(auto pFormatField: vFields)
1397 {
1398 const SwTextField* pTextField = pFormatField->GetTextField();
1399 SwTextNode& rTextNode = pTextField->GetTextNode();
1400 ::SetProgressState( 0, pDoc->GetDocShell() );
1401
1402 if (rTextNode.GetText().getLength() &&
1403 rTextNode.getLayoutFrame(pLayout) &&
1404 ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, rTextNode))
1405 && (!pLayout || !pLayout->IsHideRedlines()
1406 || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField)))
1407 {
1408 const SwSetExpField& rSeqField = dynamic_cast<const SwSetExpField&>(*(pFormatField->GetField()));
1409 const OUString sName = GetSequenceName()
1410 + OUStringChar(cSequenceMarkSeparator)
1411 + OUString::number( rSeqField.GetSeqNumber() );
1412 std::unique_ptr<SwTOXPara> pNew(new SwTOXPara( rTextNode, SwTOXElement::Sequence, 1, sName ));
1413 // set indexes if the number or the reference text are to be displayed
1415 {
1416 pNew->SetStartIndex(
1417 SwGetExpField::GetReferenceTextPos( *pFormatField, *pDoc ));
1418 }
1419 else if(GetCaptionDisplay() == CAPTION_NUMBER)
1420 {
1421 pNew->SetEndIndex(pTextField->GetStart() + 1);
1422 }
1423 pNew->InitText(pLayout);
1424 InsertSorted(std::move(pNew));
1425 }
1426 }
1427}
1428
1430 SwRootFrame const*const pLayout)
1431{
1432 SwDoc* pDoc = GetFormat()->GetDoc();
1433 SwFieldType* pAuthField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, OUString(), false);
1434 if(!pAuthField)
1435 return;
1436
1437 std::vector<SwFormatField*> vFields;
1438 pAuthField->GatherFields(vFields);
1439 for(auto pFormatField: vFields)
1440 {
1441 const auto pTextField = pFormatField->GetTextField();
1442 const SwTextNode& rTextNode = pFormatField->GetTextField()->GetTextNode();
1443 ::SetProgressState( 0, pDoc->GetDocShell() );
1444
1445 if (rTextNode.GetText().getLength() &&
1446 rTextNode.getLayoutFrame(pLayout) &&
1447 (!pLayout || !pLayout->IsHideRedlines()
1448 || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField)))
1449 {
1450 //#106485# the body node has to be used!
1451 SwContentFrame *const pFrame = rTextNode.getLayoutFrame(pLayout);
1452 SwPosition aFieldPos(rTextNode);
1453 const SwTextNode* pTextNode = nullptr;
1454 if(pFrame && !pFrame->IsInDocBody())
1455 pTextNode = GetBodyTextNode( *pDoc, aFieldPos, *pFrame );
1456 if(!pTextNode)
1457 pTextNode = &rTextNode;
1458
1459 InsertSorted(MakeSwTOXSortTabBase<SwTOXAuthority>(pLayout, *pTextNode, *pFormatField, rIntl));
1460 }
1461 }
1462}
1463
1464static SwTOOElements lcl_IsSOObject( const SvGlobalName& rFactoryNm )
1465{
1466 static const struct SoObjType {
1467 SwTOOElements nFlag;
1468 // GlobalNameId
1469 struct {
1470 sal_uInt32 n1;
1471 sal_uInt16 n2, n3;
1472 sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
1473 } aGlNmIds[4];
1474 } aArr[] = {
1489 };
1490
1491 for( SoObjType const & rArr : aArr )
1492 for (auto & rId : rArr.aGlNmIds)
1493 {
1494 if( !rId.n1 )
1495 break;
1496 SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
1497 rId.b8, rId.b9, rId.b10, rId.b11,
1498 rId.b12, rId.b13, rId.b14, rId.b15 );
1499 if( rFactoryNm == aGlbNm )
1500 {
1501 return rArr.nFlag;
1502 }
1503 }
1504
1505 return SwTOOElements::NONE;
1506}
1507
1509 const SwTextNode* pOwnChapterNode,
1510 SwRootFrame const*const pLayout)
1511{
1512 SwDoc* pDoc = GetFormat()->GetDoc();
1513 SwNodes& rNds = pDoc->GetNodes();
1514 // on the 1st Node of the 1st Section
1516 nEndIdx = rNds.GetEndOfAutotext().GetIndex();
1517
1518 while( nIdx < nEndIdx )
1519 {
1520 ::SetProgressState( 0, pDoc->GetDocShell() );
1521
1522 SwNode* pNd = rNds[ nIdx ];
1523 SwContentNode* pCNd = nullptr;
1524 switch( eMyType )
1525 {
1527 if( !pNd->IsNoTextNode() )
1528 {
1529 pCNd = pNd->GetContentNode();
1530 if( !pCNd )
1531 {
1532 SwNodeIndex aTmp( *pNd );
1533 pCNd = rNds.GoNext( &aTmp );
1534 }
1535 }
1536 break;
1538 if( pNd->IsGrfNode() )
1539 pCNd = static_cast<SwContentNode*>(pNd);
1540 break;
1541 case SwTOXElement::Ole:
1542 if( pNd->IsOLENode() )
1543 {
1544 bool bInclude = true;
1546 {
1547 SwOLENode* pOLENode = pNd->GetOLENode();
1548 SwTOOElements nMyOLEOptions = GetOLEOptions();
1549 SwOLEObj& rOLEObj = pOLENode->GetOLEObj();
1550
1551 if( rOLEObj.IsOleRef() ) // Not yet loaded
1552 {
1553 SvGlobalName aTmpName( rOLEObj.GetOleRef()->getClassID() );
1554 SwTOOElements nObj = ::lcl_IsSOObject( aTmpName );
1555 bInclude = ( (nMyOLEOptions & SwTOOElements::Other) && SwTOOElements::NONE == nObj )
1556 || (nMyOLEOptions & nObj);
1557 }
1558 else
1559 {
1560 OSL_FAIL("OLE Object no loaded?");
1561 bInclude = false;
1562 }
1563 }
1564
1565 if(bInclude)
1566 pCNd = static_cast<SwContentNode*>(pNd);
1567 }
1568 break;
1569 default: break;
1570 }
1571
1572 if( pCNd )
1573 {
1574 // find node in body text
1575 int nSetLevel = USHRT_MAX;
1576
1577 //#111105# tables of tables|illustrations|objects don't support hierarchies
1578 if( IsLevelFromChapter() &&
1582 {
1583 const SwTextNode* pOutlNd = ::lcl_FindChapterNode( *pCNd,
1584 pLayout, MAXLEVEL - 1);
1585 if( pOutlNd )
1586 {
1588 {
1589 nSetLevel = pOutlNd->GetTextColl()->GetAttrOutlineLevel();
1590 }
1591 }
1592 }
1593
1594 if (pCNd->getLayoutFrame(pLayout)
1595 && (!pLayout || !pLayout->HasMergedParas()
1597 && ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd)))
1598 {
1599 std::unique_ptr<SwTOXPara> pNew( MakeSwTOXSortTabBase<SwTOXPara>(
1600 pLayout, *pCNd, eMyType,
1601 ( USHRT_MAX != nSetLevel )
1602 ? o3tl::narrowing<sal_uInt16>(nSetLevel)
1604 InsertSorted( std::move(pNew) );
1605 }
1606 }
1607
1608 nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + SwNodeOffset(2); // 2 == End/Start Node
1609 }
1610}
1611
1613void SwTOXBaseSection::UpdateTable(const SwTextNode* pOwnChapterNode,
1614 SwRootFrame const*const pLayout)
1615{
1616 SwDoc* pDoc = GetFormat()->GetDoc();
1617 SwNodes& rNds = pDoc->GetNodes();
1618 const SwFrameFormats& rArr = *pDoc->GetTableFrameFormats();
1619
1620 for( auto pFrameFormat : rArr )
1621 {
1622 ::SetProgressState( 0, pDoc->GetDocShell() );
1623
1624 SwTable* pTmpTable = SwTable::FindTable( pFrameFormat );
1625 SwTableBox* pFBox;
1626 if( pTmpTable && nullptr != (pFBox = pTmpTable->GetTabSortBoxes()[0] ) &&
1627 pFBox->GetSttNd() && pFBox->GetSttNd()->GetNodes().IsDocNodes() )
1628 {
1629 const SwTableNode* pTableNd = pFBox->GetSttNd()->FindTableNode();
1630 SwNodeIndex aContentIdx( *pTableNd, 1 );
1631
1632 SwContentNode* pCNd;
1633 while( nullptr != ( pCNd = rNds.GoNext( &aContentIdx ) ) &&
1634 aContentIdx.GetIndex() < pTableNd->EndOfSectionIndex() )
1635 {
1636 if (pCNd->getLayoutFrame(pLayout)
1637 && (!pLayout || !pLayout->HasMergedParas()
1639 && (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd)))
1640 {
1641 std::unique_ptr<SwTOXTable> pNew(new SwTOXTable( *pCNd ));
1643 {
1644 const SwTextNode* pOutlNd =
1645 ::lcl_FindChapterNode(*pCNd, pLayout, MAXLEVEL - 1);
1646 if( pOutlNd )
1647 {
1649 {
1650 const int nTmp = pOutlNd->GetTextColl()->GetAttrOutlineLevel();
1651 pNew->SetLevel(o3tl::narrowing<sal_uInt16>(nTmp));
1652 }
1653 }
1654 }
1655 pNew->InitText(pLayout);
1656 InsertSorted(std::move(pNew));
1657 break;
1658 }
1659 }
1660 }
1661 }
1662}
1663
1666{
1667 if( m_aSortArr.empty() )
1668 return ;
1669
1670 // Insert the current PageNumber into the TOC
1671 SwPageFrame* pCurrentPage = nullptr;
1672 sal_uInt16 nPage = 0;
1673 SwDoc* pDoc = GetFormat()->GetDoc();
1674
1676 TOX_INDEX == GetTOXType()->GetType() ?
1678 GetSortAlgorithm() );
1679
1680 for( size_t nCnt = 0; nCnt < m_aSortArr.size(); ++nCnt )
1681 {
1682 // Loop over all SourceNodes
1683
1684 // process run in lines
1685 size_t nRange = 0;
1686 if(GetTOXForm().IsCommaSeparated() &&
1687 m_aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
1688 {
1689 const SwTOXMark& rMark = m_aSortArr[nCnt]->pTextMark->GetTOXMark();
1690 const OUString& sPrimKey = rMark.GetPrimaryKey();
1691 const OUString& sSecKey = rMark.GetSecondaryKey();
1692 const SwTOXMark* pNextMark = nullptr;
1693 while(m_aSortArr.size() > (nCnt + nRange)&&
1694 m_aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
1695 nullptr != (pNextMark = &(m_aSortArr[nCnt + nRange]->pTextMark->GetTOXMark())) &&
1696 pNextMark->GetPrimaryKey() == sPrimKey &&
1697 pNextMark->GetSecondaryKey() == sSecKey)
1698 nRange++;
1699 }
1700 else
1701 nRange = 1;
1702
1703 for(size_t nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; ++nRunInEntry)
1704 {
1705 std::vector<sal_uInt16> aNums; // the PageNumber
1706 std::vector<SwPageDesc*> aDescs; // The PageDescriptors matching the PageNumbers
1707 std::vector<sal_uInt16> aMainNums; // contains page numbers of main entries
1708 SwTOXSortTabBase* pSortBase = m_aSortArr[nRunInEntry].get();
1709 size_t nSize = pSortBase->aTOXSources.size();
1710 for (size_t j = 0; j < nSize; ++j)
1711 {
1712 ::SetProgressState( 0, pDoc->GetDocShell() );
1713
1714 SwTOXSource& rTOXSource = pSortBase->aTOXSources[j];
1715 if( rTOXSource.pNd )
1716 {
1718 OSL_ENSURE( pFrame || pDoc->IsUpdateTOX(), "TOX, no Frame found");
1719 if( !pFrame )
1720 continue;
1721 if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->HasFollow() )
1722 {
1723 // find the right one
1724 SwTextFrame* pNext;
1725 TextFrameIndex const nPos(static_cast<SwTextFrame*>(pFrame)
1726 ->MapModelToView(static_cast<SwTextNode const*>(rTOXSource.pNd),
1727 rTOXSource.nPos));
1728 for (;;)
1729 {
1730 pNext = static_cast<SwTextFrame*>(pFrame->GetFollow());
1731 if (!pNext || nPos < pNext->GetOffset())
1732 break;
1733 pFrame = pNext;
1734 }
1735 }
1736
1737 SwPageFrame* pTmpPage = pFrame->FindPageFrame();
1738 if( pTmpPage != pCurrentPage )
1739 {
1740 nPage = pTmpPage->GetVirtPageNum();
1741 pCurrentPage = pTmpPage;
1742 }
1743
1744 // Insert as sorted
1745 std::vector<sal_uInt16>::size_type i;
1746 for( i = 0; i < aNums.size() && aNums[i] < nPage; ++i )
1747 ;
1748
1749 if( i >= aNums.size() || aNums[ i ] != nPage )
1750 {
1751 aNums.insert(aNums.begin() + i, nPage);
1752 aDescs.insert(aDescs.begin() + i, pCurrentPage->GetPageDesc() );
1753 }
1754 // is it a main entry?
1755 if(TOX_SORT_INDEX == pSortBase->GetType() &&
1756 rTOXSource.bMainEntry)
1757 {
1758 aMainNums.push_back(nPage);
1759 }
1760 }
1761 }
1762 // Insert the PageNumber into the TOC TextNode
1763 const SwTOXSortTabBase* pBase = m_aSortArr[ nCnt ].get();
1764 if(pBase->pTOXNd)
1765 {
1766 const SwTextNode* pTextNd = pBase->pTOXNd->GetTextNode();
1767 OSL_ENSURE( pTextNd, "no TextNode, wrong TOC" );
1768
1769 UpdatePageNum_( const_cast<SwTextNode*>(pTextNd), aNums, aDescs, &aMainNums,
1770 aIntl );
1771 }
1772 }
1773 }
1774 // Delete the mapping array after setting the right PageNumber
1775 m_aSortArr.clear();
1776}
1777
1780static bool lcl_HasMainEntry( const std::vector<sal_uInt16>* pMainEntryNums, sal_uInt16 nToFind )
1781{
1782 if (!pMainEntryNums)
1783 return false;
1784
1785 for( auto nMainEntry : *pMainEntryNums )
1786 if (nToFind == nMainEntry)
1787 return true;
1788 return false;
1789}
1790
1792 const std::vector<sal_uInt16>& rNums,
1793 const std::vector<SwPageDesc*>& rDescs,
1794 const std::vector<sal_uInt16>* pMainEntryNums,
1795 const SwTOXInternational& rIntl )
1796{
1797 // collect starts end ends of main entry character style
1798 std::optional< std::vector<sal_uInt16> > xCharStyleIdx;
1799 if (pMainEntryNums)
1800 xCharStyleIdx.emplace();
1801
1802 OUString sSrchStr
1803 = OUStringChar(C_NUM_REPL) + SwTOXMark::S_PAGE_DELI + OUStringChar(C_NUM_REPL);
1804 sal_Int32 nStartPos = pNd->GetText().indexOf(sSrchStr);
1805 sSrchStr = OUStringChar(C_NUM_REPL) + OUStringChar(C_END_PAGE_NUM);
1806 sal_Int32 nEndPos = pNd->GetText().indexOf(sSrchStr);
1807
1808 if (-1 == nEndPos || rNums.empty())
1809 return;
1810
1811 if (-1 == nStartPos || nStartPos > nEndPos)
1812 nStartPos = nEndPos;
1813
1814 sal_uInt16 nOld = rNums[0],
1815 nBeg = nOld,
1816 nCount = 0;
1817 OUString aNumStr( rDescs[0]->GetNumType().GetNumStr( nBeg ) );
1818 if( xCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg ))
1819 {
1820 xCharStyleIdx->push_back( 0 );
1821 }
1822
1823 // Delete place holder
1824 SwContentIndex aPos(pNd, nStartPos);
1825 SwCharFormat* pPageNoCharFormat = nullptr;
1826 SwpHints* pHints = pNd->GetpSwpHints();
1827 if(pHints)
1828 for(size_t nHintIdx = 0; nHintIdx < pHints->Count(); ++nHintIdx)
1829 {
1830 const SwTextAttr* pAttr = pHints->Get(nHintIdx);
1831 const sal_Int32 nTmpEnd = pAttr->End() ? *pAttr->End() : 0;
1832 if( nStartPos >= pAttr->GetStart() &&
1833 (nStartPos + 2) <= nTmpEnd &&
1834 pAttr->Which() == RES_TXTATR_CHARFMT)
1835 {
1836 pPageNoCharFormat = pAttr->GetCharFormat().GetCharFormat();
1837 break;
1838 }
1839 }
1840 pNd->EraseText(aPos, nEndPos - nStartPos + 2);
1841
1842 std::vector<sal_uInt16>::size_type i;
1843 for( i = 1; i < rNums.size(); ++i)
1844 {
1845 SvxNumberType aType( rDescs[i]->GetNumType() );
1846 if( TOX_INDEX == SwTOXBase::GetType() )
1847 { // Summarize for the following
1848 // Add up all following
1849 // break up if main entry starts or ends and
1850 // insert a char style index
1851 bool bMainEntryChanges = lcl_HasMainEntry(pMainEntryNums, nOld)
1852 != lcl_HasMainEntry(pMainEntryNums, rNums[i]);
1853
1854 if(nOld == rNums[i]-1 && !bMainEntryChanges &&
1856 nCount++;
1857 else
1858 {
1859 // Flush for the following old values
1861 {
1862 if ( nCount >= 1 )
1863 aNumStr += rIntl.GetFollowingText( nCount > 1 );
1864 }
1865 else if (nCount) //#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
1866 {
1867 if (nCount == 1 )
1868 aNumStr += SwTOXMark::S_PAGE_DELI;
1869 else
1870 aNumStr += "-";
1871
1872 aNumStr += aType.GetNumStr( nBeg + nCount );
1873 }
1874
1875 // Create new String
1876 nBeg = rNums[i];
1877 aNumStr += SwTOXMark::S_PAGE_DELI;
1878 //the change of the character style must apply after sPageDeli is appended
1879 if (xCharStyleIdx && bMainEntryChanges)
1880 {
1881 xCharStyleIdx->push_back(aNumStr.getLength());
1882 }
1883 aNumStr += aType.GetNumStr( nBeg );
1884 nCount = 0;
1885 }
1886 nOld = rNums[i];
1887 }
1888 else
1889 { // Insert all Numbers
1890 aNumStr += aType.GetNumStr( rNums[i] );
1891 if (i+1 != rNums.size())
1892 aNumStr += SwTOXMark::S_PAGE_DELI;
1893 }
1894 }
1895 // Flush when ending and the following old values
1896 if( TOX_INDEX == SwTOXBase::GetType() )
1897 {
1899 {
1900 if( nCount >= 1 )
1901 aNumStr += rIntl.GetFollowingText( nCount > 1 );
1902 }
1903 else
1904 {
1905 if(nCount >= 2)
1906 aNumStr += "-";
1907 else if(nCount == 1)
1908 aNumStr += SwTOXMark::S_PAGE_DELI;
1909 //#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
1910 if(nCount)
1911 aNumStr += rDescs[i-1]->GetNumType().GetNumStr( nBeg+nCount );
1912 }
1913 }
1915 if(pPageNoCharFormat)
1916 {
1917 SwFormatCharFormat aCharFormat( pPageNoCharFormat );
1918 pNd->InsertItem(aCharFormat, nStartPos, nStartPos + aNumStr.getLength(), SetAttrMode::DONTEXPAND);
1919 }
1920
1921 // The main entries should get their character style
1922 if (!xCharStyleIdx || xCharStyleIdx->empty() || GetMainEntryCharStyle().isEmpty())
1923 return;
1924
1925 // eventually the last index must me appended
1926 if (xCharStyleIdx->size()&0x01)
1927 xCharStyleIdx->push_back(aNumStr.getLength());
1928
1929 // search by name
1930 SwDoc& rDoc = pNd->GetDoc();
1932 SwCharFormat* pCharFormat = nullptr;
1933 if(USHRT_MAX != nPoolId)
1934 pCharFormat = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
1935 else
1936 pCharFormat = rDoc.FindCharFormatByName( GetMainEntryCharStyle() );
1937 if(!pCharFormat)
1938 pCharFormat = rDoc.MakeCharFormat(GetMainEntryCharStyle(), nullptr);
1939
1940 // find the page numbers in aNumStr and set the character style
1941 sal_Int32 nOffset = pNd->GetText().getLength() - aNumStr.getLength();
1942 SwFormatCharFormat aCharFormat(pCharFormat);
1943 for (size_t j = 0; j < xCharStyleIdx->size(); j += 2)
1944 {
1945 sal_Int32 nStartIdx = (*xCharStyleIdx)[j] + nOffset;
1946 sal_Int32 nEndIdx = (*xCharStyleIdx)[j + 1] + nOffset;
1947 pNd->InsertItem(aCharFormat, nStartIdx, nEndIdx, SetAttrMode::DONTEXPAND);
1948 }
1949}
1950
1951void SwTOXBaseSection::InsertSorted(std::unique_ptr<SwTOXSortTabBase> pNew)
1952{
1953 Range aRange(0, m_aSortArr.size());
1954 if( TOX_INDEX == SwTOXBase::GetType() && pNew->pTextMark )
1955 {
1956 const SwTOXMark& rMark = pNew->pTextMark->GetTOXMark();
1957 // Evaluate Key
1958 // Calculate the range where to insert
1960 !rMark.GetPrimaryKey().isEmpty() )
1961 {
1962 aRange = GetKeyRange( rMark.GetPrimaryKey(),
1963 rMark.GetPrimaryKeyReading(),
1964 *pNew, FORM_PRIMARY_KEY, aRange );
1965
1966 if( !rMark.GetSecondaryKey().isEmpty() )
1967 aRange = GetKeyRange( rMark.GetSecondaryKey(),
1968 rMark.GetSecondaryKeyReading(),
1969 *pNew, FORM_SECONDARY_KEY, aRange );
1970 }
1971 }
1972 // Search for identical entries and remove the trailing one
1974 {
1975 for(short i = static_cast<short>(aRange.Min()); i < static_cast<short>(aRange.Max()); ++i)
1976 {
1977 SwTOXSortTabBase* pOld = m_aSortArr[i].get();
1978 if (pOld->equivalent(*pNew))
1979 {
1980 if (pOld->sort_lt(*pNew))
1981 {
1982 return;
1983 }
1984 else
1985 {
1986 // remove the old content
1987 m_aSortArr.erase( m_aSortArr.begin() + i );
1988 aRange.Max()--;
1989 break;
1990 }
1991 }
1992 }
1993 }
1994
1995 // find position and insert
1996 tools::Long i;
1997
1998 for( i = aRange.Min(); i < aRange.Max(); ++i)
1999 { // Only check for same level
2000 SwTOXSortTabBase* pOld = m_aSortArr[i].get();
2001 if (pOld->equivalent(*pNew))
2002 {
2004 {
2005 // Own entry for double entries or keywords
2006 if( pOld->GetType() == TOX_SORT_CUSTOM &&
2008 continue;
2009
2011 { // Own entry
2012 m_aSortArr.insert(m_aSortArr.begin() + i, std::move(pNew));
2013 return;
2014 }
2015 // If the own entry is already present, add it to the references list
2016 pOld->aTOXSources.push_back(pNew->aTOXSources[0]);
2017
2018 return;
2019 }
2020#if OSL_DEBUG_LEVEL > 0
2021 else
2022 OSL_FAIL("Bibliography entries cannot be found here");
2023#endif
2024 }
2025 if (pNew->sort_lt(*pOld))
2026 break;
2027 }
2028 // Skip SubLevel
2029 while( TOX_INDEX == SwTOXBase::GetType() && i < aRange.Max() &&
2030 m_aSortArr[i]->GetLevel() > pNew->GetLevel() )
2031 i++;
2032
2033 // Insert at position i
2034 m_aSortArr.insert(m_aSortArr.begin()+i, std::move(pNew));
2035}
2036
2038Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrReading,
2039 const SwTOXSortTabBase& rNew,
2040 sal_uInt16 nLevel, const Range& rRange )
2041{
2042 const SwTOXInternational& rIntl = *rNew.pTOXIntl;
2043 TextAndReading aToCompare(rStr, rStrReading);
2044
2046 {
2047 aToCompare.sText = rIntl.ToUpper( aToCompare.sText, 0 )
2048 + aToCompare.sText.subView(1);
2049 }
2050
2051 OSL_ENSURE(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0");
2052
2053 const tools::Long nMin = rRange.Min();
2054 const tools::Long nMax = rRange.Max();
2055
2056 tools::Long i;
2057
2058 for( i = nMin; i < nMax; ++i)
2059 {
2060 SwTOXSortTabBase* pBase = m_aSortArr[i].get();
2061
2062 if( rIntl.IsEqual( pBase->GetText(), pBase->GetLocale(),
2063 aToCompare, rNew.GetLocale() ) &&
2064 pBase->GetLevel() == nLevel )
2065 break;
2066 }
2067 if(i == nMax)
2068 { // If not already present, create and insert
2069 std::unique_ptr<SwTOXCustom> pKey(MakeSwTOXSortTabBase<SwTOXCustom>(
2070 nullptr, aToCompare, nLevel, rIntl, rNew.GetLocale() ));
2071 for(i = nMin; i < nMax; ++i)
2072 {
2073 if (nLevel == m_aSortArr[i]->GetLevel() && pKey->sort_lt(*m_aSortArr[i]))
2074 break;
2075 }
2076 m_aSortArr.insert(m_aSortArr.begin() + i, std::move(pKey));
2077 }
2078 const tools::Long nStart = i+1;
2079 const tools::Long nEnd = m_aSortArr.size();
2080
2081 // Find end of range
2082 for(i = nStart; i < nEnd; ++i)
2083 {
2084 if(m_aSortArr[i]->GetLevel() <= nLevel)
2085 {
2086 return Range(nStart, i);
2087 }
2088 }
2089 return Range(nStart, nEnd);
2090}
2091
2093{
2094 const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this);
2095 if (!pSect || !pSect->GetFormat())
2096 return false;
2097
2098 const SwSectionNode* pSectNode = pSect->GetFormat()->GetSectionNode();
2099 if (!pSectNode)
2100 return false;
2101
2102 const SwDocShell* pDocSh = pSectNode->GetDoc().GetDocShell();
2103 if (!pDocSh)
2104 return false;
2105
2106 if (pDocSh->IsReadOnly())
2107 return true;
2108
2109 pSectNode = pSectNode->StartOfSectionNode()->FindSectionNode();
2110 if (!pSectNode)
2111 return false;
2112
2113 return pSectNode->GetSection().IsProtectFlag();
2114}
2115
2117{
2118 const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this);
2119 if(pSect && pSect->GetFormat())
2120 return &pSect->GetFormat()->GetAttrSet();
2121 return nullptr;
2122}
2123
2125{
2126 SwTOXBaseSection *pSect = dynamic_cast<SwTOXBaseSection*>(this);
2127 if( pSect && pSect->GetFormat() )
2128 pSect->GetFormat()->SetFormatAttr( rSet );
2129}
2130
2131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator<=(const BigInt &rVal1, const BigInt &rVal2)
bool operator>=(const BigInt &rVal1, const BigInt &rVal2)
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual bool DoesUndo() const =0
Is Undo enabled?
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
tools::Long Max() const
tools::Long Min() const
sal_uInt16 Count() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsReadOnly() const
SvxBreak GetBreak() const
OUString GetNumStr(sal_Int32 nNo) const
const SvxFormatBreakItem & GetBreak(bool=true) const
Definition: frmatr.hxx:62
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
Represents the style of a text portion.
Definition: charfmt.hxx:27
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:135
Marks a character position inside a document model content node (SwContentNode)
SwContentIndex & Assign(const SwContentNode *, sal_Int32)
Definition: index.cxx:206
bool HasSwAttrSet() const
Definition: node.hxx:473
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1224
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:742
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:472
Definition: doc.hxx:192
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
Definition: doctxm.cxx:629
bool IsInReading() const
Definition: doc.hxx:958
static const SwAttrSet & GetTOXBaseAttrSet(const SwTOXBase &rTOX)
Definition: doctxm.cxx:468
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:344
void SetDefaultTOXBase(const SwTOXBase &rBase)
Definition: doctxm.cxx:503
bool DeleteTOX(const SwTOXBase &rTOXBase, bool bDelNodes)
Delete table of contents.
Definition: doctxm.cxx:524
static sal_uInt16 GetCurTOXMark(const SwPosition &rPos, SwTOXMarks &)
Get current table of contents Mark.
Definition: doctxm.cxx:117
std::unique_ptr< SwTOXTypes > mpTOXTypes
Definition: doc.hxx:251
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:395
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1867
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:170
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1667
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:611
void UpdateNumRule()
Definition: docnum.cxx:2629
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:775
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:316
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:145
SwNodes & GetNodes()
Definition: doc.hxx:413
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:358
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:336
void GetTOIKeys(SwTOIKeyType eTyp, std::vector< OUString > &rArr, SwRootFrame const &rLayout) const
Definition: doctxm.cxx:86
static SwTOXBase * GetCurTOX(const SwPosition &rPos)
Get current table of contents.
Definition: doctxm.cxx:448
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:517
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:427
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:252
const SwTOXBase * GetDefaultTOXBase(TOXTypes eTyp, bool bCreate)
Definition: doctxm.cxx:477
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:156
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:803
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:246
void DeleteTOXMark(const SwTOXMark *pTOXMark)
Delete table of contents Mark.
Definition: doctxm.cxx:155
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1322
bool SetTOXBaseName(const SwTOXBase &rTOXBase, const OUString &rName)
Definition: doctxm.cxx:705
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:853
bool IsInMailMerge() const
Definition: doc.hxx:964
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: doctxm.cxx:620
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:510
OUString GetUniqueTOXBaseName(const SwTOXType &rType, const OUString &sChkStr) const
Definition: doctxm.cxx:636
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:187
bool IsUpdateTOX() const
Definition: doc.hxx:953
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:815
SwDocShell * GetDocShell()
Definition: doc.hxx:1355
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:885
const SwTOXMark & GotoTOXMark(const SwTOXMark &rCurTOXMark, SwTOXSearch eDir, bool bInReadOnly)
Definition: doctxm.cxx:229
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:203
bool HasFollow() const
Definition: flowfrm.hxx:166
Definition: tox.hxx:314
OUString const & GetTemplate(sal_uInt16 nLevel) const
Definition: tox.hxx:672
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
const SwRect & getFrameArea() const
Definition: frame.hxx:179
Specific frame formats (frames, DrawObjects).
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1234
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1816
bool IsInDocBody() const
Definition: frame.hxx:943
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1638
static void CheckPageDescs(SwPageFrame *pStart, bool bNotifyFields=true, SwPageFrame **ppPrev=nullptr)
Check all pages (starting from the given one) if they use the appropriate frame format.
Definition: pagechg.cxx:1066
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
static sal_Int32 GetReferenceTextPos(const SwFormatField &rFormat, SwDoc &rDoc, sal_Int32 nHint=0)
Find the index of the reference text following the current field.
Definition: expfld.cxx:971
TElementType * Next()
Definition: calbck.hxx:364
TElementType * First()
Definition: calbck.hxx:356
bool HasWriterListeners() const
Definition: calbck.hxx:202
void RestoreUpperFrames(SwNodes &rNds, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: node2lay.cxx:489
SwFrame * GetFrame(const Point *pDocPos) const
Definition: node2lay.cxx:513
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
Base class of the Writer document model elements.
Definition: node.hxx:84
bool IsGrfNode() const
Definition: node.hxx:684
sal_uInt16 GetSectionLevel() const
Returns the section level at the position given by aIndex.
Definition: node.cxx:271
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:876
SwSectionNode * GetSectionNode()
Definition: node.hxx:635
SwNodeOffset GetIndex() const
Definition: node.hxx:296
bool IsNoTextNode() const
Definition: node.hxx:676
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:721
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:785
SwDoc & GetDoc()
Definition: node.hxx:217
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:701
const SwPageDesc * FindPageDesc(SwNodeOffset *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
Definition: node.cxx:487
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:370
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:981
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:137
Merge GetRedlineMergeFlag() const
Definition: node.hxx:100
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:705
SwContentNode * GetContentNode()
Definition: node.hxx:643
bool IsOLENode() const
Definition: node.hxx:680
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:710
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:240
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:103
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
Definition: ndarr.hxx:158
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2531
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1071
SwSectionNode * InsertTextSection(SwNode &rNd, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNode const *pEndNd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:782
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1334
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1300
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
bool IsOleRef() const
To avoid unnecessary loading of object.
Definition: ndole.cxx:905
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:940
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:638
const SwPosition * GetPoint() const
Definition: pam.hxx:261
A page of the document layout.
Definition: pagefrm.hxx:58
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
bool HasMergedParas() const
Definition: rootfrm.hxx:425
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:421
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:423
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:856
SwSectionNode * GetSectionNode()
Definition: section.cxx:928
const SwSection & GetSection() const
Definition: node.hxx:567
bool IsProtectFlag() const
Definition: section.hxx:189
bool IsHiddenFlag() const
Definition: section.hxx:188
const OUString & GetSectionName() const
Definition: section.hxx:169
SwSectionFormat * GetFormat()
Definition: section.hxx:337
SectionType GetType() const
Definition: section.hxx:171
void SetProtect(bool const bFlag=true)
Definition: section.cxx:354
void SetSectionName(OUString const &rName)
Definition: section.hxx:170
sal_uInt16 GetSeqNumber() const
Definition: expfld.hxx:248
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
void UpdateTemplate(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate table of contents from template areas.
Definition: doctxm.cxx:1344
void UpdatePageNum()
Calculate PageNumber and insert after formatting.
Definition: doctxm.cxx:1665
void InsertAlphaDelimiter(const SwTOXInternational &rIntl)
Definition: doctxm.cxx:1161
void UpdateTable(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Collect table entries.
Definition: doctxm.cxx:1613
void UpdateSequence(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate content from sequence fields.
Definition: doctxm.cxx:1386
void InsertSorted(std::unique_ptr< SwTOXSortTabBase > pBase)
Definition: doctxm.cxx:1951
virtual void SwClientNotify(const SwModify &rModify, const SfxHint &rHint) override
Definition: doctxm.cxx:1253
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:2038
void UpdateContent(SwTOXElement eType, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1508
void Update(const SfxItemSet *pAttr=nullptr, SwRootFrame const *pLayout=nullptr, const bool _bNewTOX=false)
Collect table of contents content.
Definition: doctxm.cxx:850
void UpdateMarks(const SwTOXInternational &rIntl, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Create from Marks.
Definition: doctxm.cxx:1279
SwTextFormatColl * GetTextFormatColl(sal_uInt16 nLevel)
Evaluate Template.
Definition: doctxm.cxx:1204
bool SetPosAtStartEnd(SwPosition &rPos) const
Definition: doctxm.cxx:836
SwTOXBaseSection(SwTOXBase const &rBase, SwSectionFormat &rFormat)
Definition: doctxm.cxx:824
void UpdateOutline(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate table of contents from outline.
Definition: doctxm.cxx:1318
void UpdateAuthorities(const SwTOXInternational &rIntl, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1429
std::vector< std::unique_ptr< SwTOXSortTabBase > > m_aSortArr
Definition: doctxm.hxx:37
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:1791
virtual ~SwTOXBaseSection() override
Definition: doctxm.cxx:832
void SetTOXName(const OUString &rSet)
Definition: tox.hxx:482
const OUString & GetSequenceName() const
Definition: tox.hxx:541
const OUString & GetSortAlgorithm() const
Definition: tox.hxx:555
bool IsLevelFromChapter() const
Definition: tox.hxx:535
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Definition: tox.hxx:466
bool IsProtected() const
Definition: tox.hxx:538
LanguageType GetLanguage() const
Definition: tox.hxx:552
sal_uInt16 nLevel
Definition: tox.hxx:441
SwTOXElement GetCreateType() const
Definition: tox.hxx:701
bool IsFromChapter() const
Definition: tox.hxx:529
SwTOOElements GetOLEOptions() const
Definition: tox.hxx:514
void SetAttrSet(const SfxItemSet &)
Definition: doctxm.cxx:2124
const SwForm & GetTOXForm() const
Definition: tox.hxx:713
const OUString & GetTOXName() const
Definition: tox.hxx:481
const OUString & GetMainEntryCharStyle() const
Definition: tox.hxx:502
const SfxItemSet * GetAttrSet() const
Definition: doctxm.cxx:2116
const SwTOXType * GetTOXType() const
Definition: tox.hxx:698
sal_uInt16 GetLevel() const
Definition: tox.hxx:731
bool IsFromObjectNames() const
Definition: tox.hxx:532
OUString const & GetStyleNames(sal_uInt16 nLevel) const
Definition: tox.hxx:519
TOXTypes GetType() const
Definition: tox.hxx:722
SwTOIOptions GetOptions() const
Definition: tox.hxx:737
bool mbKeepExpression
Definition: tox.hxx:458
bool IsTOXBaseInReadonly() const
Definition: doctxm.cxx:2092
const OUString & GetTitle() const
Definition: tox.hxx:704
OUString maMSTOCExpression
Definition: tox.hxx:457
SwCaptionDisplay GetCaptionDisplay() const
Definition: tox.hxx:544
OUString ToUpper(const OUString &rStr, sal_Int32 nPos) const
Definition: txmsrt.cxx:104
OUString GetIndexKey(const TextAndReading &rTaR, const css::lang::Locale &rLcl) const
Definition: txmsrt.cxx:123
OUString GetFollowingText(bool bMorePages) const
Definition: txmsrt.cxx:129
bool IsEqual(const TextAndReading &rTaR1, const css::lang::Locale &rLocale1, const TextAndReading &rTaR2, const css::lang::Locale &rLocale2) const
Definition: txmsrt.hxx:94
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:160
const SwTOXType * GetTOXType() const
Definition: tox.hxx:576
OUString const & GetSecondaryKeyReading() const
Definition: tox.hxx:658
OUString const & GetSecondaryKey() const
Definition: tox.hxx:640
OUString GetText(SwRootFrame const *pLayout) const
Definition: tox.cxx:201
OUString const & GetPrimaryKey() const
Definition: tox.hxx:634
static constexpr OUStringLiteral S_PAGE_DELI
Definition: tox.hxx:169
OUString const & GetPrimaryKeyReading() const
Definition: tox.hxx:652
const OUString & GetTypeName() const
Definition: tox.hxx:690
TOXTypes GetType() const
Definition: tox.hxx:693
void CollectTextMarks(SwTOXMarks &rMarks) const
Definition: tox.hxx:184
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:471
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:2104
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:262
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const sal_Int32 * End() const
Definition: txatbase.hxx:156
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
const SwFormatCharFormat & GetCharFormat() const
Definition: txatbase.hxx:187
bool HasDummyChar() const
Definition: txatbase.hxx:107
sal_uInt16 Which() const
Definition: txatbase.hxx:116
const SwTOXMark & GetTOXMark() const
Definition: txatbase.hxx:232
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:120
int GetAttrOutlineLevel() const
Definition: fmtcol.cxx:599
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:165
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1303
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:275
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
Definition: thints.cxx:1764
bool IsHiddenByParaField() const
is the paragraph visible?
Definition: ndtxt.hxx:744
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1305
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4990
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2724
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2322
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4106
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:230
const OUString & GetText() const
Definition: ndtxt.hxx:222
bool HasHiddenCharAttribute(bool bWholePara) const
Hidden Paragraph Field:
Definition: ndtxt.hxx:749
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:870
const SwTextNode * GetpTextNd() const
Definition: txttxmrk.hxx:44
const SwTextNode & GetTextNode() const
Definition: txttxmrk.hxx:49
SwHistory & GetHistory()
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:555
std::vector< SwSectionFormat * >::size_type size_type
Definition: docary.hxx:66
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:68
void DeRegister()
deregister the currently registered History
Definition: ndhints.hxx:197
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
void Register(SwRegHistory *pHist)
register a History, which receives all attribute changes (for Undo)
Definition: ndhints.hxx:195
size_t Count() const
Definition: ndhints.hxx:142
#define SO3_SDRAW_CLASSID_50
#define SO3_SCH_CLASSID_40
#define SO3_SC_CLASSID_30
#define SO3_SDRAW_CLASSID_60
#define SO3_SIMPRESS_CLASSID_50
#define SO3_SM_CLASSID_50
#define SO3_SC_CLASSID_60
#define SO3_SIMPRESS_CLASSID_30
#define SO3_SM_CLASSID_60
#define SO3_SCH_CLASSID_30
#define SO3_SCH_CLASSID_50
#define SO3_SC_CLASSID_40
#define SO3_SCH_CLASSID_60
#define SO3_SIMPRESS_CLASSID_40
#define SO3_SM_CLASSID_30
#define SO3_SM_CLASSID_40
#define SO3_SIMPRESS_CLASSID_60
#define SO3_SC_CLASSID_50
bool empty() const
size_type size() const
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
This class generates text for the entries of a table of x.
void GenerateText(SwDoc *doc, std::unordered_map< OUString, int > &rMarkURLs, const std::vector< std::unique_ptr< SwTOXSortTabBase > > &entries, sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess, SwRootFrame const *pLayout)
Generate the text for an entry of a table of X (X is, e.g., content).
int nCount
TOOLS_DLLPUBLIC OString DateTimeToOString(const DateTime &rDateTime)
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while.
Definition: doccorr.cxx:88
void DelFlyInRange(SwNode &rMkNd, SwNode &rPtNd, std::optional< sal_Int32 > oMkContentIdx, std::optional< sal_Int32 > oPtContentIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:208
static bool lcl_HasMainEntry(const std::vector< sal_uInt16 > *pMainEntryNums, sal_uInt16 nToFind)
Replace the PageNumber place holders.
Definition: doctxm.cxx:1780
static SwTOOElements lcl_IsSOObject(const SvGlobalName &rFactoryNm)
Definition: doctxm.cxx:1464
static const SwTextNode * lcl_FindChapterNode(const SwNode &rNd, SwRootFrame const *const pLayout, sal_uInt8 const nLvl=0)
Definition: doctxm.cxx:720
static bool IsHeadingContained(const SwTextNode *pChptrNd, const SwNode &rNd)
Definition: doctxm.cxx:741
static std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type MakeSwTOXSortTabBase(SwRootFrame const *const pLayout, Args &&... args)
Definition: doctxm.cxx:79
const SwTextNode * GetBodyTextNode(const SwDoc &rDoc, SwPosition &rPos, const SwFrame &rFrame)
Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes.
Definition: expfld.cxx:163
@ TableOfAuthorities
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
#define CH_TXTATR_INWORD
Definition: hintids.hxx:174
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
int n2
int n1
const char * sName
size
OUString newName(std::u16string_view aNewPrefix, const OUString &aOldPrefix, std::u16string_view old_Name)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
args
const SvxPageUsage aArr[]
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
Definition: txtfrm.cxx:1183
bool IsMarkHintHidden(SwRootFrame const &rLayout, SwTextNode const &rNode, SwTextAttrEnd const &rHint)
Definition: reffld.cxx:1141
long Long
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
sal_Int16 nId
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:982
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
@ RES_POOLCOLL_TEXT
Text body.
Definition: poolfmt.hxx:251
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
@ RES_POOLCOLL_TOX_USERH
Subgroup user indices.
Definition: poolfmt.hxx:382
@ RES_POOLCOLL_TOX_USER6
user index 6..10.
Definition: poolfmt.hxx:412
@ RES_POOLCOLL_TOX_CNTNTH
Subgroup table of contents.
Definition: poolfmt.hxx:374
@ RES_POOLCOLL_TOX_TABLESH
tables index.
Definition: poolfmt.hxx:404
@ RES_POOLCOLL_TOX_IDXH
Subgroup index tables.
Definition: poolfmt.hxx:367
@ RES_POOLCOLL_TOX_OBJECTH
object index.
Definition: poolfmt.hxx:400
@ RES_POOLCOLL_TOX_CNTNT6
Content 6th level.
Definition: poolfmt.hxx:389
@ RES_POOLCOLL_TOX_ILLUSH
illustrations index.
Definition: poolfmt.hxx:396
@ RES_POOLCOLL_TOX_AUTHORITIESH
index of authorities.
Definition: poolfmt.hxx:408
SectionType
Definition: section.hxx:46
std::vector< SwSection * > SwSections
Definition: section.hxx:42
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
SwContentIndex nContent
Definition: pam.hxx:39
Class for sorting directories.
Definition: txmsrt.hxx:123
virtual sal_uInt16 GetLevel() const =0
std::vector< SwTOXSource > aTOXSources
Definition: txmsrt.hxx:127
static SwTOIOptions GetOptions()
Definition: txmsrt.hxx:145
const css::lang::Locale & GetLocale() const
Definition: txmsrt.hxx:184
virtual bool sort_lt(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:253
TextAndReading const & GetText() const
Definition: txmsrt.hxx:178
sal_uInt16 GetType() const
Definition: txmsrt.hxx:144
virtual bool equivalent(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:227
const SwTextNode * pTOXNd
Definition: txmsrt.hxx:129
const SwTOXInternational * pTOXIntl
Definition: txmsrt.hxx:131
bool bMainEntry
Definition: txmsrt.hxx:52
const SwContentNode * pNd
Definition: txmsrt.hxx:50
sal_Int32 nPos
Definition: txmsrt.hxx:51
OUString sText
Definition: txmsrt.hxx:62
SvxBreak
const char cSequenceMarkSeparator
Definition: swtypes.hxx:126
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
const sal_Unicode C_NUM_REPL
Definition: tox.cxx:47
const sal_Unicode C_END_PAGE_NUM
Definition: tox.cxx:48
SwTOXElement
Definition: tox.hxx:366
#define FORM_TITLE
Definition: tox.hxx:206
SwTOOElements
Definition: tox.hxx:410
#define FORM_SECONDARY_KEY
Definition: tox.hxx:209
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:46
#define FORM_ALPHA_DELIMITER
Definition: tox.hxx:207
#define FORM_PRIMARY_KEY
Definition: tox.hxx:208
#define FORM_ENTRY
Definition: tox.hxx:210
@ CAPTION_NUMBER
Definition: tox.hxx:405
@ CAPTION_TEXT
Definition: tox.hxx:406
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:422
SwTOIKeyType
Definition: toxe.hxx:31
@ TOI_PRIMARY
Definition: toxe.hxx:32
TOXTypes
Definition: toxe.hxx:40
@ TOX_USER
Definition: toxe.hxx:42
@ TOX_CONTENT
Definition: toxe.hxx:43
@ TOX_TABLES
Definition: toxe.hxx:46
@ TOX_INDEX
Definition: toxe.hxx:41
@ TOX_OBJECTS
Definition: toxe.hxx:45
@ TOX_AUTHORITIES
Definition: toxe.hxx:47
@ TOX_ILLUSTRATIONS
Definition: toxe.hxx:44
@ TOX_BIBLIOGRAPHY
Definition: toxe.hxx:48
@ TOX_CITATION
Definition: toxe.hxx:49
SwTOXSearch
Definition: toxe.hxx:23
@ TOX_SAME_PRV
Definition: toxe.hxx:27
@ TOX_PRV
Definition: toxe.hxx:25
@ TOX_SAME_NXT
Definition: toxe.hxx:26
@ TOX_NXT
Definition: toxe.hxx:24
@ TOX_SORT_CUSTOM
Definition: txmsrt.hxx:41
@ TOX_SORT_INDEX
Definition: txmsrt.hxx:40
unsigned char sal_uInt8
#define SAL_MAX_INT32
bool operator<(const wwFont &r1, const wwFont &r2)
Definition: wrtw8sty.cxx:841
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
Definition: ww8par2.cxx:889
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)