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, sal_Int32 nHeight=0, sal_Int32 nWidth=0) override
 (empty) destructor More...
 
virtual void Special (TextFrameIndex nLength, const OUString &rText, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0, const SwFont *pFont=nullptr) override
 special portion. More...
 
virtual void LineBreak (sal_Int32 nWidth) 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)
 
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
 SwPortionHandler ()
 
virtual ~SwPortionHandler ()
 (empty) constructor 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
 

of portions before first core character

More...
 
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

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

Definition at line 59 of file accportions.hxx.

Definition at line 60 of file accportions.hxx.

Constructor & Destructor Documentation

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

Definition at line 80 of file accportions.cxx.

References m_aAccessiblePositions, m_aLineBreaks, m_pTextFrame, and m_ViewPositions.

SwAccessiblePortionData::~SwAccessiblePortionData ( )
overridevirtual

Definition at line 107 of file accportions.cxx.

Member Function Documentation

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

Definition at line 661 of file accportions.cxx.

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

Referenced by GetEditableRange().

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 384 of file accportions.cxx.

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

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

Definition at line 645 of file accportions.cxx.

References i, and m_aFieldPosition.

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 553 of file accportions.cxx.

References BEFORE, BEHIND, FindBreak(), FindLastBreak(), SwTextFrame::GetText(), m_aAccessiblePositions, m_aLineBreaks, m_nBeforePortions, m_pTextFrame, m_sAccessibleString, m_ViewPositions, SwSpecialPos::nCharOfst, SwSpecialPos::nExtendRange, SwSpecialPos::nLineOfst, and NONE.

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

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 237 of file accportions.cxx.

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

sal_Int32 SwAccessiblePortionData::GetAccessiblePosition ( TextFrameIndex  nPos) const
const OUString & SwAccessiblePortionData::GetAccessibleString ( ) const
void SwAccessiblePortionData::GetAttributeBoundary ( css::i18n::Boundary &  rBound,
sal_Int32  nPos 
) const
void SwAccessiblePortionData::GetBoundaryOfLine ( const sal_Int32  nLineNo,
css::i18n::Boundary &  rLineBound 
)
TextFrameIndex SwAccessiblePortionData::GetCoreViewPosition ( sal_Int32  nPos) const
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 679 of file accportions.cxx.

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

Referenced by SwAccessibleParagraph::replaceText().

sal_Int32 SwAccessiblePortionData::GetFieldIndex ( sal_Int32  nPos)

Definition at line 748 of file accportions.cxx.

References i, and m_aFieldPosition.

Referenced by SwAccessibleParagraph::GetFieldTypeNameAtIndex().

TextFrameIndex SwAccessiblePortionData::GetFirstValidCorePosition ( ) const

Definition at line 765 of file accportions.cxx.

References m_ViewPositions.

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

Definition at line 344 of file accportions.cxx.

References FillBoundary(), and m_aLineBreaks.

Referenced by SwAccessibleParagraph::GetLineBoundary().

TextFrameIndex SwAccessiblePortionData::GetLastValidCorePosition ( ) const

Definition at line 770 of file accportions.cxx.

References m_ViewPositions.

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

get the start & end positions of the sentence

Definition at line 302 of file accportions.cxx.

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

Referenced by SwAccessibleParagraph::GetLineBoundary().

sal_Int32 SwAccessiblePortionData::GetLineCount ( ) const

Definition at line 311 of file accportions.cxx.

References m_aLineBreaks, and nLineCount.

Referenced by GetLineNo().

sal_Int32 SwAccessiblePortionData::GetLineNo ( const sal_Int32  nPos) const
void SwAccessiblePortionData::GetSentenceBoundary ( css::i18n::Boundary &  rBound,
sal_Int32  nPos 
)
bool SwAccessiblePortionData::IsGrayPortionType ( PortionType  nType) const
private
bool SwAccessiblePortionData::IsIndexInFootnode ( sal_Int32  nIndex)

Definition at line 729 of file accportions.cxx.

References m_vecPairPos.

Referenced by SwAccessibleParagraph::_correctValues().

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

Access to portion attributes.

Definition at line 253 of file accportions.cxx.

References m_aPortionAttrs.

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

bool SwAccessiblePortionData::IsSpecialPortion ( size_t  nPortionNo) const
private

Definition at line 261 of file accportions.cxx.

References IsPortionAttrSet(), and PORATTR_SPECIAL.

Referenced by AdjustAndCheck(), GetCoreViewPosition(), and GetEditableRange().

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 716 of file accportions.cxx.

References m_ViewPositions.

bool SwAccessiblePortionData::IsZeroCorePositionData ( )

Definition at line 722 of file accportions.cxx.

References m_ViewPositions.

void SwAccessiblePortionData::LineBreak ( sal_Int32  nWidth)
overridevirtual

line break.

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

Implements SwPortionHandler.

Definition at line 220 of file accportions.cxx.

References m_aBuffer, m_aLineBreaks, and m_bFinished.

Referenced by Finish().

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.

Implements SwPortionHandler.

Definition at line 227 of file accportions.cxx.

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

void SwAccessiblePortionData::Special ( TextFrameIndex  nLength,
const OUString &  rText,
PortionType  nType,
sal_Int32  nHeight = 0,
sal_Int32  nWidth = 0,
const SwFont pFont = nullptr 
)
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.

Implements SwPortionHandler.

Definition at line 136 of file accportions.cxx.

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

Referenced by Finish().

void SwAccessiblePortionData::Text ( TextFrameIndex  nLength,
PortionType  nType,
sal_Int32  nHeight = 0,
sal_Int32  nWidth = 0 
)
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.

Implements SwPortionHandler.

Definition at line 111 of file accportions.cxx.

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

Member Data Documentation

AccessiblePositions SwAccessiblePortionData::m_aAccessiblePositions
private
OUStringBuffer SwAccessiblePortionData::m_aBuffer
private

Definition at line 45 of file accportions.hxx.

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

AccessiblePositions SwAccessiblePortionData::m_aFieldPosition
private

portion breaks in m_sAccessibleString

Definition at line 65 of file accportions.hxx.

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

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

Definition at line 67 of file accportions.hxx.

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

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().

size_t SwAccessiblePortionData::m_nBeforePortions
private

positions of sentence breaks

Definition at line 71 of file accportions.hxx.

Referenced by FillSpecialPos(), and Special().

TextFrameIndex SwAccessiblePortionData::m_nViewPosition
private

Definition at line 46 of file accportions.hxx.

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

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

additional portion attributes

Definition at line 69 of file accportions.hxx.

Referenced by GetSentenceBoundary().

SwTextFrame const* SwAccessiblePortionData::m_pTextFrame
private
const SwViewOption* SwAccessiblePortionData::m_pViewOptions
private

Definition at line 47 of file accportions.hxx.

Referenced by IsGrayPortionType().

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 FillSpecialPos(), Finish(), GetAccessiblePosition(), GetAccessibleString(), GetCoreViewPosition(), and GetSentenceBoundary().

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().

FramePositions SwAccessiblePortionData::m_ViewPositions
private

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