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

#include <modeltoviewhelper.hxx>

Collaboration diagram for ModelToViewHelper:
[legend]

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::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 82 of file modeltoviewhelper.hxx.

Member Typedef Documentation

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

Definition at line 102 of file modeltoviewhelper.hxx.

Constructor & Destructor Documentation

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

Definition at line 131 of file modeltoviewhelper.hxx.

Member Function Documentation

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 283 of file modeltoviewhelper.cxx.

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

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

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 259 of file modeltoviewhelper.cxx.

References m_aMap.

Referenced by SwTextNode::CountWords(), sw::ToxTextGenerator::GetAttributesForNode(), SwTextNode::GetExpandText(), lcl_commitGrammarMarkUp(), and SwTextFrame::SmartTagScan().

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

Definition at line 166 of file modeltoviewhelper.hxx.

References m_FieldPositions.

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

Definition at line 167 of file modeltoviewhelper.hxx.

References m_FootnotePositions.

const OUString& ModelToViewHelper::getViewText ( ) const
inline

Member Data Documentation

ConversionMap ModelToViewHelper::m_aMap
private
OUString ModelToViewHelper::m_aRetText
private

Definition at line 109 of file modeltoviewhelper.hxx.

Referenced by getViewText(), and ModelToViewHelper().

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

store positions of fields and footnotes for grammar checkers

Definition at line 106 of file modeltoviewhelper.hxx.

Referenced by getFieldPositions(), and ModelToViewHelper().

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

Definition at line 107 of file modeltoviewhelper.hxx.

Referenced by getFootnotePositions(), and ModelToViewHelper().


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