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, o3tl::narrowing<sal_uInt16>(eField), pLayout );
269  if (eField == ToxAuthorityField::AUTH_FIELD_URL)
270  {
271  // Get the absolute URL, the text may be a relative one.
272  const auto& rAuthority = static_cast<const SwTOXAuthority&>(rBase);
274  rAuthority.GetText(AUTH_FIELD_URL, pLayout));
275 
276  mLinkProcessor->CloseLink(rText.getLength(), aURL, /*bRelative=*/false);
277  }
278  }
279  break;
280  case TOKEN_END: break;
281  }
282 
283  if (!aCharStyleName.isEmpty())
284  {
285  SwCharFormat* pCharFormat;
286  if( USHRT_MAX != aToken.nPoolId )
287  pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( aToken.nPoolId );
288  else
289  pCharFormat = pDoc->FindCharFormatByName(aCharStyleName);
290 
291  if (pCharFormat)
292  {
293  SwFormatCharFormat aFormat( pCharFormat );
294  pTOXNd->InsertItem( aFormat, nStartCharStyle,
295  rText.getLength(), SetAttrMode::DONTEXPAND );
296  }
297  }
298  }
299 
300  pTOXNd->SetAttr( aTStops );
301  }
302  mLinkProcessor->InsertLinkAttributes(*pTOXNd);
303 }
304 
305 /*static*/ std::shared_ptr<SfxItemSet>
307 {
308  auto retval = std::make_shared<SfxItemSet>(pool);
309  if (hint.Which() != RES_TXTATR_AUTOFMT) {
310  return retval;
311  }
312  const SwFormatAutoFormat& afmt = hint.GetAutoFormat();
313  SfxItemIter aIter( *afmt.GetStyleHandle());
314  const SfxPoolItem* pItem = aIter.GetCurItem();
315  do
316  {
317  if (pItem->Which() == RES_CHRATR_ESCAPEMENT ||
318  pItem->Which() == RES_CHRATR_POSTURE ||
319  pItem->Which() == RES_CHRATR_CJK_POSTURE ||
320  pItem->Which() == RES_CHRATR_CTL_POSTURE)
321  {
322  retval->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
323  }
324  pItem = aIter.NextItem();
325  } while (pItem);
326  return retval;
327 }
328 
331  sal_Int32 & rOffset,
332  SwTextNode const& rNode,
333  ToxWhitespaceStripper const& rStripper,
334  SwAttrPool & rPool,
335  SwRootFrame const*const pLayout)
336 {
337  // note: this *must* use the same flags as SwTextNode::GetExpandText()
338  // or indexes will be off!
340  if (pLayout && pLayout->IsHideRedlines())
341  {
342  eMode |= ExpandMode::HideDeletions;
343  }
344  ModelToViewHelper aConversionMap(rNode, pLayout, eMode);
345  if (SwpHints const*const pHints = rNode.GetpSwpHints())
346  {
347  for (size_t i = 0; i < pHints->Count(); ++i)
348  {
349  const SwTextAttr* pHint = pHints->Get(i);
350  std::shared_ptr<SfxItemSet> attributesToClone =
351  CollectAttributesForTox(*pHint, rPool);
352  if (attributesToClone->Count() <= 0) {
353  continue;
354  }
355 
356  // sw_redlinehide: due to the ... interesting ... multi-level index
357  // mapping going on here, can't use the usual merged attr iterators :(
358 
359  sal_Int32 const nStart(aConversionMap.ConvertToViewPosition(pHint->GetStart()));
360  sal_Int32 const nEnd(aConversionMap.ConvertToViewPosition(pHint->GetAnyEnd()));
361  if (nStart != nEnd) // might be in delete redline, and useless anyway
362  {
363  std::unique_ptr<SwFormatAutoFormat> pClone(pHint->GetAutoFormat().Clone());
364  pClone->SetStyleHandle(attributesToClone);
365  rResult.autoFormats.push_back(std::move(pClone));
366  // note the rStripper is on the whole merged text, so need rOffset
367  rResult.startPositions.push_back(
368  rStripper.GetPositionInStrippedString(rOffset + nStart));
369  rResult.endPositions.push_back(
370  rStripper.GetPositionInStrippedString(rOffset + nEnd));
371  }
372  }
373  }
374  rOffset += aConversionMap.getViewText().getLength();
375 }
376 
379  SwAttrPool& pool, SwRootFrame const*const pLayout)
380 {
382  ToxWhitespaceStripper stripper(source.GetText().sText);
383  result.text = stripper.GetStrippedString();
384 
385  // FIXME: there is a pre-existing problem that the index mapping of the
386  // attributes only works if the paragraph is fully selected
387  if (!source.IsFullPara() || source.aTOXSources.empty())
388  return result;
389 
390  const SwTextNode* pSrc = source.aTOXSources.front().pNd->GetTextNode();
391  if (!pSrc)
392  {
393  return result;
394  }
395 
396  sal_Int32 nOffset(0);
397  GetAttributesForNode(result, nOffset, *pSrc, stripper, pool, pLayout);
398  if (pLayout && pLayout->HasMergedParas())
399  {
400  if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(pSrc->getLayoutFrame(pLayout)))
401  {
402  if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
403  {
404  // pSrc already copied above
405  assert(pSrc == pMerged->pParaPropsNode);
406  for (sal_uLong i = pSrc->GetIndex() + 1;
407  i <= pMerged->pLastNode->GetIndex(); ++i)
408  {
409  SwNode *const pTmp(pSrc->GetNodes()[i]);
410  if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
411  {
412  GetAttributesForNode(result, nOffset,
413  *pTmp->GetTextNode(), stripper, pool, pLayout);
414  }
415  }
416  }
417  }
418  }
419 
420  return result;
421 }
422 
423 /*static*/ void
425 {
426  sal_Int32 offset = targetNode.GetText().getLength();
427  SwIndex aIdx(&targetNode, offset);
428  targetNode.InsertText(htt.text, aIdx);
429  for (size_t i=0; i < htt.autoFormats.size(); ++i) {
430  targetNode.InsertItem(*htt.autoFormats.at(i),
431  htt.startPositions.at(i) + offset,
432  htt.endPositions.at(i) + offset);
433  }
434 }
435 
436 /*static*/ OUString
438 {
439  if (numberOfToxSources == 0) {
440  return OUString();
441  }
442  OUStringBuffer retval;
443  // Place holder for the PageNumber; we only respect the first one
444  retval.append(C_NUM_REPL);
445  for (size_t i = 1; i < numberOfToxSources; ++i) {
446  retval.append(SwTOXMark::S_PAGE_DELI);
447  retval.append(C_NUM_REPL);
448  }
449  retval.append(C_END_PAGE_NUM);
450  return retval.makeStringAndClear();
451 }
452 
453 /*virtual*/ SwChapterField
455  const SwFormToken* chapterToken, const SwContentFrame* contentFrame,
456  const SwContentNode* contentNode) const
457 {
458  assert(chapterToken);
459  assert(chapterToken->nOutlineLevel >= 1);
460 
461  SwChapterField retval(chapterFieldType, chapterToken->nChapterFormat);
462  retval.SetLevel(static_cast<sal_uInt8>(chapterToken->nOutlineLevel - 1));
463  // #i53420#
464  retval.ChangeExpansion(*contentFrame, contentNode, true);
465  return retval;
466 }
467 } // end namespace sw
468 
469 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:289
std::shared_ptr< ToxLinkProcessor > mLinkProcessor
const sal_Unicode C_NUM_REPL
Definition: tox.cxx:46
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
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:772
const OUString & GetText() const
Definition: ndtxt.hxx:216
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:4883
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:224
sal_uInt16 nOutlineLevel
Definition: tox.hxx:255
Definition: tox.hxx:316
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:699
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)
static OUString GetSourceURL(const OUString &rText)
Gets the URL of the underlying SwAuthEntry, ignoring its page number.
Definition: txmsrt.cxx:850
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:4091
chapter number without post-/prefix and title
Definition: chpfld.hxx:36
virtual bool IsFullPara() const
Definition: txmsrt.cxx:215
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:957
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:2798
sal_uInt16 nChapterFormat
Definition: tox.hxx:254
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:188
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
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:328
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:2268
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:79
static constexpr OUStringLiteral S_PAGE_DELI
Definition: tox.hxx:172
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:249
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:3106
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:220
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:1320
Represents one row in the bibliography table.
Definition: txmsrt.hxx:283
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