36 #include <com/sun/star/accessibility/AccessibleRole.hpp>
37 #include <com/sun/star/accessibility/AccessibleScrollType.hpp>
38 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
39 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
40 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
42 #include <com/sun/star/i18n/Boundary.hpp>
43 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
44 #include <com/sun/star/i18n/WordType.hpp>
45 #include <com/sun/star/i18n/XBreakIterator.hpp>
46 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
47 #include <com/sun/star/beans/UnknownPropertyException.hpp>
61 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
68 #include <com/sun/star/beans/XPropertySet.hpp>
71 #include <com/sun/star/awt/FontWeight.hpp>
72 #include <com/sun/star/awt/FontStrikeout.hpp>
73 #include <com/sun/star/awt/FontSlant.hpp>
83 #include <com/sun/star/text/WritingMode2.hpp>
84 #include <viewimp.hxx>
87 #include <com/sun/star/text/TextMarkupType.hpp>
92 #include <editeng/editids.hrc>
96 #include "../../uibase/inc/fldmgr.hxx"
103 using beans::PropertyValue;
104 using beans::XMultiPropertySet;
105 using beans::UnknownPropertyException;
106 using beans::PropertyState_DIRECT_VALUE;
116 constexpr OUStringLiteral
sServiceName =
u"com.sun.star.text.AccessibleParagraphView";
137 if( pCaret !=
nullptr )
153 bool bFormat = pTextFrame->
HasPara();
173 OSL_ENSURE( nRet >= 0,
"invalid cursor?" );
191 SwPaM* pCursor =
nullptr;
195 if ( pCursorShell !=
nullptr &&
196 ( _bForSelection || !pCursorShell->
IsTableMode() ) )
203 pCursor = pCursorShell->
GetCursor(
false );
223 rStateSet.
AddState( AccessibleStateType::MULTI_LINE );
228 rStateSet.
AddState(AccessibleStateType::MULTI_SELECTABLE);
230 rStateSet.
AddState(AccessibleStateType::FOCUSABLE);
237 if (pCaret !=
nullptr &&
243 rStateSet.
AddState( AccessibleStateType::FOCUSED );
257 if( rText != sOldText )
260 AccessibleEventObject
aEvent;
261 aEvent.EventId = AccessibleEventId::TEXT_CHANGED;
270 uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
271 if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
276 AccessibleEventObject aParaEvent;
277 aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
282 else if( !bVisibleDataFired )
292 std::scoped_lock aGuard(
m_Mutex );
298 if( bNewIsHeading != bOldIsHeading )
301 AccessibleEventObject
aEvent;
302 aEvent.EventId = AccessibleEventId::ROLE_CHANGED;
307 if( rText == sOldText )
313 std::scoped_lock aGuard(
m_Mutex );
319 if( sNewDesc != sOldDesc )
322 AccessibleEventObject
aEvent;
323 aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
324 aEvent.OldValue <<= sOldDesc;
325 aEvent.NewValue <<= sNewDesc;
337 std::scoped_lock aGuard(
m_Mutex );
354 if( pWin && pWin->
HasFocus() && -1 == nOld )
357 AccessibleEventObject
aEvent;
358 aEvent.EventId = AccessibleEventId::CARET_CHANGED;
359 aEvent.OldValue <<= nOld;
360 aEvent.NewValue <<= nNew;
364 if( pWin && pWin->
HasFocus() && -1 == nNew )
372 aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
373 aEvent.OldValue.clear();
374 aEvent.NewValue.clear();
388 std::scoped_lock aGuard(
m_Mutex );
391 OSL_ENSURE( nPos != -1,
"focus object should be selected" );
399 std::shared_ptr<SwAccessibleMap>
const& pInitMap,
402 , m_nOldCaretPos( -1 )
403 , m_bIsHeading(
false )
405 , m_nHeadingLevel (-1)
406 , m_aSelectionHelper( *this )
408 , m_bLastHasSelection(
false)
432 std::scoped_lock aGuard(
m_Mutex );
439 OSL_ENSURE(
GetFrame() !=
nullptr,
"The text frame has vanished!" );
440 OSL_ENSURE(
GetFrame()->IsTextFrame(),
"The text frame has mutated!" );
448 OSL_ENSURE(
m_pPortionData !=
nullptr,
"UpdatePortionData() failed" );
459 OSL_ENSURE(
GetMap() !=
nullptr,
"no map?" );
462 OSL_ENSURE( pViewShell !=
nullptr,
"View shell expected!" );
465 OSL_ENSURE( pSfxShell !=
nullptr,
"SfxViewShell shell expected!" );
470 OSL_ENSURE( pFrame !=
nullptr,
"View frame expected!" );
475 OSL_ENSURE( pDispatcher !=
nullptr,
"Dispatcher expected!" );
483 sal_Int32 nStartIndex,
484 sal_Int32 nEndIndex )
487 (nEndIndex == -1)) ||
489 "please check parameters before calling this method" );
499 auto pUnoCursor(const_cast<SwDoc&>(pFrame->
GetDoc()).CreateUnoCursor(aStartPos));
500 pUnoCursor->SetMark();
504 uno::Reference<text::XText> aEmpty;
511 sal_Int32 nPos, sal_Int32 nLength)
513 return (nPos >= 0) && (nPos < nLength);
517 sal_Int32 nPos, sal_Int32 nLength)
519 return (nPos >= 0) && (nPos <= nLength);
523 sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength)
545 i18n::Boundary& rBound,
551 rBound.startPos = nPos;
552 rBound.endPos = nPos+1;
557 i18n::Boundary& rBound,
558 const OUString& rText,
571 const sal_Int16 nWordType = i18n::WordType::ANY_WORD;
575 rText, nPos, aLocale, nWordType,
true );
581 i18n::Boundary& rBound,
582 const OUString& rText,
586 while( nPos < rText.getLength() && pStr[nPos] ==
u' ' )
594 i18n::Boundary& rBound,
595 const OUString& rText,
598 if( rText.getLength() == nPos )
606 i18n::Boundary& rBound,
607 const OUString& rText )
610 rBound.endPos = rText.getLength();
615 i18n::Boundary& rBound,
623 i18n::Boundary& rBound,
624 const OUString& rText,
637 const sal_Int16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
640 rText, nPos, aLocale, nIterMode, 1, nDone );
642 rText, rBound.endPos, aLocale, nIterMode, 1, nDone );
643 bool bRet = ((rBound.startPos <= nPos) && (nPos <= rBound.endPos));
644 OSL_ENSURE( rBound.startPos <= nPos,
"start pos too high" );
645 OSL_ENSURE( rBound.endPos >= nPos,
"end pos too low" );
651 i18n::Boundary& rBound,
652 const OUString& rText,
654 sal_Int16 nTextType )
657 if( !( AccessibleTextType::LINE == nTextType
660 throw lang::IndexOutOfBoundsException();
666 case AccessibleTextType::WORD:
670 case AccessibleTextType::SENTENCE:
674 case AccessibleTextType::PARAGRAPH:
678 case AccessibleTextType::CHARACTER:
682 case AccessibleTextType::LINE:
684 if((nPos == rText.getLength()) && nPos > 0)
690 case AccessibleTextType::ATTRIBUTE_RUN:
694 case AccessibleTextType::GLYPH:
699 throw lang::IllegalArgumentException( );
711 std::scoped_lock aGuard2(
m_Mutex );
725 throw uno::RuntimeException(
"no SwTextFrame", static_cast<cppu::OWeakObject*>(
this));
743 OSL_ENSURE( pTextFrame,
744 "<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame");
748 if ( pPrevContentFrame )
750 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pPrevContentFrame ) };
751 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
753 pHelper->AddRelation( aAccRel );
757 if ( pNextContentFrame )
759 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pNextContentFrame ) };
760 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
762 pHelper->AddRelation( aAccRel );
780 if (pCursorSh !=
nullptr &&
781 ( pCursor ==
nullptr ||
787 SwPaM aPaM( aStartPos );
797 if (pWindow !=
nullptr)
808 std::optional<Color> xSectionTOXColor;
813 pFrame->
GetBackgroundBrush( aFillAttributes, pBackgroundBrush, xSectionTOXColor, aDummyRect,
false,
false ) )
815 if ( xSectionTOXColor )
817 rColor = *xSectionTOXColor;
822 rColor = pBackgroundBrush->
GetColor();
826 else if ( pCursorSh )
839 Color aBackgroundCol;
843 if ( aBackgroundCol.
IsDark() )
860 Color aBackgroundCol;
864 return sal_Int32(aBackgroundCol);
876 const OUString& sTestServiceName)
888 static uno::Sequence< OUString >
const aNames
911 static uno::Sequence< OUString >
const aNames
934 uno::Reference<XAccessibleText> aAccText =
static_cast<XAccessibleText *
>(*this);
939 uno::Reference<XAccessibleEditableText> aAccEditText =
this;
940 aRet <<= aAccEditText;
944 uno::Reference<XAccessibleSelection> aAccSel =
this;
949 uno::Reference<XAccessibleHypertext> aAccHyp =
this;
956 uno::Reference<XAccessibleTextAttributes> aAccTextAttr =
this;
957 aRet <<= aAccTextAttr;
963 uno::Reference<XAccessibleTextMarkup> aAccTextMarkup =
this;
964 aRet <<= aAccTextMarkup;
969 uno::Reference<XAccessibleMultiLineText> aAccMultiLineText =
this;
970 aRet <<= aAccMultiLineText;
974 uno::Reference< css::accessibility::XAccessibleTextSelection > aTextExtension =
this;
975 aRet <<= aTextExtension;
979 uno::Reference<XAccessibleExtendedAttributes> xAttr =
this;
984 aRet = SwAccessibleContext::queryInterface(rType);
1002 SwAccessibleContext::getTypes() ).
getTypes();
1007 return css::uno::Sequence<sal_Int8>();
1020 std::scoped_lock aOldCaretPosGuard(
m_Mutex );
1043 throw lang::IndexOutOfBoundsException();
1050 if( pCursorShell !=
nullptr )
1056 SwPaM aPaM( aStartPos );
1075 throw lang::IndexOutOfBoundsException();
1077 return sText[nIndex];
1090 throw lang::IndexOutOfBoundsException();
1093 bool bBehindText =
false;
1119 css::uno::Sequence< css::style::TabStop > tabs;
1120 const sal_Int32 nStrLen = pFrame->
GetText().getLength();
1127 if( tabs.hasElements() )
1133 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
1142 aScreenRect.
Move( -aFramePixPos.X(), -aFramePixPos.Y() );
1144 tabs.getArray()[0].Position = aScreenRect.
GetWidth();
1155 explicit IndexCompare(
const PropertyValue* pVals ) : pValues(pVals) {}
1156 bool operator() ( sal_Int32 a, sal_Int32 b )
const
1158 return (pValues[a].Name < pValues[b].Name);
1166 OUString strTypeName;
1170 if (nFieldIndex >= 0)
1179 && (nFieldIndex-- == 0))
1186 && (nFieldIndex-- == 0))
1188 strTypeName =
"set reference";
1200 sal_uInt32 subType = 0;
1204 subType =
static_cast<const SwDocStatField*
>(pField)->GetSubType();
1214 sEntry =
"Headings";
1216 sEntry =
"Numbered Paragraphs";
1218 sEntry =
"Bookmarks";
1222 sEntry =
"Footnotes";
1225 sEntry =
"Endnotes";
1228 sEntry =
"Insert Reference";
1231 sEntry =
static_cast<const SwGetRefField*
>(pField)->GetSetRefName();
1235 strTypeName = sEntry;
1240 if (sEntry.getLength() > 0)
1242 strTypeName +=
"-" + sEntry;
1252 const sal_uInt32 nFormat= pField->
GetFormat();
1254 if (nFormat < nSize)
1257 if (sEntry.getLength() > 0)
1259 strTypeName +=
"-" + sEntry;
1265 subType =
static_cast<const SwExtUserField*
>(pField)->GetSubType();
1271 if (sEntry.getLength() > 0)
1273 strTypeName +=
"-" + sEntry;
1284 bool bOn = pRPld->
IsOn();
1287 strTypeName +=
"on";
1289 strTypeName +=
"off";
1301 std::vector<OUString> aLst;
1303 if (subType < aLst.size())
1304 sEntry = aLst[subType];
1305 if (sEntry.getLength() > 0)
1309 strTypeName = sEntry;
1311 const sal_uInt16 nExSub = pField->
GetSubType() & 0xff00;
1312 if (nSize > 0 && nExSub > 0)
1317 strTypeName += sEntry;
1322 strTypeName +=
"-" + sEntry;
1335 const uno::Sequence< OUString >& aRequestedAttributes )
1345 throw lang::IndexOutOfBoundsException();
1347 bool bSupplementalMode =
false;
1348 uno::Sequence< OUString > aNames = aRequestedAttributes;
1349 if (!aNames.hasElements())
1351 bSupplementalMode =
true;
1363 std::vector< PropertyValue > aValues( aDefAttrSeq.size() );
1365 for (
const auto& rDefEntry : aDefAttrSeq )
1367 tAccParaPropValMap::const_iterator aRunIter =
1368 aRunAttrSeq.find( rDefEntry.first );
1369 if ( aRunIter != aRunAttrSeq.end() )
1371 aValues[i] = aRunIter->second;
1375 aValues[i] = rDefEntry.second;
1379 if( bSupplementalMode )
1381 uno::Sequence< OUString > aSupplementalNames = aRequestedAttributes;
1382 if (!aSupplementalNames.hasElements())
1388 aValues.resize( aValues.size() + aSupplementalAttrSeq.size() );
1390 for (
const auto& rSupplementalEntry : aSupplementalAttrSeq )
1392 aValues[i] = rSupplementalEntry.second;
1398 aValues.emplace_back();
1401 if (!strTypeName.isEmpty())
1403 aValues.emplace_back();
1404 PropertyValue& rValueFT = aValues.back();
1405 rValueFT.Name =
"FieldType";
1406 rValueFT.Value <<= strTypeName.toAsciiLowerCase();
1407 rValueFT.Handle = -1;
1408 rValueFT.State = PropertyState_DIRECT_VALUE;
1413 sal_Int32
nLength = aValues.size();
1414 std::vector<sal_Int32> aIndices;
1415 aIndices.reserve(nLength);
1416 for (i = 0; i < nLength; ++i)
1417 aIndices.push_back(i);
1418 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(aValues.data()));
1420 uno::Sequence<PropertyValue> aNewValues( nLength );
1421 PropertyValue* pNewValues = aNewValues.getArray();
1422 for (i = 0; i < nLength; ++i)
1424 pNewValues[i] = aValues[aIndices[i]];
1437 targetSet.
Put(sourceSet);
1442 const uno::Sequence< OUString >& aRequestedAttributes,
1444 const bool bOnlyCharAttrs )
1449 std::optional<SfxItemSet> pSet;
1450 if ( !bOnlyCharAttrs )
1452 pSet.emplace( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1459 pSet.emplace( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1460 svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1> );
1468 if ( !bOnlyCharAttrs )
1472 aParaSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()) );
1473 pTextNode->SwContentNode::GetAttr( aParaSet );
1474 pSet->Put( aParaSet );
1477 OSL_ENSURE( pTextNode->GetTextColl(),
1478 "<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect!" );
1479 if ( pTextNode->GetTextColl() )
1482 aCharSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()) );
1484 pSet->Put( aCharSet );
1494 const SfxPoolItem* pItem = pSet->GetItem( pEntry->nWID );
1498 pItem->
QueryValue( aVal, pEntry->nMemberId );
1500 PropertyValue rPropVal;
1501 rPropVal.Name = pEntry->aName;
1502 rPropVal.Value = aVal;
1503 rPropVal.Handle = -1;
1504 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1506 aDefAttrSeq[rPropVal.Name] = rPropVal;
1512 if ( !bOnlyCharAttrs && pTextNode->GetTextColl() )
1516 PropertyValue rPropVal;
1519 rPropVal.Value = aVal;
1520 rPropVal.Handle = -1;
1521 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1523 aDefAttrSeq[rPropVal.Name] = rPropVal;
1529 if ( !bOnlyCharAttrs &&
GetFrame() )
1532 if ( aIter != aDefAttrSeq.end() )
1534 PropertyValue rPropVal( aIter->second );
1535 sal_Int16 nVal = rPropVal.Value.get<sal_Int16>();
1536 if ( nVal == text::WritingMode2::PAGE )
1539 while ( pUpperFrame )
1546 nVal = text::WritingMode2::TB_RL;
1550 nVal = text::WritingMode2::RL_TB;
1554 nVal = text::WritingMode2::LR_TB;
1556 rPropVal.Value <<= nVal;
1557 aDefAttrSeq[rPropVal.Name] = rPropVal;
1563 pUpperFrame =
static_cast<const SwFlyFrame*
>(pUpperFrame)->GetAnchorFrame();
1567 pUpperFrame = pUpperFrame->
GetUpper();
1575 if ( !aRequestedAttributes.hasElements() )
1577 rDefAttrSeq = aDefAttrSeq;
1581 for(
const OUString& rReqAttr : aRequestedAttributes )
1583 tAccParaPropValMap::const_iterator
const aIter = aDefAttrSeq.find( rReqAttr );
1584 if ( aIter != aDefAttrSeq.end() )
1586 rDefAttrSeq[ aIter->first ] = aIter->second;
1593 const uno::Sequence< OUString >& aRequestedAttributes )
1603 constexpr OUStringLiteral sMMToPixelRatio =
u"MMToPixelRatio";
1604 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
1607 uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
1608 ( bProvideMMToPixelRatio ? 1 : 0 ) );
1609 auto pValues = aValues.getArray();
1610 std::transform(aDefAttrSeq.begin(), aDefAttrSeq.end(),
pValues,
1611 [](
const auto& rEntry) -> PropertyValue {
return rEntry.second; });
1614 if ( bProvideMMToPixelRatio )
1616 PropertyValue rPropVal;
1617 rPropVal.Name = sMMToPixelRatio;
1618 const Size a100thMMSize( 1000, 1000 );
1620 const float fRatio = (
static_cast<float>(a100thMMSize.
Width())/100)/aPixelSize.
Width();
1621 rPropVal.Value <<= fRatio;
1622 rPropVal.Handle = -1;
1623 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1624 pValues[ aValues.getLength() - 1 ] = rPropVal;
1631 const sal_Int32 nIndex,
1632 const uno::Sequence< OUString >& aRequestedAttributes,
1636 std::optional<SwPaM> pPaM;
1640 SwTextNode *
const pTextNode(aModelPos.nNode.GetNode().GetTextNode());
1643 aModelPos.nContent.GetIndex() == pTextNode->Len()
1645 : aModelPos.nContent.GetIndex() + 1);
1646 pPaM.emplace(aModelPos, aEndPos);
1658 if ( pTextNode->HasSwAttrSet() )
1661 aAutomaticParaStyleCharAttrs.Put( *(pTextNode->GetpSwAttrSet()),
false );
1662 aSet.Put( aAutomaticParaStyleCharAttrs );
1669 aSet.Put( aCharAttrsAtPaM );
1677 uno::Sequence< OUString > aDummy;
1687 if ( aSet.GetItemState( pEntry->nWID,
true, &pItem ) == SfxItemState::SET )
1690 pItem->
QueryValue( aVal, pEntry->nMemberId );
1692 PropertyValue rPropVal;
1693 rPropVal.Name = pEntry->aName;
1694 rPropVal.Value = aVal;
1695 rPropVal.Handle = -1;
1696 rPropVal.State = PropertyState_DIRECT_VALUE;
1698 tAccParaPropValMap::const_iterator aDefIter =
1699 aDefAttrSeq.find( rPropVal.Name );
1700 if ( aDefIter == aDefAttrSeq.end() ||
1701 rPropVal.Value != aDefIter->second.Value )
1703 aRunAttrSeq[rPropVal.Name] = rPropVal;
1709 if ( !aRequestedAttributes.hasElements() )
1711 rRunAttrSeq = aRunAttrSeq;
1715 for(
const OUString& rReqAttr : aRequestedAttributes )
1717 tAccParaPropValMap::iterator aIter = aRunAttrSeq.find( rReqAttr );
1718 if ( aIter != aRunAttrSeq.end() )
1720 rRunAttrSeq[ (*aIter).first ] = (*aIter).second;
1729 const uno::Sequence< OUString >& aRequestedAttributes )
1739 throw lang::IndexOutOfBoundsException();
1750 const uno::Sequence< OUString >& aRequestedAttributes,
1761 aSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()) );
1763 if ( pTextNode->HasBullet() || pTextNode->HasNumber() )
1767 aSet.Put( pTextNode->SwContentNode::GetAttr(
RES_UL_SPACE) );
1768 aSet.Put( pTextNode->SwContentNode::GetAttr(RES_LR_SPACE) );
1769 aSet.Put( pTextNode->SwContentNode::GetAttr(RES_PARATR_ADJUST) );
1775 while ( !pPropMap->aName.isEmpty() )
1777 const SfxPoolItem* pItem = aSet.GetItem( pPropMap->nWID );
1781 pItem->
QueryValue( aVal, pPropMap->nMemberId );
1783 PropertyValue rPropVal;
1784 rPropVal.Name = pPropMap->aName;
1785 rPropVal.Value = aVal;
1786 rPropVal.Handle = -1;
1787 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1789 aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
1796 for(
const OUString& rSupplementalAttr : aRequestedAttributes )
1798 tAccParaPropValMap::const_iterator
const aIter = aSupplementalAttrSeq.find( rSupplementalAttr );
1799 if ( aIter != aSupplementalAttrSeq.end() )
1801 rSupplementalAttrSeq[ aIter->first ] = aIter->second;
1807 std::vector< PropertyValue >& rValues)
1821 case RedlineType::Insert:
1824 case RedlineType::Delete:
1827 case RedlineType::Format:
1835 case SID_ATTR_CHAR_WEIGHT:
1837 ChangeAttr.Value <<= awt::FontWeight::BOLD;
1839 case SID_ATTR_CHAR_POSTURE:
1841 ChangeAttr.Value <<= awt::FontSlant_ITALIC;
1843 case SID_ATTR_CHAR_STRIKEOUT:
1845 ChangeAttr.Value <<= awt::FontStrikeout::SINGLE;
1847 case SID_ATTR_CHAR_UNDERLINE:
1849 ChangeAttr.Value <<= aChangeAttr.
m_nAttr;
1854 if( aChangeAttr.
m_nItemId == SID_ATTR_BRUSH )
1858 ChangeAttrColor.Value <<=
COL_BLUE;
1860 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1866 ChangeAttrColor.Value <<=
COL_BLUE;
1868 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1880 if (
pos.first->Len() ==
pos.second
1884 assert(
pos.first->Len() !=
pos.second);
1888 sal_Int32 nValues = rValues.size();
1889 for (sal_Int32
i = 0;
i < nValues; ++
i)
1891 PropertyValue& rValue = rValues[
i];
1893 if (rValue.Name == ChangeAttr.Name )
1895 rValue.Value = ChangeAttr.Value;
1899 if (rValue.Name == ChangeAttrColor.Name )
1901 rValue.Value = ChangeAttrColor.Value;
1909 sal_uInt32 crBack =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1912 uno::Reference<XAccessibleComponent> xComponent(
this);
1913 if (xComponent.is())
1915 crBack =
static_cast<sal_uInt32
>(xComponent->getBackground());
1917 rValue.Value <<= crBack;
1928 sal_uInt32 crChar =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1932 uno::Reference<XAccessibleComponent> xComponent(
this);
1933 if (xComponent.is())
1937 rValue.Value <<= crChar;
1951 if(
nullptr != pWrongList )
1953 sal_Int32 nBegin =
pos.second;
1972 if(
nullptr != pWrongList )
1974 sal_Int32 nBegin =
pos.second;
1978 rValue.Value <<= sal_Int32(0x00ff0000);
1985 sal_uInt32 crUnderline =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1988 uno::Reference<XAccessibleComponent> xComponent(
this);
1989 if (xComponent.is())
1993 rValue.Value <<= crUnderline;
2004 if( !tabs.hasElements() )
2006 css::style::TabStop ts;
2009 if( rc1.X - rc0.X >= 48 )
2010 ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
2013 ts.DecimalChar =
' ';
2015 ts.Alignment = css::style::TabAlign_LEFT;
2018 rValue.Value <<= tabs;
2027 rValue.Value <<= sal_Int32(101);
2044 throw lang::IndexOutOfBoundsException();
2047 bool bBehindText =
false;
2076 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2083 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
2086 return awt::Rectangle(
2087 aScreenRect.
Left(), aScreenRect.
Top(),
2110 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2112 Point aPoint( rPoint.X, rPoint.Y );
2115 aPoint.setX(aPoint.getX() + aPixPos.getX());
2116 aPoint.setY(aPoint.getY() + aPixPos.getY());
2117 Point aCorePoint(
GetMap()->PixelToCore( aPoint ) );
2118 if( !aLogBounds.
Contains( aCorePoint ) )
2123 awt::Rectangle aRectEndPos =
2126 if (rPoint.X - aRectEndPos.X >= 0 &&
2127 rPoint.X - aRectEndPos.X < aRectEndPos.Width &&
2128 rPoint.Y - aRectEndPos.Y >= 0 &&
2129 rPoint.Y - aRectEndPos.Y < aRectEndPos.Height)
2136 OSL_ENSURE(
GetFrame() !=
nullptr,
"The text frame has vanished!" );
2137 OSL_ENSURE(
GetFrame()->IsTextFrame(),
"The text frame has mutated!" );
2155 if ( (!bVert && aResultRect.
Pos().getX() > aCorePoint.getX()) ||
2156 ( bVert && aResultRect.
Pos().getY() > aCorePoint.getY()) ||
2157 ( bR2L && aResultRect.
Right() < aCorePoint.getX()) )
2162 if ( (!bVert && aResultRectPrev.Pos().getX() < aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) ||
2163 ( bVert && aResultRectPrev.Pos().getY() < aCorePoint.getY() && aResultRect.
Pos().getX() == aResultRectPrev.Pos().getX()) ||
2164 ( bR2L && aResultRectPrev.Right() > aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) )
2182 sal_Int32 nStart, nEnd;
2185 ?
GetString().copy( nStart, nEnd - nStart )
2195 sal_Int32 nStart, nEnd;
2206 sal_Int32 nStart, nEnd;
2219 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2221 throw lang::IndexOutOfBoundsException();
2228 if( pCursorShell !=
nullptr )
2255 sal_Int32 nStartIndex, sal_Int32 nEndIndex )
2263 if ( !
IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
2264 throw lang::IndexOutOfBoundsException();
2267 return sText.copy(nStartIndex, nEndIndex-nStartIndex );
2276 TextSegment aResult;
2277 aResult.SegmentStart = -1;
2278 aResult.SegmentEnd = -1;
2285 if( nIndex == rText.getLength() && AccessibleTextType::LINE != nTextType )
2289 i18n::Boundary aBound;
2292 OSL_ENSURE( aBound.startPos >= 0,
"illegal boundary" );
2293 OSL_ENSURE( aBound.startPos <= aBound.endPos,
"illegal boundary" );
2298 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2299 aResult.SegmentStart = aBound.startPos;
2300 aResult.SegmentEnd = aBound.endPos;
2314 TextSegment aResult;
2315 aResult.SegmentStart = -1;
2316 aResult.SegmentEnd = -1;
2323 i18n::Boundary aBound;
2324 if (nIndex == rText.getLength())
2325 aBound.startPos = aBound.endPos = nIndex;
2331 aBound.startPos = aBound.endPos = nIndex;
2335 if (nTextType==2 || nTextType == 3)
2337 i18n::Boundary preBound = aBound;
2338 while(preBound.startPos==aBound.startPos && nIndex > 0)
2340 nIndex =
min( nIndex, preBound.startPos ) - 1;
2341 if( nIndex < 0 )
break;
2342 GetTextBoundary( preBound, rText, nIndex, nTextType );
2348 aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
2349 aResult.SegmentStart = preBound.startPos;
2350 aResult.SegmentEnd = preBound.endPos;
2358 nIndex =
min( nIndex, aBound.startPos ) - 1;
2361 bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
2367 if (bWord && nIndex<rText.getLength())
2369 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2370 aResult.SegmentStart = aBound.startPos;
2371 aResult.SegmentEnd = aBound.endPos;
2383 TextSegment aResult;
2384 aResult.SegmentStart = -1;
2385 aResult.SegmentEnd = -1;
2391 if( nIndex == rText.getLength() )
2395 i18n::Boundary aBound;
2400 nIndex =
max( sal_Int32(nIndex+1), aBound.endPos );
2401 if( nIndex < rText.getLength() )
2409 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2410 aResult.SegmentStart = aBound.startPos;
2411 aResult.SegmentEnd = aBound.endPos;
2487 sal_Int32 nEndIndex, AccessibleScrollType aScrollType )
2495 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2496 throw lang::IndexOutOfBoundsException();
2500 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2503 awt::Rectangle startR, endR;
2509 Point eP(std::max(startR.X + startR.Width, endR.X + endR.Width), endR.Y + endR.Height);
2520 switch (aScrollType)
2523 case AccessibleScrollType_SCROLL_TOP_LEFT:
2525 case AccessibleScrollType_SCROLL_BOTTOM_RIGHT:
2527 case AccessibleScrollType_SCROLL_TOP_EDGE:
2529 case AccessibleScrollType_SCROLL_BOTTOM_EDGE:
2531 case AccessibleScrollType_SCROLL_LEFT_EDGE:
2533 case AccessibleScrollType_SCROLL_RIGHT_EDGE:
2536 case AccessibleScrollType_SCROLL_ANYWHERE:
2542 const SwRect aRect(startPoint, endPoint);
2544 OSL_ENSURE( pViewShell !=
nullptr,
"View shell expected!" );
2546 ScrollMDI(pViewShell, aRect, USHRT_MAX, USHRT_MAX);
2585 return replaceText( nStartIndex, nEndIndex, OUString() );
2594 sal_Int32 nStartIndex, sal_Int32 nEndIndex,
2595 const OUString& sReplacement )
2603 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2604 throw lang::IndexOutOfBoundsException();
2613 nStartIndex, nEndIndex, nStart, nEnd );
2626 const uno::Reference<text::XTextRange> xRange(
2628 const_cast<SwDoc&>(pFrame->
GetDoc()), aStartPos, &aEndPos));
2629 xRange->setString(sReplacement);
2640 sal_Int32 nStartIndex,
2641 sal_Int32 nEndIndex,
2642 const uno::Sequence<PropertyValue>& rAttributeSet )
2650 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2651 throw lang::IndexOutOfBoundsException();
2662 sal_Int32
nLength = rAttributeSet.getLength();
2663 const PropertyValue* pPairs = rAttributeSet.getConstArray();
2664 std::vector<sal_Int32> aIndices(nLength);
2665 std::iota(aIndices.begin(), aIndices.end(), 0);
2666 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(pPairs));
2669 uno::Sequence< OUString > aNames( nLength );
2670 OUString* pNames = aNames.getArray();
2671 uno::Sequence< uno::Any > aValues( nLength );
2673 for (sal_Int32
i = 0;
i < nLength; ++
i)
2675 const PropertyValue& rVal = pPairs[aIndices[
i]];
2676 pNames[
i] = rVal.Name;
2685 xPortion->setPropertyValues( aNames, aValues );
2687 catch (
const UnknownPropertyException&)
2704 sal_Int32 nChildIndex )
2712 sal_Int32 nChildIndex )
2739 sal_Int32 nSelectedChildIndex )
2748 sal_Int32 nChildIndex )
2759 class SwHyperlinkIter_Impl
2767 explicit SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame);
2776 SwHyperlinkIter_Impl::SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame)
2777 : m_rFrame(rTextFrame)
2778 , m_Iter(rTextFrame)
2779 , m_nStt(rTextFrame.GetOffset())
2794 while (
SwTextAttr const*
const pHt = m_Iter.NextAttr(&pNode))
2798 const TextFrameIndex nHtStt(m_rFrame.MapModelToView(pNode, pHt->GetStart()));
2799 const TextFrameIndex nHtEnd(m_rFrame.MapModelToView(pNode, pHt->GetAnyEnd()));
2800 if (nHtEnd > nHtStt &&
2801 ((nHtStt >= m_nStt && nHtStt < m_nEnd) ||
2802 (nHtEnd > m_nStt && nHtEnd <= m_nEnd)))
2827 SwHyperlinkIter_Impl aIter(*pTextFrame);
2828 while( aIter.next() )
2834 uno::Reference< XAccessibleHyperlink > SAL_CALL
2841 uno::Reference< XAccessibleHyperlink > xRet;
2844 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2847 for (sal_Int32 nTIndex = 0; pHt && nTIndex <= nLinkIndex; ++nTIndex)
2849 if( nTIndex == nLinkIndex )
2857 xRet = (*aIter).second;
2864 max(aHIter.startIdx(), nHintStart));
2866 min(aHIter.endIdx(), nHintEnd));
2868 *
this, nTmpHStt, nTmpHEnd );
2871 (*aIter).second = xRet;
2882 pHt =
const_cast<SwTextAttr*
>(aHIter.next(&pNode));
2885 throw lang::IndexOutOfBoundsException();
2900 throw lang::IndexOutOfBoundsException();
2903 sal_Int32 nRet = -1;
2907 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2916 pHt = aHIter.next(&pNode);
2925 throw lang::IndexOutOfBoundsException();
2934 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
2935 switch ( nTextMarkupType )
2937 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
2938 case text::TextMarkupType::TRACK_CHANGE_DELETION:
2939 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
2953 return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
2966 sal_Int32 nSelected = 0;
2968 if( pCursor !=
nullptr )
2976 nLastNode = pMerged->pLastNode->GetIndex();
2980 nLastNode = nFirstNode;
2987 if( rTmpCursor.HasMark() )
2994 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3013 sal_Int32 nStart=-1, nEnd=-1;
3024 sal_Int32 nStart=-1, nEnd=-1;
3033 if(selectionIndex < 0)
return false;
3035 sal_Int32 nSelected = selectionIndex;
3040 if( pCursor !=
nullptr )
3050 nLastNode = pMerged->pLastNode->GetIndex();
3054 nLastNode = nFirstNode;
3058 SwPaM* pRingStart = pCursor;
3069 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3071 if( nSelected == 0 )
3073 pCursor->
MoveTo(
nullptr);
3087 while( !bRet && (pCursor != pRingStart) );
3100 if ( !
IsValidRange( startOffset, endOffset, nLength ) )
3102 throw lang::IndexOutOfBoundsException();
3106 for ( sal_Int32
i = nSelectedCount ;
i >= 0 ;
i--)
3108 sal_Int32 nStart, nEnd;
3114 if (( startOffset>=nStart && startOffset <=nEnd ) ||
3115 ( endOffset>=nStart && endOffset <=nEnd ) ||
3116 ( startOffset <= nStart && endOffset >=nEnd) ||
3117 ( startOffset >= nStart && endOffset <=nEnd) )
3125 if (( startOffset>=nEnd && startOffset <=nStart ) ||
3126 ( endOffset>=nEnd && endOffset <=nStart ) ||
3127 ( startOffset <= nStart && endOffset >=nEnd) ||
3128 ( startOffset >= nStart && endOffset <=nEnd) )
3140 if( pCursorShell !=
nullptr )
3155 TextSegment SAL_CALL
3157 sal_Int32 nTextMarkupType )
3161 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3162 switch ( nTextMarkupType )
3164 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3165 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3166 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3180 return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
3183 uno::Sequence< TextSegment > SAL_CALL
3185 sal_Int32 nTextMarkupType )
3193 throw lang::IndexOutOfBoundsException();
3196 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3197 switch ( nTextMarkupType )
3199 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3200 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3201 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3215 return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
3227 throw lang::IndexOutOfBoundsException();
3234 TextSegment SAL_CALL
3243 throw lang::IndexOutOfBoundsException();
3246 i18n::Boundary aLineBound;
3249 TextSegment aTextAtLine;
3251 aTextAtLine.SegmentText = rText.copy( aLineBound.startPos,
3252 aLineBound.endPos - aLineBound.startPos );
3253 aTextAtLine.SegmentStart = aLineBound.startPos;
3254 aTextAtLine.SegmentEnd = aLineBound.endPos;
3265 if ( nLineNoOfCaret >= 0 &&
3271 return TextSegment();
3288 if ( nCaretPos != 0 )
3290 i18n::Boundary aLineBound;
3292 if ( nCaretPos == aLineBound.startPos )
3295 if ( pCursorShell !=
nullptr )
3304 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
3311 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
3314 const awt::Rectangle aCursorRect( aScreenRect.
Left(),
3319 if ( aCharRect.X != aCursorRect.X ||
3320 aCharRect.Y != aCursorRect.Y )
3338 sal_Int32 * pSelection, sal_Int32& nStart, sal_Int32& nEnd)
3340 if (pSelection && *pSelection < 0)
return false;
3348 if( pCursor !=
nullptr )
3356 nLastNode = pMerged->pLastNode->GetIndex();
3360 nLastNode = nFirstNode;
3367 if( rTmpCursor.HasMark() )
3374 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3376 if (!pSelection || *pSelection == 0)
3381 sal_Int32 nLocalStart = -1;
3382 if (nStartIndex < nFirstNode)
3402 else if( nCoreStart <=
3409 "problem determining valid core position");
3418 sal_Int32 nLocalEnd = -1;
3419 if (nLastNode < nEndIndex)
3441 else if( nCoreEnd >=
3449 "problem determining valid core position");
3456 if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
3458 nStart = nLocalStart;
3477 if (pSelection && bRet)
3480 if( nStart == nCaretPos )
3482 sal_Int32 tmp = nStart;
3497 return AccessibleRole::HEADING;
3501 return AccessibleRole::PARAGRAPH;
3508 uno::Reference< css::beans::XPropertySet > xPortion =
CreateUnoPortion( 0, 0 );
3509 uno::Any styleAny = xPortion->getPropertyValue(
"ParaStyleName" );
3511 if (styleAny >>= sValue)
3513 sal_Int32
length = sValue.getLength();
3514 if (length == 9 || length == 10)
3516 if (sValue.startsWith(
"Heading"))
3518 std::u16string_view intStr = sValue.subView(8);
3520 return headingLevel;
3532 OUString strHeading(
"heading-level:");
3536 strHeading +=
";level:";
virtual sal_Int32 SAL_CALL getSeletedPositionStart(sal_Int32 nSelectedPortionIndex) override
const OUString & GetAccessibleString() const
get the text string, as presented by the layout
void _getDefaultAttributesImpl(const css::uno::Sequence< OUString > &aRequestedAttributes, tAccParaPropValMap &rDefAttrSeq, const bool bOnlyCharAttrs=false)
SfxViewFrame * GetViewFrame() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
static uno::Sequence< OUString > const & getAttributeNames()
bool GetWordBoundary(css::i18n::Boundary &rBound, const OUString &rText, sal_Int32 nPos)
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
static Color & GetFieldShadingsColor()
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void Right(const tools::Long nRight)
void FireAccessibleEvent(css::accessibility::AccessibleEventObject &rEvent)
css::uno::Sequence< css::style::TabStop > GetCurrentTabStop(sal_Int32 nIndex)
friend class SwAccessibleHyperlink
virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
bool GetAttributeBoundary(css::i18n::Boundary &rBound, sal_Int32 nPos)
static bool GetParagraphBoundary(css::i18n::Boundary &rBound, const OUString &rText)
Marks a position in the document model.
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
static bool lcl_GetBackgroundColor(Color &rColor, const SwFrame *pFrame, SwCursorShell *pCursorSh)
SwTextFrame * DynCastTextFrame()
#define UNO_NAME_CHAR_UNDERLINE_COLOR
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
static OUString GetDescription()
#define PROPERTY_MAP_TEXT_CURSOR
void ExecuteAtViewShell(sal_uInt16 nSlot)
bool m_bRealHeight
should the real height be calculated?
static constexpr auto Items
bool IsOutline() const
Returns if this text node is an outline.
virtual sal_Int32 SAL_CALL getSeletedPositionEnd(sal_Int32 nSelectedPortionIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
#define UNO_NAME_CHAR_FONT_NAME
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
virtual void GetStates(::utl::AccessibleStateSetHelper &rStateSet) override
OUString const & GetString()
get the (accessible) text string (requires frame; check before)
void Left(const tools::Long nLeft)
virtual sal_Int32 SAL_CALL getHyperLinkCount() override
void selectAllAccessibleChildren()
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
virtual sal_Int32 SAL_CALL getBackground() override
TextFrameIndex FillSpecialPos(sal_Int32 nPos, SwSpecialPos &rPos, SwSpecialPos *&rpPos) const
fill a SwSpecialPos structure, suitable for calling SwTextFrame->GetCharRect Returns the core positio...
virtual sal_Bool SAL_CALL setAttributes(sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue > &aAttributeSet) override
SwFrameType GetType() const
#define UNO_NAME_PARA_LEFT_MARGIN
SfxDispatcher * GetDispatcher()
void _getSupplementalAttributesImpl(const css::uno::Sequence< OUString > &aRequestedAttributes, tAccParaPropValMap &rSupplementalAttrSeq)
virtual sal_Int32 SAL_CALL getForeground() override
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
virtual sal_Int32 SAL_CALL getSelectionEnd() override
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
vcl::Window * GetWindow()
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
sal_Int32 getSelectedAccessibleChildCount()
const SwPosition * GetMark() const
virtual sal_Bool SAL_CALL scrollToPosition(const css::awt::Point &aPoint, sal_Bool isLeftTop) override
Base class of all fields.
virtual sal_Bool SAL_CALL setText(const OUString &sText) override
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define UNO_NAME_PARA_STYLE_NAME
sw::MergedPara * GetMergedPara()
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
#define PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE
virtual css::lang::Locale SAL_CALL getLocale() override
Return the parents locale or throw exception if this object has no parent yet/anymore.
bool m_bRealWidth
Calculation of the width required.
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
bool GetSelectionAtIndex(sal_Int32 *pSelection, sal_Int32 &nStart, sal_Int32 &nEnd)
constexpr sal_uInt16 RES_FRMATR_END(133)
SwViewShell * GetShell()
convenience method to get the SwViewShell through accessibility map
constexpr OUStringLiteral sServiceName
virtual bool GetCharRect(SwRect &rRect, const SwPosition &rPos, SwCursorMoveState *pCMS=nullptr, bool bAllowFarAway=true) const override
Returns the view rectangle for the rPos model position.
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
In nOffset returns the offset of the char within the set text buffer, which is closest to the positio...
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Bool SAL_CALL insertText(const OUString &sText, sal_Int32 nIndex) override
virtual sal_Int32 SAL_CALL getHyperLinkIndex(sal_Int32 nCharIndex) override
void Pos(const Point &rNew)
virtual sal_Int32 SAL_CALL getSelectedPortionCount() override
#define UNO_NAME_WRITING_MODE
virtual sal_Bool SAL_CALL pasteText(sal_Int32 nIndex) override
virtual void InvalidateFocus_() override
constexpr OUStringLiteral UNO_NAME_NUMBERING_RULES
Of course Writer needs its own rectangles.
SfxViewShell * GetSfxViewShell() const
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
bool IsInside(TextFrameIndex nPos) const
Respect the Follows.
sal_Int32 GetAnyEnd() const
end (if available), else start
const AuthorCharAttr & GetInsertAuthorAttr() const
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
SwAccessiblePortionData & GetPortionData()
static bool IsValidRange(sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength)
void MoveTo(value_type *pDestRing)
Removes this item from its current ring container and adds it to another ring container.
constexpr OUStringLiteral UNO_NAME_CHAR_HEIGHT
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
bool IsSymbolAt(sal_Int32 nBegin) const
in ndcopy.cxx
virtual sal_Int32 SAL_CALL getNumberOfLineWithCaret() override
rtl::Reference< SwXTextPortion > CreateUnoPortion(sal_Int32 nStart, sal_Int32 nEnd)
constexpr tools::Long Width() const
std::map< key_type, mapped_type, key_compare >::iterator iterator
SwCursorShell * GetCursorShell()
convenience method to get SwCursorShell through accessibility map
SwViewShell * GetShell() const
virtual sal_Bool SAL_CALL scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
SwAccessibleSelectionHelper m_aSelectionHelper
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
const SwFrame * GetFrame() const
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_LEVEL(83)
#define UNO_NAME_PARA_LINE_SPACING
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
#define UNO_NAME_PARA_RIGHT_MARGIN
bool isAccessibleChildSelected(sal_Int32 nChildIndex)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
std::unique_ptr< SwAccessiblePortionData > m_pPortionData
static bool IsValidChar(sal_Int32 nPos, sal_Int32 nLength)
virtual OUString SAL_CALL getText() override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_Int32 GetStart() const
virtual sal_Int32 SAL_CALL getForeground() override
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
constexpr OUStringLiteral sAccessibleServiceName
SwAccessibleParagraph(std::shared_ptr< SwAccessibleMap > const &pInitMap, const SwTextFrame &rTextFrame)
sal_uInt16 GetFormatCount(SwFieldTypesEnum nTypeId, bool bHtmlMode) const
const SwFormatField & GetFormatField() const
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
SwNodeOffset GetIndex() const
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
constexpr OUStringLiteral UNO_NAME_NUMBERING_LEVEL
const AuthorCharAttr & GetFormatAuthorAttr() const
virtual css::accessibility::TextSegment SAL_CALL getTextMarkup(sal_Int32 nTextMarkupIndex, sal_Int32 nTextMarkupType) override
SwTextFrame * GetFollow()
TextFrameIndex GetOffset() const
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
void GetAttributeBoundary(css::i18n::Boundary &rBound, sal_Int32 nPos) const
virtual sal_Int32 SAL_CALL getTextMarkupCount(sal_Int32 nTextMarkupType) override
bool Select(SwPaM *pPaM, SdrObject *pObj, bool bAdd)
void GetLineBoundary(css::i18n::Boundary &rBound, sal_Int32 nPos) const
get the start & end positions of the sentence
bool IsInGrayPortion(sal_Int32 nPos)
css::uno::Reference< css::accessibility::XAccessible > getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex)
virtual OUString SAL_CALL getImplementationName() override
const Color & GetColor() const
void FireStateChangedEvent(sal_Int16 nState, bool bNewState)
PaM is Point and Mark: a selection of the document model.
SwTextNode * GetTextNodeFirst()
std::unique_ptr< SwParaChangeTrackingInfo > mpParaChangeTrackInfo
virtual sal_Int16 SAL_CALL getAccessibleRole() override
SwTextNode const * GetTextNodeForParaProps() const
virtual sal_Bool SAL_CALL cutText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
bool IsRefToNumItemCrossRefBookmark() const
virtual void SAL_CALL grabFocus() override
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
const SfxItemSet * GetParent() const
virtual css::uno::Sequence< css::style::TabStop > GetTabStopInfo(SwTwips)
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
SwPaM * GetCursor(const bool _bForSelection)
sal_Int32 m_nHeadingLevel
constexpr OUStringLiteral UNO_NAME_CHAR_UNDERLINE
const SwPosition * GetPoint() const
static bool IsValidPosition(sal_Int32 nPos, sal_Int32 nLength)
bool GetEditableRange(sal_Int32 nStart, sal_Int32 nEnd, TextFrameIndex &rCoreStart, TextFrameIndex &rCoreEnd) const
Convert start and end positions into core positions.
void GetBoundaryOfLine(const sal_Int32 nLineNo, css::i18n::Boundary &rLineBound)
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
constexpr sal_uInt16 RES_PARATR_LIST_END(88)
virtual void SAL_CALL selectAllAccessibleChildren() override
#define UNO_NAME_PARA_ADJUST
virtual bool HasCursor() override
#define UNO_NAME_PARA_BOTTOM_MARGIN
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
constexpr OUStringLiteral UNO_NAME_CHAR_POSTURE
SwNodeOffset GetIndex() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwLayoutFrame * GetUpper()
const SfxItemPropertyMap & getPropertyMap() const
virtual void InvalidateCursorPos_() override
void GetSentenceBoundary(css::i18n::Boundary &rBound, sal_Int32 nPos)
#define UNO_NAME_CHAR_EMPHASIS
TextFrameIndex GetCoreViewPosition(sal_Int32 nPos) const
get the position in the core view string for a given (accessibility) position
constexpr OUStringLiteral sImplementationName
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
collect text portion data from the layout through SwPortionHandler interface
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
virtual css::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret() override
T static_txtattr_cast(S *s)
ring_container GetRingContainer()
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
bool IsOnlineSpell() const
const SwRangeRedline * GetRedlineAtIndex()
bool GetTextBoundary(css::i18n::Boundary &rBound, const OUString &rText, sal_Int32 nPos, sal_Int16 aTextType)
SwRect GetBounds(const SwAccessibleMap &rAccMap, const SwFrame *pFrame=nullptr)
#define UNO_NAME_PARA_FIRST_LINE_INDENT
bool GetLineBoundary(css::i18n::Boundary &rBound, const OUString &rText, sal_Int32 nPos)
virtual sal_uInt16 GetSubType() const
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes(const css::uno::Sequence< OUString > &aRequestedAttributes) override
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
const SwPosition * Start() const
bool Contains(const Point &rPOINT) const
SwFieldType * GetTyp() const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex)
#define UNO_NAME_CHAR_BACK_COLOR
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
static void OrderRange(sal_Int32 &nBegin, sal_Int32 &nEnd)
bool GetBackgroundBrush(drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes, const SvxBrushItem *&rpBrush, std::optional< Color > &rxColor, SwRect &rOrigRect, bool bLowerMode, bool bConsiderTextBox) const
Determine the background brush for the frame: the background brush is taken from it-self or from its ...
#define UNO_NAME_CHAR_ESCAPEMENT
virtual sal_Int32 SAL_CALL getCaretPosition() override
static void SetPutRecursive(SfxItemSet &targetSet, const SfxItemSet &sourceSet)
const css::lang::Locale & GetLocale(const LanguageType aLang)
sal_Int32 GetRealHeadingLevel()
const PropertyValue * pValues
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwFieldTypesEnum GetTypeId() const
SwTextNode is a paragraph in the document model.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
#define UNO_NAME_CHAR_CONTOURED
virtual sal_Int32 SAL_CALL getBackground() override
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &aPoint) override
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
virtual OUString SAL_CALL getSelectedText() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
virtual css::accessibility::TextSegment SAL_CALL getTextAtLineNumber(sal_Int32 nLineNo) override
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
void ScrollMDI(SwViewShell const *pVwSh, const SwRect &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY)
general base class for all free-flowing frames
Color GetRetoucheColor() const
virtual OUString GetName() const
Only in derived classes.
#define SAL_WARN_IF(condition, area, stream)
bool IsRefToHeadingCrossRefBookmark() const
bool GetSelection(sal_Int32 &nStart, sal_Int32 &nEnd)
const SwViewOption * GetViewOptions() const
constexpr OUStringLiteral UNO_NAME_CHAR_SHADOWED
css::uno::Sequence< typename M::mapped_type > mapValuesToSequence(M const &map)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::unordered_map< OUString, css::beans::PropertyValue > tAccParaPropValMap
sal_Int32 GetLineNo(const sal_Int32 nPos) const
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
virtual void GetStates(::utl::AccessibleStateSetHelper &rStateSet)
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
constexpr OUStringLiteral UNO_NAME_CHAR_WEIGHT
const SwPosition * End() const
void _correctValues(const sal_Int32 nIndex, std::vector< css::beans::PropertyValue > &rValues)
bool IsRightToLeft() const
constexpr OUStringLiteral UNO_NAME_CHAR_COLOR
SwDoc & GetDoc() const
Returns the document this position is in.
void selectAccessibleChild(sal_Int32 nChildIndex)
virtual sal_Int32 SAL_CALL addSelection(sal_Int32 selectionIndex, sal_Int32 startOffset, sal_Int32 endOffset) override
virtual OUString SAL_CALL getAccessibleDescription() override
constexpr sal_uInt16 RES_PARATR_END(82)
const SwRect & GetCharRect() const
RedlineType GetType(sal_uInt16 nPos=0) const
bool GetGlyphBoundary(css::i18n::Boundary &rBound, const OUString &rText, sal_Int32 nPos)
const o3tl::sorted_vector< const SfxItemPropertyMapEntry *, SfxItemPropertyMapCompare > & getPropertyEntries() const
virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override
void _getRunAttributesImpl(const sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes, tAccParaPropValMap &rRunAttrSeq)
size_t IsObjSelected() const
#define UNO_NAME_CHAR_STRIKEOUT
virtual Point LogicToPixel(const Point &rPoint) const override
SwUnoPropertyMapProvider aSwMapProvider
virtual sal_Int32 SAL_CALL getLineNumberAtIndex(sal_Int32 nIndex) override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
SwSpecialPos * m_pSpecialPos
for positions inside fields
css::uno::Reference< css::accessibility::XAccessible > GetContext(const SwFrame *pFrame, bool bCreate=true)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
double getLength(const B2DPolygon &rCandidate)
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
void GetLastLineBoundary(css::i18n::Boundary &rBound) const
SwAccessibleMap * GetMap()
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr sal_uInt16 RES_CHRATR_END(46)
bool m_bPosMatchesBounds
GetModelPositionForViewPoint should not return the next position if screen position is inside second ...
void deselectAccessibleChild(sal_Int32 nChildIndex)
virtual sal_Bool SAL_CALL replaceText(sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString &sReplacement) override
#define UNO_NAME_TABSTOPS
virtual css::uno::Reference< css::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink(sal_Int32 nLinkIndex) override
std::unique_ptr< SwAccessibleHyperTextData > m_pHyperTextData
OUString GetFormatStr(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatId) const
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
SwContentFrame * FindPrevCnt()
void SetCursorContext(const ::rtl::Reference< SwAccessibleContext > &rCursorContext)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
virtual ~SwAccessibleParagraph() override
sal_Int32 GetAccessiblePosition(TextFrameIndex nPos) const
get the position in the accessibility string for a given view position
void VisitPortions(SwPortionHandler &rPH) const
Visit all portions for Accessibility.
static bool implInitTextChangedEvent(std::u16string_view rOldString, std::u16string_view rNewString, css::uno::Any &rDeleted, css::uno::Any &rInserted)
bool GetCharBoundary(css::i18n::Boundary &rBound, sal_Int32 nPos)
sal_Int32 GetFieldIndex(sal_Int32 nPos) const
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
void AddState(sal_Int16 aState)
void FireVisibleDataEvent()
virtual sal_Int32 SAL_CALL getSelectionStart() override
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
const AuthorCharAttr & GetDeletedAuthorAttr() const
bool IsIndexInFootnode(sal_Int32 nIndex)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
virtual void InvalidateContent_(bool bVisibleDataFired) override
void SetName(const OUString &rName)
bool IsFrameSelected() const
virtual css::uno::Sequence< css::accessibility::TextSegment > SAL_CALL getTextMarkupAtIndex(sal_Int32 nCharIndex, sal_Int32 nTextMarkupType) override
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
virtual sal_Bool SAL_CALL deleteText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Int32 SAL_CALL getCharacterCount() override
virtual sal_Bool SAL_CALL removeSelection(sal_Int32 selectionIndex) override
const SfxItemPropertyMapEntry * GetPropertyMapEntries(sal_uInt16 PropertyId)
bool GetSentenceBoundary(css::i18n::Boundary &rBound, const OUString &rText, sal_Int32 nPos)
static uno::Sequence< OUString > const & getSupplementalAttributeNames()
virtual void SAL_CALL clearAccessibleSelection() override
void EndAction(const bool bIdleEnd=false)
bool IsInFrontOfLabel() const
bool m_bDetectedRangeSegmentation false
void GetSubTypes(SwFieldTypesEnum nId, std::vector< OUString > &rToFill)
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override