LibreOffice Module sw (master)  1
ToxTextGenerator.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 <ToxTextGenerator.hxx>
21 
22 #include <chpfld.hxx>
23 #include <cntfrm.hxx>
24 #include <txtfrm.hxx>
25 #include <rootfrm.hxx>
26 #include <ndindex.hxx>
27 #include <fchrfmt.hxx>
28 #include <doc.hxx>
31 #include <ndtxt.hxx>
32 #include <tox.hxx>
33 #include <txmsrt.hxx>
34 #include <fmtautofmt.hxx>
35 #include <swatrset.hxx>
37 #include <ToxLinkProcessor.hxx>
39 #include <txatbase.hxx>
40 #include <modeltoviewhelper.hxx>
41 #include <strings.hrc>
42 
43 #include <osl/diagnose.h>
44 #include <rtl/ustrbuf.hxx>
45 #include <svl/itemiter.hxx>
46 
47 #include <cassert>
48 #include <memory>
49 
50 namespace {
51 
52 bool sortTabHasNoToxSourcesOrFirstToxSourceHasNoNode(const SwTOXSortTabBase& sortTab)
53 {
54  if (sortTab.aTOXSources.empty()) {
55  return true;
56  }
57  if (sortTab.aTOXSources.at(0).pNd == nullptr) {
58  return true;
59  }
60  return false;
61 }
62 
63 } // end anonymous namespace
64 
65 namespace sw {
66 
67 OUString
69  bool bUsePrefix, sal_uInt8 nLevel,
70  SwRootFrame const*const pLayout)
71 {
72  if (sortTabHasNoToxSourcesOrFirstToxSourceHasNoNode(rBase)) {
73  return OUString();
74  }
75 
76  OUString sRet;
77  if (rBase.pTextMark) { // only if it's not a Mark
78  return sRet;
79  }
80 
81  const SwTextNode* pNd = rBase.aTOXSources[0].pNd->GetTextNode();
82  if (!pNd) {
83  return sRet;
84  }
85  if (pLayout && pLayout->HasMergedParas())
86  { // note: pNd could be any node, since it could be Sequence etc.
87  pNd = sw::GetParaPropsNode(*pLayout, SwNodeIndex(*pNd));
88  }
89 
90  const SwNumRule* pRule = pNd->GetNumRule();
91  if (!pRule) {
92  return sRet;
93  }
94 
95  if (pNd->GetActualListLevel() < MAXLEVEL) {
96  sRet = pNd->GetNumString(bUsePrefix, nLevel, pLayout);
97  }
98 
99  if (!sRet.isEmpty()) {
100  sRet += " ";// Makes sure spacing is done only when there is outline numbering
101  }
102 
103  return sRet;
104 }
105 
106 
108  std::shared_ptr<ToxTabStopTokenHandler> const & tabStopHandler)
109 : mToxForm(toxForm),
110  mLinkProcessor(std::make_shared<ToxLinkProcessor>()),
111  mTabStopTokenHandler(tabStopHandler)
112 {}
113 
115 {}
116 
117 OUString
119  const SwFormToken& aToken, SwRootFrame const*const pLayout) const
120 {
121  if (sortTabHasNoToxSourcesOrFirstToxSourceHasNoNode(rBase)) {
122  return OUString();
123  }
124 
125  // A bit tricky: Find a random Frame
126  const SwContentNode* contentNode = rBase.aTOXSources.at(0).pNd->GetContentNode();
127  if (!contentNode) {
128  return OUString();
129  }
130 
131  // #i53420#
132  const SwContentFrame* contentFrame = contentNode->getLayoutFrame(pLayout);
133  if (!contentFrame) {
134  return OUString();
135  }
136 
137  return GenerateTextForChapterToken(aToken, contentFrame, contentNode, pLayout);
138 }
139 
140 OUString
142  const SwContentNode *contentNode,
143  SwRootFrame const*const pLayout) const
144 {
145  OUString retval;
146 
147  SwChapterFieldType chapterFieldType;
148  SwChapterField aField = ObtainChapterField(&chapterFieldType, &chapterToken, contentFrame, contentNode);
149 
150  //---> #i89791#
151  // continue to support CF_NUMBER and CF_NUM_TITLE in order to handle ODF 1.0/1.1 written by OOo 3.x
152  // in the same way as OOo 2.x would handle them.
153  if (CF_NUM_NOPREPST_TITLE == chapterToken.nChapterFormat || CF_NUMBER == chapterToken.nChapterFormat) {
154  retval += aField.GetNumber(pLayout); // get the string number without pre/postfix
155  }
156  else if (CF_NUMBER_NOPREPST == chapterToken.nChapterFormat || CF_NUM_TITLE == chapterToken.nChapterFormat) {
157  retval += aField.GetNumber(pLayout) + " ";
158  retval += aField.GetTitle(pLayout);
159  } else if (CF_TITLE == chapterToken.nChapterFormat) {
160  retval += aField.GetTitle(pLayout);
161  }
162  return retval;
163 }
164 
165 // Add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control,
166 // which page description is used, no appropriate one is found.
167 void
169  std::unordered_map<OUString, int> & rMarkURLs,
170  const std::vector<std::unique_ptr<SwTOXSortTabBase>> &entries,
171  sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess,
172  SwRootFrame const*const pLayout)
173 {
174  // pTOXNd is only set at the first mark
175  SwTextNode* pTOXNd = const_cast<SwTextNode*>(entries.at(indexOfEntryToProcess)->pTOXNd);
176  // FIXME this operates directly on the node text
177  OUString & rText = const_cast<OUString&>(pTOXNd->GetText());
178  rText.clear();
179  for(sal_uInt16 nIndex = indexOfEntryToProcess; nIndex < indexOfEntryToProcess + numberOfEntriesToProcess; nIndex++)
180  {
181  if(nIndex > indexOfEntryToProcess)
182  rText += ", "; // comma separation
183  // Initialize String with the Pattern from the form
184  const SwTOXSortTabBase& rBase = *entries.at(nIndex);
185  sal_uInt16 nLvl = rBase.GetLevel();
186  OSL_ENSURE( nLvl < mToxForm.GetFormMax(), "invalid FORM_LEVEL");
187 
188  SvxTabStopItem aTStops( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
189  // create an enumerator
190  // #i21237#
191  SwFormTokens aPattern = mToxForm.GetPattern(nLvl);
192  // remove text from node
193  for(const auto& aToken : aPattern) // #i21237#
194  {
195  sal_Int32 nStartCharStyle = rText.getLength();
196  OUString aCharStyleName = aToken.sCharStyleName;
197  switch( aToken.eTokenType )
198  {
199  case TOKEN_ENTRY_NO:
200  // for TOC numbering
201  rText += GetNumStringOfFirstNode(rBase,
202  aToken.nChapterFormat == CF_NUMBER,
203  static_cast<sal_uInt8>(aToken.nOutlineLevel - 1), pLayout);
204  break;
205 
206  case TOKEN_ENTRY_TEXT: {
207  HandledTextToken htt = HandleTextToken(rBase, pDoc->GetAttrPool(), pLayout);
208  ApplyHandledTextToken(htt, *pTOXNd);
209  }
210  break;
211 
212  case TOKEN_ENTRY:
213  {
214  // for TOC numbering
215  rText += GetNumStringOfFirstNode(rBase, true, MAXLEVEL, pLayout);
216  HandledTextToken htt = HandleTextToken(rBase, pDoc->GetAttrPool(), pLayout);
217  ApplyHandledTextToken(htt, *pTOXNd);
218  }
219  break;
220 
221  case TOKEN_TAB_STOP: {
223  mTabStopTokenHandler->HandleTabStopToken(aToken, *pTOXNd, pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
224  rText += htst.text;
225  aTStops.Insert(htst.tabStop);
226  break;
227  }
228 
229  case TOKEN_TEXT:
230  rText += aToken.sText;
231  break;
232 
233  case TOKEN_PAGE_NUMS:
234  rText += ConstructPageNumberPlaceholder(rBase.aTOXSources.size());
235  break;
236 
237  case TOKEN_CHAPTER_INFO:
238  rText += HandleChapterToken(rBase, aToken, pLayout);
239  break;
240 
241  case TOKEN_LINK_START:
242  mLinkProcessor->StartNewLink(rText.getLength(), aToken.sCharStyleName);
243  break;
244 
245  case TOKEN_LINK_END:
246  {
247  auto [url, isMark] = rBase.GetURL(pLayout);
248  if (isMark)
249  {
250  auto [iter, _] = rMarkURLs.emplace(url, 0);
251  (void) _; // sigh... ignore it more explicitly
252  ++iter->second;
253  url = "#" + OUString::number(iter->second) + url;
254  }
255  mLinkProcessor->CloseLink(rText.getLength(), url, /*bRelative=*/true);
256  }
257  break;
258 
259  case TOKEN_AUTHORITY:
260  {
261  ToxAuthorityField eField = static_cast<ToxAuthorityField>(aToken.nAuthorityField);
262  SwIndex aIdx( pTOXNd, rText.getLength() );
263  if (eField == ToxAuthorityField::AUTH_FIELD_URL)
264  {
265  aCharStyleName = SwResId(STR_POOLCHR_INET_NORMAL);
266  mLinkProcessor->StartNewLink(rText.getLength(), aCharStyleName);
267  }
268  rBase.FillText( *pTOXNd, aIdx, static_cast<sal_uInt16>(eField), pLayout );
269  if (eField == ToxAuthorityField::AUTH_FIELD_URL)
270  {
271  OUString aURL(rText.subView(nStartCharStyle));
272  mLinkProcessor->CloseLink(rText.getLength(), aURL, /*bRelative=*/false);
273  }
274  }
275  break;
276  case TOKEN_END: break;
277  }
278 
279  if (!aCharStyleName.isEmpty())
280  {
281  SwCharFormat* pCharFormat;
282  if( USHRT_MAX != aToken.nPoolId )
283  pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( aToken.nPoolId );
284  else
285  pCharFormat = pDoc->FindCharFormatByName(aCharStyleName);
286 
287  if (pCharFormat)
288  {
289  SwFormatCharFormat aFormat( pCharFormat );
290  pTOXNd->InsertItem( aFormat, nStartCharStyle,
291  rText.getLength(), SetAttrMode::DONTEXPAND );
292  }
293  }
294  }
295 
296  pTOXNd->SetAttr( aTStops );
297  }
298  mLinkProcessor->InsertLinkAttributes(*pTOXNd);
299 }
300 
301 /*static*/ std::shared_ptr<SfxItemSet>
303 {
304  auto retval = std::make_shared<SfxItemSet>(pool);
305  if (hint.Which() != RES_TXTATR_AUTOFMT) {
306  return retval;
307  }
308  const SwFormatAutoFormat& afmt = hint.GetAutoFormat();
309  SfxItemIter aIter( *afmt.GetStyleHandle());
310  const SfxPoolItem* pItem = aIter.GetCurItem();
311  do
312  {
313  if (pItem->Which() == RES_CHRATR_ESCAPEMENT ||
314  pItem->Which() == RES_CHRATR_POSTURE ||
315  pItem->Which() == RES_CHRATR_CJK_POSTURE ||
316  pItem->Which() == RES_CHRATR_CTL_POSTURE)
317  {
318  retval->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
319  }
320  pItem = aIter.NextItem();
321  } while (pItem);
322  return retval;
323 }
324 
327  sal_Int32 & rOffset,
328  SwTextNode const& rNode,
329  ToxWhitespaceStripper const& rStripper,
330  SwAttrPool & rPool,
331  SwRootFrame const*const pLayout)
332 {
333  // note: this *must* use the same flags as SwTextNode::GetExpandText()
334  // or indexes will be off!
336  if (pLayout && pLayout->IsHideRedlines())
337  {
338  eMode |= ExpandMode::HideDeletions;
339  }
340  ModelToViewHelper aConversionMap(rNode, pLayout, eMode);
341  if (SwpHints const*const pHints = rNode.GetpSwpHints())
342  {
343  for (size_t i = 0; i < pHints->Count(); ++i)
344  {
345  const SwTextAttr* pHint = pHints->Get(i);
346  std::shared_ptr<SfxItemSet> attributesToClone =
347  CollectAttributesForTox(*pHint, rPool);
348  if (attributesToClone->Count() <= 0) {
349  continue;
350  }
351 
352  // sw_redlinehide: due to the ... interesting ... multi-level index
353  // mapping going on here, can't use the usual merged attr iterators :(
354 
355  sal_Int32 const nStart(aConversionMap.ConvertToViewPosition(pHint->GetStart()));
356  sal_Int32 const nEnd(aConversionMap.ConvertToViewPosition(pHint->GetAnyEnd()));
357  if (nStart != nEnd) // might be in delete redline, and useless anyway
358  {
359  std::unique_ptr<SwFormatAutoFormat> pClone(pHint->GetAutoFormat().Clone());
360  pClone->SetStyleHandle(attributesToClone);
361  rResult.autoFormats.push_back(std::move(pClone));
362  // note the rStripper is on the whole merged text, so need rOffset
363  rResult.startPositions.push_back(
364  rStripper.GetPositionInStrippedString(rOffset + nStart));
365  rResult.endPositions.push_back(
366  rStripper.GetPositionInStrippedString(rOffset + nEnd));
367  }
368  }
369  }
370  rOffset += aConversionMap.getViewText().getLength();
371 }
372 
375  SwAttrPool& pool, SwRootFrame const*const pLayout)
376 {
378  ToxWhitespaceStripper stripper(source.GetText().sText);
379  result.text = stripper.GetStrippedString();
380 
381  // FIXME: there is a pre-existing problem that the index mapping of the
382  // attributes only works if the paragraph is fully selected
383  if (!source.IsFullPara() || source.aTOXSources.empty())
384  return result;
385 
386  const SwTextNode* pSrc = source.aTOXSources.front().pNd->GetTextNode();
387  if (!pSrc)
388  {
389  return result;
390  }
391 
392  sal_Int32 nOffset(0);
393  GetAttributesForNode(result, nOffset, *pSrc, stripper, pool, pLayout);
394  if (pLayout && pLayout->HasMergedParas())
395  {
396  if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(pSrc->getLayoutFrame(pLayout)))
397  {
398  if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
399  {
400  // pSrc already copied above
401  assert(pSrc == pMerged->pParaPropsNode);
402  for (sal_uLong i = pSrc->GetIndex() + 1;
403  i <= pMerged->pLastNode->GetIndex(); ++i)
404  {
405  SwNode *const pTmp(pSrc->GetNodes()[i]);
406  if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
407  {
408  GetAttributesForNode(result, nOffset,
409  *pTmp->GetTextNode(), stripper, pool, pLayout);
410  }
411  }
412  }
413  }
414  }
415 
416  return result;
417 }
418 
419 /*static*/ void
421 {
422  sal_Int32 offset = targetNode.GetText().getLength();
423  SwIndex aIdx(&targetNode, offset);
424  targetNode.InsertText(htt.text, aIdx);
425  for (size_t i=0; i < htt.autoFormats.size(); ++i) {
426  targetNode.InsertItem(*htt.autoFormats.at(i),
427  htt.startPositions.at(i) + offset,
428  htt.endPositions.at(i) + offset);
429  }
430 }
431 
432 /*static*/ OUString
434 {
435  if (numberOfToxSources == 0) {
436  return OUString();
437  }
438  OUStringBuffer retval;
439  // Place holder for the PageNumber; we only respect the first one
440  retval.append(C_NUM_REPL);
441  for (size_t i = 1; i < numberOfToxSources; ++i) {
442  retval.append(SwTOXMark::S_PAGE_DELI);
443  retval.append(C_NUM_REPL);
444  }
445  retval.append(C_END_PAGE_NUM);
446  return retval.makeStringAndClear();
447 }
448 
449 /*virtual*/ SwChapterField
451  const SwFormToken* chapterToken, const SwContentFrame* contentFrame,
452  const SwContentNode* contentNode) const
453 {
454  assert(chapterToken);
455  assert(chapterToken->nOutlineLevel >= 1);
456 
457  SwChapterField retval(chapterFieldType, chapterToken->nChapterFormat);
458  retval.SetLevel(static_cast<sal_uInt8>(chapterToken->nOutlineLevel - 1));
459  // #i53420#
460  retval.ChangeExpansion(*contentFrame, contentNode, true);
461  return retval;
462 }
463 } // end namespace sw
464 
465 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:288
std::shared_ptr< ToxLinkProcessor > mLinkProcessor
const sal_Unicode C_NUM_REPL
Definition: tox.cxx:46
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:157
URL aURL
sal_uLong GetIndex() const
Definition: node.hxx:291
OUString HandleChapterToken(const SwTOXSortTabBase &rBase, const SwFormToken &aToken, SwRootFrame const *pLayout) const
Handle a chapter token.
sal_Int32 nIndex
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
SwCharFormat * FindCharFormatByName(std::u16string_view rName) const
Definition: doc.hxx:773
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
std::vector< std::unique_ptr< SwFormatAutoFormat > > autoFormats
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4897
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
sal_uInt16 nOutlineLevel
Definition: tox.hxx:254
Definition: tox.hxx:315
sal_uIntPtr sal_uLong
virtual sal_uInt16 GetLevel() const =0
virtual SwFormatAutoFormat * Clone(SfxItemPool *pPool=nullptr) const override
Definition: fmtatr2.cxx:124
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1212
Definition: doc.hxx:187
only chapter number without post-/prefix
Definition: chpfld.hxx:35
std::shared_ptr< ToxTabStopTokenHandler > mTabStopTokenHandler
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
This class helps to remove unwanted whitespaces from a string to use in a Tox.
sal_uInt16 GetFormMax() const
Definition: tox.hxx:698
Dialog to specify the properties of date form field.
void SetLevel(sal_uInt8)
Definition: chpfld.cxx:81
sal_uInt16 Which() const
Definition: txatbase.hxx:114
std::shared_ptr< T > make_shared(Args &&...args)
sal_Int32 GetAnyEnd() const
end (if available), else start
Definition: txatbase.hxx:157
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
static OUString GetNumStringOfFirstNode(const SwTOXSortTabBase &rBase, bool bUsePrefix, sal_uInt8 nLevel, SwRootFrame const *pLayout)
This method will call GetNumStringOfFirstNode() of the first node in the provided SwTOXSortTabBase...
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4105
chapter number without post-/prefix and title
Definition: chpfld.hxx:36
virtual bool IsFullPara() const
Definition: txmsrt.cxx:209
const OUString & GetTitle(SwRootFrame const *pLayout=nullptr) const
Definition: chpfld.cxx:93
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
eField
sal_Int32 GetStart() const
Definition: txatbase.hxx:86
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
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:1271
Mode eMode
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:953
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
ToxTextGenerator(const SwForm &toxForm, std::shared_ptr< ToxTabStopTokenHandler > const &tabStopHandler)
virtual SwChapterField ObtainChapterField(SwChapterFieldType *chapterFieldType, const SwFormToken *chapterToken, const SwContentFrame *contentFrame, const SwContentNode *contentNode) const
Obtain a ChapterField to use for the text generation.
const OUString & getViewText() const
number and title
Definition: chpfld.hxx:34
int i
const SwFormTokens & GetPattern(sal_uInt16 nLevel) const
Definition: tox.cxx:950
static OUString ConstructPageNumberPlaceholder(size_t numberOfToxSources)
Handle a page number token.
Marks a character position inside a document model node.
Definition: index.hxx:33
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2812
sal_uInt16 nChapterFormat
Definition: tox.hxx:253
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:697
virtual std::pair< OUString, bool > GetURL(SwRootFrame const *const pLayout) const
Definition: txmsrt.cxx:182
OUString SwResId(const char *pId)
Definition: swmodule.cxx:166
const SwTextTOXMark * pTextMark
Definition: txmsrt.hxx:128
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
OUString GenerateTextForChapterToken(const SwFormToken &chapterToken, const SwContentFrame *contentFrame, const SwContentNode *contentNode, SwRootFrame const *pLayout) const
Generate the text for a chapter token.
const sal_Unicode C_END_PAGE_NUM
Definition: tox.cxx:47
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:324
ToxAuthorityField
Definition: toxe.hxx:82
only the chapter number
Definition: chpfld.hxx:32
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2282
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).
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
static constexpr OUStringLiteral S_PAGE_DELI
Definition: tox.hxx:171
ExpandMode
Some helpers for converting model strings to view strings.
OUString sText
Definition: txmsrt.hxx:60
sal_Int32 GetPositionInStrippedString(sal_Int32 pos) const
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
void ChangeExpansion(const SwFrame &, const SwContentNode *, bool bSrchNum=false)
Definition: chpfld.cxx:128
unsigned char sal_uInt8
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
static std::shared_ptr< SfxItemSet > CollectAttributesForTox(const SwTextAttr &hint, SwAttrPool &pool)
Collect the attributes of a hint that shall be copied over to the TOX.
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
static void ApplyHandledTextToken(const HandledTextToken &htt, SwTextNode &targetNode)
Applies the result of a handled text token to a target node.
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:420
const OUString & GetNumber(SwRootFrame const *pLayout=nullptr) const
Definition: chpfld.cxx:87
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr) const
Returns outline of numbering string.
Definition: ndtxt.cxx:3120
static void GetAttributesForNode(HandledTextToken &rResult, sal_Int32 &rOffset, SwTextNode const &rNode, ToxWhitespaceStripper const &rStripper, SwAttrPool &rPool, SwRootFrame const *const pLayout)
Any result
const SwFormatAutoFormat & GetAutoFormat() const
Definition: txatbase.hxx:189
bool HasMergedParas() const
Definition: rootfrm.hxx:424
virtual void FillText(SwTextNode &rNd, const SwIndex &rInsPos, sal_uInt16 nAuthField, SwRootFrame const *pLayout) const
Definition: txmsrt.cxx:214
static HandledTextToken HandleTextToken(const SwTOXSortTabBase &source, SwAttrPool &attrPool, SwRootFrame const *const pLayout)
Append text (and selected attributes) to a target node.
TextAndReading const & GetText() const
Definition: txmsrt.hxx:176
Class for sorting directories.
Definition: txmsrt.hxx:120
std::vector< SwTOXSource > aTOXSources
Definition: txmsrt.hxx:125
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
A helper class for ToxTextGenerator.
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1321
only the title
Definition: chpfld.hxx:33
Base class of the Writer document model elements.
Definition: node.hxx:80
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo