LibreOffice Module sw (master) 1
|
This class generates text for the entries of a table of x. More...
#include <ToxTextGenerator.hxx>
Classes | |
struct | HandledTextToken |
A handled text token. More... | |
Public Member Functions | |
ToxTextGenerator (const SwForm &toxForm, std::shared_ptr< ToxTabStopTokenHandler > tabStopHandler) | |
virtual | ~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). More... | |
Private Member Functions | |
OUString | HandleChapterToken (const SwTOXSortTabBase &rBase, const SwFormToken &aToken, SwRootFrame const *pLayout) const |
Handle a chapter token. More... | |
OUString | GenerateTextForChapterToken (const SwFormToken &chapterToken, const SwContentFrame *contentFrame, const SwContentNode *contentNode, SwRootFrame const *pLayout) const |
Generate the text for a chapter token. More... | |
virtual SwChapterField | ObtainChapterField (SwChapterFieldType *chapterFieldType, const SwFormToken *chapterToken, const SwContentFrame *contentFrame, const SwContentNode *contentNode) const |
Obtain a ChapterField to use for the text generation. More... | |
Static Private Member Functions | |
static void | GetAttributesForNode (HandledTextToken &rResult, sal_Int32 &rOffset, SwTextNode const &rNode, ToxWhitespaceStripper const &rStripper, SwAttrPool &rPool, SwRootFrame const *const pLayout) |
static HandledTextToken | HandleTextToken (const SwTOXSortTabBase &source, SwAttrPool &attrPool, SwRootFrame const *const pLayout) |
Append text (and selected attributes) to a target node. More... | |
static void | ApplyHandledTextToken (const HandledTextToken &htt, SwTextNode &targetNode) |
Applies the result of a handled text token to a target node. More... | |
static OUString | ConstructPageNumberPlaceholder (size_t numberOfToxSources) |
Handle a page number token. More... | |
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. More... | |
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. More... | |
Private Attributes | |
const SwForm & | mToxForm |
std::shared_ptr< ToxLinkProcessor > | mLinkProcessor |
std::shared_ptr< ToxTabStopTokenHandler > | mTabStopTokenHandler |
Friends | |
class | ::ToxTextGeneratorTest |
This class generates text for the entries of a table of x.
You can control its behavior by calling and specifying the desired behavior.
Definition at line 58 of file ToxTextGenerator.hxx.
sw::ToxTextGenerator::ToxTextGenerator | ( | const SwForm & | toxForm, |
std::shared_ptr< ToxTabStopTokenHandler > | tabStopHandler | ||
) |
Definition at line 111 of file ToxTextGenerator.cxx.
References make_shared().
|
virtual |
Definition at line 118 of file ToxTextGenerator.cxx.
|
staticprivate |
Applies the result of a handled text token to a target node.
Definition at line 432 of file ToxTextGenerator.cxx.
References sw::ToxTextGenerator::HandledTextToken::autoFormats, sw::ToxTextGenerator::HandledTextToken::endPositions, SwTextNode::GetText(), i, SwTextNode::InsertItem(), SwTextNode::InsertText(), sw::ToxTextGenerator::HandledTextToken::startPositions, and sw::ToxTextGenerator::HandledTextToken::text.
Referenced by GenerateText().
|
staticprivate |
Collect the attributes of a hint that shall be copied over to the TOX.
Some text attributes are used in the TOX entries. This method defines which attributes are used.
hint | The hint from which the attributes are taken |
pool | The attribute pool for the new items |
Definition at line 314 of file ToxTextGenerator.cxx.
References SfxPoolItem::Clone(), SwTextAttr::GetAutoFormat(), SfxItemIter::GetCurItem(), SwFormatAutoFormat::GetStyleHandle(), SfxItemIter::NextItem(), RES_CHRATR_CJK_POSTURE(), RES_CHRATR_CTL_POSTURE(), RES_CHRATR_ESCAPEMENT(), RES_CHRATR_POSTURE(), RES_TXTATR_AUTOFMT(), SfxPoolItem::Which(), and SwTextAttr::Which().
Referenced by GetAttributesForNode().
|
staticprivate |
Handle a page number token.
Will return a string of numberOfToxSources
concatenated '@' signs, separated by commas, and finished by a '~'. (The '@' sign is the magic character C_NUM_REPL, the '~' sign is the magic character C_END_PAGE_NUM.
Definition at line 445 of file ToxTextGenerator.cxx.
References C_END_PAGE_NUM, C_NUM_REPL, i, and SwTOXMark::S_PAGE_DELI.
Referenced by GenerateText().
void sw::ToxTextGenerator::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).
This method will process the entries in entries
, starting at indexOfEntryToProcess
and process numberOfEntriesToProcess
entries.
Definition at line 171 of file ToxTextGenerator.cxx.
References ApplyHandledTextToken(), SwTOXSortTabBase::aTOXSources, aURL, AUTH_FIELD_URL, CF_NUMBER, ConstructPageNumberPlaceholder(), DONTEXPAND, SwTOXSortTabBase::FillText(), SwDoc::FindCharFormatByName(), SwDoc::GetAttrPool(), IDocumentStylePoolAccess::GetCharFormatFromPool(), IDocumentLayoutAccess::GetCurrentLayout(), SwForm::GetFormMax(), SwDoc::getIDocumentLayoutAccess(), SwDoc::getIDocumentStylePoolAccess(), SwTOXSortTabBase::GetLevel(), GetNumStringOfFirstNode(), SwForm::GetPattern(), SwTOXAuthority::GetSourceURL(), SwTextNode::GetText(), SwTOXSortTabBase::GetURL(), HandleChapterToken(), HandleTextToken(), i, SvxTabStopItem::Insert(), SwTextNode::InsertItem(), MAXLEVEL, mLinkProcessor, mTabStopTokenHandler, mToxForm, nIndex, RES_PARATR_TABSTOP(), SwTextNode::SetAttr(), SwResId(), sw::ToxTabStopTokenHandler::HandledTabStopToken::tabStop, sw::ToxTabStopTokenHandler::HandledTabStopToken::text, TOKEN_AUTHORITY, TOKEN_CHAPTER_INFO, TOKEN_END, TOKEN_ENTRY, TOKEN_ENTRY_NO, TOKEN_ENTRY_TEXT, TOKEN_LINK_END, TOKEN_LINK_START, TOKEN_PAGE_NUMS, TOKEN_TAB_STOP, and TOKEN_TEXT.
Referenced by SwTOXBaseSection::Update().
|
private |
Generate the text for a chapter token.
Definition at line 145 of file ToxTextGenerator.cxx.
References CF_NUM_NOPREPST_TITLE, CF_NUM_TITLE, CF_NUMBER, CF_NUMBER_NOPREPST, CF_TITLE, SwChapterField::GetNumber(), SwChapterField::GetTitle(), SwFormToken::nChapterFormat, and ObtainChapterField().
Referenced by HandleChapterToken().
|
staticprivate |
Definition at line 337 of file ToxTextGenerator.cxx.
References sw::ToxTextGenerator::HandledTextToken::autoFormats, SwFormatAutoFormat::Clone(), CollectAttributesForTox(), ModelToViewHelper::ConvertToViewPosition(), eMode, sw::ToxTextGenerator::HandledTextToken::endPositions, ExpandFields, SwTextAttr::GetAnyEnd(), SwTextAttr::GetAutoFormat(), sw::ToxWhitespaceStripper::GetPositionInStrippedString(), SwTextNode::GetpSwpHints(), SwTextAttr::GetStart(), ModelToViewHelper::getViewText(), HideDeletions, HideFieldmarkCommands, i, SwRootFrame::IsHideRedlines(), and sw::ToxTextGenerator::HandledTextToken::startPositions.
Referenced by HandleTextToken().
|
staticprivate |
This method will call GetNumStringOfFirstNode() of the first node in the provided SwTOXSortTabBase.
The parameters bUsePrefix
and nLevel
are passed to SwTextNode::GetNumString()
Definition at line 72 of file ToxTextGenerator.cxx.
References SwTOXSortTabBase::aTOXSources, SwTextNode::GetActualListLevel(), SwTextNode::GetNumRule(), SwTextNode::GetNumString(), sw::GetParaPropsNode(), SwRootFrame::HasMergedParas(), MAXLEVEL, and SwTOXSortTabBase::pTextMark.
Referenced by GenerateText().
|
private |
Handle a chapter token.
Definition at line 122 of file ToxTextGenerator.cxx.
References SwTOXSortTabBase::aTOXSources, GenerateTextForChapterToken(), and SwContentNode::getLayoutFrame().
Referenced by GenerateText().
|
staticprivate |
Append text (and selected attributes) to a target node.
Will take the text of source
, and return the text and the attributes which should be added to the target text node.
Definition at line 386 of file ToxTextGenerator.cxx.
References SwTOXSortTabBase::aTOXSources, GetAttributesForNode(), SwNode::GetIndex(), SwContentNode::getLayoutFrame(), SwNode::GetNodes(), SwNode::GetRedlineMergeFlag(), sw::ToxWhitespaceStripper::GetStrippedString(), SwTOXSortTabBase::GetText(), SwNode::GetTextNode(), SwRootFrame::HasMergedParas(), i, SwTOXSortTabBase::IsFullPara(), SwNode::NonFirst, result, and TextAndReading::sText.
Referenced by GenerateText().
|
privatevirtual |
Obtain a ChapterField to use for the text generation.
Definition at line 461 of file ToxTextGenerator.cxx.
References SwChapterField::ChangeExpansion(), SwFormToken::nChapterFormat, SwFormToken::nOutlineLevel, and SwChapterField::SetLevel().
Referenced by GenerateTextForChapterToken().
|
friend |
Definition at line 168 of file ToxTextGenerator.hxx.
|
private |
Definition at line 79 of file ToxTextGenerator.hxx.
Referenced by GenerateText().
|
private |
Definition at line 80 of file ToxTextGenerator.hxx.
Referenced by GenerateText().
|
private |
Definition at line 78 of file ToxTextGenerator.hxx.
Referenced by GenerateText().