LibreOffice Module sw (master) 1
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
ModelToViewHelper Class Reference

#include <modeltoviewhelper.hxx>

Classes

struct  ConversionMapEntry
 For each expanded/hidden portion in the model string, there is an entry in the conversion map. More...
 
struct  ModelPosition
 This struct defines a position in the model string. More...
 

Public Member Functions

 ModelToViewHelper (const SwTextNode &rNode, SwRootFrame const *pLayout, ExpandMode eMode=ExpandMode::ExpandFields|ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands|ExpandMode::ReplaceMode)
 
 ModelToViewHelper ()
 
sal_Int32 ConvertToViewPosition (sal_Int32 nModelPos) const
 Converts a model position into a view position. More...
 
ModelPosition ConvertToModelPosition (sal_Int32 nViewPos) const
 Converts a view position into a model position. More...
 
const OUString & getViewText () const
 
std::vector< sal_Int32 > const & getFieldPositions () const
 
std::vector< sal_Int32 > const & getFootnotePositions () const
 

Private Types

typedef std::vector< ConversionMapEntryConversionMap
 

Private Attributes

ConversionMap m_aMap
 
std::vector< sal_Int32 > m_FieldPositions
 store positions of fields and footnotes for grammar checkers More...
 
std::vector< sal_Int32 > m_FootnotePositions
 
OUString m_aRetText
 

Detailed Description

Definition at line 83 of file modeltoviewhelper.hxx.

Member Typedef Documentation

◆ ConversionMap

typedef std::vector< ConversionMapEntry > ModelToViewHelper::ConversionMap
private

Definition at line 103 of file modeltoviewhelper.hxx.

Constructor & Destructor Documentation

◆ ModelToViewHelper() [1/2]

ModelToViewHelper::ModelToViewHelper ( const SwTextNode rNode,
SwRootFrame const *  pLayout,
ExpandMode  eMode = ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::HideFieldmarkCommands | ExpandMode::ReplaceMode 
)

◆ ModelToViewHelper() [2/2]

ModelToViewHelper::ModelToViewHelper ( )
inline

Definition at line 132 of file modeltoviewhelper.hxx.

Member Function Documentation

◆ ConvertToModelPosition()

ModelToViewHelper::ModelPosition ModelToViewHelper::ConvertToModelPosition ( sal_Int32  nViewPos) const

Converts a view position into a model position.

Parameters
nPosnPos denotes a position in the view string which should be converted.
Returns
the position of nPos in the model string. In case the conversion could not be performed (e.g., because there is not ConversionMap or nPos is behind the last entry in the conversion map) a model model position with mnPos = nPos and mnIsField = false will be returned.

Definition at line 422 of file modeltoviewhelper.cxx.

References m_aMap, ModelToViewHelper::ModelPosition::mbIsField, ModelToViewHelper::ModelPosition::mnPos, and ModelToViewHelper::ModelPosition::mnSubPos.

Referenced by lcl_commitGrammarMarkUp(), lcl_syncGrammarError(), SwScanner::NextWord(), SwDoc::Spell(), and SwScanner::SwScanner().

◆ ConvertToViewPosition()

sal_Int32 ModelToViewHelper::ConvertToViewPosition ( sal_Int32  nModelPos) const

Converts a model position into a view position.

Parameters
nPosnPos denotes a position in the model string which should be converted. Note that converting model positions inside fields is not supported, therefore nPos is not of type ModelPosition.
Returns
the position of nPos in the view string. In case the conversion could not be performed (e.g., because there is not ConversionMap or nPos is behind the last entry in the conversion map) nPos will be returned.

Definition at line 398 of file modeltoviewhelper.cxx.

References m_aMap.

Referenced by SwTextNode::CountWords(), sw::ToxTextGenerator::GetAttributesForNode(), SwEditShell::GetCorrection(), SwTextNode::GetExpandText(), SwEditShell::GetGrammarCorrection(), lcl_commitGrammarMarkUp(), SwTextFrame::SmartTagScan(), and SwDoc::Spell().

◆ getFieldPositions()

std::vector< sal_Int32 > const & ModelToViewHelper::getFieldPositions ( ) const
inline

Definition at line 167 of file modeltoviewhelper.hxx.

References m_FieldPositions.

◆ getFootnotePositions()

std::vector< sal_Int32 > const & ModelToViewHelper::getFootnotePositions ( ) const
inline

Definition at line 168 of file modeltoviewhelper.hxx.

References m_FootnotePositions.

◆ getViewText()

const OUString & ModelToViewHelper::getViewText ( ) const
inline

Member Data Documentation

◆ m_aMap

ConversionMap ModelToViewHelper::m_aMap
private

◆ m_aRetText

OUString ModelToViewHelper::m_aRetText
private

Definition at line 110 of file modeltoviewhelper.hxx.

Referenced by getViewText(), and ModelToViewHelper().

◆ m_FieldPositions

std::vector<sal_Int32> ModelToViewHelper::m_FieldPositions
private

store positions of fields and footnotes for grammar checkers

Definition at line 107 of file modeltoviewhelper.hxx.

Referenced by getFieldPositions(), and ModelToViewHelper().

◆ m_FootnotePositions

std::vector<sal_Int32> ModelToViewHelper::m_FootnotePositions
private

Definition at line 108 of file modeltoviewhelper.hxx.

Referenced by getFootnotePositions(), and ModelToViewHelper().


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