LibreOffice Module sw (master) 1
|
collect text portion data from the layout through SwPortionHandler interface More...
#include <accportions.hxx>
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< TextFrameIndex > | FramePositions |
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 SwViewOption * | m_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_uInt8 > | m_aPortionAttrs |
std::unique_ptr< AccessiblePositions > | m_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 |
collect text portion data from the layout through SwPortionHandler interface
Definition at line 39 of file accportions.hxx.
|
private |
Definition at line 59 of file accportions.hxx.
|
private |
Definition at line 60 of file accportions.hxx.
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.
|
overridevirtual |
Definition at line 82 of file accportions.cxx.
|
private |
Definition at line 638 of file accportions.cxx.
References FindBreak(), IsSpecialPortion(), m_aAccessiblePositions, m_ViewPositions, and nPos.
Referenced by GetEditableRange().
|
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().
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.
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().
|
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().
sal_Int32 SwAccessiblePortionData::GetAccessiblePosition | ( | TextFrameIndex | nPos | ) | const |
get the position in the accessibility string for a given view position
Definition at line 499 of file accportions.cxx.
References FindLastBreak(), SwTextFrame::GetText(), IsSpecialPortion(), m_aAccessiblePositions, m_pTextFrame, m_sAccessibleString, m_ViewPositions, and nPos.
Referenced by SwAccessibleParagraph::GetCaretPos(), SwAccessibleParagraph::getHyperLink(), SwAccessibleParagraph::getIndexAtPoint(), SwAccessibleParagraph::GetSelectionAtIndex(), SwTextMarkupHelper::getTextMarkup(), and SwTextMarkupHelper::getTextMarkupAtIndex().
const OUString & SwAccessiblePortionData::GetAccessibleString | ( | ) | const |
get the text string, as presented by the layout
Definition at line 273 of file accportions.cxx.
References m_bFinished, and m_sAccessibleString.
Referenced by SwAccessibleParagraph::GetSelectionAtIndex(), SwAccessibleParagraph::GetString(), SwTextMarkupHelper::getTextMarkup(), and SwTextMarkupHelper::getTextMarkupAtIndex().
void SwAccessiblePortionData::GetAttributeBoundary | ( | css::i18n::Boundary & | rBound, |
sal_Int32 | nPos | ||
) | const |
Definition at line 488 of file accportions.cxx.
References FillBoundary(), FindBreak(), m_aAccessiblePositions, m_pTextFrame, and nPos.
Referenced by SwAccessibleParagraph::GetAttributeBoundary().
void SwAccessiblePortionData::GetBoundaryOfLine | ( | const sal_Int32 | nLineNo, |
css::i18n::Boundary & | rLineBound | ||
) |
Definition at line 316 of file accportions.cxx.
References FillBoundary(), and m_aLineBreaks.
Referenced by SwAccessibleParagraph::getNumberOfLineWithCaret(), and SwAccessibleParagraph::getTextAtLineNumber().
TextFrameIndex SwAccessiblePortionData::GetCoreViewPosition | ( | sal_Int32 | nPos | ) | const |
get the position in the core view string for a given (accessibility) position
Definition at line 333 of file accportions.cxx.
References FindBreak(), IsSpecialPortion(), m_aAccessiblePositions, m_sAccessibleString, m_ViewPositions, and nPos.
Referenced by SwAccessibleParagraph::CreateUnoPortion(), SwAccessibleParagraph::GetGlyphBoundary(), SwAccessibleParagraph::getHyperLinkIndex(), GetSentenceBoundary(), SwTextMarkupHelper::getTextMarkupAtIndex(), and SwAccessibleParagraph::GetWordBoundary().
bool SwAccessiblePortionData::GetEditableRange | ( | sal_Int32 | nStart, |
sal_Int32 | nEnd, | ||
TextFrameIndex & | rCoreStart, | ||
TextFrameIndex & | rCoreEnd | ||
) | const |
Convert start and end positions into core positions.
Definition at line 656 of file accportions.cxx.
References AdjustAndCheck(), IsPortionAttrSet(), IsSpecialPortion(), and PORATTR_READONLY.
Referenced by SwAccessibleParagraph::replaceText().
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().
TextFrameIndex SwAccessiblePortionData::GetFirstValidCorePosition | ( | ) | const |
Definition at line 742 of file accportions.cxx.
References m_ViewPositions.
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().
TextFrameIndex SwAccessiblePortionData::GetLastValidCorePosition | ( | ) | const |
Definition at line 747 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 280 of file accportions.cxx.
References FillBoundary(), FindBreak(), m_aLineBreaks, and nPos.
Referenced by SwAccessibleParagraph::GetLineBoundary().
sal_Int32 SwAccessiblePortionData::GetLineCount | ( | ) | const |
Definition at line 289 of file accportions.cxx.
References m_aLineBreaks.
Referenced by GetLineNo().
sal_Int32 SwAccessiblePortionData::GetLineNo | ( | const sal_Int32 | nPos | ) | const |
Definition at line 302 of file accportions.cxx.
References FindBreak(), GetLineCount(), m_aLineBreaks, and nPos.
Referenced by SwAccessibleParagraph::getLineNumberAtIndex(), and SwAccessibleParagraph::getNumberOfLineWithCaret().
void SwAccessiblePortionData::GetSentenceBoundary | ( | css::i18n::Boundary & | rBound, |
sal_Int32 | nPos | ||
) |
Definition at line 443 of file accportions.cxx.
References FillBoundary(), FindBreak(), g_pBreakIt, SwBreakIt::GetBreakIter(), GetCoreViewPosition(), SwTextFrame::GetLangOfChar(), SwBreakIt::GetLocale(), m_pSentences, m_pTextFrame, m_sAccessibleString, nFramePos, nLength, and nPos.
Referenced by SwAccessibleParagraph::GetSentenceBoundary().
|
private |
Definition at line 244 of file accportions.cxx.
References Blank, Field, Footnote, Hidden, InputField, SwViewOption::IsFieldShadings(), SwViewOption::IsHardBlank(), IsoRef, IsoTox, SwViewOption::IsPagePreview(), SwViewOption::IsReadonly(), SwViewOption::IsSoftHyph(), SwViewOption::IsTab(), m_pViewOptions, nType, Number, QuoVadis, Ref, SoftHyphen, Tab, and Tox.
bool SwAccessiblePortionData::IsIndexInFootnode | ( | sal_Int32 | nIndex | ) |
Definition at line 706 of file accportions.cxx.
References m_vecPairPos, and nIndex.
Referenced by SwAccessibleParagraph::_correctValues().
bool SwAccessiblePortionData::IsInGrayPortion | ( | sal_Int32 | nPos | ) |
Definition at line 718 of file accportions.cxx.
References FindBreak(), IsPortionAttrSet(), m_aAccessiblePositions, nPos, and PORATTR_GRAY.
Referenced by SwAccessibleParagraph::_correctValues().
|
private |
Access to portion attributes.
Definition at line 231 of file accportions.cxx.
References m_aPortionAttrs.
Referenced by GetEditableRange(), IsInGrayPortion(), and IsSpecialPortion().
|
private |
Definition at line 239 of file accportions.cxx.
References IsPortionAttrSet(), and PORATTR_SPECIAL.
Referenced by AdjustAndCheck(), FillSpecialPos(), GetAccessiblePosition(), 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 693 of file accportions.cxx.
References m_ViewPositions, and nPos.
Referenced by SwTextMarkupHelper::getTextMarkup(), and SwTextMarkupHelper::getTextMarkupCount().
bool SwAccessiblePortionData::IsZeroCorePositionData | ( | ) |
Definition at line 699 of file accportions.cxx.
References m_ViewPositions.
|
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().
|
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.
nLength | number 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.
|
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.
nLength | length of this portion in the view string |
nType | text 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().
|
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.
nLength | length of this portion in the view string |
nType | type 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.
|
private |
position of portion breaks in the core view
Definition at line 64 of file accportions.hxx.
Referenced by AdjustAndCheck(), FillSpecialPos(), GetAccessiblePosition(), GetAttributeBoundary(), GetCoreViewPosition(), IsInGrayPortion(), Special(), SwAccessiblePortionData(), and Text().
|
private |
Definition at line 45 of file accportions.hxx.
Referenced by Finish(), LineBreak(), Special(), and Text().
|
private |
portion breaks in m_sAccessibleString
Definition at line 65 of file accportions.hxx.
Referenced by FillBoundaryIFDateField(), GetFieldIndex(), and Special().
|
private |
Definition at line 62 of file accportions.hxx.
Referenced by FillSpecialPos(), GetBoundaryOfLine(), GetLastLineBoundary(), GetLineBoundary(), GetLineCount(), GetLineNo(), LineBreak(), and SwAccessiblePortionData().
|
private |
Definition at line 67 of file accportions.hxx.
Referenced by IsPortionAttrSet(), Special(), and Text().
|
private |
Definition at line 72 of file accportions.hxx.
Referenced by Finish(), GetAccessibleString(), LineBreak(), Skip(), Special(), and Text().
|
private |
positions of sentence breaks
Definition at line 71 of file accportions.hxx.
Referenced by FillSpecialPos(), and Special().
|
private |
Definition at line 46 of file accportions.hxx.
|
private |
additional portion attributes
Definition at line 69 of file accportions.hxx.
Referenced by GetSentenceBoundary().
|
private |
Definition at line 42 of file accportions.hxx.
Referenced by GetAccessiblePosition(), GetAttributeBoundary(), GetSentenceBoundary(), Skip(), Special(), SwAccessiblePortionData(), and Text().
|
private |
Definition at line 47 of file accportions.hxx.
Referenced by IsGrayPortionType(), and Special().
|
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().
|
private |
Definition at line 166 of file accportions.hxx.
Referenced by IsIndexInFootnode(), and Special().
|
private |
position of line breaks
Definition at line 63 of file accportions.hxx.
Referenced by AdjustAndCheck(), FillSpecialPos(), GetAccessiblePosition(), GetCoreViewPosition(), GetFirstValidCorePosition(), GetLastValidCorePosition(), IsValidCorePosition(), IsZeroCorePositionData(), Skip(), Special(), SwAccessiblePortionData(), and Text().