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

collect text portion data from the layout through SwPortionHandler interface More...

#include <accportions.hxx>

Inheritance diagram for SwAccessiblePortionData:
[legend]
Collaboration diagram for SwAccessiblePortionData:
[legend]

Public Member Functions

 SwAccessiblePortionData (const SwTextFrame *pTextFrame, const SwViewOption *pViewOpt)
 
virtual ~SwAccessiblePortionData () override
 
virtual void Text (TextFrameIndex nLength, PortionType nType) override
 (empty) destructor More...
 
virtual void Special (TextFrameIndex nLength, const OUString &rText, PortionType nType) override
 special portion. More...
 
virtual void LineBreak () override
 line break. More...
 
virtual void Skip (TextFrameIndex nLength) override
 skip characters. More...
 
virtual void Finish () override
 end of paragraph. More...
 
bool FillBoundaryIFDateField (css::i18n::Boundary &rBound, const sal_Int32 nPos)
 
bool IsIndexInFootnode (sal_Int32 nIndex)
 
bool IsInGrayPortion (sal_Int32 nPos)
 
sal_Int32 GetFieldIndex (sal_Int32 nPos) const
 
bool IsZeroCorePositionData ()
 
const OUString & GetAccessibleString () const
 get the text string, as presented by the layout More...
 
void GetLineBoundary (css::i18n::Boundary &rBound, sal_Int32 nPos) const
 get the start & end positions of the sentence More...
 
void GetLastLineBoundary (css::i18n::Boundary &rBound) const
 
bool IsValidCorePosition (TextFrameIndex nPos) const
 Determine whether this core position is valid for these portions. More...
 
TextFrameIndex GetFirstValidCorePosition () const
 
TextFrameIndex GetLastValidCorePosition () const
 
sal_Int32 GetAccessiblePosition (TextFrameIndex nPos) const
 get the position in the accessibility string for a given view position More...
 
sal_Int32 GetLineCount () const
 
sal_Int32 GetLineNo (const sal_Int32 nPos) const
 
void GetBoundaryOfLine (const sal_Int32 nLineNo, css::i18n::Boundary &rLineBound)
 
TextFrameIndex GetCoreViewPosition (sal_Int32 nPos) const
 get the position in the core view string for a given (accessibility) position More...
 
TextFrameIndex FillSpecialPos (sal_Int32 nPos, SwSpecialPos &rPos, SwSpecialPos *&rpPos) const
 fill a SwSpecialPos structure, suitable for calling SwTextFrame->GetCharRect Returns the core position, and fills rpPos either with NULL or with the &rPos, after putting the appropriate data into it. More...
 
void GetSentenceBoundary (css::i18n::Boundary &rBound, sal_Int32 nPos)
 
void GetAttributeBoundary (css::i18n::Boundary &rBound, sal_Int32 nPos) const
 
bool GetEditableRange (sal_Int32 nStart, sal_Int32 nEnd, TextFrameIndex &rCoreStart, TextFrameIndex &rCoreEnd) const
 Convert start and end positions into core positions. More...
 
- Public Member Functions inherited from SwPortionHandler
virtual ~SwPortionHandler ()
 
virtual void Text (TextFrameIndex nLength, PortionType nType)=0
 (empty) destructor More...
 
virtual void Special (TextFrameIndex nLength, const OUString &rText, PortionType nType)=0
 special portion. More...
 
virtual void LineBreak ()=0
 line break. More...
 
virtual void Skip (TextFrameIndex nLength)=0
 skip characters. More...
 
virtual void Finish ()=0
 end of paragraph. More...
 

Private Types

typedef std::vector< sal_Int32 > AccessiblePositions
 
typedef std::vector< TextFrameIndexFramePositions
 

Private Member Functions

bool IsPortionAttrSet (size_t nPortionNo, sal_uInt8 nAttr) const
 Access to portion attributes. More...
 
bool IsSpecialPortion (size_t nPortionNo) const
 
bool IsGrayPortionType (PortionType nType) const
 
void AdjustAndCheck (sal_Int32 nPos, size_t &nPortionNo, TextFrameIndex &rCorePos, bool &bEdit) const
 

Static Private Member Functions

static void FillBoundary (css::i18n::Boundary &rBound, const AccessiblePositions &rPositions, size_t nPos)
 fill the boundary with the values from rPositions[nPos] More...
 

Private Attributes

SwTextFrame const * m_pTextFrame
 
OUStringBuffer m_aBuffer
 
TextFrameIndex m_nViewPosition
 
const SwViewOptionm_pViewOptions
 
OUString m_sAccessibleString
 the accessible string note that the content is different both from the string in the text node(s) as well as the string in the text frame, so there are 3 different index spaces involved. More...
 
AccessiblePositions m_aLineBreaks
 
FramePositions m_ViewPositions
 position of line breaks More...
 
AccessiblePositions m_aAccessiblePositions
 position of portion breaks in the core view More...
 
AccessiblePositions m_aFieldPosition
 portion breaks in m_sAccessibleString More...
 
std::vector< sal_uInt8m_aPortionAttrs
 
std::unique_ptr< AccessiblePositionsm_pSentences
 additional portion attributes More...
 
size_t m_nBeforePortions
 positions of sentence breaks More...
 
bool m_bFinished
 
std::vector< std::pair< sal_Int32, sal_Int32 > > m_vecPairPos
 

Detailed Description

collect text portion data from the layout through SwPortionHandler interface

Definition at line 39 of file accportions.hxx.

Member Typedef Documentation

◆ AccessiblePositions

typedef std::vector<sal_Int32> SwAccessiblePortionData::AccessiblePositions
private

Definition at line 59 of file accportions.hxx.

◆ FramePositions

Definition at line 60 of file accportions.hxx.

Constructor & Destructor Documentation

◆ SwAccessiblePortionData()

SwAccessiblePortionData::SwAccessiblePortionData ( const SwTextFrame pTextFrame,
const SwViewOption pViewOpt 
)

Definition at line 62 of file accportions.cxx.

References m_aAccessiblePositions, m_aLineBreaks, m_pTextFrame, and m_ViewPositions.

◆ ~SwAccessiblePortionData()

SwAccessiblePortionData::~SwAccessiblePortionData ( )
overridevirtual

Definition at line 82 of file accportions.cxx.

Member Function Documentation

◆ AdjustAndCheck()

void SwAccessiblePortionData::AdjustAndCheck ( sal_Int32  nPos,
size_t &  nPortionNo,
TextFrameIndex rCorePos,
bool &  bEdit 
) const
private

Definition at line 638 of file accportions.cxx.

References FindBreak(), IsSpecialPortion(), m_aAccessiblePositions, m_ViewPositions, and nPos.

Referenced by GetEditableRange().

◆ FillBoundary()

void SwAccessiblePortionData::FillBoundary ( css::i18n::Boundary &  rBound,
const AccessiblePositions rPositions,
size_t  nPos 
)
staticprivate

fill the boundary with the values from rPositions[nPos]

Definition at line 362 of file accportions.cxx.

References nPos.

Referenced by GetAttributeBoundary(), GetBoundaryOfLine(), GetLastLineBoundary(), GetLineBoundary(), and GetSentenceBoundary().

◆ FillBoundaryIFDateField()

bool SwAccessiblePortionData::FillBoundaryIFDateField ( css::i18n::Boundary &  rBound,
const sal_Int32  nPos 
)

Definition at line 622 of file accportions.cxx.

References i, m_aFieldPosition, and nPos.

◆ FillSpecialPos()

TextFrameIndex SwAccessiblePortionData::FillSpecialPos ( sal_Int32  nPos,
SwSpecialPos rPos,
SwSpecialPos *&  rpPos 
) const

fill a SwSpecialPos structure, suitable for calling SwTextFrame->GetCharRect Returns the core position, and fills rpPos either with NULL or with the &rPos, after putting the appropriate data into it.

Definition at line 531 of file accportions.cxx.

References BEFORE, BEHIND, FindBreak(), FindLastBreak(), IsSpecialPortion(), m_aAccessiblePositions, m_aLineBreaks, m_nBeforePortions, m_ViewPositions, SwSpecialPos::nCharOfst, SwSpecialPos::nExtendRange, SwSpecialPos::nLineOfst, NONE, and nPos.

Referenced by SwAccessibleParagraph::getCharacterBounds(), and SwAccessibleParagraph::GetCurrentTabStop().

◆ Finish()

void SwAccessiblePortionData::Finish ( )
overridevirtual

end of paragraph.

This method is to be called when all the paragraph's portions have been processed.

Implements SwPortionHandler.

Definition at line 215 of file accportions.cxx.

References LineBreak(), m_aBuffer, m_bFinished, m_sAccessibleString, POR_TERMINATE, and Special().

◆ GetAccessiblePosition()

sal_Int32 SwAccessiblePortionData::GetAccessiblePosition ( TextFrameIndex  nPos) const

◆ GetAccessibleString()

const OUString & SwAccessiblePortionData::GetAccessibleString ( ) const

◆ GetAttributeBoundary()

void SwAccessiblePortionData::GetAttributeBoundary ( css::i18n::Boundary &  rBound,
sal_Int32  nPos 
) const

◆ GetBoundaryOfLine()

void SwAccessiblePortionData::GetBoundaryOfLine ( const sal_Int32  nLineNo,
css::i18n::Boundary &  rLineBound 
)

◆ GetCoreViewPosition()

TextFrameIndex SwAccessiblePortionData::GetCoreViewPosition ( sal_Int32  nPos) const

◆ GetEditableRange()

bool SwAccessiblePortionData::GetEditableRange ( sal_Int32  nStart,
sal_Int32  nEnd,
TextFrameIndex rCoreStart,
TextFrameIndex rCoreEnd 
) const

Convert start and end positions into core positions.

Returns
true if 'special' portions are included either completely or not at all. This can be used to test whether editing that range would be legal

Definition at line 656 of file accportions.cxx.

References AdjustAndCheck(), IsPortionAttrSet(), IsSpecialPortion(), and PORATTR_READONLY.

Referenced by SwAccessibleParagraph::replaceText().

◆ GetFieldIndex()

sal_Int32 SwAccessiblePortionData::GetFieldIndex ( sal_Int32  nPos) const

Definition at line 725 of file accportions.cxx.

References i, m_aFieldPosition, nIndex, and nPos.

Referenced by SwAccessibleParagraph::GetFieldTypeNameAtIndex().

◆ GetFirstValidCorePosition()

TextFrameIndex SwAccessiblePortionData::GetFirstValidCorePosition ( ) const

Definition at line 742 of file accportions.cxx.

References m_ViewPositions.

◆ GetLastLineBoundary()

void SwAccessiblePortionData::GetLastLineBoundary ( css::i18n::Boundary &  rBound) const

Definition at line 322 of file accportions.cxx.

References FillBoundary(), and m_aLineBreaks.

Referenced by SwAccessibleParagraph::GetLineBoundary().

◆ GetLastValidCorePosition()

TextFrameIndex SwAccessiblePortionData::GetLastValidCorePosition ( ) const

Definition at line 747 of file accportions.cxx.

References m_ViewPositions.

◆ GetLineBoundary()

void SwAccessiblePortionData::GetLineBoundary ( css::i18n::Boundary &  rBound,
sal_Int32  nPos 
) const

get the start & end positions of the sentence

Definition at line 280 of file accportions.cxx.

References FillBoundary(), FindBreak(), m_aLineBreaks, and nPos.

Referenced by SwAccessibleParagraph::GetLineBoundary().

◆ GetLineCount()

sal_Int32 SwAccessiblePortionData::GetLineCount ( ) const

Definition at line 289 of file accportions.cxx.

References m_aLineBreaks.

Referenced by GetLineNo().

◆ GetLineNo()

sal_Int32 SwAccessiblePortionData::GetLineNo ( const sal_Int32  nPos) const

◆ GetSentenceBoundary()

void SwAccessiblePortionData::GetSentenceBoundary ( css::i18n::Boundary &  rBound,
sal_Int32  nPos 
)

◆ IsGrayPortionType()

bool SwAccessiblePortionData::IsGrayPortionType ( PortionType  nType) const
private

◆ IsIndexInFootnode()

bool SwAccessiblePortionData::IsIndexInFootnode ( sal_Int32  nIndex)

Definition at line 706 of file accportions.cxx.

References m_vecPairPos, and nIndex.

Referenced by SwAccessibleParagraph::_correctValues().

◆ IsInGrayPortion()

bool SwAccessiblePortionData::IsInGrayPortion ( sal_Int32  nPos)

◆ IsPortionAttrSet()

bool SwAccessiblePortionData::IsPortionAttrSet ( size_t  nPortionNo,
sal_uInt8  nAttr 
) const
private

Access to portion attributes.

Definition at line 231 of file accportions.cxx.

References m_aPortionAttrs.

Referenced by GetEditableRange(), IsInGrayPortion(), and IsSpecialPortion().

◆ IsSpecialPortion()

bool SwAccessiblePortionData::IsSpecialPortion ( size_t  nPortionNo) const
private

◆ IsValidCorePosition()

bool SwAccessiblePortionData::IsValidCorePosition ( TextFrameIndex  nPos) const

Determine whether this core position is valid for these portions.

(A paragraph may be split into several frames, e.g. at page boundaries. In this case, only part of a paragraph is represented through this object. This method determines whether one particular position is valid for this object or not.)

Definition at line 693 of file accportions.cxx.

References m_ViewPositions, and nPos.

Referenced by SwTextMarkupHelper::getTextMarkup(), and SwTextMarkupHelper::getTextMarkupCount().

◆ IsZeroCorePositionData()

bool SwAccessiblePortionData::IsZeroCorePositionData ( )

Definition at line 699 of file accportions.cxx.

References m_ViewPositions.

◆ LineBreak()

void SwAccessiblePortionData::LineBreak ( )
overridevirtual

line break.

This method is called whenever a line break in the layout occurs.

Implements SwPortionHandler.

Definition at line 198 of file accportions.cxx.

References m_aBuffer, m_aLineBreaks, and m_bFinished.

Referenced by Finish().

◆ Skip()

void SwAccessiblePortionData::Skip ( TextFrameIndex  nLength)
overridevirtual

skip characters.

The SwTextFrame may only display partially display a certain paragraph (e.g. when the paragraph is split across multiple pages). In this case, the Skip() method must be called to inform the portion handler to ignore a certain run of characters in the 'view string'. Skip(), if used at all, must be called before any of the other methods is called. Calling Skip() between portions is not allowed.

Parameters
nLengthnumber of 'view string' characters to be skipped

Implements SwPortionHandler.

Definition at line 205 of file accportions.cxx.

References SwTextFrame::GetText(), m_bFinished, m_nViewPosition, m_pTextFrame, m_ViewPositions, and nLength.

◆ Special()

void SwAccessiblePortionData::Special ( TextFrameIndex  nLength,
const OUString &  rText,
PortionType  nType 
)
overridevirtual

special portion.

This method is called for every non-text portion. The parameters describe the length of the corresponding characters in the view string (often 0 or 1), the text which is displayed, and the type of the portion.

Parameters
nLengthlength of this portion in the view string
nTypetext which is painted on-screen type of this portion

Implements SwPortionHandler.

Definition at line 111 of file accportions.cxx.

References Bookmark, Bullet, Combined, ControlChar, Field, FlyCnt, Footnote, FootnoteNum, SwTextFrame::GetText(), GrfNum, Hidden, IsGrayPortionType(), IsoRef, SwViewOption::IsShowBookmarks(), m_aAccessiblePositions, m_aBuffer, m_aFieldPosition, m_aPortionAttrs, m_bFinished, m_nBeforePortions, m_nViewPosition, m_pTextFrame, m_pViewOptions, m_vecPairPos, m_ViewPositions, nLength, nType, Number, POR_TERMINATE, PORATTR_GRAY, PORATTR_READONLY, PORATTR_SPECIAL, PORATTR_TERM, PostIts, sDisplay, and u.

Referenced by Finish().

◆ Text()

void SwAccessiblePortionData::Text ( TextFrameIndex  nLength,
PortionType  nType 
)
overridevirtual

(empty) destructor

text portion. A run of nLength characters from the view string, that contains no special characters like embedded fields, etc. Thus, the on-screen text of this portion corresponds exactly to the corresponding characters in the view string.

Parameters
nLengthlength of this portion in the view string
nTypetype of this portion

Implements SwPortionHandler.

Definition at line 86 of file accportions.cxx.

References SwTextFrame::GetText(), IsGrayPortionType(), m_aAccessiblePositions, m_aBuffer, m_aPortionAttrs, m_bFinished, m_nViewPosition, m_pTextFrame, m_ViewPositions, nLength, nType, and PORATTR_GRAY.

Member Data Documentation

◆ m_aAccessiblePositions

AccessiblePositions SwAccessiblePortionData::m_aAccessiblePositions
private

◆ m_aBuffer

OUStringBuffer SwAccessiblePortionData::m_aBuffer
private

Definition at line 45 of file accportions.hxx.

Referenced by Finish(), LineBreak(), Special(), and Text().

◆ m_aFieldPosition

AccessiblePositions SwAccessiblePortionData::m_aFieldPosition
private

portion breaks in m_sAccessibleString

Definition at line 65 of file accportions.hxx.

Referenced by FillBoundaryIFDateField(), GetFieldIndex(), and Special().

◆ m_aLineBreaks

AccessiblePositions SwAccessiblePortionData::m_aLineBreaks
private

◆ m_aPortionAttrs

std::vector<sal_uInt8> SwAccessiblePortionData::m_aPortionAttrs
private

Definition at line 67 of file accportions.hxx.

Referenced by IsPortionAttrSet(), Special(), and Text().

◆ m_bFinished

bool SwAccessiblePortionData::m_bFinished
private

of portions before first core character

Definition at line 72 of file accportions.hxx.

Referenced by Finish(), GetAccessibleString(), LineBreak(), Skip(), Special(), and Text().

◆ m_nBeforePortions

size_t SwAccessiblePortionData::m_nBeforePortions
private

positions of sentence breaks

Definition at line 71 of file accportions.hxx.

Referenced by FillSpecialPos(), and Special().

◆ m_nViewPosition

TextFrameIndex SwAccessiblePortionData::m_nViewPosition
private

Definition at line 46 of file accportions.hxx.

Referenced by Skip(), Special(), and Text().

◆ m_pSentences

std::unique_ptr<AccessiblePositions> SwAccessiblePortionData::m_pSentences
private

additional portion attributes

Definition at line 69 of file accportions.hxx.

Referenced by GetSentenceBoundary().

◆ m_pTextFrame

SwTextFrame const* SwAccessiblePortionData::m_pTextFrame
private

◆ m_pViewOptions

const SwViewOption* SwAccessiblePortionData::m_pViewOptions
private

Definition at line 47 of file accportions.hxx.

Referenced by IsGrayPortionType(), and Special().

◆ m_sAccessibleString

OUString SwAccessiblePortionData::m_sAccessibleString
private

the accessible string note that the content is different both from the string in the text node(s) as well as the string in the text frame, so there are 3 different index spaces involved.

Definition at line 53 of file accportions.hxx.

Referenced by Finish(), GetAccessiblePosition(), GetAccessibleString(), GetCoreViewPosition(), and GetSentenceBoundary().

◆ m_vecPairPos

std::vector< std::pair<sal_Int32,sal_Int32> > SwAccessiblePortionData::m_vecPairPos
private

Definition at line 166 of file accportions.hxx.

Referenced by IsIndexInFootnode(), and Special().

◆ m_ViewPositions

FramePositions SwAccessiblePortionData::m_ViewPositions
private

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