LibreOffice Module sw (master) 1
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
sw::DefaultToxTabStopTokenHandler Class Referencefinal

The default implementation of ToxTabStopTokenHandler. More...

#include <ToxTabStopTokenHandler.hxx>

Inheritance diagram for sw::DefaultToxTabStopTokenHandler:
[legend]
Collaboration diagram for sw::DefaultToxTabStopTokenHandler:
[legend]

Public Types

enum  TabStopReferencePolicy {
  TABSTOPS_RELATIVE_TO_INDENT ,
  TABSTOPS_RELATIVE_TO_PAGE
}
 

Public Member Functions

 DefaultToxTabStopTokenHandler (SwNodeOffset indexOfSectionNode, const SwPageDesc &defaultPageDescription, bool tabPositionIsRelativeToParagraphIndent, TabStopReferencePolicy referencePolicy)
 
ToxTabStopTokenHandler::HandledTabStopToken HandleTabStopToken (const SwFormToken &aToken, const SwTextNode &targetNode, const SwRootFrame *currentLayout) const override
 Handle a tab stop token. More...
 
- Public Member Functions inherited from sw::ToxTabStopTokenHandler
virtual ~ToxTabStopTokenHandler ()
 
virtual HandledTabStopToken HandleTabStopToken (const SwFormToken &aToken, const SwTextNode &targetNode, const SwRootFrame *currentLayout) const =0
 Handle a tab stop token. More...
 

Private Member Functions

tools::Long CalculatePageMarginFromPageDescription (const SwTextNode &targetNode) const
 Calculate the page margin from the page description. More...
 

Static Private Member Functions

static bool CanUseLayoutRectangle (const SwTextNode &targetNode, const SwRootFrame *currentLayout)
 Test whether the page layout can be obtained by a layout rectangle. More...
 

Private Attributes

SwNodeOffset mIndexOfSectionNode
 
const SwPageDescmDefaultPageDescription
 
bool mTabPositionIsRelativeToParagraphIndent
 
TabStopReferencePolicy mTabStopReferencePolicy
 

Detailed Description

The default implementation of ToxTabStopTokenHandler.

Definition at line 53 of file ToxTabStopTokenHandler.hxx.

Member Enumeration Documentation

◆ TabStopReferencePolicy

Enumerator
TABSTOPS_RELATIVE_TO_INDENT 
TABSTOPS_RELATIVE_TO_PAGE 

Definition at line 57 of file ToxTabStopTokenHandler.hxx.

Constructor & Destructor Documentation

◆ DefaultToxTabStopTokenHandler()

sw::DefaultToxTabStopTokenHandler::DefaultToxTabStopTokenHandler ( SwNodeOffset  indexOfSectionNode,
const SwPageDesc defaultPageDescription,
bool  tabPositionIsRelativeToParagraphIndent,
TabStopReferencePolicy  referencePolicy 
)
Parameters
indexOfSectionNodeThe index of the section node. It is needed to determine whether a page description was given by a node before the tox section.
defaultPageDescriptionWhich page description shall be used if we do not find one or the found page description was provided by a node before the tox section
tabPositionIsRelativeToParagraphIndentWhether the tab position is relative to the paragraph indent. (toxForm.IsRelTabPos() is true or false.)
tabstopReferencePolicyHow tab stops are positioned. (#i21237) The default behavior is to place tab stops relative to the page.

Definition at line 29 of file ToxTabStopTokenHandler.cxx.

Member Function Documentation

◆ CalculatePageMarginFromPageDescription()

tools::Long sw::DefaultToxTabStopTokenHandler::CalculatePageMarginFromPageDescription ( const SwTextNode targetNode) const
private

◆ CanUseLayoutRectangle()

bool sw::DefaultToxTabStopTokenHandler::CanUseLayoutRectangle ( const SwTextNode targetNode,
const SwRootFrame currentLayout 
)
staticprivate

Test whether the page layout can be obtained by a layout rectangle.

Is used to determine how to find tab stop position.

Definition at line 106 of file ToxTabStopTokenHandler.cxx.

References SwFrame::FindPageFrame(), SwContentNode::getLayoutFrame(), SwPageFrame::GetPageDesc(), and RES_PAGEDESC().

Referenced by HandleTabStopToken().

◆ HandleTabStopToken()

ToxTabStopTokenHandler::HandledTabStopToken sw::DefaultToxTabStopTokenHandler::HandleTabStopToken ( const SwFormToken aToken,
const SwTextNode targetNode,
const SwRootFrame currentLayout 
) const
overridevirtual

Handle a tab stop token.

If the token contains tab alignment information, that is used to create the SvxTabStop. Else, the information about the tab stop is taken from a page description. Depending on the TabStopReferencePolicy provided in the constructor, the method behaves differently when deriving the tab stop position.

Implements sw::ToxTabStopTokenHandler.

Definition at line 42 of file ToxTabStopTokenHandler.cxx.

References SwFormToken::bWithTab, CalculatePageMarginFromPageDescription(), CanUseLayoutRectangle(), cDfltDecimalChar, SwFormToken::cTabFillChar, SwFormToken::eTabAlign, SwContentNode::FindLayoutRect(), SvxLRSpaceItem::GetLeft(), SwFormat::GetLRSpace(), SwTextNode::GetTextColl(), SvxLRSpaceItem::GetTextFirstLineOffset(), SvxLRSpaceItem::GetTextLeft(), SwRect::IsEmpty(), mTabPositionIsRelativeToParagraphIndent, mTabStopReferencePolicy, nRightMargin, SwFormToken::nTabStopPosition, RES_LR_SPACE(), result, TABSTOPS_RELATIVE_TO_INDENT, and SwRect::Width().

Member Data Documentation

◆ mDefaultPageDescription

const SwPageDesc& sw::DefaultToxTabStopTokenHandler::mDefaultPageDescription
private

Definition at line 105 of file ToxTabStopTokenHandler.hxx.

Referenced by CalculatePageMarginFromPageDescription().

◆ mIndexOfSectionNode

SwNodeOffset sw::DefaultToxTabStopTokenHandler::mIndexOfSectionNode
private

Definition at line 104 of file ToxTabStopTokenHandler.hxx.

Referenced by CalculatePageMarginFromPageDescription().

◆ mTabPositionIsRelativeToParagraphIndent

bool sw::DefaultToxTabStopTokenHandler::mTabPositionIsRelativeToParagraphIndent
private

Definition at line 106 of file ToxTabStopTokenHandler.hxx.

Referenced by HandleTabStopToken().

◆ mTabStopReferencePolicy

TabStopReferencePolicy sw::DefaultToxTabStopTokenHandler::mTabStopReferencePolicy
private

Definition at line 107 of file ToxTabStopTokenHandler.hxx.

Referenced by HandleTabStopToken().


The documentation for this class was generated from the following files: