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
50namespace {
51
52bool 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
65namespace sw {
66
67OUString
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
117OUString
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
140OUString
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) + " " + aField.GetTitle(pLayout);
158 } else if (CF_TITLE == chapterToken.nChapterFormat) {
159 retval += aField.GetTitle(pLayout);
160 }
161 return retval;
162}
163
164// Add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control,
165// which page description is used, no appropriate one is found.
166void
168 std::unordered_map<OUString, int> & rMarkURLs,
169 const std::vector<std::unique_ptr<SwTOXSortTabBase>> &entries,
170 sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess,
171 SwRootFrame const*const pLayout)
172{
173 // pTOXNd is only set at the first mark
174 SwTextNode* pTOXNd = const_cast<SwTextNode*>(entries.at(indexOfEntryToProcess)->pTOXNd);
175 // FIXME this operates directly on the node text
176 OUString & rText = const_cast<OUString&>(pTOXNd->GetText());
177 rText.clear();
178 for(sal_uInt16 nIndex = indexOfEntryToProcess; nIndex < indexOfEntryToProcess + numberOfEntriesToProcess; nIndex++)
179 {
180 if(nIndex > indexOfEntryToProcess)
181 rText += ", "; // comma separation
182 // Initialize String with the Pattern from the form
183 const SwTOXSortTabBase& rBase = *entries.at(nIndex);
184 sal_uInt16 nLvl = rBase.GetLevel();
185 OSL_ENSURE( nLvl < mToxForm.GetFormMax(), "invalid FORM_LEVEL");
186
187 SvxTabStopItem aTStops( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
188 // create an enumerator
189 // #i21237#
190 SwFormTokens aPattern = mToxForm.GetPattern(nLvl);
191 // remove text from node
192 for(const auto& aToken : aPattern) // #i21237#
193 {
194 sal_Int32 nStartCharStyle = rText.getLength();
195 OUString aCharStyleName = aToken.sCharStyleName;
196 switch( aToken.eTokenType )
197 {
198 case TOKEN_ENTRY_NO:
199 // for TOC numbering
200 rText += GetNumStringOfFirstNode(rBase,
201 aToken.nChapterFormat == CF_NUMBER,
202 static_cast<sal_uInt8>(aToken.nOutlineLevel - 1), pLayout);
203 break;
204
205 case TOKEN_ENTRY_TEXT: {
206 HandledTextToken htt = HandleTextToken(rBase, pDoc->GetAttrPool(), pLayout);
207 ApplyHandledTextToken(htt, *pTOXNd);
208 }
209 break;
210
211 case TOKEN_ENTRY:
212 {
213 // for TOC numbering
214 rText += GetNumStringOfFirstNode(rBase, true, MAXLEVEL, pLayout);
215 HandledTextToken htt = HandleTextToken(rBase, pDoc->GetAttrPool(), pLayout);
216 ApplyHandledTextToken(htt, *pTOXNd);
217 }
218 break;
219
220 case TOKEN_TAB_STOP: {
222 mTabStopTokenHandler->HandleTabStopToken(aToken, *pTOXNd, pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
223 rText += htst.text;
224 aTStops.Insert(htst.tabStop);
225 break;
226 }
227
228 case TOKEN_TEXT:
229 rText += aToken.sText;
230 break;
231
232 case TOKEN_PAGE_NUMS:
233 rText += ConstructPageNumberPlaceholder(rBase.aTOXSources.size());
234 break;
235
237 rText += HandleChapterToken(rBase, aToken, pLayout);
238 break;
239
240 case TOKEN_LINK_START:
241 mLinkProcessor->StartNewLink(rText.getLength(), aToken.sCharStyleName);
242 break;
243
244 case TOKEN_LINK_END:
245 {
246 auto [url, isMark] = rBase.GetURL(pLayout);
247 if (isMark)
248 {
249 auto [iter, _] = rMarkURLs.emplace(url, 0);
250 (void) _; // sigh... ignore it more explicitly
251 ++iter->second;
252 url = "#" + OUString::number(iter->second) + url;
253 }
254 mLinkProcessor->CloseLink(rText.getLength(), url, /*bRelative=*/true);
255 }
256 break;
257
258 case TOKEN_AUTHORITY:
259 {
260 ToxAuthorityField eField = static_cast<ToxAuthorityField>(aToken.nAuthorityField);
261 SwIndex aIdx( pTOXNd, rText.getLength() );
263 {
264 aCharStyleName = SwResId(STR_POOLCHR_INET_NORMAL);
265 mLinkProcessor->StartNewLink(rText.getLength(), aCharStyleName);
266 }
267 rBase.FillText( *pTOXNd, aIdx, o3tl::narrowing<sal_uInt16>(eField), pLayout );
269 {
270 // Get the absolute URL, the text may be a relative one.
271 const auto& rAuthority = static_cast<const SwTOXAuthority&>(rBase);
273 rAuthority.GetText(AUTH_FIELD_URL, pLayout));
274
275 mLinkProcessor->CloseLink(rText.getLength(), aURL, /*bRelative=*/false);
276 }
277 }
278 break;
279 case TOKEN_END: break;
280 }
281
282 if (!aCharStyleName.isEmpty())
283 {
284 SwCharFormat* pCharFormat;
285 if( USHRT_MAX != aToken.nPoolId )
286 pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( aToken.nPoolId );
287 else
288 pCharFormat = pDoc->FindCharFormatByName(aCharStyleName);
289
290 if (pCharFormat)
291 {
292 SwFormatCharFormat aFormat( pCharFormat );
293 pTOXNd->InsertItem( aFormat, nStartCharStyle,
294 rText.getLength(), SetAttrMode::DONTEXPAND );
295 }
296 }
297 }
298
299 pTOXNd->SetAttr( aTStops );
300 }
301 mLinkProcessor->InsertLinkAttributes(*pTOXNd);
302}
303
304/*static*/ std::shared_ptr<SfxItemSet>
306{
307 auto retval = std::make_shared<SfxItemSet>(pool);
308 if (hint.Which() != RES_TXTATR_AUTOFMT) {
309 return retval;
310 }
311 const SwFormatAutoFormat& afmt = hint.GetAutoFormat();
312 SfxItemIter aIter( *afmt.GetStyleHandle());
313 const SfxPoolItem* pItem = aIter.GetCurItem();
314 do
315 {
316 if (pItem->Which() == RES_CHRATR_ESCAPEMENT ||
317 pItem->Which() == RES_CHRATR_POSTURE ||
318 pItem->Which() == RES_CHRATR_CJK_POSTURE ||
319 pItem->Which() == RES_CHRATR_CTL_POSTURE)
320 {
321 retval->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
322 }
323 pItem = aIter.NextItem();
324 } while (pItem);
325 return retval;
326}
327
330 sal_Int32 & rOffset,
331 SwTextNode const& rNode,
332 ToxWhitespaceStripper const& rStripper,
333 SwAttrPool & rPool,
334 SwRootFrame const*const pLayout)
335{
336 // note: this *must* use the same flags as SwTextNode::GetExpandText()
337 // or indexes will be off!
339 if (pLayout && pLayout->IsHideRedlines())
340 {
342 }
343 ModelToViewHelper aConversionMap(rNode, pLayout, eMode);
344 if (SwpHints const*const pHints = rNode.GetpSwpHints())
345 {
346 for (size_t i = 0; i < pHints->Count(); ++i)
347 {
348 const SwTextAttr* pHint = pHints->Get(i);
349 std::shared_ptr<SfxItemSet> attributesToClone =
350 CollectAttributesForTox(*pHint, rPool);
351 if (attributesToClone->Count() <= 0) {
352 continue;
353 }
354
355 // sw_redlinehide: due to the ... interesting ... multi-level index
356 // mapping going on here, can't use the usual merged attr iterators :(
357
358 sal_Int32 const nStart(aConversionMap.ConvertToViewPosition(pHint->GetStart()));
359 sal_Int32 const nEnd(aConversionMap.ConvertToViewPosition(pHint->GetAnyEnd()));
360 if (nStart != nEnd) // might be in delete redline, and useless anyway
361 {
362 std::unique_ptr<SwFormatAutoFormat> pClone(pHint->GetAutoFormat().Clone());
363 pClone->SetStyleHandle(attributesToClone);
364 rResult.autoFormats.push_back(std::move(pClone));
365 // note the rStripper is on the whole merged text, so need rOffset
366 rResult.startPositions.push_back(
367 rStripper.GetPositionInStrippedString(rOffset + nStart));
368 rResult.endPositions.push_back(
369 rStripper.GetPositionInStrippedString(rOffset + nEnd));
370 }
371 }
372 }
373 rOffset += aConversionMap.getViewText().getLength();
374}
375
378 SwAttrPool& pool, SwRootFrame const*const pLayout)
379{
381 ToxWhitespaceStripper stripper(source.GetText().sText);
382 result.text = stripper.GetStrippedString();
383
384 // FIXME: there is a pre-existing problem that the index mapping of the
385 // attributes only works if the paragraph is fully selected
386 if (!source.IsFullPara() || source.aTOXSources.empty())
387 return result;
388
389 const SwTextNode* pSrc = source.aTOXSources.front().pNd->GetTextNode();
390 if (!pSrc)
391 {
392 return result;
393 }
394
395 sal_Int32 nOffset(0);
396 GetAttributesForNode(result, nOffset, *pSrc, stripper, pool, pLayout);
397 if (pLayout && pLayout->HasMergedParas())
398 {
399 if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(pSrc->getLayoutFrame(pLayout)))
400 {
401 if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
402 {
403 // pSrc already copied above
404 assert(pSrc == pMerged->pParaPropsNode);
405 for (SwNodeOffset i = pSrc->GetIndex() + 1;
406 i <= pMerged->pLastNode->GetIndex(); ++i)
407 {
408 SwNode *const pTmp(pSrc->GetNodes()[i]);
410 {
412 *pTmp->GetTextNode(), stripper, pool, pLayout);
413 }
414 }
415 }
416 }
417 }
418
419 return result;
420}
421
422/*static*/ void
424{
425 sal_Int32 offset = targetNode.GetText().getLength();
426 SwIndex aIdx(&targetNode, offset);
427 targetNode.InsertText(htt.text, aIdx);
428 for (size_t i=0; i < htt.autoFormats.size(); ++i) {
429 targetNode.InsertItem(*htt.autoFormats.at(i),
430 htt.startPositions.at(i) + offset,
431 htt.endPositions.at(i) + offset);
432 }
433}
434
435/*static*/ OUString
437{
438 if (numberOfToxSources == 0) {
439 return OUString();
440 }
441 OUStringBuffer retval;
442 // Place holder for the PageNumber; we only respect the first one
443 retval.append(C_NUM_REPL);
444 for (size_t i = 1; i < numberOfToxSources; ++i) {
445 retval.append(SwTOXMark::S_PAGE_DELI);
446 retval.append(C_NUM_REPL);
447 }
448 retval.append(C_END_PAGE_NUM);
449 return retval.makeStringAndClear();
450}
451
452/*virtual*/ SwChapterField
454 const SwFormToken* chapterToken, const SwContentFrame* contentFrame,
455 const SwContentNode* contentNode) const
456{
457 assert(chapterToken);
458 assert(chapterToken->nOutlineLevel >= 1);
459
460 SwChapterField retval(chapterFieldType, chapterToken->nChapterFormat);
461 retval.SetLevel(static_cast<sal_uInt8>(chapterToken->nOutlineLevel - 1));
462 // #i53420#
463 retval.ChangeExpansion(*contentFrame, contentNode, true);
464 return retval;
465}
466} // end namespace sw
467
468/* 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:58
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1204
Definition: doc.hxx:188
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:770
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
Definition: tox.hxx:312
const SwFormTokens & GetPattern(sal_uInt16 nLevel) const
Definition: tox.cxx:943
sal_uInt16 GetFormMax() const
Definition: tox.hxx:681
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
virtual SwFormatAutoFormat * Clone(SfxItemPool *pPool=nullptr) const override
Definition: fmtatr2.cxx:126
Marks a character position inside a document model node.
Definition: index.hxx:34
Marks a node in the document model.
Definition: ndindex.hxx:31
Base class of the Writer document model elements.
Definition: node.hxx:83
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:871
SwNodeOffset GetIndex() const
Definition: node.hxx:292
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:705
Merge GetRedlineMergeFlag() const
Definition: node.hxx:99
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
bool HasMergedParas() const
Definition: rootfrm.hxx:425
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:421
static constexpr OUStringLiteral S_PAGE_DELI
Definition: tox.hxx:167
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:163
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:84
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:4939
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2833
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:4141
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:3160
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:228
const OUString & GetText() const
Definition: ndtxt.hxx:220
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2296
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 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.
static HandledTextToken HandleTextToken(const SwTOXSortTabBase &source, SwAttrPool &attrPool, SwRootFrame const *const pLayout)
Append text (and selected attributes) to a target node.
std::shared_ptr< ToxLinkProcessor > mLinkProcessor
ToxTextGenerator(const SwForm &toxForm, std::shared_ptr< ToxTabStopTokenHandler > const &tabStopHandler)
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.
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.
int i
std::shared_ptr< T > make_shared(Args &&... args)
Dialog to specify the properties of date form field.
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:330
eField
sal_uInt16 nChapterFormat
Definition: tox.hxx:249
sal_uInt16 nOutlineLevel
Definition: tox.hxx:250
Represents one row in the bibliography table.
Definition: txmsrt.hxx:285
static OUString GetSourceURL(const OUString &rText)
Gets the URL of the underlying SwAuthEntry, ignoring its page number.
Definition: txmsrt.cxx:850
Class for sorting directories.
Definition: txmsrt.hxx:122
virtual sal_uInt16 GetLevel() const =0
std::vector< SwTOXSource > aTOXSources
Definition: txmsrt.hxx:126
virtual std::pair< OUString, bool > GetURL(SwRootFrame const *const pLayout) const
Definition: txmsrt.cxx:188
TextAndReading const & GetText() const
Definition: txmsrt.hxx:177
virtual bool IsFullPara() const
Definition: txmsrt.cxx:215
const SwTextTOXMark * pTextMark
Definition: txmsrt.hxx:129
virtual void FillText(SwTextNode &rNd, const SwIndex &rInsPos, sal_uInt16 nAuthField, SwRootFrame const *pLayout) const
Definition: txmsrt.cxx:220
OUString sText
Definition: txmsrt.hxx:61
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:961
std::vector< std::unique_ptr< SwFormatAutoFormat > > autoFormats
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
const sal_Unicode C_NUM_REPL
Definition: tox.cxx:45
const sal_Unicode C_END_PAGE_NUM
Definition: tox.cxx:46
@ TOKEN_ENTRY_NO
Definition: tox.hxx:228
@ TOKEN_LINK_START
Definition: tox.hxx:235
@ TOKEN_TEXT
Definition: tox.hxx:232
@ TOKEN_AUTHORITY
Definition: tox.hxx:237
@ TOKEN_PAGE_NUMS
Definition: tox.hxx:233
@ TOKEN_ENTRY
Definition: tox.hxx:230
@ TOKEN_END
Definition: tox.hxx:238
@ TOKEN_TAB_STOP
Definition: tox.hxx:231
@ TOKEN_ENTRY_TEXT
Definition: tox.hxx:229
@ TOKEN_CHAPTER_INFO
Definition: tox.hxx:234
@ TOKEN_LINK_END
Definition: tox.hxx:236
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:284
ToxAuthorityField
Definition: toxe.hxx:83
@ AUTH_FIELD_URL
Definition: toxe.hxx:110
unsigned char sal_uInt8
Any result