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);
361 GetIDocumentUndoRedo().StartUndo( SwUndoId::INSTOX, 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, sw::ParagraphBreakMode> const tmp(
367 &rTOX,
368 pLayout && pLayout->IsHideRedlines()
371 pLayout ? pLayout->GetFieldmarkMode() : sw::FieldmarkMode::ShowBoth,
373 SwTOXBaseSection *const pNewSection = dynamic_cast<SwTOXBaseSection *>(
374 InsertSwSection(aPam, aSectionData, & tmp, pSet, false));
375 if (pNewSection)
376 {
377 SwSectionNode *const pSectNd = pNewSection->GetFormat()->GetSectionNode();
378 pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
379
380 if( bExpand )
381 {
382 // add value for 2nd parameter = true to
383 // indicate, that a creation of a new table of content has to be performed.
384 // Value of 1st parameter = default value.
385 pNewSection->Update( nullptr, pLayout, true );
386 }
387 else if( rTOX.GetTitle().getLength()==1 && IsInReading() )
388 // insert title of TOX
389 {
390 // then insert the headline section
391 SwNodeIndex aIdx( *pSectNd, +1 );
392
393 SwTextNode* pHeadNd = GetNodes().MakeTextNode( aIdx.GetNode(),
394 getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ) );
395
396 SwSectionData headerData( SectionType::ToxHeader, pNewSection->GetTOXName()+"_Head" );
397
398 --aIdx;
399 SwSectionFormat* pSectFormat = MakeSectionFormat();
401 *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx.GetNode(), true, false);
402 }
403 }
404
405 GetIDocumentUndoRedo().EndUndo( SwUndoId::INSTOX, nullptr );
406
407 return pNewSection;
408}
409
411 const SwTOXBase& rTOX,
412 const SfxItemSet* pSet )
413{
414 // check for recursive TOX
415 SwNode* pNd = GetNodes()[ nSttNd ];
416 SwSectionNode* pSectNd = pNd->FindSectionNode();
417 while( pSectNd )
418 {
419 SectionType eT = pSectNd->GetSection().GetType();
421 return;
422 pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
423 }
424
425 const OUString sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), rTOX.GetTOXName());
426
427 SwSectionData aSectionData( SectionType::ToxContent, sSectNm );
428
429 SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
431 if(pSet)
432 pFormat->SetFormatAttr(*pSet);
433
434 SwSectionNode *const pNewSectionNode =
435 GetNodes().InsertTextSection(aStt.GetNode(), *pFormat, aSectionData, &rTOX, &aEnd.GetNode());
436 if (!pNewSectionNode)
437 {
438 DelSectionFormat( pFormat );
439 return;
440 }
441
442 SwTOXBaseSection *const pNewSection(
443 dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
444 if (pNewSection)
445 pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
446}
447
450{
451 SwNode& rNd = rPos.GetNode();
452 SwSectionNode* pSectNd = rNd.FindSectionNode();
453 while( pSectNd )
454 {
455 SectionType eT = pSectNd->GetSection().GetType();
456 if( SectionType::ToxContent == eT )
457 {
458 assert( dynamic_cast< const SwTOXBaseSection *>( &pSectNd->GetSection()) &&
459 "no TOXBaseSection!" );
460 SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(
461 pSectNd->GetSection());
462 return &rTOXSect;
463 }
464 pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
465 }
466 return nullptr;
467}
468
470{
471 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
472 const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase);
473 SwSectionFormat const * pFormat = rTOXSect.GetFormat();
474 OSL_ENSURE( pFormat, "invalid TOXBaseSection!" );
475 return pFormat->GetAttrSet();
476}
477
478const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, bool bCreate )
479{
480 std::unique_ptr<SwTOXBase>* prBase = nullptr;
481 switch(eTyp)
482 {
483 case TOX_CONTENT: prBase = &mpDefTOXBases->pContBase; break;
484 case TOX_INDEX: prBase = &mpDefTOXBases->pIdxBase; break;
485 case TOX_USER: prBase = &mpDefTOXBases->pUserBase; break;
486 case TOX_TABLES: prBase = &mpDefTOXBases->pTableBase; break;
487 case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break;
488 case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
489 case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
490 case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
491 case TOX_CITATION: break;
492 }
493 if (!prBase)
494 return nullptr;
495 if(!(*prBase) && bCreate)
496 {
497 SwForm aForm(eTyp);
498 const SwTOXType* pType = GetTOXType(eTyp, 0);
499 prBase->reset(new SwTOXBase(pType, aForm, SwTOXElement::NONE, pType->GetTypeName()));
500 }
501 return prBase->get();
502}
503
505{
506 std::unique_ptr<SwTOXBase>* prBase = nullptr;
507 switch(rBase.GetType())
508 {
509 case TOX_CONTENT: prBase = &mpDefTOXBases->pContBase; break;
510 case TOX_INDEX: prBase = &mpDefTOXBases->pIdxBase; break;
511 case TOX_USER: prBase = &mpDefTOXBases->pUserBase; break;
512 case TOX_TABLES: prBase = &mpDefTOXBases->pTableBase; break;
513 case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break;
514 case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
515 case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
516 case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
517 case TOX_CITATION: break;
518 }
519 if (!prBase)
520 return;
521 prBase->reset(new SwTOXBase(rBase));
522}
523
525bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes )
526{
527 // We only delete the TOX, not the Nodes
528 bool bRet = false;
529 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
530
531 const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase);
532 SwSectionFormat const * pFormat = rTOXSect.GetFormat();
533 /* Save the start node of the TOX' section. */
534 SwSectionNode const * pMyNode = pFormat ? pFormat->GetSectionNode() : nullptr;
535 if (pMyNode)
536 {
537 GetIDocumentUndoRedo().StartUndo( SwUndoId::CLEARTOXRANGE, nullptr );
538
539 /* Save start node of section's surrounding. */
540 SwNode const * pStartNd = pMyNode->StartOfSectionNode();
541
542 /* Look for the point where to move the cursors in the area to
543 delete to. This is done by first searching forward from the
544 end of the TOX' section. If no content node is found behind
545 the TOX one is searched before it. If this is not
546 successful, too, insert new text node behind the end of
547 the TOX' section. The cursors from the TOX' section will be
548 moved to the content node found or the new text node. */
549
550 /* Set PaM to end of TOX' section and search following content node.
551 aSearchPam will contain the point where to move the cursors
552 to. */
553 SwPaM aSearchPam(*pMyNode->EndOfSectionNode());
554 SwPosition aEndPos(*pStartNd->EndOfSectionNode());
555 if (! aSearchPam.Move() /* no content node found */
556 || *aSearchPam.GetPoint() >= aEndPos /* content node found
557 outside surrounding */
558 )
559 {
560 /* Set PaM to beginning of TOX' section and search previous
561 content node */
562 SwPaM aTmpPam(*pMyNode);
563 aSearchPam = aTmpPam;
564 SwPosition aStartPos(*pStartNd);
565
566 if ( ! aSearchPam.Move(fnMoveBackward) /* no content node found */
567 || *aSearchPam.GetPoint() <= aStartPos /* content node
568 found outside
569 surrounding */
570 )
571 {
572 /* There is no content node in the surrounding of
573 TOX'. Append text node behind TOX' section. */
574
575 SwPosition aInsPos(*pMyNode->EndOfSectionNode());
577
578 SwPaM aTmpPam1(aInsPos);
579 aSearchPam = aTmpPam1;
580 }
581 }
582
583 /* PaM containing the TOX. */
584 SwPaM aPam(*pMyNode->EndOfSectionNode(), *pMyNode);
585
586 /* Move cursors contained in TOX to the above calculated point. */
587 PaMCorrAbs(aPam, *aSearchPam.GetPoint());
588
589 if( !bDelNodes )
590 {
591 SwSections aArr( 0 );
592 pFormat->GetChildSections( aArr, SectionSort::Not, false );
593 for( const auto pSect : aArr )
594 {
595 if( SectionType::ToxHeader == pSect->GetType() )
596 {
597 DelSectionFormat( pSect->GetFormat(), bDelNodes );
598 }
599 }
600 }
601
602 DelSectionFormat( const_cast<SwSectionFormat *>(pFormat), bDelNodes );
603
604 GetIDocumentUndoRedo().EndUndo( SwUndoId::CLEARTOXRANGE, nullptr );
605 bRet = true;
606 }
607
608 return bRet;
609}
610
612sal_uInt16 SwDoc::GetTOXTypeCount(TOXTypes eTyp) const
613{
614 sal_uInt16 nCnt = 0;
615 for( auto const & pTOXType : *mpTOXTypes )
616 if( eTyp == pTOXType->GetType() )
617 ++nCnt;
618 return nCnt;
619}
620
621const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const
622{
623 sal_uInt16 nCnt = 0;
624 for( auto const & pTOXType : *mpTOXTypes )
625 if( eTyp == pTOXType->GetType() && nCnt++ == nId )
626 return pTOXType.get();
627 return nullptr;
628}
629
631{
632 SwTOXType * pNew = new SwTOXType(rTyp);
633 mpTOXTypes->emplace_back( pNew );
634 return pNew;
635}
636
638 const OUString& sChkStr ) const
639{
640 if( IsInMailMerge())
641 {
642 OUString newName = "MailMergeTOX"
643 + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
644 + OUString::number( mpSectionFormatTable->size() + 1 );
645 if( !sChkStr.isEmpty())
646 newName += sChkStr;
647 return newName;
648 }
649
650 bool bUseChkStr = !sChkStr.isEmpty();
651 const OUString& aName( rType.GetTypeName() );
652 const sal_Int32 nNmLen = aName.getLength();
653
655 const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) +2;
656 std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
657 memset( pSetFlags.get(), 0, nFlagSize );
658
659 for( auto pSectionFormat : *mpSectionFormatTable )
660 {
661 const SwSectionNode *pSectNd = pSectionFormat->GetSectionNode();
662 if ( !pSectNd )
663 continue;
664
665 const SwSection& rSect = pSectNd->GetSection();
666 if (rSect.GetType()==SectionType::ToxContent)
667 {
668 const OUString& rNm = rSect.GetSectionName();
669 if ( rNm.startsWith(aName) )
670 {
671 // Calculate number and set the Flag
672 nNum = o3tl::toInt32(rNm.subView( nNmLen ));
673 if( nNum-- && nNum < mpSectionFormatTable->size() )
674 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
675 }
676 if ( bUseChkStr && sChkStr==rNm )
677 bUseChkStr = false;
678 }
679 }
680
681 if( !bUseChkStr )
682 {
683 // All Numbers have been flagged accordingly, so get the right Number
684 nNum = mpSectionFormatTable->size();
685 for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
686 {
687 sal_uInt8 nTmp = pSetFlags[ n ];
688 if( nTmp != 0xff )
689 {
690 // so get the Number
691 nNum = n * 8;
692 while( nTmp & 1 )
693 {
694 ++nNum;
695 nTmp >>= 1;
696 }
697 break;
698 }
699 }
700 }
701 if ( bUseChkStr )
702 return sChkStr;
703 return aName + OUString::number( ++nNum );
704}
705
706bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName)
707{
708 assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no TOXBaseSection!" );
709 SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOXBase));
710
711 if (GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), rName) == rName)
712 {
713 pTOX->SetTOXName(rName);
714 pTOX->SetSectionName(rName);
716 return true;
717 }
718 return false;
719}
720
721static const SwTextNode* lcl_FindChapterNode( const SwNode& rNd,
722 SwRootFrame const*const pLayout, sal_uInt8 const nLvl = 0 )
723{
724 const SwNode* pNd = &rNd;
725 if( pNd->GetNodes().GetEndOfExtras().GetIndex() > pNd->GetIndex() )
726 {
727 // then find the "Anchor" (Body) position
728 Point aPt;
729 SwNode2Layout aNode2Layout( *pNd, pNd->GetIndex() );
730 const SwFrame* pFrame = aNode2Layout.GetFrame( &aPt );
731
732 if( pFrame )
733 {
734 SwPosition aPos( *pNd );
735 pNd = GetBodyTextNode( pNd->GetDoc(), aPos, *pFrame );
736 OSL_ENSURE( pNd, "Where's the paragraph?" );
737 // tdf#151462 - search for outline node containing the current node
738 return pNd ? pNd->FindOutlineNodeOfLevel(pNd->GetSectionLevel() - 1, pLayout) : nullptr;
739 }
740 }
741 return pNd->FindOutlineNodeOfLevel(nLvl, pLayout);
742}
743
744static bool IsHeadingContained(const SwTextNode* pChptrNd, const SwNode& rNd)
745{
746 const SwNode* pNd = &rNd;
747 const SwOutlineNodes& rONds = pNd->GetNodes().GetOutLineNds();
748 bool bIsHeadingContained = false;
749 if (!rONds.empty())
750 {
751 bool bCheckFirst = false;
753
754 if (!rONds.Seek_Entry(const_cast<SwNode*>(pNd), &nPos))
755 {
756 if (nPos == 0)
757 bCheckFirst = true;
758 else
759 nPos--;
760 }
761
762 if (bCheckFirst)
763 {
764 const SwContentNode* pCNd = pNd->GetContentNode();
765
766 Point aPt(0, 0);
767 std::pair<Point, bool> const tmp(aPt, false);
768
769 const SwFrame* pChptrFrame = pChptrNd ? pChptrNd->getLayoutFrame(
770 pChptrNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
771 const SwPageFrame* pChptrPgFrame = pChptrFrame ? pChptrFrame->FindPageFrame() : nullptr;
772 const SwFrame* pNdFrame
773 = pCNd ? pCNd->getLayoutFrame(
774 pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)
775 : nullptr;
776
777 // Check if the one asking doesn't precede the page of the specified chapter note
778 bIsHeadingContained
779 = pNdFrame && pChptrPgFrame
780 && pChptrPgFrame->getFrameArea().Top() <= pNdFrame->getFrameArea().Top();
781 // Check if the one asking doesn't succeed the specified chapter note
782 if (bIsHeadingContained)
783 {
784 const SwNode* aChptrNd = pChptrNd;
785 if (!rONds.Seek_Entry(const_cast<SwNode*>(aChptrNd), &nPos) && nPos)
786 nPos--;
787 // Search for the next outline node with a larger level than the specified chapter node
788 while (nPos < rONds.size() - 1
789 && pChptrNd->GetAttrOutlineLevel()
790 < rONds[nPos + 1]->GetTextNode()->GetAttrOutlineLevel())
791 nPos++;
792 // If there exists such an outline node, check if the one asking doesn't succeed
793 // the specified chapter node
794 if (nPos < rONds.size() - 1) {
795 nPos++;
796 const auto aONdsTxtNd = rONds[nPos]->GetTextNode();
797 pChptrFrame = aONdsTxtNd->getLayoutFrame(
798 aONdsTxtNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr,
799 &tmp);
800 pChptrPgFrame = pChptrFrame ? pChptrFrame->FindPageFrame() : nullptr;
801 bIsHeadingContained
802 = pNdFrame && pChptrPgFrame
803 && pChptrPgFrame->getFrameArea().Top() >= pNdFrame->getFrameArea().Top();
804 }
805 }
806 }
807 else
808 {
809 // Search for the next outline node which lies not within the current chapter node
810 while (nPos > 0
811 && pChptrNd->GetAttrOutlineLevel()
812 < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
813 nPos--;
814 bIsHeadingContained = pChptrNd == rONds[nPos]->GetTextNode();
815 }
816 }
817 else
818 {
819 // If there are no outline nodes, consider the heading contained,
820 // otherwise the _XDocumentIndex._update() test fails
821 bIsHeadingContained = true;
822 }
823 return bIsHeadingContained;
824}
825
826// Table of contents class
828 : SwTOXBase( rBase )
829 , SwSection( SectionType::ToxContent, OUString(), rFormat )
830{
831 SetProtect( rBase.IsProtected() );
833}
834
836{
837}
838
840{
841 bool bRet = false;
842 const SwSectionNode* pSectNd = GetFormat()->GetSectionNode();
843 if( pSectNd )
844 {
845 rPos.Assign(*pSectNd);
846 pSectNd->GetDoc().GetNodes().GoNext( &rPos );
847 bRet = true;
848 }
849 return bRet;
850}
851
854 SwRootFrame const*const pLayout,
855 const bool _bNewTOX)
856{
857 if (!GetFormat())
858 return;
859 SwSectionNode const*const pSectNd(GetFormat()->GetSectionNode());
860 if (nullptr == pSectNd ||
861 !pSectNd->GetNodes().IsDocNodes() ||
862 IsHiddenFlag() ||
863 (pLayout->HasMergedParas() && pSectNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden))
864 {
865 return;
866 }
867
868 if ( !mbKeepExpression )
869 {
870 maMSTOCExpression.clear();
871 }
872
873 SwDoc& rDoc = const_cast<SwDoc&>(pSectNd->GetDoc());
874
875 if (pAttr && GetFormat())
876 rDoc.ChgFormat(*GetFormat(), *pAttr);
877
878 // determine default page description, which will be used by the content nodes,
879 // if no appropriate one is found.
880 const SwPageDesc* pDefaultPageDesc;
881 {
882 pDefaultPageDesc =
884 if ( !_bNewTOX && !pDefaultPageDesc )
885 {
886 // determine page description of table-of-content
887 SwNodeOffset nPgDescNdIdx = pSectNd->GetIndex() + 1;
888 SwNodeOffset* pPgDescNdIdx = &nPgDescNdIdx;
889 pDefaultPageDesc = pSectNd->FindPageDesc( pPgDescNdIdx );
890 if ( nPgDescNdIdx < pSectNd->GetIndex() )
891 {
892 pDefaultPageDesc = nullptr;
893 }
894 }
895 // consider end node of content section in the node array.
896 if ( !pDefaultPageDesc &&
897 ( pSectNd->EndOfSectionNode()->GetIndex() <
898 (pSectNd->GetNodes().GetEndOfContent().GetIndex() - 1) )
899 )
900 {
901 // determine page description of content after table-of-content
902 SwNodeIndex aIdx( *(pSectNd->EndOfSectionNode()) );
903 const SwContentNode* pNdAfterTOX = pSectNd->GetNodes().GoNext( &aIdx );
904 const SwAttrSet& aNdAttrSet = pNdAfterTOX->GetSwAttrSet();
905 const SvxBreak eBreak = aNdAttrSet.GetBreak().GetBreak();
906 if ( eBreak != SvxBreak::PageBefore && eBreak != SvxBreak::PageBoth )
907 {
908 pDefaultPageDesc = pNdAfterTOX->FindPageDesc();
909 }
910 }
911 // consider start node of content section in the node array.
912 if ( !pDefaultPageDesc &&
913 ( pSectNd->GetIndex() >
914 (pSectNd->GetNodes().GetEndOfContent().StartOfSectionIndex() + 1) )
915 )
916 {
917 // determine page description of content before table-of-content
918 SwNodeIndex aIdx( *pSectNd );
919 SwContentNode* pTmp = SwNodes::GoPrevious( &aIdx );
920 assert(pTmp); // make coverity happy
921 pDefaultPageDesc = pTmp->FindPageDesc();
922
923 }
924 if ( !pDefaultPageDesc )
925 {
926 // determine default page description
927 pDefaultPageDesc = &rDoc.GetPageDesc( 0 );
928 }
929 }
930
932
933 // get current Language
938
939 m_aSortArr.clear();
940
941 // find the first layout node for this TOX, if it only find the content
942 // in his own chapter
943 const SwSectionNode* pChapterSectNd = IsFromChapter() ? pSectNd->FindSectionNode() : nullptr;
944 const SwTextNode* pOwnChapterNode = pChapterSectNd
945 ? ::lcl_FindChapterNode( *pSectNd, pLayout, pChapterSectNd->GetSectionLevel() + 1 )
946 : nullptr;
947
948 SwNode2LayoutSaveUpperFrames aN2L(*pSectNd);
949 const_cast<SwSectionNode*>(pSectNd)->DelFrames();
950
951 // This would be a good time to update the Numbering
952 rDoc.UpdateNumRule();
953
955 UpdateMarks( aIntl, pOwnChapterNode, pLayout );
956
958 UpdateOutline( pOwnChapterNode, pLayout );
959
961 UpdateTemplate( pOwnChapterNode, pLayout );
962
965 UpdateContent( SwTOXElement::Ole, pOwnChapterNode, pLayout );
966
969 UpdateTable( pOwnChapterNode, pLayout );
970
973 UpdateContent( SwTOXElement::Graphic, pOwnChapterNode, pLayout );
974
975 if( !GetSequenceName().isEmpty() && !IsFromObjectNames() &&
978 UpdateSequence( pOwnChapterNode, pLayout );
979
981 UpdateContent( SwTOXElement::Frame, pOwnChapterNode, pLayout );
982
984 UpdateAuthorities( aIntl, pLayout );
985
986 // Insert AlphaDelimiters if needed (just for keywords)
987 if( TOX_INDEX == SwTOXBase::GetType() &&
989 InsertAlphaDelimiter( aIntl );
990
991 // remove old content an insert one empty textnode (to hold the layout!)
992 SwTextNode* pFirstEmptyNd;
993
994 SwUndoUpdateIndex * pUndo(nullptr);
995 {
996 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pSectNd, true, RedlineType::Any );
997
998 SwNodeIndex aSttIdx( *pSectNd, +1 );
999 SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
1000 pFirstEmptyNd = rDoc.GetNodes().MakeTextNode( aEndIdx.GetNode(),
1002
1003 {
1004 // Task 70995 - save and restore PageDesc and Break Attributes
1005 SwNodeIndex aNxtIdx( aSttIdx );
1006 const SwContentNode* pCNd = aNxtIdx.GetNode().GetContentNode();
1007 if( !pCNd )
1008 pCNd = rDoc.GetNodes().GoNext( &aNxtIdx );
1009 assert(pCNd != pFirstEmptyNd);
1010 assert(pCNd->GetIndex() < pFirstEmptyNd->GetIndex());
1011 if( pCNd->HasSwAttrSet() )
1012 {
1013 SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
1014 aBrkSet.Put( *pCNd->GetpSwAttrSet() );
1015 if( aBrkSet.Count() )
1016 pFirstEmptyNd->SetAttr( aBrkSet );
1017 }
1018 }
1019
1020 if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1021 {
1022 // note: this will first append a SwUndoDelSection from the ctor...
1023 pUndo = new SwUndoUpdateIndex(*this);
1024 // tdf#123313 insert Undo *after* all CrossRefBookmark Undos have
1025 // been inserted by the Update*() functions
1026 rDoc.GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndoUpdateIndex>(pUndo));
1027 }
1028 else
1029 {
1030 --aEndIdx;
1031 SwPosition aPos( aEndIdx, pFirstEmptyNd, 0 );
1032 SwDoc::CorrAbs( aSttIdx, aEndIdx, aPos, true );
1033
1034 // delete flys in whole range including start node which requires
1035 // giving the node before start node as Mark parameter, hence -1.
1036 // (flys must be deleted because the anchor nodes are removed)
1037 DelFlyInRange( SwNodeIndex(aSttIdx, -1).GetNode(), aEndIdx.GetNode() );
1038
1039 rDoc.GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
1040 }
1041 }
1042
1043 // insert title of TOX
1044 if ( !GetTitle().isEmpty() )
1045 {
1046 // then insert the headline section
1047 SwNodeIndex aIdx( *pSectNd, +1 );
1048
1049 SwTextNode* pHeadNd = rDoc.GetNodes().MakeTextNode( aIdx.GetNode(),
1051 pHeadNd->InsertText( GetTitle(), SwContentIndex( pHeadNd ) );
1052
1053 SwSectionData headerData( SectionType::ToxHeader, GetTOXName()+"_Head" );
1054
1055 --aIdx;
1056 SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
1058 *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx.GetNode(), true, false);
1059
1060 if (pUndo)
1061 {
1062 pUndo->TitleSectionInserted(*pSectFormat);
1063 }
1064 }
1065
1066 // Sort the List of all TOC Marks and TOC Sections
1067 std::vector<SwTextFormatColl*> aCollArr( GetTOXForm().GetFormMax(), nullptr );
1068 std::unordered_map<OUString, int> markURLs;
1069 SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
1070 for( size_t nCnt = 0; nCnt < m_aSortArr.size(); ++nCnt )
1071 {
1072 ::SetProgressState( 0, rDoc.GetDocShell() );
1073
1074 // Put the Text into the TOC
1075 sal_uInt16 nLvl = m_aSortArr[ nCnt ]->GetLevel();
1076 SwTextFormatColl* pColl = aCollArr[ nLvl ];
1077 if( !pColl )
1078 {
1079 pColl = GetTextFormatColl( nLvl );
1080 aCollArr[ nLvl ] = pColl;
1081 }
1082
1083 // Generate: Set dynamic TabStops
1084 SwTextNode* pTOXNd = rDoc.GetNodes().MakeTextNode( aInsPos.GetNode() , pColl );
1085 m_aSortArr[ nCnt ]->pTOXNd = pTOXNd;
1086
1087 // Generate: Evaluate Form and insert the place holder for the
1088 // page number. If it is a TOX_INDEX and the SwForm IsCommaSeparated()
1089 // then a range of entries must be generated into one paragraph
1090 size_t nRange = 1;
1091 if(TOX_INDEX == SwTOXBase::GetType() &&
1092 GetTOXForm().IsCommaSeparated() &&
1093 m_aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
1094 {
1095 const SwTOXMark& rMark = m_aSortArr[nCnt]->pTextMark->GetTOXMark();
1096 const OUString& sPrimKey = rMark.GetPrimaryKey();
1097 const OUString& sSecKey = rMark.GetSecondaryKey();
1098 const SwTOXMark* pNextMark = nullptr;
1099 while(m_aSortArr.size() > (nCnt + nRange) &&
1100 m_aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX )
1101 {
1102 pNextMark = &(m_aSortArr[nCnt + nRange]->pTextMark->GetTOXMark());
1103 if( !pNextMark ||
1104 pNextMark->GetPrimaryKey() != sPrimKey ||
1105 pNextMark->GetSecondaryKey() != sSecKey)
1106 break;
1107 nRange++;
1108 }
1109 }
1110 // pass node index of table-of-content section and default page description
1111 // to method <GenerateText(..)>.
1112 ::SetProgressState( 0, rDoc.GetDocShell() );
1113
1114 std::shared_ptr<sw::ToxTabStopTokenHandler> tabStopTokenHandler =
1115 std::make_shared<sw::DefaultToxTabStopTokenHandler>(
1116 pSectNd->GetIndex(), *pDefaultPageDesc, GetTOXForm().IsRelTabPos(),
1120 sw::ToxTextGenerator ttgn(GetTOXForm(), tabStopTokenHandler);
1121 ttgn.GenerateText(GetFormat()->GetDoc(), markURLs, m_aSortArr, nCnt, nRange, pLayout);
1122 nCnt += nRange - 1;
1123 }
1124
1125 // delete the first dummy node and remove all Cursor into the previous node
1126 aInsPos = *pFirstEmptyNd;
1127 {
1128 SwPaM aCorPam( *pFirstEmptyNd );
1129 if( !aCorPam.Move( fnMoveForward ) )
1130 aCorPam.Move( fnMoveBackward );
1131 SwNodeIndex aEndIdx( aInsPos, 1 );
1132 SwDoc::CorrAbs( aInsPos, aEndIdx, *aCorPam.GetPoint(), true );
1133
1134 // Task 70995 - save and restore PageDesc and Break Attributes
1135 if( pFirstEmptyNd->HasSwAttrSet() )
1136 {
1137 if( !GetTitle().isEmpty() )
1138 aEndIdx = *pSectNd;
1139 else
1140 aEndIdx = *pFirstEmptyNd;
1141 SwContentNode* pCNd = rDoc.GetNodes().GoNext( &aEndIdx );
1142 if( pCNd ) // Robust against defect documents, e.g. i60336
1143 pCNd->SetAttr( *pFirstEmptyNd->GetpSwAttrSet() );
1144 }
1145 }
1146
1147 // now create the new Frames
1148 SwNodeOffset nIdx = pSectNd->GetIndex();
1149 // don't delete if index is empty
1150 if(nIdx + SwNodeOffset(2) < pSectNd->EndOfSectionIndex())
1151 rDoc.GetNodes().Delete( aInsPos );
1152
1153 aN2L.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 );
1155 for ( const auto& rpLayout : aAllLayouts )
1156 {
1157 SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(rpLayout->Lower()) );
1158 }
1159
1161}
1162
1164{
1165 SwDoc* pDoc = GetFormat()->GetDoc();
1166 OUString sLastDeli;
1167 size_t i = 0;
1168 while( i < m_aSortArr.size() )
1169 {
1170 ::SetProgressState( 0, pDoc->GetDocShell() );
1171
1172 sal_uInt16 nLevel = m_aSortArr[i]->GetLevel();
1173
1174 // Skip AlphaDelimiter
1176 continue;
1177
1178 const OUString sDeli = rIntl.GetIndexKey( m_aSortArr[i]->GetText(),
1179 m_aSortArr[i]->GetLocale() );
1180
1181 // Do we already have a Delimiter?
1182 if( !sDeli.isEmpty() && sLastDeli != sDeli )
1183 {
1184 // We skip all that are less than a small Blank (these are special characters)
1185 if( ' ' <= sDeli[0] )
1186 {
1187 std::unique_ptr<SwTOXCustom> pCst(
1188 MakeSwTOXSortTabBase<SwTOXCustom>(nullptr,
1189 TextAndReading(sDeli, OUString()),
1191 rIntl, m_aSortArr[i]->GetLocale() ));
1192 m_aSortArr.insert( m_aSortArr.begin() + i, std::move(pCst));
1193 i++;
1194 }
1195 sLastDeli = sDeli;
1196 }
1197
1198 // Skip until we get to the same or a lower Level
1199 do {
1200 i++;
1201 } while (i < m_aSortArr.size() && m_aSortArr[i]->GetLevel() > nLevel);
1202 }
1203}
1204
1207{
1208 SwDoc* pDoc = GetFormat()->GetDoc();
1209 const OUString& rName = GetTOXForm().GetTemplate( nLevel );
1210 SwTextFormatColl* pColl = !rName.isEmpty() ? pDoc->FindTextFormatCollByName(rName) :nullptr;
1211 if( !pColl )
1212 {
1213 sal_uInt16 nPoolFormat = 0;
1214 const TOXTypes eMyType = SwTOXBase::GetType();
1215 switch( eMyType )
1216 {
1217 case TOX_INDEX: nPoolFormat = RES_POOLCOLL_TOX_IDXH; break;
1218 case TOX_USER:
1219 if( nLevel < 6 )
1220 nPoolFormat = RES_POOLCOLL_TOX_USERH;
1221 else
1222 nPoolFormat = RES_POOLCOLL_TOX_USER6 - 6;
1223 break;
1224 case TOX_ILLUSTRATIONS: nPoolFormat = RES_POOLCOLL_TOX_ILLUSH; break;
1225 case TOX_OBJECTS: nPoolFormat = RES_POOLCOLL_TOX_OBJECTH; break;
1226 case TOX_TABLES: nPoolFormat = RES_POOLCOLL_TOX_TABLESH; break;
1227 case TOX_AUTHORITIES:
1228 case TOX_BIBLIOGRAPHY:
1229 nPoolFormat = RES_POOLCOLL_TOX_AUTHORITIESH; break;
1230 case TOX_CITATION: break;
1231 case TOX_CONTENT:
1232 // There's a jump in the ContentArea!
1233 if( nLevel < 6 )
1234 nPoolFormat = RES_POOLCOLL_TOX_CNTNTH;
1235 else
1236 nPoolFormat = RES_POOLCOLL_TOX_CNTNT6 - 6;
1237 break;
1238 }
1239
1240 if(eMyType == TOX_AUTHORITIES && nLevel)
1241 nPoolFormat = nPoolFormat + 1;
1242 else if(eMyType == TOX_INDEX && nLevel)
1243 {
1244 // pool: Level 1,2,3, Delimiter
1245 // SwForm: Delimiter, Level 1,2,3
1246 nPoolFormat += 1 == nLevel ? nLevel + 3 : nLevel - 1;
1247 }
1248 else
1249 nPoolFormat = nPoolFormat + nLevel;
1250 pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolFormat );
1251 }
1252 return pColl;
1253}
1254
1255void SwTOXBaseSection::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
1256{
1257 if (auto pFindHint = dynamic_cast<const sw::FindContentFrameHint*>(&rHint))
1258 {
1259 if(pFindHint->m_rpContentFrame)
1260 return;
1261 auto pSectFormat = GetFormat();
1262 if(!pSectFormat)
1263 return;
1264 const SwSectionNode* pSectNd = pSectFormat->GetSectionNode();
1265 if(!pSectNd)
1266 return;
1267 SwNodeIndex aIdx(*pSectNd, 1);
1268 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
1269 if(!pCNd)
1270 pCNd = pFindHint->m_rDoc.GetNodes().GoNext(&aIdx);
1271 if(!pCNd)
1272 return;
1273 if(pCNd->EndOfSectionIndex() >= pSectNd->EndOfSectionIndex())
1274 return;
1275 pFindHint->m_rpContentFrame = pCNd->getLayoutFrame(&pFindHint->m_rLayout);
1276 } else
1277 SwTOXBase::SwClientNotify(rModify, rHint);
1278}
1279
1282 const SwTextNode* pOwnChapterNode,
1283 SwRootFrame const*const pLayout)
1284{
1285 const auto pType = static_cast<SwTOXType*>(SwTOXBase::GetRegisteredIn());
1286 auto pShell = GetFormat()->GetDoc()->GetDocShell();
1287 const TOXTypes eTOXTyp = GetTOXType()->GetType();
1288 std::vector<std::reference_wrapper<SwTextTOXMark>> vMarks;
1289 pType->CollectTextTOXMarksForLayout(vMarks, pLayout);
1290 for(auto& rMark: vMarks)
1291 {
1292 ::SetProgressState(0, pShell);
1293 auto& rNode = rMark.get().GetTextNode();
1294 if(IsFromChapter() && !IsHeadingContained(pOwnChapterNode, rNode))
1295 continue;
1296 auto rTOXMark = rMark.get().GetTOXMark();
1297 if(TOX_INDEX == eTOXTyp)
1298 {
1299 // index entry mark
1300 assert(g_pBreakIt);
1301 lang::Locale aLocale = g_pBreakIt->GetLocale(rNode.GetLang(rMark.get().GetStart()));
1302 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_ENTRY, rIntl, aLocale));
1303 if(GetOptions() & SwTOIOptions::KeyAsEntry && !rTOXMark.GetPrimaryKey().isEmpty())
1304 {
1305 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale));
1306 if (!rTOXMark.GetSecondaryKey().isEmpty())
1307 {
1308 InsertSorted(MakeSwTOXSortTabBase<SwTOXIndex>(pLayout, rNode, &rMark.get(), GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale));
1309 }
1310 }
1311 }
1312 else if(TOX_USER == eTOXTyp || rTOXMark.GetLevel() <= GetLevel())
1313 { // table of content mark, also used for user marks
1314 InsertSorted(MakeSwTOXSortTabBase<SwTOXContent>(pLayout, rNode, &rMark.get(), rIntl));
1315 }
1316 }
1317}
1318
1320void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode,
1321 SwRootFrame const*const pLayout)
1322{
1323 SwDoc* pDoc = GetFormat()->GetDoc();
1324 SwNodes& rNds = pDoc->GetNodes();
1325
1326 const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1327 for( auto pOutlineNode : rOutlNds )
1328 {
1329 ::SetProgressState( 0, pDoc->GetDocShell() );
1330 SwTextNode* pTextNd = pOutlineNode->GetTextNode();
1331 if( pTextNd && pTextNd->Len() && pTextNd->HasWriterListeners() &&
1333 pTextNd->getLayoutFrame(pLayout) &&
1334 !pTextNd->IsHiddenByParaField() &&
1335 !pTextNd->HasHiddenCharAttribute( true ) &&
1336 (!pLayout || !pLayout->HasMergedParas()
1337 || static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) &&
1338 ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd) ))
1339 {
1340 InsertSorted(MakeSwTOXSortTabBase<SwTOXPara>(pLayout, *pTextNd, SwTOXElement::OutlineLevel));
1341 }
1342 }
1343}
1344
1347 SwRootFrame const*const pLayout)
1348{
1349 SwDoc* pDoc = GetFormat()->GetDoc();
1350 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1351 {
1352 const OUString sTmpStyleNames = GetStyleNames(i);
1353 if (sTmpStyleNames.isEmpty())
1354 continue;
1355
1356 sal_Int32 nIndex = 0;
1357 while (nIndex >= 0)
1358 {
1360 sTmpStyleNames.getToken( 0, TOX_STYLE_DELIMITER, nIndex ));
1361 //TODO: no outline Collections in content indexes if OutlineLevels are already included
1362 if( !pColl ||
1366 continue;
1367
1369 for( SwTextNode* pTextNd = aIter.First(); pTextNd; pTextNd = aIter.Next() )
1370 {
1371 ::SetProgressState( 0, pDoc->GetDocShell() );
1372
1373 if (pTextNd->GetText().getLength() &&
1374 pTextNd->getLayoutFrame(pLayout) &&
1375 pTextNd->GetNodes().IsDocNodes() &&
1376 // tdf#40142 - consider level settings of the various text nodes
1377 o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= GetLevel() &&
1378 (!pLayout || !pLayout->HasMergedParas()
1379 || static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) &&
1380 (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd)))
1381 {
1382 InsertSorted(MakeSwTOXSortTabBase<SwTOXPara>(pLayout, *pTextNd, SwTOXElement::Template, i + 1));
1383 }
1384 }
1385 }
1386 }
1387}
1388
1391 SwRootFrame const*const pLayout)
1392{
1393 SwDoc* pDoc = GetFormat()->GetDoc();
1395 if(!pSeqField)
1396 return;
1397
1398 std::vector<SwFormatField*> vFields;
1399 pSeqField->GatherFields(vFields);
1400 for(auto pFormatField: vFields)
1401 {
1402 const SwTextField* pTextField = pFormatField->GetTextField();
1403 SwTextNode& rTextNode = pTextField->GetTextNode();
1404 ::SetProgressState( 0, pDoc->GetDocShell() );
1405
1406 if (rTextNode.GetText().getLength() &&
1407 rTextNode.getLayoutFrame(pLayout) &&
1408 ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, rTextNode))
1409 && (!pLayout || !pLayout->IsHideRedlines()
1410 || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField)))
1411 {
1412 const SwSetExpField& rSeqField = dynamic_cast<const SwSetExpField&>(*(pFormatField->GetField()));
1413 const OUString sName = GetSequenceName()
1414 + OUStringChar(cSequenceMarkSeparator)
1415 + OUString::number( rSeqField.GetSeqNumber() );
1416 std::unique_ptr<SwTOXPara> pNew(new SwTOXPara( rTextNode, SwTOXElement::Sequence, 1, sName ));
1417 // set indexes if the number or the reference text are to be displayed
1419 {
1420 pNew->SetStartIndex(
1421 SwGetExpField::GetReferenceTextPos( *pFormatField, *pDoc ));
1422 }
1423 else if(GetCaptionDisplay() == CAPTION_NUMBER)
1424 {
1425 pNew->SetEndIndex(pTextField->GetStart() + 1);
1426 }
1427 pNew->InitText(pLayout);
1428 InsertSorted(std::move(pNew));
1429 }
1430 }
1431}
1432
1434 SwRootFrame const*const pLayout)
1435{
1436 SwDoc* pDoc = GetFormat()->GetDoc();
1437 SwFieldType* pAuthField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, OUString(), false);
1438 if(!pAuthField)
1439 return;
1440
1441 std::vector<SwFormatField*> vFields;
1442 pAuthField->GatherFields(vFields);
1443 for(auto pFormatField: vFields)
1444 {
1445 const auto pTextField = pFormatField->GetTextField();
1446 const SwTextNode& rTextNode = pFormatField->GetTextField()->GetTextNode();
1447 ::SetProgressState( 0, pDoc->GetDocShell() );
1448
1449 if (rTextNode.GetText().getLength() &&
1450 rTextNode.getLayoutFrame(pLayout) &&
1451 (!pLayout || !pLayout->IsHideRedlines()
1452 || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField)))
1453 {
1454 //#106485# the body node has to be used!
1455 SwContentFrame *const pFrame = rTextNode.getLayoutFrame(pLayout);
1456 SwPosition aFieldPos(rTextNode);
1457 const SwTextNode* pTextNode = nullptr;
1458 if(pFrame && !pFrame->IsInDocBody())
1459 pTextNode = GetBodyTextNode( *pDoc, aFieldPos, *pFrame );
1460 if(!pTextNode)
1461 pTextNode = &rTextNode;
1462
1463 InsertSorted(MakeSwTOXSortTabBase<SwTOXAuthority>(pLayout, *pTextNode, *pFormatField, rIntl));
1464 }
1465 }
1466}
1467
1468static SwTOOElements lcl_IsSOObject( const SvGlobalName& rFactoryNm )
1469{
1470 static const struct SoObjType {
1471 SwTOOElements nFlag;
1472 // GlobalNameId
1473 struct {
1474 sal_uInt32 n1;
1475 sal_uInt16 n2, n3;
1476 sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
1477 } aGlNmIds[4];
1478 } aArr[] = {
1493 };
1494
1495 for( SoObjType const & rArr : aArr )
1496 for (auto & rId : rArr.aGlNmIds)
1497 {
1498 if( !rId.n1 )
1499 break;
1500 SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
1501 rId.b8, rId.b9, rId.b10, rId.b11,
1502 rId.b12, rId.b13, rId.b14, rId.b15 );
1503 if( rFactoryNm == aGlbNm )
1504 {
1505 return rArr.nFlag;
1506 }
1507 }
1508
1509 return SwTOOElements::NONE;
1510}
1511
1513 const SwTextNode* pOwnChapterNode,
1514 SwRootFrame const*const pLayout)
1515{
1516 SwDoc* pDoc = GetFormat()->GetDoc();
1517 SwNodes& rNds = pDoc->GetNodes();
1518 // on the 1st Node of the 1st Section
1520 nEndIdx = rNds.GetEndOfAutotext().GetIndex();
1521
1522 while( nIdx < nEndIdx )
1523 {
1524 ::SetProgressState( 0, pDoc->GetDocShell() );
1525
1526 SwNode* pNd = rNds[ nIdx ];
1527 SwContentNode* pCNd = nullptr;
1528 switch( eMyType )
1529 {
1531 if( !pNd->IsNoTextNode() )
1532 {
1533 pCNd = pNd->GetContentNode();
1534 if( !pCNd )
1535 {
1536 SwNodeIndex aTmp( *pNd );
1537 pCNd = rNds.GoNext( &aTmp );
1538 }
1539 }
1540 break;
1542 if( pNd->IsGrfNode() )
1543 pCNd = static_cast<SwContentNode*>(pNd);
1544 break;
1545 case SwTOXElement::Ole:
1546 if( pNd->IsOLENode() )
1547 {
1548 bool bInclude = true;
1550 {
1551 SwOLENode* pOLENode = pNd->GetOLENode();
1552 SwTOOElements nMyOLEOptions = GetOLEOptions();
1553 SwOLEObj& rOLEObj = pOLENode->GetOLEObj();
1554
1555 if( rOLEObj.IsOleRef() ) // Not yet loaded
1556 {
1557 SvGlobalName aTmpName( rOLEObj.GetOleRef()->getClassID() );
1558 SwTOOElements nObj = ::lcl_IsSOObject( aTmpName );
1559 bInclude = ( (nMyOLEOptions & SwTOOElements::Other) && SwTOOElements::NONE == nObj )
1560 || (nMyOLEOptions & nObj);
1561 }
1562 else
1563 {
1564 OSL_FAIL("OLE Object no loaded?");
1565 bInclude = false;
1566 }
1567 }
1568
1569 if(bInclude)
1570 pCNd = static_cast<SwContentNode*>(pNd);
1571 }
1572 break;
1573 default: break;
1574 }
1575
1576 if( pCNd )
1577 {
1578 // find node in body text
1579 int nSetLevel = USHRT_MAX;
1580
1581 //#111105# tables of tables|illustrations|objects don't support hierarchies
1582 if( IsLevelFromChapter() &&
1586 {
1587 const SwTextNode* pOutlNd = ::lcl_FindChapterNode( *pCNd,
1588 pLayout, MAXLEVEL - 1);
1589 if( pOutlNd )
1590 {
1592 {
1593 nSetLevel = pOutlNd->GetTextColl()->GetAttrOutlineLevel();
1594 }
1595 }
1596 }
1597
1598 if (pCNd->getLayoutFrame(pLayout)
1599 && (!pLayout || !pLayout->HasMergedParas()
1601 && ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd)))
1602 {
1603 std::unique_ptr<SwTOXPara> pNew( MakeSwTOXSortTabBase<SwTOXPara>(
1604 pLayout, *pCNd, eMyType,
1605 ( USHRT_MAX != nSetLevel )
1606 ? o3tl::narrowing<sal_uInt16>(nSetLevel)
1608 InsertSorted( std::move(pNew) );
1609 }
1610 }
1611
1612 nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + SwNodeOffset(2); // 2 == End/Start Node
1613 }
1614}
1615
1617void SwTOXBaseSection::UpdateTable(const SwTextNode* pOwnChapterNode,
1618 SwRootFrame const*const pLayout)
1619{
1620 SwDoc* pDoc = GetFormat()->GetDoc();
1621 SwNodes& rNds = pDoc->GetNodes();
1622
1623 for(SwTableFormat* pFrameFormat: *pDoc->GetTableFrameFormats())
1624 {
1625 ::SetProgressState( 0, pDoc->GetDocShell() );
1626
1627 SwTable* pTmpTable = SwTable::FindTable( pFrameFormat );
1628 SwTableBox* pFBox;
1629 if( pTmpTable && nullptr != (pFBox = pTmpTable->GetTabSortBoxes()[0] ) &&
1630 pFBox->GetSttNd() && pFBox->GetSttNd()->GetNodes().IsDocNodes() )
1631 {
1632 const SwTableNode* pTableNd = pFBox->GetSttNd()->FindTableNode();
1633 SwNodeIndex aContentIdx( *pTableNd, 1 );
1634
1635 SwContentNode* pCNd;
1636 while( nullptr != ( pCNd = rNds.GoNext( &aContentIdx ) ) &&
1637 aContentIdx.GetIndex() < pTableNd->EndOfSectionIndex() )
1638 {
1639 if (pCNd->getLayoutFrame(pLayout)
1640 && (!pLayout || !pLayout->HasMergedParas()
1642 && (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd)))
1643 {
1644 std::unique_ptr<SwTOXTable> pNew(new SwTOXTable( *pCNd ));
1646 {
1647 const SwTextNode* pOutlNd =
1648 ::lcl_FindChapterNode(*pCNd, pLayout, MAXLEVEL - 1);
1649 if( pOutlNd )
1650 {
1652 {
1653 const int nTmp = pOutlNd->GetTextColl()->GetAttrOutlineLevel();
1654 pNew->SetLevel(o3tl::narrowing<sal_uInt16>(nTmp));
1655 }
1656 }
1657 }
1658 pNew->InitText(pLayout);
1659 InsertSorted(std::move(pNew));
1660 break;
1661 }
1662 }
1663 }
1664 }
1665}
1666
1669{
1670 if( m_aSortArr.empty() )
1671 return ;
1672
1673 // Insert the current PageNumber into the TOC
1674 SwPageFrame* pCurrentPage = nullptr;
1675 sal_uInt16 nPage = 0;
1676 SwDoc* pDoc = GetFormat()->GetDoc();
1677
1679 TOX_INDEX == GetTOXType()->GetType() ?
1681 GetSortAlgorithm() );
1682
1683 for( size_t nCnt = 0; nCnt < m_aSortArr.size(); ++nCnt )
1684 {
1685 // Loop over all SourceNodes
1686
1687 // process run in lines
1688 size_t nRange = 0;
1689 if(GetTOXForm().IsCommaSeparated() &&
1690 m_aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
1691 {
1692 const SwTOXMark& rMark = m_aSortArr[nCnt]->pTextMark->GetTOXMark();
1693 const OUString& sPrimKey = rMark.GetPrimaryKey();
1694 const OUString& sSecKey = rMark.GetSecondaryKey();
1695 const SwTOXMark* pNextMark = nullptr;
1696 while(m_aSortArr.size() > (nCnt + nRange)&&
1697 m_aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
1698 nullptr != (pNextMark = &(m_aSortArr[nCnt + nRange]->pTextMark->GetTOXMark())) &&
1699 pNextMark->GetPrimaryKey() == sPrimKey &&
1700 pNextMark->GetSecondaryKey() == sSecKey)
1701 nRange++;
1702 }
1703 else
1704 nRange = 1;
1705
1706 for(size_t nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; ++nRunInEntry)
1707 {
1708 std::vector<sal_uInt16> aNums; // the PageNumber
1709 std::vector<SwPageDesc*> aDescs; // The PageDescriptors matching the PageNumbers
1710 std::vector<sal_uInt16> aMainNums; // contains page numbers of main entries
1711 SwTOXSortTabBase* pSortBase = m_aSortArr[nRunInEntry].get();
1712 size_t nSize = pSortBase->aTOXSources.size();
1713 for (size_t j = 0; j < nSize; ++j)
1714 {
1715 ::SetProgressState( 0, pDoc->GetDocShell() );
1716
1717 SwTOXSource& rTOXSource = pSortBase->aTOXSources[j];
1718 if( rTOXSource.pNd )
1719 {
1721 OSL_ENSURE( pFrame || pDoc->IsUpdateTOX(), "TOX, no Frame found");
1722 if( !pFrame )
1723 continue;
1724 if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->HasFollow() )
1725 {
1726 // find the right one
1727 SwTextFrame* pNext;
1728 TextFrameIndex const nPos(static_cast<SwTextFrame*>(pFrame)
1729 ->MapModelToView(static_cast<SwTextNode const*>(rTOXSource.pNd),
1730 rTOXSource.nPos));
1731 for (;;)
1732 {
1733 pNext = static_cast<SwTextFrame*>(pFrame->GetFollow());
1734 if (!pNext || nPos < pNext->GetOffset())
1735 break;
1736 pFrame = pNext;
1737 }
1738 }
1739
1740 SwPageFrame* pTmpPage = pFrame->FindPageFrame();
1741 if( pTmpPage != pCurrentPage )
1742 {
1743 nPage = pTmpPage->GetVirtPageNum();
1744 pCurrentPage = pTmpPage;
1745 }
1746
1747 // Insert as sorted
1748 std::vector<sal_uInt16>::size_type i;
1749 for( i = 0; i < aNums.size() && aNums[i] < nPage; ++i )
1750 ;
1751
1752 if( i >= aNums.size() || aNums[ i ] != nPage )
1753 {
1754 aNums.insert(aNums.begin() + i, nPage);
1755 aDescs.insert(aDescs.begin() + i, pCurrentPage->GetPageDesc() );
1756 }
1757 // is it a main entry?
1758 if(TOX_SORT_INDEX == pSortBase->GetType() &&
1759 rTOXSource.bMainEntry)
1760 {
1761 aMainNums.push_back(nPage);
1762 }
1763 }
1764 }
1765 // Insert the PageNumber into the TOC TextNode
1766 const SwTOXSortTabBase* pBase = m_aSortArr[ nCnt ].get();
1767 if(pBase->pTOXNd)
1768 {
1769 const SwTextNode* pTextNd = pBase->pTOXNd->GetTextNode();
1770 OSL_ENSURE( pTextNd, "no TextNode, wrong TOC" );
1771
1772 UpdatePageNum_( const_cast<SwTextNode*>(pTextNd), aNums, aDescs, &aMainNums,
1773 aIntl );
1774 }
1775 }
1776 }
1777 // Delete the mapping array after setting the right PageNumber
1778 m_aSortArr.clear();
1779}
1780
1783static bool lcl_HasMainEntry( const std::vector<sal_uInt16>* pMainEntryNums, sal_uInt16 nToFind )
1784{
1785 if (!pMainEntryNums)
1786 return false;
1787
1788 for( auto nMainEntry : *pMainEntryNums )
1789 if (nToFind == nMainEntry)
1790 return true;
1791 return false;
1792}
1793
1795 const std::vector<sal_uInt16>& rNums,
1796 const std::vector<SwPageDesc*>& rDescs,
1797 const std::vector<sal_uInt16>* pMainEntryNums,
1798 const SwTOXInternational& rIntl )
1799{
1800 // collect starts end ends of main entry character style
1801 std::optional< std::vector<sal_uInt16> > xCharStyleIdx;
1802 if (pMainEntryNums)
1803 xCharStyleIdx.emplace();
1804
1805 OUString sSrchStr
1806 = OUStringChar(C_NUM_REPL) + SwTOXMark::S_PAGE_DELI + OUStringChar(C_NUM_REPL);
1807 sal_Int32 nStartPos = pNd->GetText().indexOf(sSrchStr);
1808 sSrchStr = OUStringChar(C_NUM_REPL) + OUStringChar(C_END_PAGE_NUM);
1809 sal_Int32 nEndPos = pNd->GetText().indexOf(sSrchStr);
1810
1811 if (-1 == nEndPos || rNums.empty())
1812 return;
1813
1814 if (-1 == nStartPos || nStartPos > nEndPos)
1815 nStartPos = nEndPos;
1816
1817 sal_uInt16 nOld = rNums[0],
1818 nBeg = nOld,
1819 nCount = 0;
1820 OUString aNumStr( rDescs[0]->GetNumType().GetNumStr( nBeg ) );
1821 if( xCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg ))
1822 {
1823 xCharStyleIdx->push_back( 0 );
1824 }
1825
1826 // Delete place holder
1827 SwContentIndex aPos(pNd, nStartPos);
1828 SwCharFormat* pPageNoCharFormat = nullptr;
1829 SwpHints* pHints = pNd->GetpSwpHints();
1830 if(pHints)
1831 for(size_t nHintIdx = 0; nHintIdx < pHints->Count(); ++nHintIdx)
1832 {
1833 const SwTextAttr* pAttr = pHints->Get(nHintIdx);
1834 const sal_Int32 nTmpEnd = pAttr->End() ? *pAttr->End() : 0;
1835 if( nStartPos >= pAttr->GetStart() &&
1836 (nStartPos + 2) <= nTmpEnd &&
1837 pAttr->Which() == RES_TXTATR_CHARFMT)
1838 {
1839 pPageNoCharFormat = pAttr->GetCharFormat().GetCharFormat();
1840 break;
1841 }
1842 }
1843 pNd->EraseText(aPos, nEndPos - nStartPos + 2);
1844
1845 std::vector<sal_uInt16>::size_type i;
1846 for( i = 1; i < rNums.size(); ++i)
1847 {
1848 SvxNumberType aType( rDescs[i]->GetNumType() );
1849 if( TOX_INDEX == SwTOXBase::GetType() )
1850 { // Summarize for the following
1851 // Add up all following
1852 // break up if main entry starts or ends and
1853 // insert a char style index
1854 bool bMainEntryChanges = lcl_HasMainEntry(pMainEntryNums, nOld)
1855 != lcl_HasMainEntry(pMainEntryNums, rNums[i]);
1856
1857 if(nOld == rNums[i]-1 && !bMainEntryChanges &&
1859 nCount++;
1860 else
1861 {
1862 // Flush for the following old values
1864 {
1865 if ( nCount >= 1 )
1866 aNumStr += rIntl.GetFollowingText( nCount > 1 );
1867 }
1868 else if (nCount) //#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
1869 {
1870 if (nCount == 1 )
1871 aNumStr += SwTOXMark::S_PAGE_DELI;
1872 else
1873 aNumStr += "-";
1874
1875 aNumStr += aType.GetNumStr( nBeg + nCount );
1876 }
1877
1878 // Create new String
1879 nBeg = rNums[i];
1880 aNumStr += SwTOXMark::S_PAGE_DELI;
1881 //the change of the character style must apply after sPageDeli is appended
1882 if (xCharStyleIdx && bMainEntryChanges)
1883 {
1884 xCharStyleIdx->push_back(aNumStr.getLength());
1885 }
1886 aNumStr += aType.GetNumStr( nBeg );
1887 nCount = 0;
1888 }
1889 nOld = rNums[i];
1890 }
1891 else
1892 { // Insert all Numbers
1893 aNumStr += aType.GetNumStr( rNums[i] );
1894 if (i+1 != rNums.size())
1895 aNumStr += SwTOXMark::S_PAGE_DELI;
1896 }
1897 }
1898 // Flush when ending and the following old values
1899 if( TOX_INDEX == SwTOXBase::GetType() )
1900 {
1902 {
1903 if( nCount >= 1 )
1904 aNumStr += rIntl.GetFollowingText( nCount > 1 );
1905 }
1906 else
1907 {
1908 if(nCount >= 2)
1909 aNumStr += "-";
1910 else if(nCount == 1)
1911 aNumStr += SwTOXMark::S_PAGE_DELI;
1912 //#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
1913 if(nCount)
1914 aNumStr += rDescs[i-1]->GetNumType().GetNumStr( nBeg+nCount );
1915 }
1916 }
1918 if(pPageNoCharFormat)
1919 {
1920 SwFormatCharFormat aCharFormat( pPageNoCharFormat );
1921 pNd->InsertItem(aCharFormat, nStartPos, nStartPos + aNumStr.getLength(), SetAttrMode::DONTEXPAND);
1922 }
1923
1924 // The main entries should get their character style
1925 if (!xCharStyleIdx || xCharStyleIdx->empty() || GetMainEntryCharStyle().isEmpty())
1926 return;
1927
1928 // eventually the last index must me appended
1929 if (xCharStyleIdx->size()&0x01)
1930 xCharStyleIdx->push_back(aNumStr.getLength());
1931
1932 // search by name
1933 SwDoc& rDoc = pNd->GetDoc();
1935 SwCharFormat* pCharFormat = nullptr;
1936 if(USHRT_MAX != nPoolId)
1937 pCharFormat = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
1938 else
1939 pCharFormat = rDoc.FindCharFormatByName( GetMainEntryCharStyle() );
1940 if(!pCharFormat)
1941 pCharFormat = rDoc.MakeCharFormat(GetMainEntryCharStyle(), nullptr);
1942
1943 // find the page numbers in aNumStr and set the character style
1944 sal_Int32 nOffset = pNd->GetText().getLength() - aNumStr.getLength();
1945 SwFormatCharFormat aCharFormat(pCharFormat);
1946 for (size_t j = 0; j < xCharStyleIdx->size(); j += 2)
1947 {
1948 sal_Int32 nStartIdx = (*xCharStyleIdx)[j] + nOffset;
1949 sal_Int32 nEndIdx = (*xCharStyleIdx)[j + 1] + nOffset;
1950 pNd->InsertItem(aCharFormat, nStartIdx, nEndIdx, SetAttrMode::DONTEXPAND);
1951 }
1952}
1953
1954void SwTOXBaseSection::InsertSorted(std::unique_ptr<SwTOXSortTabBase> pNew)
1955{
1956 Range aRange(0, m_aSortArr.size());
1957 if( TOX_INDEX == SwTOXBase::GetType() && pNew->pTextMark )
1958 {
1959 const SwTOXMark& rMark = pNew->pTextMark->GetTOXMark();
1960 // Evaluate Key
1961 // Calculate the range where to insert
1963 !rMark.GetPrimaryKey().isEmpty() )
1964 {
1965 aRange = GetKeyRange( rMark.GetPrimaryKey(),
1966 rMark.GetPrimaryKeyReading(),
1967 *pNew, FORM_PRIMARY_KEY, aRange );
1968
1969 if( !rMark.GetSecondaryKey().isEmpty() )
1970 aRange = GetKeyRange( rMark.GetSecondaryKey(),
1971 rMark.GetSecondaryKeyReading(),
1972 *pNew, FORM_SECONDARY_KEY, aRange );
1973 }
1974 }
1975 // Search for identical entries and remove the trailing one
1977 {
1978 for(short i = static_cast<short>(aRange.Min()); i < static_cast<short>(aRange.Max()); ++i)
1979 {
1980 SwTOXSortTabBase* pOld = m_aSortArr[i].get();
1981 if (pOld->equivalent(*pNew))
1982 {
1983 if (pOld->sort_lt(*pNew))
1984 {
1985 return;
1986 }
1987 else
1988 {
1989 // remove the old content
1990 m_aSortArr.erase( m_aSortArr.begin() + i );
1991 aRange.Max()--;
1992 break;
1993 }
1994 }
1995 }
1996 }
1997
1998 // find position and insert
1999 tools::Long i;
2000
2001 for( i = aRange.Min(); i < aRange.Max(); ++i)
2002 { // Only check for same level
2003 SwTOXSortTabBase* pOld = m_aSortArr[i].get();
2004 if (pOld->equivalent(*pNew))
2005 {
2007 {
2008 // Own entry for double entries or keywords
2009 if( pOld->GetType() == TOX_SORT_CUSTOM &&
2011 continue;
2012
2014 { // Own entry
2015 m_aSortArr.insert(m_aSortArr.begin() + i, std::move(pNew));
2016 return;
2017 }
2018 // If the own entry is already present, add it to the references list
2019 pOld->aTOXSources.push_back(pNew->aTOXSources[0]);
2020
2021 return;
2022 }
2023#if OSL_DEBUG_LEVEL > 0
2024 else
2025 OSL_FAIL("Bibliography entries cannot be found here");
2026#endif
2027 }
2028 if (pNew->sort_lt(*pOld))
2029 break;
2030 }
2031 // Skip SubLevel
2032 while( TOX_INDEX == SwTOXBase::GetType() && i < aRange.Max() &&
2033 m_aSortArr[i]->GetLevel() > pNew->GetLevel() )
2034 i++;
2035
2036 // Insert at position i
2037 m_aSortArr.insert(m_aSortArr.begin()+i, std::move(pNew));
2038}
2039
2041Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrReading,
2042 const SwTOXSortTabBase& rNew,
2043 sal_uInt16 nLevel, const Range& rRange )
2044{
2045 const SwTOXInternational& rIntl = *rNew.pTOXIntl;
2046 TextAndReading aToCompare(rStr, rStrReading);
2047
2049 {
2050 aToCompare.sText = rIntl.ToUpper( aToCompare.sText, 0 )
2051 + aToCompare.sText.subView(1);
2052 }
2053
2054 OSL_ENSURE(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0");
2055
2056 const tools::Long nMin = rRange.Min();
2057 const tools::Long nMax = rRange.Max();
2058
2059 tools::Long i;
2060
2061 for( i = nMin; i < nMax; ++i)
2062 {
2063 SwTOXSortTabBase* pBase = m_aSortArr[i].get();
2064
2065 if( rIntl.IsEqual( pBase->GetText(), pBase->GetLocale(),
2066 aToCompare, rNew.GetLocale() ) &&
2067 pBase->GetLevel() == nLevel )
2068 break;
2069 }
2070 if(i == nMax)
2071 { // If not already present, create and insert
2072 std::unique_ptr<SwTOXCustom> pKey(MakeSwTOXSortTabBase<SwTOXCustom>(
2073 nullptr, aToCompare, nLevel, rIntl, rNew.GetLocale() ));
2074 for(i = nMin; i < nMax; ++i)
2075 {
2076 if (nLevel == m_aSortArr[i]->GetLevel() && pKey->sort_lt(*m_aSortArr[i]))
2077 break;
2078 }
2079 m_aSortArr.insert(m_aSortArr.begin() + i, std::move(pKey));
2080 }
2081 const tools::Long nStart = i+1;
2082 const tools::Long nEnd = m_aSortArr.size();
2083
2084 // Find end of range
2085 for(i = nStart; i < nEnd; ++i)
2086 {
2087 if(m_aSortArr[i]->GetLevel() <= nLevel)
2088 {
2089 return Range(nStart, i);
2090 }
2091 }
2092 return Range(nStart, nEnd);
2093}
2094
2096{
2097 const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this);
2098 if (!pSect || !pSect->GetFormat())
2099 return false;
2100
2101 const SwSectionNode* pSectNode = pSect->GetFormat()->GetSectionNode();
2102 if (!pSectNode)
2103 return false;
2104
2105 const SwDocShell* pDocSh = pSectNode->GetDoc().GetDocShell();
2106 if (!pDocSh)
2107 return false;
2108
2109 if (pDocSh->IsReadOnly())
2110 return true;
2111
2112 pSectNode = pSectNode->StartOfSectionNode()->FindSectionNode();
2113 if (!pSectNode)
2114 return false;
2115
2116 return pSectNode->GetSection().IsProtectFlag();
2117}
2118
2120{
2121 const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this);
2122 if(pSect && pSect->GetFormat())
2123 return &pSect->GetFormat()->GetAttrSet();
2124 return nullptr;
2125}
2126
2128{
2129 SwTOXBaseSection *pSect = dynamic_cast<SwTOXBaseSection*>(this);
2130 if( pSect && pSect->GetFormat() )
2131 pSect->GetFormat()->SetFormatAttr( rSet );
2132}
2133
2134/* 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.
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:74
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:68
Represents the style of a text portion.
Definition: charfmt.hxx:27
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:166
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:136
Marks a character position inside a document model content node (SwContentNode)
bool HasSwAttrSet() const
Definition: node.hxx:494
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:727
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
Definition: doc.hxx:197
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
Definition: doctxm.cxx:630
bool IsInReading() const
Definition: doc.hxx:969
static const SwAttrSet & GetTOXBaseAttrSet(const SwTOXBase &rTOX)
Definition: doctxm.cxx:469
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:504
bool DeleteTOX(const SwTOXBase &rTOXBase, bool bDelNodes)
Delete table of contents.
Definition: doctxm.cxx:525
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:257
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
const sw::TableFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:826
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1890
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:171
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1699
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:612
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:148
void UpdateNumRule()
Definition: docnum.cxx:2628
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:786
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
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:449
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:507
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:258
const SwTOXBase * GetDefaultTOXBase(TOXTypes eTyp, bool bCreate)
Definition: doctxm.cxx:478
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:814
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:252
void DeleteTOXMark(const SwTOXMark *pTOXMark)
Delete table of contents Mark.
Definition: doctxm.cxx:155
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
bool SetTOXBaseName(const SwTOXBase &rTOXBase, const OUString &rName)
Definition: doctxm.cxx:706
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:863
bool IsInMailMerge() const
Definition: doc.hxx:975
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: doctxm.cxx:621
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:500
OUString GetUniqueTOXBaseName(const SwTOXType &rType, const OUString &sChkStr) const
Definition: doctxm.cxx:637
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:200
bool IsUpdateTOX() const
Definition: doc.hxx:964
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
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:247
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:205
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:447
const SwRect & getFrameArea() const
Definition: frame.hxx:179
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1240
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1817
bool IsInDocBody() const
Definition: frame.hxx:949
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1639
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:1078
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
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:965
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
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:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsGrfNode() const
Definition: node.hxx:195
sal_uInt16 GetSectionLevel() const
Returns the section level at the position given by aIndex.
Definition: node.cxx:280
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwSectionNode * GetSectionNode()
Definition: node.hxx:658
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsNoTextNode() const
Definition: node.hxx:194
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:706
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:791
SwDoc & GetDoc()
Definition: node.hxx:233
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:687
const SwPageDesc * FindPageDesc(SwNodeOffset *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
Definition: node.cxx:496
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:968
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:165
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
SwContentNode * GetContentNode()
Definition: node.hxx:666
bool IsOLENode() const
Definition: node.hxx:193
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:236
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:121
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:2555
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1070
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:769
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1333
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:116
bool IsOleRef() const
To avoid unnecessary loading of object.
Definition: ndole.cxx:977
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:1012
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:188
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
const SwPosition * GetPoint() const
Definition: pam.hxx:253
A page of the document layout.
Definition: pagefrm.hxx:60
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
bool HasMergedParas() const
Definition: wsfrm.cxx:4773
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:434
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:436
sw::ParagraphBreakMode GetParagraphBreakMode() const
Definition: rootfrm.hxx:438
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:853
SwSectionNode * GetSectionNode()
Definition: section.cxx:923
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
const SwSection & GetSection() const
Definition: node.hxx:590
bool IsProtectFlag() const
Definition: section.hxx:191
bool IsHiddenFlag() const
Definition: section.hxx:190
const OUString & GetSectionName() const
Definition: section.hxx:171
SwSectionFormat * GetFormat()
Definition: section.hxx:341
SectionType GetType() const
Definition: section.hxx:173
void SetProtect(bool const bFlag=true)
Definition: section.cxx:362
void SetSectionName(OUString const &rName)
Definition: section.hxx:172
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:1346
void UpdatePageNum()
Calculate PageNumber and insert after formatting.
Definition: doctxm.cxx:1668
void InsertAlphaDelimiter(const SwTOXInternational &rIntl)
Definition: doctxm.cxx:1163
void UpdateTable(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Collect table entries.
Definition: doctxm.cxx:1617
void UpdateSequence(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate content from sequence fields.
Definition: doctxm.cxx:1390
void InsertSorted(std::unique_ptr< SwTOXSortTabBase > pBase)
Definition: doctxm.cxx:1954
virtual void SwClientNotify(const SwModify &rModify, const SfxHint &rHint) override
Definition: doctxm.cxx:1255
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:2041
void UpdateContent(SwTOXElement eType, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1512
void Update(const SfxItemSet *pAttr=nullptr, SwRootFrame const *pLayout=nullptr, const bool _bNewTOX=false)
Collect table of contents content.
Definition: doctxm.cxx:853
void UpdateMarks(const SwTOXInternational &rIntl, const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Create from Marks.
Definition: doctxm.cxx:1281
SwTextFormatColl * GetTextFormatColl(sal_uInt16 nLevel)
Evaluate Template.
Definition: doctxm.cxx:1206
bool SetPosAtStartEnd(SwPosition &rPos) const
Definition: doctxm.cxx:839
SwTOXBaseSection(SwTOXBase const &rBase, SwSectionFormat &rFormat)
Definition: doctxm.cxx:827
void UpdateOutline(const SwTextNode *pOwnChapterNode, SwRootFrame const *pLayout)
Generate table of contents from outline.
Definition: doctxm.cxx:1320
void UpdateAuthorities(const SwTOXInternational &rIntl, SwRootFrame const *pLayout)
Definition: doctxm.cxx:1433
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:1794
virtual ~SwTOXBaseSection() override
Definition: doctxm.cxx:835
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:2127
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:2119
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:2095
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:95
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:443
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:495
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:2308
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:267
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:61
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
int GetAttrOutlineLevel() const
Definition: fmtcol.cxx:673
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1390
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:291
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
Definition: thints.cxx:1763
bool IsHiddenByParaField() const
is the paragraph visible?
Definition: ndtxt.hxx:769
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:5066
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:2777
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2372
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4168
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:252
const OUString & GetText() const
Definition: ndtxt.hxx:244
bool HasHiddenCharAttribute(bool bWholePara) const
Hidden Paragraph Field:
Definition: ndtxt.hxx:774
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:895
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:67
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:90
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:1783
static SwTOOElements lcl_IsSOObject(const SvGlobalName &rFactoryNm)
Definition: doctxm.cxx:1468
static const SwTextNode * lcl_FindChapterNode(const SwNode &rNd, SwRootFrame const *const pLayout, sal_uInt8 const nLvl=0)
Definition: doctxm.cxx:721
static bool IsHeadingContained(const SwTextNode *pChptrNd, const SwNode &rNd)
Definition: doctxm.cxx:744
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
OUString sName
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
#define CH_TXTATR_INWORD
Definition: hintids.hxx:175
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
sal_uInt32 n3
size
OUString newName(std::u16string_view aNewPrefix, std::u16string_view 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:1270
bool IsMarkHintHidden(SwRootFrame const &rLayout, SwTextNode const &rNode, SwTextAttrEnd const &rHint)
Definition: reffld.cxx:1140
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:1043
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
@ 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:384
@ RES_POOLCOLL_TOX_USER6
user index 6..10.
Definition: poolfmt.hxx:414
@ RES_POOLCOLL_TOX_CNTNTH
Subgroup table of contents.
Definition: poolfmt.hxx:376
@ RES_POOLCOLL_TOX_TABLESH
tables index.
Definition: poolfmt.hxx:406
@ RES_POOLCOLL_TOX_IDXH
Subgroup index tables.
Definition: poolfmt.hxx:369
@ RES_POOLCOLL_TOX_OBJECTH
object index.
Definition: poolfmt.hxx:402
@ RES_POOLCOLL_TOX_CNTNT6
Content 6th level.
Definition: poolfmt.hxx:391
@ RES_POOLCOLL_TOX_ILLUSH
illustrations index.
Definition: poolfmt.hxx:398
@ RES_POOLCOLL_TOX_AUTHORITIESH
index of authorities.
Definition: poolfmt.hxx:410
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:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
Class for sorting directories.
Definition: txmsrt.hxx:124
virtual sal_uInt16 GetLevel() const =0
std::vector< SwTOXSource > aTOXSources
Definition: txmsrt.hxx:128
static SwTOIOptions GetOptions()
Definition: txmsrt.hxx:146
const css::lang::Locale & GetLocale() const
Definition: txmsrt.hxx:185
virtual bool sort_lt(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:253
TextAndReading const & GetText() const
Definition: txmsrt.hxx:179
sal_uInt16 GetType() const
Definition: txmsrt.hxx:145
virtual bool equivalent(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:227
const SwTextNode * pTOXNd
Definition: txmsrt.hxx:130
const SwTOXInternational * pTOXIntl
Definition: txmsrt.hxx:132
bool bMainEntry
Definition: txmsrt.hxx:53
const SwContentNode * pNd
Definition: txmsrt.hxx:51
sal_Int32 nPos
Definition: txmsrt.hxx:52
OUString sText
Definition: txmsrt.hxx:63
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:42
@ TOX_SORT_INDEX
Definition: txmsrt.hxx:41
unsigned char sal_uInt8
#define SAL_MAX_INT32
bool operator<(const wwFont &r1, const wwFont &r2)
Definition: wrtw8sty.cxx:885
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
Definition: ww8par2.cxx:853
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)