33 #include <osl/mutex.hxx>
37 #include <com/sun/star/accessibility/AccessibleRole.hpp>
38 #include <com/sun/star/accessibility/AccessibleScrollType.hpp>
39 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
40 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
41 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
43 #include <com/sun/star/i18n/Boundary.hpp>
44 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
45 #include <com/sun/star/i18n/WordType.hpp>
46 #include <com/sun/star/i18n/XBreakIterator.hpp>
47 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
48 #include <com/sun/star/beans/UnknownPropertyException.hpp>
62 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
69 #include <com/sun/star/beans/XPropertySet.hpp>
72 #include <com/sun/star/awt/FontWeight.hpp>
73 #include <com/sun/star/awt/FontStrikeout.hpp>
74 #include <com/sun/star/awt/FontSlant.hpp>
82 #include <com/sun/star/text/WritingMode2.hpp>
83 #include <viewimp.hxx>
86 #include <com/sun/star/text/TextMarkupType.hpp>
90 #include <editeng/editids.hrc>
94 #include "../../uibase/inc/fldmgr.hxx"
101 using beans::PropertyValue;
102 using beans::XMultiPropertySet;
103 using beans::UnknownPropertyException;
104 using beans::PropertyState_DIRECT_VALUE;
114 constexpr OUStringLiteral
sServiceName =
u"com.sun.star.text.AccessibleParagraphView";
135 if( pCaret !=
nullptr )
151 bool bFormat = pTextFrame->
HasPara();
171 OSL_ENSURE( nRet >= 0,
"invalid cursor?" );
189 SwPaM* pCursor =
nullptr;
193 if ( pCursorShell !=
nullptr &&
194 ( _bForSelection || !pCursorShell->
IsTableMode() ) )
201 pCursor = pCursorShell->
GetCursor(
false );
221 rStateSet.
AddState( AccessibleStateType::MULTI_LINE );
226 rStateSet.
AddState(AccessibleStateType::MULTI_SELECTABLE);
228 rStateSet.
AddState(AccessibleStateType::FOCUSABLE);
235 if (pCaret !=
nullptr &&
241 rStateSet.
AddState( AccessibleStateType::FOCUSED );
255 if( rText != sOldText )
258 AccessibleEventObject
aEvent;
259 aEvent.EventId = AccessibleEventId::TEXT_CHANGED;
268 uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
269 if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
274 AccessibleEventObject aParaEvent;
275 aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
280 else if( !bVisibleDataFired )
290 osl::MutexGuard aGuard(
m_Mutex );
296 if( bNewIsHeading != bOldIsHeading )
299 AccessibleEventObject
aEvent;
300 aEvent.EventId = AccessibleEventId::ROLE_CHANGED;
305 if( rText == sOldText )
311 osl::MutexGuard aGuard(
m_Mutex );
317 if( sNewDesc != sOldDesc )
320 AccessibleEventObject
aEvent;
321 aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
322 aEvent.OldValue <<= sOldDesc;
323 aEvent.NewValue <<= sNewDesc;
335 osl::MutexGuard aGuard(
m_Mutex );
352 if( pWin && pWin->
HasFocus() && -1 == nOld )
355 AccessibleEventObject
aEvent;
356 aEvent.EventId = AccessibleEventId::CARET_CHANGED;
357 aEvent.OldValue <<= nOld;
358 aEvent.NewValue <<= nNew;
362 if( pWin && pWin->
HasFocus() && -1 == nNew )
370 aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
371 aEvent.OldValue.clear();
372 aEvent.NewValue.clear();
386 osl::MutexGuard aGuard(
m_Mutex );
389 OSL_ENSURE( nPos != -1,
"focus object should be selected" );
397 std::shared_ptr<SwAccessibleMap>
const& pInitMap,
401 , m_nOldCaretPos( -1 )
402 , m_bIsHeading( false )
404 , m_nHeadingLevel (-1)
405 , m_aSelectionHelper( *this )
407 , m_bLastHasSelection(false)
431 osl::MutexGuard aGuard(
m_Mutex );
438 OSL_ENSURE(
GetFrame() !=
nullptr,
"The text frame has vanished!" );
439 OSL_ENSURE(
GetFrame()->IsTextFrame(),
"The text frame has mutated!" );
447 OSL_ENSURE(
m_pPortionData !=
nullptr,
"UpdatePortionData() failed" );
458 OSL_ENSURE(
GetMap() !=
nullptr,
"no map?" );
461 OSL_ENSURE( pViewShell !=
nullptr,
"View shell expected!" );
464 OSL_ENSURE( pSfxShell !=
nullptr,
"SfxViewShell shell expected!" );
469 OSL_ENSURE( pFrame !=
nullptr,
"View frame expected!" );
474 OSL_ENSURE( pDispatcher !=
nullptr,
"Dispatcher expected!" );
482 sal_Int32 nStartIndex,
483 sal_Int32 nEndIndex )
486 (nEndIndex == -1)) ||
488 "please check parameters before calling this method" );
498 auto pUnoCursor(const_cast<SwDoc&>(pFrame->
GetDoc()).CreateUnoCursor(aStartPos));
499 pUnoCursor->SetMark();
503 uno::Reference<text::XText> aEmpty;
510 sal_Int32 nPos, sal_Int32 nLength)
512 return (nPos >= 0) && (nPos < nLength);
516 sal_Int32 nPos, sal_Int32 nLength)
518 return (nPos >= 0) && (nPos <= nLength);
522 sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength)
544 i18n::Boundary& rBound,
550 rBound.startPos = nPos;
551 rBound.endPos = nPos+1;
556 i18n::Boundary& rBound,
557 const OUString& rText,
570 const sal_Int16 nWordType = i18n::WordType::ANY_WORD;
574 rText, nPos, aLocale, nWordType,
true );
580 i18n::Boundary& rBound,
581 const OUString& rText,
585 while( nPos < rText.getLength() && pStr[nPos] ==
u' ' )
593 i18n::Boundary& rBound,
594 const OUString& rText,
597 if( rText.getLength() == nPos )
605 i18n::Boundary& rBound,
606 const OUString& rText )
609 rBound.endPos = rText.getLength();
614 i18n::Boundary& rBound,
622 i18n::Boundary& rBound,
623 const OUString& rText,
636 const sal_Int16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
639 rText, nPos, aLocale, nIterMode, 1, nDone );
641 rText, rBound.endPos, aLocale, nIterMode, 1, nDone );
642 bool bRet = ((rBound.startPos <= nPos) && (nPos <= rBound.endPos));
643 OSL_ENSURE( rBound.startPos <= nPos,
"start pos too high" );
644 OSL_ENSURE( rBound.endPos >= nPos,
"end pos too low" );
650 i18n::Boundary& rBound,
651 const OUString& rText,
653 sal_Int16 nTextType )
656 if( !( AccessibleTextType::LINE == nTextType
659 throw lang::IndexOutOfBoundsException();
665 case AccessibleTextType::WORD:
669 case AccessibleTextType::SENTENCE:
673 case AccessibleTextType::PARAGRAPH:
677 case AccessibleTextType::CHARACTER:
681 case AccessibleTextType::LINE:
683 if((nPos == rText.getLength()) && nPos > 0)
689 case AccessibleTextType::ATTRIBUTE_RUN:
693 case AccessibleTextType::GLYPH:
698 throw lang::IllegalArgumentException( );
710 osl::MutexGuard aGuard2(
m_Mutex );
724 throw uno::RuntimeException(
"no SwTextFrame", static_cast<cppu::OWeakObject*>(
this));
742 OSL_ENSURE( pTextFrame,
743 "<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame");
747 if ( pPrevContentFrame )
749 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pPrevContentFrame ) };
750 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
752 pHelper->AddRelation( aAccRel );
756 if ( pNextContentFrame )
758 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pNextContentFrame ) };
759 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
761 pHelper->AddRelation( aAccRel );
779 if (pCursorSh !=
nullptr &&
780 ( pCursor ==
nullptr ||
786 SwPaM aPaM( aStartPos );
796 if (pWindow !=
nullptr)
807 std::optional<Color> xSectionTOXColor;
812 pFrame->
GetBackgroundBrush( aFillAttributes, pBackgrdBrush, xSectionTOXColor, aDummyRect,
false,
false ) )
814 if ( xSectionTOXColor )
816 rColor = *xSectionTOXColor;
825 else if ( pCursorSh )
838 Color aBackgroundCol;
842 if ( aBackgroundCol.
IsDark() )
859 Color aBackgroundCol;
863 return sal_Int32(aBackgroundCol);
875 const OUString& sTestServiceName)
887 static uno::Sequence< OUString >
const aNames
910 static uno::Sequence< OUString >
const aNames
933 uno::Reference<XAccessibleText> aAccText =
static_cast<XAccessibleText *
>(*this);
938 uno::Reference<XAccessibleEditableText> aAccEditText =
this;
939 aRet <<= aAccEditText;
943 uno::Reference<XAccessibleSelection> aAccSel =
this;
948 uno::Reference<XAccessibleHypertext> aAccHyp =
this;
955 uno::Reference<XAccessibleTextAttributes> aAccTextAttr =
this;
956 aRet <<= aAccTextAttr;
962 uno::Reference<XAccessibleTextMarkup> aAccTextMarkup =
this;
963 aRet <<= aAccTextMarkup;
968 uno::Reference<XAccessibleMultiLineText> aAccMultiLineText =
this;
969 aRet <<= aAccMultiLineText;
973 uno::Reference< css::accessibility::XAccessibleTextSelection > aTextExtension =
this;
974 aRet <<= aTextExtension;
978 uno::Reference<XAccessibleExtendedAttributes> xAttr =
this;
983 aRet = SwAccessibleContext::queryInterface(rType);
1001 SwAccessibleContext::getTypes() ).
getTypes();
1006 return css::uno::Sequence<sal_Int8>();
1019 osl::MutexGuard aOldCaretPosGuard(
m_Mutex );
1042 throw lang::IndexOutOfBoundsException();
1049 if( pCursorShell !=
nullptr )
1055 SwPaM aPaM( aStartPos );
1074 throw lang::IndexOutOfBoundsException();
1076 return sText[nIndex];
1089 throw lang::IndexOutOfBoundsException();
1092 bool bBehindText =
false;
1118 css::uno::Sequence< css::style::TabStop > tabs;
1119 const sal_Int32 nStrLen = pFrame->
GetText().getLength();
1126 if( tabs.hasElements() )
1132 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
1141 aScreenRect.
Move( -aFramePixPos.X(), -aFramePixPos.Y() );
1143 tabs[0].Position = aScreenRect.
GetWidth();
1154 explicit IndexCompare(
const PropertyValue* pVals ) : pValues(pVals) {}
1155 bool operator() ( sal_Int32 a, sal_Int32 b )
const
1157 return (pValues[a].Name < pValues[b].Name);
1165 OUString strTypeName;
1169 if (nFieldIndex >= 0)
1178 && (nFieldIndex-- == 0))
1185 && (nFieldIndex-- == 0))
1187 strTypeName =
"set reference";
1199 sal_uInt32 subType = 0;
1203 subType =
static_cast<const SwDocStatField*
>(pField)->GetSubType();
1213 sEntry =
"Headings";
1215 sEntry =
"Numbered Paragraphs";
1217 sEntry =
"Bookmarks";
1221 sEntry =
"Footnotes";
1224 sEntry =
"Endnotes";
1227 sEntry =
"Insert Reference";
1230 sEntry =
static_cast<const SwGetRefField*
>(pField)->GetSetRefName();
1234 strTypeName = sEntry;
1239 if (sEntry.getLength() > 0)
1241 strTypeName +=
"-" + sEntry;
1251 const sal_uInt32 nFormat= pField->
GetFormat();
1253 if (nFormat < nSize)
1256 if (sEntry.getLength() > 0)
1258 strTypeName +=
"-" + sEntry;
1264 subType =
static_cast<const SwExtUserField*
>(pField)->GetSubType();
1270 if (sEntry.getLength() > 0)
1272 strTypeName +=
"-" + sEntry;
1283 bool bOn = pRPld->
IsOn();
1286 strTypeName +=
"on";
1288 strTypeName +=
"off";
1300 std::vector<OUString> aLst;
1302 if (subType < aLst.size())
1303 sEntry = aLst[subType];
1304 if (sEntry.getLength() > 0)
1308 strTypeName = sEntry;
1310 const sal_uInt16 nExSub = pField->
GetSubType() & 0xff00;
1311 if (nSize > 0 && nExSub > 0)
1316 strTypeName += sEntry;
1321 strTypeName +=
"-" + sEntry;
1334 const uno::Sequence< OUString >& aRequestedAttributes )
1344 throw lang::IndexOutOfBoundsException();
1346 bool bSupplementalMode =
false;
1347 uno::Sequence< OUString > aNames = aRequestedAttributes;
1348 if (!aNames.hasElements())
1350 bSupplementalMode =
true;
1362 std::vector< PropertyValue > aValues( aDefAttrSeq.size() );
1364 for (
const auto& rDefEntry : aDefAttrSeq )
1366 tAccParaPropValMap::const_iterator aRunIter =
1367 aRunAttrSeq.find( rDefEntry.first );
1368 if ( aRunIter != aRunAttrSeq.end() )
1370 aValues[i] = aRunIter->second;
1374 aValues[i] = rDefEntry.second;
1378 if( bSupplementalMode )
1380 uno::Sequence< OUString > aSupplementalNames = aRequestedAttributes;
1381 if (!aSupplementalNames.hasElements())
1387 aValues.resize( aValues.size() + aSupplementalAttrSeq.size() );
1389 for (
const auto& rSupplementalEntry : aSupplementalAttrSeq )
1391 aValues[i] = rSupplementalEntry.second;
1397 aValues.emplace_back();
1400 if (!strTypeName.isEmpty())
1402 aValues.emplace_back();
1403 PropertyValue& rValueFT = aValues.back();
1404 rValueFT.Name =
"FieldType";
1405 rValueFT.Value <<= strTypeName.toAsciiLowerCase();
1406 rValueFT.Handle = -1;
1407 rValueFT.State = PropertyState_DIRECT_VALUE;
1412 sal_Int32
nLength = aValues.size();
1413 std::vector<sal_Int32> aIndices;
1414 aIndices.reserve(nLength);
1415 for (i = 0; i < nLength; ++i)
1416 aIndices.push_back(i);
1417 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(aValues.data()));
1419 uno::Sequence<PropertyValue> aNewValues( nLength );
1420 PropertyValue* pNewValues = aNewValues.getArray();
1421 for (i = 0; i < nLength; ++i)
1423 pNewValues[i] = aValues[aIndices[i]];
1436 targetSet.
Put(sourceSet);
1441 const uno::Sequence< OUString >& aRequestedAttributes,
1443 const bool bOnlyCharAttrs )
1448 std::unique_ptr<SfxItemSet> pSet;
1449 if ( !bOnlyCharAttrs )
1451 pSet.reset(
new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1458 pSet.reset(
new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1467 if ( !bOnlyCharAttrs )
1469 SfxItemSet aParaSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1472 pTextNode->SwContentNode::GetAttr( aParaSet );
1473 pSet->Put( aParaSet );
1476 OSL_ENSURE( pTextNode->GetTextColl(),
1477 "<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect!" );
1478 if ( pTextNode->GetTextColl() )
1480 SfxItemSet aCharSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1483 pSet->Put( aCharSet );
1493 const SfxPoolItem* pItem = pSet->GetItem( pEntry->nWID );
1497 pItem->
QueryValue( aVal, pEntry->nMemberId );
1499 PropertyValue rPropVal;
1500 rPropVal.Name = pEntry->aName;
1501 rPropVal.Value = aVal;
1502 rPropVal.Handle = -1;
1503 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1505 aDefAttrSeq[rPropVal.Name] = rPropVal;
1511 if ( !bOnlyCharAttrs && pTextNode->GetTextColl() )
1515 PropertyValue rPropVal;
1517 uno::Any aVal( uno::makeAny( pTextNode->GetTextColl()->GetName() ) );
1518 rPropVal.Value = aVal;
1519 rPropVal.Handle = -1;
1520 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1522 aDefAttrSeq[rPropVal.Name] = rPropVal;
1528 if ( !bOnlyCharAttrs &&
GetFrame() )
1531 if ( aIter != aDefAttrSeq.end() )
1533 PropertyValue rPropVal( aIter->second );
1534 sal_Int16 nVal = rPropVal.Value.get<sal_Int16>();
1535 if ( nVal == text::WritingMode2::PAGE )
1538 while ( pUpperFrame )
1545 nVal = text::WritingMode2::TB_RL;
1549 nVal = text::WritingMode2::RL_TB;
1553 nVal = text::WritingMode2::LR_TB;
1555 rPropVal.Value <<= nVal;
1556 aDefAttrSeq[rPropVal.Name] = rPropVal;
1560 if (
const SwFlyFrame* pFlyFrame = dynamic_cast<const SwFlyFrame*>(pUpperFrame) )
1562 pUpperFrame = pFlyFrame->GetAnchorFrame();
1566 pUpperFrame = pUpperFrame->
GetUpper();
1574 if ( !aRequestedAttributes.hasElements() )
1576 rDefAttrSeq = aDefAttrSeq;
1580 for(
const OUString& rReqAttr : aRequestedAttributes )
1582 tAccParaPropValMap::const_iterator
const aIter = aDefAttrSeq.find( rReqAttr );
1583 if ( aIter != aDefAttrSeq.end() )
1585 rDefAttrSeq[ aIter->first ] = aIter->second;
1592 const uno::Sequence< OUString >& aRequestedAttributes )
1602 constexpr OUStringLiteral sMMToPixelRatio =
u"MMToPixelRatio";
1603 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
1606 uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
1607 ( bProvideMMToPixelRatio ? 1 : 0 ) );
1608 std::transform(aDefAttrSeq.begin(), aDefAttrSeq.end(), aValues.begin(),
1609 [](
const auto& rEntry) -> PropertyValue {
return rEntry.second; });
1612 if ( bProvideMMToPixelRatio )
1614 PropertyValue rPropVal;
1615 rPropVal.Name = sMMToPixelRatio;
1616 const Size a100thMMSize( 1000, 1000 );
1618 const float fRatio = (
static_cast<float>(a100thMMSize.
Width())/100)/aPixelSize.
Width();
1619 rPropVal.Value <<= fRatio;
1620 rPropVal.Handle = -1;
1621 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1622 aValues[ aValues.getLength() - 1 ] = rPropVal;
1629 const sal_Int32 nIndex,
1630 const uno::Sequence< OUString >& aRequestedAttributes,
1634 std::unique_ptr<SwPaM> pPaM;
1638 SwTextNode *
const pTextNode(aModelPos.nNode.GetNode().GetTextNode());
1641 aModelPos.nContent.GetIndex() == pTextNode->Len()
1643 : aModelPos.nContent.GetIndex() + 1);
1644 pPaM.reset(
new SwPaM(aModelPos, aEndPos));
1648 SfxItemSet aSet( pPaM->GetDoc().GetAttrPool(),
1657 if ( pTextNode->HasSwAttrSet() )
1659 SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc().GetAttrPool(),
1661 aAutomaticParaStyleCharAttrs.Put( *(pTextNode->GetpSwAttrSet()),
false );
1662 aSet.Put( aAutomaticParaStyleCharAttrs );
1667 SfxItemSet aCharAttrsAtPaM( pPaM->GetDoc().GetAttrPool(),
1670 aSet.Put( aCharAttrsAtPaM );
1678 uno::Sequence< OUString > aDummy;
1688 if ( aSet.GetItemState( pEntry->nWID,
true, &pItem ) == SfxItemState::SET )
1691 pItem->
QueryValue( aVal, pEntry->nMemberId );
1693 PropertyValue rPropVal;
1694 rPropVal.Name = pEntry->aName;
1695 rPropVal.Value = aVal;
1696 rPropVal.Handle = -1;
1697 rPropVal.State = PropertyState_DIRECT_VALUE;
1699 tAccParaPropValMap::const_iterator aDefIter =
1700 aDefAttrSeq.find( rPropVal.Name );
1701 if ( aDefIter == aDefAttrSeq.end() ||
1702 rPropVal.Value != aDefIter->second.Value )
1704 aRunAttrSeq[rPropVal.Name] = rPropVal;
1710 if ( !aRequestedAttributes.hasElements() )
1712 rRunAttrSeq = aRunAttrSeq;
1716 for(
const OUString& rReqAttr : aRequestedAttributes )
1718 tAccParaPropValMap::iterator aIter = aRunAttrSeq.find( rReqAttr );
1719 if ( aIter != aRunAttrSeq.end() )
1721 rRunAttrSeq[ (*aIter).first ] = (*aIter).second;
1730 const uno::Sequence< OUString >& aRequestedAttributes )
1740 throw lang::IndexOutOfBoundsException();
1751 const uno::Sequence< OUString >& aRequestedAttributes,
1756 std::unique_ptr<SfxItemSet> pSet;
1759 const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1767 if ( pTextNode->HasBullet() || pTextNode->HasNumber() )
1771 pSet->Put( pTextNode->SwContentNode::GetAttr(
RES_UL_SPACE) );
1772 pSet->Put( pTextNode->SwContentNode::GetAttr(
RES_LR_SPACE) );
1779 while ( !pPropMap->aName.isEmpty() )
1781 const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
1785 pItem->
QueryValue( aVal, pPropMap->nMemberId );
1787 PropertyValue rPropVal;
1788 rPropVal.Name = pPropMap->aName;
1789 rPropVal.Value = aVal;
1790 rPropVal.Handle = -1;
1791 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1793 aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
1800 for(
const OUString& rSupplementalAttr : aRequestedAttributes )
1802 tAccParaPropValMap::const_iterator
const aIter = aSupplementalAttrSeq.find( rSupplementalAttr );
1803 if ( aIter != aSupplementalAttrSeq.end() )
1805 rSupplementalAttrSeq[ aIter->first ] = aIter->second;
1811 std::vector< PropertyValue >& rValues)
1825 case RedlineType::Insert:
1828 case RedlineType::Delete:
1831 case RedlineType::Format:
1839 case SID_ATTR_CHAR_WEIGHT:
1841 ChangeAttr.Value <<= awt::FontWeight::BOLD;
1843 case SID_ATTR_CHAR_POSTURE:
1845 ChangeAttr.Value <<= awt::FontSlant_ITALIC;
1847 case SID_ATTR_CHAR_STRIKEOUT:
1849 ChangeAttr.Value <<= awt::FontStrikeout::SINGLE;
1851 case SID_ATTR_CHAR_UNDERLINE:
1853 ChangeAttr.Value <<= aChangeAttr.
m_nAttr;
1858 if( aChangeAttr.
m_nItemId == SID_ATTR_BRUSH )
1862 ChangeAttrColor.Value <<=
COL_BLUE;
1864 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1870 ChangeAttrColor.Value <<=
COL_BLUE;
1872 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1884 if (
pos.first->Len() ==
pos.second
1892 sal_Int32 nValues = rValues.size();
1893 for (sal_Int32
i = 0;
i < nValues; ++
i)
1895 PropertyValue&
rValue = rValues[
i];
1897 if (rValue.Name == ChangeAttr.Name )
1899 rValue.Value = ChangeAttr.Value;
1903 if (rValue.Name == ChangeAttrColor.Name )
1905 rValue.Value = ChangeAttrColor.Value;
1913 sal_uInt32 crBack =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1916 uno::Reference<XAccessibleComponent> xComponent(
this);
1917 if (xComponent.is())
1919 crBack =
static_cast<sal_uInt32
>(xComponent->getBackground());
1921 rValue.Value <<= crBack;
1932 sal_uInt32 crChar =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1936 uno::Reference<XAccessibleComponent> xComponent(
this);
1937 if (xComponent.is())
1941 rValue.Value <<= crChar;
1955 if(
nullptr != pWrongList )
1957 sal_Int32 nBegin =
pos.second;
1976 if(
nullptr != pWrongList )
1978 sal_Int32 nBegin =
pos.second;
1982 rValue.Value <<= sal_Int32(0x00ff0000);
1989 sal_uInt32 crUnderline =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1992 uno::Reference<XAccessibleComponent> xComponent(
this);
1993 if (xComponent.is())
1997 rValue.Value <<= crUnderline;
2008 if( !tabs.hasElements() )
2011 css::style::TabStop ts;
2014 if( rc1.X - rc0.X >= 48 )
2015 ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
2018 ts.DecimalChar =
' ';
2020 ts.Alignment = css::style::TabAlign_LEFT;
2023 rValue.Value <<= tabs;
2032 rValue.Value <<= sal_Int32(101);
2049 throw lang::IndexOutOfBoundsException();
2052 bool bBehindText =
false;
2081 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2088 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
2091 return awt::Rectangle(
2092 aScreenRect.
Left(), aScreenRect.
Top(),
2115 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2117 Point aPoint( rPoint.X, rPoint.Y );
2120 aPoint.setX(aPoint.getX() + aPixPos.getX());
2121 aPoint.setY(aPoint.getY() + aPixPos.getY());
2122 Point aCorePoint(
GetMap()->PixelToCore( aPoint ) );
2123 if( !aLogBounds.
IsInside( aCorePoint ) )
2128 awt::Rectangle aRectEndPos =
2131 if (rPoint.X - aRectEndPos.X >= 0 &&
2132 rPoint.X - aRectEndPos.X < aRectEndPos.Width &&
2133 rPoint.Y - aRectEndPos.Y >= 0 &&
2134 rPoint.Y - aRectEndPos.Y < aRectEndPos.Height)
2141 OSL_ENSURE(
GetFrame() !=
nullptr,
"The text frame has vanished!" );
2142 OSL_ENSURE(
GetFrame()->IsTextFrame(),
"The text frame has mutated!" );
2160 if ( (!bVert && aResultRect.
Pos().getX() > aCorePoint.getX()) ||
2161 ( bVert && aResultRect.
Pos().getY() > aCorePoint.getY()) ||
2162 ( bR2L && aResultRect.
Right() < aCorePoint.getX()) )
2167 if ( (!bVert && aResultRectPrev.Pos().getX() < aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) ||
2168 ( bVert && aResultRectPrev.Pos().getY() < aCorePoint.getY() && aResultRect.
Pos().getX() == aResultRectPrev.Pos().getX()) ||
2169 ( bR2L && aResultRectPrev.Right() > aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) )
2187 sal_Int32 nStart, nEnd;
2190 ?
GetString().copy( nStart, nEnd - nStart )
2200 sal_Int32 nStart, nEnd;
2211 sal_Int32 nStart, nEnd;
2224 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2226 throw lang::IndexOutOfBoundsException();
2233 if( pCursorShell !=
nullptr )
2260 sal_Int32 nStartIndex, sal_Int32 nEndIndex )
2268 if ( !
IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
2269 throw lang::IndexOutOfBoundsException();
2272 return sText.copy(nStartIndex, nEndIndex-nStartIndex );
2281 TextSegment aResult;
2282 aResult.SegmentStart = -1;
2283 aResult.SegmentEnd = -1;
2290 if( nIndex == rText.getLength() && AccessibleTextType::LINE != nTextType )
2294 i18n::Boundary aBound;
2297 OSL_ENSURE( aBound.startPos >= 0,
"illegal boundary" );
2298 OSL_ENSURE( aBound.startPos <= aBound.endPos,
"illegal boundary" );
2303 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2304 aResult.SegmentStart = aBound.startPos;
2305 aResult.SegmentEnd = aBound.endPos;
2319 TextSegment aResult;
2320 aResult.SegmentStart = -1;
2321 aResult.SegmentEnd = -1;
2328 i18n::Boundary aBound;
2329 if (nIndex == rText.getLength())
2330 aBound.startPos = aBound.endPos = nIndex;
2336 aBound.startPos = aBound.endPos = nIndex;
2340 if (nTextType==2 || nTextType == 3)
2342 i18n::Boundary preBound = aBound;
2343 while(preBound.startPos==aBound.startPos && nIndex > 0)
2345 nIndex =
min( nIndex, preBound.startPos ) - 1;
2346 if( nIndex < 0 )
break;
2347 GetTextBoundary( preBound, rText, nIndex, nTextType );
2353 aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
2354 aResult.SegmentStart = preBound.startPos;
2355 aResult.SegmentEnd = preBound.endPos;
2363 nIndex =
min( nIndex, aBound.startPos ) - 1;
2366 bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
2372 if (bWord && nIndex<rText.getLength())
2374 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2375 aResult.SegmentStart = aBound.startPos;
2376 aResult.SegmentEnd = aBound.endPos;
2388 TextSegment aResult;
2389 aResult.SegmentStart = -1;
2390 aResult.SegmentEnd = -1;
2396 if( nIndex == rText.getLength() )
2400 i18n::Boundary aBound;
2405 nIndex =
max( sal_Int32(nIndex+1), aBound.endPos );
2406 if( nIndex < rText.getLength() )
2414 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2415 aResult.SegmentStart = aBound.startPos;
2416 aResult.SegmentEnd = aBound.endPos;
2492 sal_Int32 nEndIndex, AccessibleScrollType aScrollType )
2500 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2501 throw lang::IndexOutOfBoundsException();
2505 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2508 awt::Rectangle startR, endR;
2513 Point sP(std::min(startR.X, endR.X), startR.Y);
2514 Point eP(std::max(startR.X + startR.Width, endR.X + endR.Width), endR.Y + endR.Height);
2525 switch (aScrollType)
2528 case AccessibleScrollType_SCROLL_TOP_LEFT:
2530 case AccessibleScrollType_SCROLL_BOTTOM_RIGHT:
2532 case AccessibleScrollType_SCROLL_TOP_EDGE:
2534 case AccessibleScrollType_SCROLL_BOTTOM_EDGE:
2536 case AccessibleScrollType_SCROLL_LEFT_EDGE:
2538 case AccessibleScrollType_SCROLL_RIGHT_EDGE:
2541 case AccessibleScrollType_SCROLL_ANYWHERE:
2547 const SwRect aRect(startPoint, endPoint);
2549 OSL_ENSURE( pViewShell !=
nullptr,
"View shell expected!" );
2590 return replaceText( nStartIndex, nEndIndex, OUString() );
2599 sal_Int32 nStartIndex, sal_Int32 nEndIndex,
2600 const OUString& sReplacement )
2608 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2609 throw lang::IndexOutOfBoundsException();
2618 nStartIndex, nEndIndex, nStart, nEnd );
2631 const uno::Reference<text::XTextRange> xRange(
2633 const_cast<SwDoc&>(pFrame->
GetDoc()), aStartPos, &aEndPos));
2634 xRange->setString(sReplacement);
2645 sal_Int32 nStartIndex,
2646 sal_Int32 nEndIndex,
2647 const uno::Sequence<PropertyValue>& rAttributeSet )
2655 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2656 throw lang::IndexOutOfBoundsException();
2667 sal_Int32
nLength = rAttributeSet.getLength();
2668 const PropertyValue* pPairs = rAttributeSet.getConstArray();
2669 std::vector<sal_Int32> aIndices(nLength);
2670 std::iota(aIndices.begin(), aIndices.end(), 0);
2671 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(pPairs));
2674 uno::Sequence< OUString > aNames( nLength );
2675 OUString* pNames = aNames.getArray();
2676 uno::Sequence< uno::Any > aValues( nLength );
2678 for (sal_Int32
i = 0;
i < nLength; ++
i)
2680 const PropertyValue& rVal = pPairs[aIndices[
i]];
2681 pNames[
i] = rVal.Name;
2690 xPortion->setPropertyValues( aNames, aValues );
2692 catch (
const UnknownPropertyException&)
2709 sal_Int32 nChildIndex )
2717 sal_Int32 nChildIndex )
2744 sal_Int32 nSelectedChildIndex )
2753 sal_Int32 nChildIndex )
2764 class SwHyperlinkIter_Impl
2772 explicit SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame);
2781 SwHyperlinkIter_Impl::SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame)
2782 : m_rFrame(rTextFrame)
2783 , m_Iter(rTextFrame)
2784 , m_nStt(rTextFrame.GetOffset())
2799 while (
SwTextAttr const*
const pHt = m_Iter.NextAttr(&pNode))
2803 const TextFrameIndex nHtStt(m_rFrame.MapModelToView(pNode, pHt->GetStart()));
2804 const TextFrameIndex nHtEnd(m_rFrame.MapModelToView(pNode, pHt->GetAnyEnd()));
2805 if (nHtEnd > nHtStt &&
2806 ((nHtStt >= m_nStt && nHtStt < m_nEnd) ||
2807 (nHtEnd > m_nStt && nHtEnd <= m_nEnd)))
2832 SwHyperlinkIter_Impl aIter(*pTextFrame);
2833 while( aIter.next() )
2839 uno::Reference< XAccessibleHyperlink > SAL_CALL
2846 uno::Reference< XAccessibleHyperlink > xRet;
2849 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2852 for (sal_Int32 nTIndex = 0; pHt && nTIndex <= nLinkIndex; ++nTIndex)
2854 if( nTIndex == nLinkIndex )
2862 xRet = (*aIter).second;
2869 max(aHIter.startIdx(), nHintStart));
2871 min(aHIter.endIdx(), nHintEnd));
2873 *
this, nTmpHStt, nTmpHEnd );
2876 (*aIter).second = xRet;
2887 pHt =
const_cast<SwTextAttr*
>(aHIter.next(&pNode));
2890 throw lang::IndexOutOfBoundsException();
2905 throw lang::IndexOutOfBoundsException();
2908 sal_Int32 nRet = -1;
2912 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2921 pHt = aHIter.next(&pNode);
2930 throw lang::IndexOutOfBoundsException();
2939 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
2940 switch ( nTextMarkupType )
2942 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
2943 case text::TextMarkupType::TRACK_CHANGE_DELETION:
2944 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
2958 return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
2971 sal_Int32 nSelected = 0;
2973 if( pCursor !=
nullptr )
2981 nLastNode = pMerged->pLastNode->GetIndex();
2985 nLastNode = nFirstNode;
2992 if( rTmpCursor.HasMark() )
2999 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3018 sal_Int32 nStart, nEnd;
3029 sal_Int32 nStart, nEnd;
3038 if(selectionIndex < 0)
return false;
3040 sal_Int32 nSelected = selectionIndex;
3045 if( pCursor !=
nullptr )
3055 nLastNode = pMerged->pLastNode->GetIndex();
3059 nLastNode = nFirstNode;
3063 SwPaM* pRingStart = pCursor;
3074 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3076 if( nSelected == 0 )
3078 pCursor->
MoveTo(
nullptr);
3092 while( !bRet && (pCursor != pRingStart) );
3105 if ( !
IsValidRange( startOffset, endOffset, nLength ) )
3107 throw lang::IndexOutOfBoundsException();
3111 for ( sal_Int32
i = nSelectedCount ;
i >= 0 ;
i--)
3113 sal_Int32 nStart, nEnd;
3119 if (( startOffset>=nStart && startOffset <=nEnd ) ||
3120 ( endOffset>=nStart && endOffset <=nEnd ) ||
3121 ( startOffset <= nStart && endOffset >=nEnd) ||
3122 ( startOffset >= nStart && endOffset <=nEnd) )
3130 if (( startOffset>=nEnd && startOffset <=nStart ) ||
3131 ( endOffset>=nEnd && endOffset <=nStart ) ||
3132 ( startOffset <= nStart && endOffset >=nEnd) ||
3133 ( startOffset >= nStart && endOffset <=nEnd) )
3145 if( pCursorShell !=
nullptr )
3160 TextSegment SAL_CALL
3162 sal_Int32 nTextMarkupType )
3166 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3167 switch ( nTextMarkupType )
3169 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3170 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3171 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3185 return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
3188 uno::Sequence< TextSegment > SAL_CALL
3190 sal_Int32 nTextMarkupType )
3198 throw lang::IndexOutOfBoundsException();
3201 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3202 switch ( nTextMarkupType )
3204 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3205 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3206 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3220 return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
3232 throw lang::IndexOutOfBoundsException();
3239 TextSegment SAL_CALL
3248 throw lang::IndexOutOfBoundsException();
3251 i18n::Boundary aLineBound;
3254 TextSegment aTextAtLine;
3256 aTextAtLine.SegmentText = rText.copy( aLineBound.startPos,
3257 aLineBound.endPos - aLineBound.startPos );
3258 aTextAtLine.SegmentStart = aLineBound.startPos;
3259 aTextAtLine.SegmentEnd = aLineBound.endPos;
3270 if ( nLineNoOfCaret >= 0 &&
3276 return TextSegment();
3293 if ( nCaretPos != 0 )
3295 i18n::Boundary aLineBound;
3297 if ( nCaretPos == aLineBound.startPos )
3300 if ( pCursorShell !=
nullptr )
3309 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
3316 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
3319 const awt::Rectangle aCursorRect( aScreenRect.
Left(),
3324 if ( aCharRect.X != aCursorRect.X ||
3325 aCharRect.Y != aCursorRect.Y )
3343 sal_Int32 * pSelection, sal_Int32& nStart, sal_Int32& nEnd)
3345 if (pSelection && *pSelection < 0)
return false;
3353 if( pCursor !=
nullptr )
3361 nLastNode = pMerged->pLastNode->GetIndex();
3365 nLastNode = nFirstNode;
3372 if( rTmpCursor.HasMark() )
3379 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3381 if (!pSelection || *pSelection == 0)
3386 sal_Int32 nLocalStart = -1;
3387 if (nStartIndex < nFirstNode)
3407 else if( nCoreStart <=
3414 "problem determining valid core position");
3423 sal_Int32 nLocalEnd = -1;
3424 if (nLastNode < nEndIndex)
3446 else if( nCoreEnd >=
3454 "problem determining valid core position");
3461 if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
3463 nStart = nLocalStart;
3482 if (pSelection && bRet)
3485 if( nStart == nCaretPos )
3487 sal_Int32 tmp = nStart;
3502 return AccessibleRole::HEADING;
3506 return AccessibleRole::PARAGRAPH;
3513 uno::Reference< css::beans::XPropertySet > xPortion =
CreateUnoPortion( 0, 0 );
3514 uno::Any styleAny = xPortion->getPropertyValue(
"ParaStyleName" );
3516 if (styleAny >>= sValue)
3518 sal_Int32
length = sValue.getLength();
3519 if (length == 9 || length == 10)
3521 OUString headStr = sValue.copy(0, 7);
3522 if (headStr ==
"Heading")
3524 OUString intStr = sValue.copy(8);
3525 sal_Int32 headingLevel = intStr.toInt32();
3526 return headingLevel;
3538 OUString strHeading(
"heading-level:");
3542 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
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
sal_uLong GetIndex() const
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)
#define UNO_NAME_CHAR_UNDERLINE_COLOR
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
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?
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
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 screen position of rPos.
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
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()
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(59)
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.
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
css::uno::Any const & rValue
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
static bool implInitTextChangedEvent(const OUString &rOldString, const OUString &rNewString, css::uno::Any &rDeleted, css::uno::Any &rInserted)
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
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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)
#define UNO_NAME_NUMBERING_RULES
virtual OUString SAL_CALL getText() override
sal_uLong GetIndex() const
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...
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
#define UNO_NAME_CHAR_POSTURE
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()
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
std::unique_ptr< SwParaChangeTrackingInfo > mpParaChangeTrackInfo
#define UNO_NAME_CHAR_SHADOWED
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
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)
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)
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
SwFieldType * GetTyp() const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex)
#define UNO_NAME_CHAR_UNDERLINE
#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
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
virtual css::accessibility::TextSegment SAL_CALL getTextAtLineNumber(sal_Int32 nLineNo) override
tools::Rectangle SVRect() const
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)
#define UNO_NAME_CHAR_WEIGHT
const SwViewOption * GetViewOptions() const
css::uno::Sequence< typename M::mapped_type > mapValuesToSequence(M const &map)
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
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.
bool IsInside(const Point &rPOINT) const
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
const SwPosition * End() const
void _correctValues(const sal_Int32 nIndex, std::vector< css::beans::PropertyValue > &rValues)
bool IsRightToLeft() const
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)
#define UNO_NAME_CHAR_HEIGHT
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
mutable::osl::Mutex m_Mutex
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)
#define UNO_NAME_NUMBERING_LEVEL
#define UNO_NAME_CHAR_COLOR
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.
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
void GetSubTypes(SwFieldTypesEnum nId, std::vector< OUString > &rToFill)
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override