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