25#include <com/sun/star/text/TextMarkupType.hpp>
26#include <com/sun/star/accessibility/TextSegment.hpp>
27#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28#include <com/sun/star/lang/IllegalArgumentException.hpp>
31#include <osl/diagnose.h>
42 getTextMarkupFunc(
const sal_Int32 nTextMarkupType))()
const
44 switch ( nTextMarkupType )
46 case text::TextMarkupType::SPELLCHECK:
51 case text::TextMarkupType::PROOFREADING:
57 case text::TextMarkupType::SMARTTAG:
65 throw lang::IllegalArgumentException();
74 : mrPortionData( rPortionData )
75 , m_pTextFrame(&rTextFrame)
76 , mpTextMarkupList( nullptr )
83 : mrPortionData( rPortionData )
84 , m_pTextFrame( nullptr )
85 , mpTextMarkupList( &rTextMarkupList )
91 sal_Int32 nTextMarkupCount( 0 );
108 return nTextMarkupCount;
111css::accessibility::TextSegment
113 const sal_Int32 nTextMarkupType )
116 nTextMarkupIndex < 0 )
118 throw lang::IndexOutOfBoundsException();
121 css::accessibility::TextSegment aTextMarkupSegment;
122 aTextMarkupSegment.SegmentStart = -1;
123 aTextMarkupSegment.SegmentEnd = -1;
125 std::unique_ptr<sw::WrongListIteratorCounter> pIter;
142 auto const oElement(pIter->GetElementAt(nTextMarkupIndex));
146 const sal_Int32 nStartPos =
148 const sal_Int32 nEndPos =
150 aTextMarkupSegment.SegmentText = rText.copy( nStartPos, nEndPos - nStartPos );
151 aTextMarkupSegment.SegmentStart = nStartPos;
152 aTextMarkupSegment.SegmentEnd = nEndPos;
156 OSL_FAIL(
"<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" );
160 return aTextMarkupSegment;
163css::uno::Sequence< css::accessibility::TextSegment >
165 const sal_Int32 nTextMarkupType )
175 return uno::Sequence< css::accessibility::TextSegment >();
178 std::unique_ptr<sw::WrongListIteratorCounter> pIter;
193 std::vector< css::accessibility::TextSegment > aTmpTextMarkups;
197 sal_uInt16
count(pIter->GetElementCount());
198 for (sal_uInt16
i = 0;
i <
count; ++
i)
200 auto const oElement(pIter->GetElementAt(
i));
202 oElement->first <= nCoreCharIndex &&
203 nCoreCharIndex < oElement->second)
205 const sal_Int32 nStartPos =
207 const sal_Int32 nEndPos =
209 css::accessibility::TextSegment aTextMarkupSegment;
210 aTextMarkupSegment.SegmentText = rText.copy( nStartPos, nEndPos - nStartPos );
211 aTextMarkupSegment.SegmentStart = nStartPos;
212 aTextMarkupSegment.SegmentEnd = nEndPos;
213 aTmpTextMarkups.push_back( aTextMarkupSegment );
collect text portion data from the layout through SwPortionHandler interface
TextFrameIndex GetCoreViewPosition(sal_Int32 nPos) const
get the position in the core view string for a given (accessibility) position
const OUString & GetAccessibleString() const
get the text string, as presented by the layout
sal_Int32 GetAccessiblePosition(TextFrameIndex nPos) const
get the position in the accessibility string for a given view position
Represents the visualization of a paragraph.
SwTextFrame const * m_pTextFrame
const SwAccessiblePortionData & mrPortionData
SwTextMarkupHelper(const SwAccessiblePortionData &rPortionData, const SwTextFrame &rTextFrame)
sal_Int32 getTextMarkupCount(const sal_Int32 nTextMarkupType)
css::uno::Sequence< css::accessibility::TextSegment > getTextMarkupAtIndex(const sal_Int32 nCharIndex, const sal_Int32 nTextMarkupType)
css::accessibility::TextSegment getTextMarkup(const sal_Int32 nTextMarkupIndex, const sal_Int32 nTextMarkupType)
const SwWrongList * mpTextMarkupList
SwTextNode is a paragraph in the document model.
sal_uInt16 GetElementCount()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)