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() ) )
197 ? static_cast< SwFEShell * >( pCursorShell ) :
nullptr;
202 pCursor = pCursorShell->
GetCursor(
false );
222 rStateSet.
AddState( AccessibleStateType::MULTI_LINE );
227 rStateSet.
AddState(AccessibleStateType::MULTI_SELECTABLE);
229 rStateSet.
AddState(AccessibleStateType::FOCUSABLE);
236 if (pCaret !=
nullptr &&
242 rStateSet.
AddState( AccessibleStateType::FOCUSED );
256 if( rText != sOldText )
259 AccessibleEventObject
aEvent;
260 aEvent.EventId = AccessibleEventId::TEXT_CHANGED;
269 uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
270 if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
275 AccessibleEventObject aParaEvent;
276 aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
281 else if( !bVisibleDataFired )
291 osl::MutexGuard aGuard(
m_Mutex );
297 if( bNewIsHeading != bOldIsHeading )
300 AccessibleEventObject
aEvent;
301 aEvent.EventId = AccessibleEventId::ROLE_CHANGED;
306 if( rText == sOldText )
312 osl::MutexGuard aGuard(
m_Mutex );
318 if( sNewDesc != sOldDesc )
321 AccessibleEventObject
aEvent;
322 aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
323 aEvent.OldValue <<= sOldDesc;
324 aEvent.NewValue <<= sNewDesc;
336 osl::MutexGuard aGuard(
m_Mutex );
353 if( pWin && pWin->
HasFocus() && -1 == nOld )
356 AccessibleEventObject
aEvent;
357 aEvent.EventId = AccessibleEventId::CARET_CHANGED;
358 aEvent.OldValue <<= nOld;
359 aEvent.NewValue <<= nNew;
363 if( pWin && pWin->
HasFocus() && -1 == nNew )
371 aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
372 aEvent.OldValue.clear();
373 aEvent.NewValue.clear();
387 osl::MutexGuard aGuard(
m_Mutex );
390 OSL_ENSURE( nPos != -1,
"focus object should be selected" );
398 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 osl::MutexGuard 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;
514 sal_Int32 nPos, sal_Int32 nLength)
516 return (nPos >= 0) && (nPos < nLength);
520 sal_Int32 nPos, sal_Int32 nLength)
522 return (nPos >= 0) && (nPos <= nLength);
526 sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength)
548 i18n::Boundary& rBound,
554 rBound.startPos = nPos;
555 rBound.endPos = nPos+1;
560 i18n::Boundary& rBound,
561 const OUString& rText,
574 const sal_Int16 nWordType = i18n::WordType::ANY_WORD;
578 rText, nPos, aLocale, nWordType,
true );
584 i18n::Boundary& rBound,
585 const OUString& rText,
589 while( nPos < rText.getLength() && pStr[nPos] ==
u' ' )
597 i18n::Boundary& rBound,
598 const OUString& rText,
601 if( rText.getLength() == nPos )
609 i18n::Boundary& rBound,
610 const OUString& rText )
613 rBound.endPos = rText.getLength();
618 i18n::Boundary& rBound,
626 i18n::Boundary& rBound,
627 const OUString& rText,
640 const sal_Int16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
643 rText, nPos, aLocale, nIterMode, 1, nDone );
645 rText, rBound.endPos, aLocale, nIterMode, 1, nDone );
646 bool bRet = ((rBound.startPos <= nPos) && (nPos <= rBound.endPos));
647 OSL_ENSURE( rBound.startPos <= nPos,
"start pos too high" );
648 OSL_ENSURE( rBound.endPos >= nPos,
"end pos too low" );
654 i18n::Boundary& rBound,
655 const OUString& rText,
657 sal_Int16 nTextType )
660 if( !( AccessibleTextType::LINE == nTextType
663 throw lang::IndexOutOfBoundsException();
669 case AccessibleTextType::WORD:
673 case AccessibleTextType::SENTENCE:
677 case AccessibleTextType::PARAGRAPH:
681 case AccessibleTextType::CHARACTER:
685 case AccessibleTextType::LINE:
687 if((nPos == rText.getLength()) && nPos > 0)
693 case AccessibleTextType::ATTRIBUTE_RUN:
697 case AccessibleTextType::GLYPH:
702 throw lang::IllegalArgumentException( );
714 osl::MutexGuard aGuard2(
m_Mutex );
728 throw uno::RuntimeException(
"no SwTextFrame", static_cast<cppu::OWeakObject*>(
this));
746 OSL_ENSURE( pTextFrame,
747 "<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame");
751 if ( pPrevContentFrame )
753 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pPrevContentFrame ) };
754 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
760 if ( pNextContentFrame )
762 uno::Sequence< uno::Reference<XInterface> > aSequence {
GetMap()->
GetContext( pNextContentFrame ) };
763 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
783 if (pCursorSh !=
nullptr &&
784 ( pCursor ==
nullptr ||
790 SwPaM aPaM( aStartPos );
800 if (pWindow !=
nullptr)
811 std::optional<Color> xSectionTOXColor;
816 pFrame->
GetBackgroundBrush( aFillAttributes, pBackgrdBrush, xSectionTOXColor, aDummyRect,
false,
false ) )
818 if ( xSectionTOXColor )
820 rColor = *xSectionTOXColor;
829 else if ( pCursorSh )
842 Color aBackgroundCol;
846 if ( aBackgroundCol.
IsDark() )
863 Color aBackgroundCol;
867 return sal_Int32(aBackgroundCol);
879 const OUString& sTestServiceName)
891 static uno::Sequence< OUString >
const aNames
914 static uno::Sequence< OUString >
const aNames
937 uno::Reference<XAccessibleText> aAccText =
static_cast<XAccessibleText *
>(*this);
942 uno::Reference<XAccessibleEditableText> aAccEditText =
this;
943 aRet <<= aAccEditText;
947 uno::Reference<XAccessibleSelection> aAccSel =
this;
952 uno::Reference<XAccessibleHypertext> aAccHyp =
this;
959 uno::Reference<XAccessibleTextAttributes> aAccTextAttr =
this;
960 aRet <<= aAccTextAttr;
966 uno::Reference<XAccessibleTextMarkup> aAccTextMarkup =
this;
967 aRet <<= aAccTextMarkup;
972 uno::Reference<XAccessibleMultiLineText> aAccMultiLineText =
this;
973 aRet <<= aAccMultiLineText;
977 uno::Reference< css::accessibility::XAccessibleTextSelection > aTextExtension =
this;
978 aRet <<= aTextExtension;
982 uno::Reference<XAccessibleExtendedAttributes> xAttr =
this;
987 aRet = SwAccessibleContext::queryInterface(rType);
1005 SwAccessibleContext::getTypes() ).
getTypes();
1010 return css::uno::Sequence<sal_Int8>();
1023 osl::MutexGuard aOldCaretPosGuard(
m_Mutex );
1046 throw lang::IndexOutOfBoundsException();
1053 if( pCursorShell !=
nullptr )
1059 SwPaM aPaM( aStartPos );
1078 throw lang::IndexOutOfBoundsException();
1080 return sText[nIndex];
1093 throw lang::IndexOutOfBoundsException();
1096 bool bBehindText =
false;
1122 css::uno::Sequence< css::style::TabStop > tabs;
1123 const sal_Int32 nStrLen = pFrame->
GetText().getLength();
1130 if( tabs.hasElements() )
1136 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
1145 aScreenRect.
Move( -aFramePixPos.X(), -aFramePixPos.Y() );
1147 tabs[0].Position = aScreenRect.
GetWidth();
1158 explicit IndexCompare(
const PropertyValue* pVals ) : pValues(pVals) {}
1159 bool operator() ( sal_Int32 a, sal_Int32 b )
const
1161 return (pValues[a].Name < pValues[b].Name);
1169 OUString strTypeName;
1173 if (nFieldIndex >= 0)
1182 && (nFieldIndex-- == 0))
1189 && (nFieldIndex-- == 0))
1191 strTypeName =
"set reference";
1203 sal_uInt32 subType = 0;
1207 subType =
static_cast<const SwDocStatField*
>(pField)->GetSubType();
1217 sEntry =
"Headings";
1219 sEntry =
"Numbered Paragraphs";
1221 sEntry =
"Bookmarks";
1225 sEntry =
"Footnotes";
1228 sEntry =
"Endnotes";
1231 sEntry =
"Insert Reference";
1234 sEntry =
static_cast<const SwGetRefField*
>(pField)->GetSetRefName();
1238 strTypeName = sEntry;
1243 if (sEntry.getLength() > 0)
1245 strTypeName +=
"-" + sEntry;
1255 const sal_uInt32 nFormat= pField->
GetFormat();
1257 if (nFormat < nSize)
1260 if (sEntry.getLength() > 0)
1262 strTypeName +=
"-" + sEntry;
1268 subType =
static_cast<const SwExtUserField*
>(pField)->GetSubType();
1274 if (sEntry.getLength() > 0)
1276 strTypeName +=
"-" + sEntry;
1287 bool bOn = pRPld->
IsOn();
1290 strTypeName +=
"on";
1292 strTypeName +=
"off";
1304 std::vector<OUString> aLst;
1306 if (subType < aLst.size())
1307 sEntry = aLst[subType];
1308 if (sEntry.getLength() > 0)
1312 strTypeName = sEntry;
1314 const sal_uInt16 nExSub = pField->
GetSubType() & 0xff00;
1315 if (nSize > 0 && nExSub > 0)
1320 strTypeName += sEntry;
1325 strTypeName +=
"-" + sEntry;
1338 const uno::Sequence< OUString >& aRequestedAttributes )
1348 throw lang::IndexOutOfBoundsException();
1350 bool bSupplementalMode =
false;
1351 uno::Sequence< OUString > aNames = aRequestedAttributes;
1352 if (!aNames.hasElements())
1354 bSupplementalMode =
true;
1366 std::vector< PropertyValue > aValues( aDefAttrSeq.size() );
1368 for (
const auto& rDefEntry : aDefAttrSeq )
1370 tAccParaPropValMap::const_iterator aRunIter =
1371 aRunAttrSeq.find( rDefEntry.first );
1372 if ( aRunIter != aRunAttrSeq.end() )
1374 aValues[i] = aRunIter->second;
1378 aValues[i] = rDefEntry.second;
1382 if( bSupplementalMode )
1384 uno::Sequence< OUString > aSupplementalNames = aRequestedAttributes;
1385 if (!aSupplementalNames.hasElements())
1391 aValues.resize( aValues.size() + aSupplementalAttrSeq.size() );
1393 for (
const auto& rSupplementalEntry : aSupplementalAttrSeq )
1395 aValues[i] = rSupplementalEntry.second;
1401 aValues.emplace_back();
1404 if (!strTypeName.isEmpty())
1406 aValues.emplace_back();
1407 PropertyValue& rValueFT = aValues.back();
1408 rValueFT.Name =
"FieldType";
1409 rValueFT.Value <<= strTypeName.toAsciiLowerCase();
1410 rValueFT.Handle = -1;
1411 rValueFT.State = PropertyState_DIRECT_VALUE;
1416 sal_Int32
nLength = aValues.size();
1417 std::vector<sal_Int32> aIndices;
1418 aIndices.reserve(nLength);
1419 for (i = 0; i < nLength; ++i)
1420 aIndices.push_back(i);
1421 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(aValues.data()));
1423 uno::Sequence<PropertyValue> aNewValues( nLength );
1424 PropertyValue* pNewValues = aNewValues.getArray();
1425 for (i = 0; i < nLength; ++i)
1427 pNewValues[i] = aValues[aIndices[i]];
1440 targetSet.
Put(sourceSet);
1445 const uno::Sequence< OUString >& aRequestedAttributes,
1447 const bool bOnlyCharAttrs )
1452 std::unique_ptr<SfxItemSet> pSet;
1453 if ( !bOnlyCharAttrs )
1455 pSet.reset(
new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1462 pSet.reset(
new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1471 if ( !bOnlyCharAttrs )
1473 SfxItemSet aParaSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1476 pTextNode->SwContentNode::GetAttr( aParaSet );
1477 pSet->Put( aParaSet );
1480 OSL_ENSURE( pTextNode->GetTextColl(),
1481 "<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect!" );
1482 if ( pTextNode->GetTextColl() )
1484 SfxItemSet aCharSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1487 pSet->Put( aCharSet );
1496 for (
const auto& rProp : aPropertyEntries )
1498 const SfxPoolItem* pItem = pSet->GetItem( rProp.nWID );
1504 PropertyValue rPropVal;
1505 rPropVal.Name = rProp.sName;
1506 rPropVal.Value = aVal;
1507 rPropVal.Handle = -1;
1508 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1510 aDefAttrSeq[rPropVal.Name] = rPropVal;
1516 if ( !bOnlyCharAttrs && pTextNode->GetTextColl() )
1520 PropertyValue rPropVal;
1522 uno::Any aVal( uno::makeAny( pTextNode->GetTextColl()->GetName() ) );
1523 rPropVal.Value = aVal;
1524 rPropVal.Handle = -1;
1525 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1527 aDefAttrSeq[rPropVal.Name] = rPropVal;
1533 if ( !bOnlyCharAttrs &&
GetFrame() )
1536 if ( aIter != aDefAttrSeq.end() )
1538 PropertyValue rPropVal( aIter->second );
1539 sal_Int16 nVal = rPropVal.Value.get<sal_Int16>();
1540 if ( nVal == text::WritingMode2::PAGE )
1543 while ( pUpperFrame )
1550 nVal = text::WritingMode2::TB_RL;
1554 nVal = text::WritingMode2::RL_TB;
1558 nVal = text::WritingMode2::LR_TB;
1560 rPropVal.Value <<= nVal;
1561 aDefAttrSeq[rPropVal.Name] = rPropVal;
1565 if (
const SwFlyFrame* pFlyFrame = dynamic_cast<const SwFlyFrame*>(pUpperFrame) )
1567 pUpperFrame = pFlyFrame->GetAnchorFrame();
1571 pUpperFrame = pUpperFrame->
GetUpper();
1579 if ( !aRequestedAttributes.hasElements() )
1581 rDefAttrSeq = aDefAttrSeq;
1585 for(
const OUString& rReqAttr : aRequestedAttributes )
1587 tAccParaPropValMap::const_iterator
const aIter = aDefAttrSeq.find( rReqAttr );
1588 if ( aIter != aDefAttrSeq.end() )
1590 rDefAttrSeq[ aIter->first ] = aIter->second;
1597 const uno::Sequence< OUString >& aRequestedAttributes )
1607 static const char sMMToPixelRatio[] =
"MMToPixelRatio";
1608 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
1611 uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
1612 ( bProvideMMToPixelRatio ? 1 : 0 ) );
1613 std::transform(aDefAttrSeq.begin(), aDefAttrSeq.end(), aValues.begin(),
1614 [](
const auto& rEntry) -> PropertyValue {
return rEntry.second; });
1617 if ( bProvideMMToPixelRatio )
1619 PropertyValue rPropVal;
1620 rPropVal.Name = sMMToPixelRatio;
1621 const Size a100thMMSize( 1000, 1000 );
1623 const float fRatio = (
static_cast<float>(a100thMMSize.
Width())/100)/aPixelSize.
Width();
1624 rPropVal.Value <<= fRatio;
1625 rPropVal.Handle = -1;
1626 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1627 aValues[ aValues.getLength() - 1 ] = rPropVal;
1634 const sal_Int32 nIndex,
1635 const uno::Sequence< OUString >& aRequestedAttributes,
1639 std::unique_ptr<SwPaM> pPaM;
1643 SwTextNode *
const pTextNode(aModelPos.nNode.GetNode().GetTextNode());
1646 aModelPos.nContent.GetIndex() == pTextNode->Len()
1648 : aModelPos.nContent.GetIndex() + 1);
1649 pPaM.reset(
new SwPaM(aModelPos, aEndPos));
1653 SfxItemSet aSet( pPaM->GetDoc().GetAttrPool(),
1662 if ( pTextNode->HasSwAttrSet() )
1664 SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc().GetAttrPool(),
1666 aAutomaticParaStyleCharAttrs.Put( *(pTextNode->GetpSwAttrSet()),
false );
1667 aSet.Put( aAutomaticParaStyleCharAttrs );
1672 SfxItemSet aCharAttrsAtPaM( pPaM->GetDoc().GetAttrPool(),
1675 aSet.Put( aCharAttrsAtPaM );
1683 uno::Sequence< OUString > aDummy;
1689 for (
const auto& rProp : aPropertyEntries )
1694 if ( aSet.GetItemState( rProp.nWID,
true, &pItem ) == SfxItemState::SET )
1699 PropertyValue rPropVal;
1700 rPropVal.Name = rProp.sName;
1701 rPropVal.Value = aVal;
1702 rPropVal.Handle = -1;
1703 rPropVal.State = PropertyState_DIRECT_VALUE;
1705 tAccParaPropValMap::const_iterator aDefIter =
1706 aDefAttrSeq.find( rPropVal.Name );
1707 if ( aDefIter == aDefAttrSeq.end() ||
1708 rPropVal.Value != aDefIter->second.Value )
1710 aRunAttrSeq[rPropVal.Name] = rPropVal;
1716 if ( !aRequestedAttributes.hasElements() )
1718 rRunAttrSeq = aRunAttrSeq;
1722 for(
const OUString& rReqAttr : aRequestedAttributes )
1724 tAccParaPropValMap::iterator aIter = aRunAttrSeq.find( rReqAttr );
1725 if ( aIter != aRunAttrSeq.end() )
1727 rRunAttrSeq[ (*aIter).first ] = (*aIter).second;
1736 const uno::Sequence< OUString >& aRequestedAttributes )
1746 throw lang::IndexOutOfBoundsException();
1757 const uno::Sequence< OUString >& aRequestedAttributes,
1762 std::unique_ptr<SfxItemSet> pSet;
1765 const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
1773 if ( pTextNode->HasBullet() || pTextNode->HasNumber() )
1777 pSet->Put( pTextNode->SwContentNode::GetAttr(
RES_UL_SPACE) );
1778 pSet->Put( pTextNode->SwContentNode::GetAttr(
RES_LR_SPACE) );
1785 while ( !pPropMap->aName.empty() )
1787 const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
1791 pItem->
QueryValue( aVal, pPropMap->nMemberId );
1793 PropertyValue rPropVal;
1794 rPropVal.Name = pPropMap->aName;
1795 rPropVal.Value = aVal;
1796 rPropVal.Handle = -1;
1797 rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
1799 aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
1806 for(
const OUString& rSupplementalAttr : aRequestedAttributes )
1808 tAccParaPropValMap::const_iterator
const aIter = aSupplementalAttrSeq.find( rSupplementalAttr );
1809 if ( aIter != aSupplementalAttrSeq.end() )
1811 rSupplementalAttrSeq[ aIter->first ] = aIter->second;
1817 std::vector< PropertyValue >& rValues)
1831 case RedlineType::Insert:
1834 case RedlineType::Delete:
1837 case RedlineType::Format:
1845 case SID_ATTR_CHAR_WEIGHT:
1847 ChangeAttr.Value <<= awt::FontWeight::BOLD;
1849 case SID_ATTR_CHAR_POSTURE:
1851 ChangeAttr.Value <<= awt::FontSlant_ITALIC;
1853 case SID_ATTR_CHAR_STRIKEOUT:
1855 ChangeAttr.Value <<= awt::FontStrikeout::SINGLE;
1857 case SID_ATTR_CHAR_UNDERLINE:
1859 ChangeAttr.Value <<= aChangeAttr.
m_nAttr;
1864 if( aChangeAttr.
m_nItemId == SID_ATTR_BRUSH )
1868 ChangeAttrColor.Value <<=
COL_BLUE;
1870 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1876 ChangeAttrColor.Value <<=
COL_BLUE;
1878 ChangeAttrColor.Value <<= aChangeAttr.
m_nColor;
1890 if (
pos.first->Len() ==
pos.second
1898 sal_Int32 nValues = rValues.size();
1899 for (sal_Int32
i = 0;
i < nValues; ++
i)
1901 PropertyValue&
rValue = rValues[
i];
1903 if (rValue.Name == ChangeAttr.Name )
1905 rValue.Value = ChangeAttr.Value;
1909 if (rValue.Name == ChangeAttrColor.Name )
1911 rValue.Value = ChangeAttrColor.Value;
1919 sal_uInt32 crBack =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1922 uno::Reference<XAccessibleComponent> xComponent(
this);
1923 if (xComponent.is())
1925 crBack =
static_cast<sal_uInt32
>(xComponent->getBackground());
1927 rValue.Value <<= crBack;
1938 sal_uInt32 crChar =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1942 uno::Reference<XAccessibleComponent> xComponent(
this);
1943 if (xComponent.is())
1945 Color cr(xComponent->getBackground());
1947 rValue.Value <<= crChar;
1961 if(
nullptr != pWrongList )
1963 sal_Int32 nBegin =
pos.second;
1982 if(
nullptr != pWrongList )
1984 sal_Int32 nBegin =
pos.second;
1988 rValue.Value <<= sal_Int32(0x00ff0000);
1995 sal_uInt32 crUnderline =
static_cast<sal_uInt32
>(
reinterpret_cast<sal_uIntPtr
>(anyChar.pReserved));
1998 uno::Reference<XAccessibleComponent> xComponent(
this);
1999 if (xComponent.is())
2001 Color cr(xComponent->getBackground());
2003 rValue.Value <<= crUnderline;
2014 if( !tabs.hasElements() )
2017 css::style::TabStop ts;
2020 if( rc1.X - rc0.X >= 48 )
2021 ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
2024 ts.DecimalChar =
' ';
2026 ts.Alignment = css::style::TabAlign_LEFT;
2029 rValue.Value <<= tabs;
2038 rValue.Value <<= sal_Int32(101);
2055 throw lang::IndexOutOfBoundsException();
2058 bool bBehindText =
false;
2087 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2094 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
2097 return awt::Rectangle(
2098 aScreenRect.
Left(), aScreenRect.
Top(),
2121 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2123 Point aPoint( rPoint.X, rPoint.Y );
2126 aPoint.setX(aPoint.getX() + aPixPos.getX());
2127 aPoint.setY(aPoint.getY() + aPixPos.getY());
2128 Point aCorePoint(
GetMap()->PixelToCore( aPoint ) );
2129 if( !aLogBounds.
IsInside( aCorePoint ) )
2134 awt::Rectangle aRectEndPos =
2137 if (rPoint.X - aRectEndPos.X >= 0 &&
2138 rPoint.X - aRectEndPos.X < aRectEndPos.Width &&
2139 rPoint.Y - aRectEndPos.Y >= 0 &&
2140 rPoint.Y - aRectEndPos.Y < aRectEndPos.Height)
2147 OSL_ENSURE(
GetFrame() !=
nullptr,
"The text frame has vanished!" );
2148 OSL_ENSURE(
GetFrame()->IsTextFrame(),
"The text frame has mutated!" );
2166 if ( (!bVert && aResultRect.
Pos().getX() > aCorePoint.getX()) ||
2167 ( bVert && aResultRect.
Pos().getY() > aCorePoint.getY()) ||
2168 ( bR2L && aResultRect.
Right() < aCorePoint.getX()) )
2173 if ( (!bVert && aResultRectPrev.Pos().getX() < aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) ||
2174 ( bVert && aResultRectPrev.Pos().getY() < aCorePoint.getY() && aResultRect.
Pos().getX() == aResultRectPrev.Pos().getX()) ||
2175 ( bR2L && aResultRectPrev.Right() > aCorePoint.getX() && aResultRect.
Pos().getY() == aResultRectPrev.Pos().getY()) )
2193 sal_Int32 nStart, nEnd;
2196 ?
GetString().copy( nStart, nEnd - nStart )
2206 sal_Int32 nStart, nEnd;
2217 sal_Int32 nStart, nEnd;
2230 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2232 throw lang::IndexOutOfBoundsException();
2239 if( pCursorShell !=
nullptr )
2266 sal_Int32 nStartIndex, sal_Int32 nEndIndex )
2274 if ( !
IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
2275 throw lang::IndexOutOfBoundsException();
2278 return sText.copy(nStartIndex, nEndIndex-nStartIndex );
2287 TextSegment aResult;
2288 aResult.SegmentStart = -1;
2289 aResult.SegmentEnd = -1;
2296 if( nIndex == rText.getLength() && AccessibleTextType::LINE != nTextType )
2300 i18n::Boundary aBound;
2303 OSL_ENSURE( aBound.startPos >= 0,
"illegal boundary" );
2304 OSL_ENSURE( aBound.startPos <= aBound.endPos,
"illegal boundary" );
2309 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2310 aResult.SegmentStart = aBound.startPos;
2311 aResult.SegmentEnd = aBound.endPos;
2325 TextSegment aResult;
2326 aResult.SegmentStart = -1;
2327 aResult.SegmentEnd = -1;
2334 i18n::Boundary aBound;
2335 if (nIndex == rText.getLength())
2336 aBound.startPos = aBound.endPos = nIndex;
2342 aBound.startPos = aBound.endPos = nIndex;
2346 if (nTextType==2 || nTextType == 3)
2348 i18n::Boundary preBound = aBound;
2349 while(preBound.startPos==aBound.startPos && nIndex > 0)
2351 nIndex =
min( nIndex, preBound.startPos ) - 1;
2352 if( nIndex < 0 )
break;
2353 GetTextBoundary( preBound, rText, nIndex, nTextType );
2359 aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
2360 aResult.SegmentStart = preBound.startPos;
2361 aResult.SegmentEnd = preBound.endPos;
2369 nIndex =
min( nIndex, aBound.startPos ) - 1;
2372 bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
2378 if (bWord && nIndex<rText.getLength())
2380 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2381 aResult.SegmentStart = aBound.startPos;
2382 aResult.SegmentEnd = aBound.endPos;
2394 TextSegment aResult;
2395 aResult.SegmentStart = -1;
2396 aResult.SegmentEnd = -1;
2402 if( nIndex == rText.getLength() )
2406 i18n::Boundary aBound;
2411 nIndex =
max( sal_Int32(nIndex+1), aBound.endPos );
2412 if( nIndex < rText.getLength() )
2420 aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
2421 aResult.SegmentStart = aBound.startPos;
2422 aResult.SegmentEnd = aBound.endPos;
2498 sal_Int32 nEndIndex, AccessibleScrollType aScrollType )
2506 if ( !
IsValidRange( nStartIndex, nEndIndex, nLength ) )
2507 throw lang::IndexOutOfBoundsException();
2511 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
2514 awt::Rectangle startR, endR;
2519 Point sP(std::min(startR.X, endR.X), startR.Y);
2520 Point eP(std::max(startR.X + startR.Width, endR.X + endR.Width), endR.Y + endR.Height);
2531 switch (aScrollType)
2534 case AccessibleScrollType_SCROLL_TOP_LEFT:
2536 case AccessibleScrollType_SCROLL_BOTTOM_RIGHT:
2538 case AccessibleScrollType_SCROLL_TOP_EDGE:
2540 case AccessibleScrollType_SCROLL_BOTTOM_EDGE:
2542 case AccessibleScrollType_SCROLL_LEFT_EDGE:
2544 case AccessibleScrollType_SCROLL_RIGHT_EDGE:
2547 case AccessibleScrollType_SCROLL_ANYWHERE:
2553 const SwRect aRect(startPoint, endPoint);
2555 OSL_ENSURE( pViewShell !=
nullptr,
"View shell expected!" );
2596 return replaceText( nStartIndex, nEndIndex, OUString() );
2605 sal_Int32 nStartIndex, sal_Int32 nEndIndex,
2606 const OUString& sReplacement )
2614 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2615 throw lang::IndexOutOfBoundsException();
2624 nStartIndex, nEndIndex, nStart, nEnd );
2637 const uno::Reference<text::XTextRange> xRange(
2639 const_cast<SwDoc&>(pFrame->
GetDoc()), aStartPos, &aEndPos));
2640 xRange->setString(sReplacement);
2651 sal_Int32 nStartIndex,
2652 sal_Int32 nEndIndex,
2653 const uno::Sequence<PropertyValue>& rAttributeSet )
2661 if( !
IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
2662 throw lang::IndexOutOfBoundsException();
2669 uno::Reference<XMultiPropertySet> xPortion =
CreateUnoPortion( nStartIndex,
2673 sal_Int32
nLength = rAttributeSet.getLength();
2674 const PropertyValue* pPairs = rAttributeSet.getConstArray();
2675 std::vector<sal_Int32> aIndices(nLength);
2676 std::iota(aIndices.begin(), aIndices.end(), 0);
2677 std::sort(aIndices.begin(), aIndices.end(), IndexCompare(pPairs));
2680 uno::Sequence< OUString > aNames( nLength );
2681 OUString* pNames = aNames.getArray();
2682 uno::Sequence< uno::Any > aValues( nLength );
2684 for (sal_Int32
i = 0;
i < nLength; ++
i)
2686 const PropertyValue& rVal = pPairs[aIndices[
i]];
2687 pNames[
i] = rVal.Name;
2696 xPortion->setPropertyValues( aNames, aValues );
2698 catch (
const UnknownPropertyException&)
2715 sal_Int32 nChildIndex )
2723 sal_Int32 nChildIndex )
2750 sal_Int32 nSelectedChildIndex )
2759 sal_Int32 nChildIndex )
2770 class SwHyperlinkIter_Impl
2778 explicit SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame);
2787 SwHyperlinkIter_Impl::SwHyperlinkIter_Impl(
const SwTextFrame & rTextFrame)
2788 : m_rFrame(rTextFrame)
2789 , m_Iter(rTextFrame)
2790 , m_nStt(rTextFrame.GetOffset())
2805 while (
SwTextAttr const*
const pHt = m_Iter.NextAttr(&pNode))
2809 const TextFrameIndex nHtStt(m_rFrame.MapModelToView(pNode, pHt->GetStart()));
2810 const TextFrameIndex nHtEnd(m_rFrame.MapModelToView(pNode, pHt->GetAnyEnd()));
2811 if (nHtEnd > nHtStt &&
2812 ((nHtStt >= m_nStt && nHtStt < m_nEnd) ||
2813 (nHtEnd > m_nStt && nHtEnd <= m_nEnd)))
2838 SwHyperlinkIter_Impl aIter(*pTextFrame);
2839 while( aIter.next() )
2845 uno::Reference< XAccessibleHyperlink > SAL_CALL
2852 uno::Reference< XAccessibleHyperlink > xRet;
2855 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2858 for (sal_Int32 nTIndex = 0; pHt && nTIndex <= nLinkIndex; ++nTIndex)
2860 if( nTIndex == nLinkIndex )
2868 xRet = (*aIter).second;
2875 max(aHIter.startIdx(), nHintStart));
2877 min(aHIter.endIdx(), nHintEnd));
2879 *
this, nTmpHStt, nTmpHEnd );
2882 (*aIter).second = xRet;
2893 pHt =
const_cast<SwTextAttr*
>(aHIter.next(&pNode));
2896 throw lang::IndexOutOfBoundsException();
2911 throw lang::IndexOutOfBoundsException();
2914 sal_Int32 nRet = -1;
2918 SwHyperlinkIter_Impl aHIter(*pTextFrame);
2927 pHt = aHIter.next(&pNode);
2936 throw lang::IndexOutOfBoundsException();
2945 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
2946 switch ( nTextMarkupType )
2948 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
2949 case text::TextMarkupType::TRACK_CHANGE_DELETION:
2950 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
2964 return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
2977 sal_Int32 nSelected = 0;
2979 if( pCursor !=
nullptr )
2987 nLastNode = pMerged->pLastNode->GetIndex();
2991 nLastNode = nFirstNode;
2998 if( rTmpCursor.HasMark() )
3005 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3024 sal_Int32 nStart, nEnd;
3035 sal_Int32 nStart, nEnd;
3044 if(selectionIndex < 0)
return false;
3046 sal_Int32 nSelected = selectionIndex;
3051 if( pCursor !=
nullptr )
3061 nLastNode = pMerged->pLastNode->GetIndex();
3065 nLastNode = nFirstNode;
3069 SwPaM* pRingStart = pCursor;
3080 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3082 if( nSelected == 0 )
3084 pCursor->
MoveTo(
nullptr);
3098 while( !bRet && (pCursor != pRingStart) );
3111 if ( !
IsValidRange( startOffset, endOffset, nLength ) )
3113 throw lang::IndexOutOfBoundsException();
3117 for ( sal_Int32
i = nSelectedCount ;
i >= 0 ;
i--)
3119 sal_Int32 nStart, nEnd;
3125 if (( startOffset>=nStart && startOffset <=nEnd ) ||
3126 ( endOffset>=nStart && endOffset <=nEnd ) ||
3127 ( startOffset <= nStart && endOffset >=nEnd) ||
3128 ( startOffset >= nStart && endOffset <=nEnd) )
3136 if (( startOffset>=nEnd && startOffset <=nStart ) ||
3137 ( endOffset>=nEnd && endOffset <=nStart ) ||
3138 ( startOffset <= nStart && endOffset >=nEnd) ||
3139 ( startOffset >= nStart && endOffset <=nEnd) )
3151 if( pCursorShell !=
nullptr )
3166 TextSegment SAL_CALL
3168 sal_Int32 nTextMarkupType )
3172 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3173 switch ( nTextMarkupType )
3175 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3176 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3177 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3191 return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
3194 uno::Sequence< TextSegment > SAL_CALL
3196 sal_Int32 nTextMarkupType )
3204 throw lang::IndexOutOfBoundsException();
3207 std::unique_ptr<SwTextMarkupHelper> pTextMarkupHelper;
3208 switch ( nTextMarkupType )
3210 case text::TextMarkupType::TRACK_CHANGE_INSERTION:
3211 case text::TextMarkupType::TRACK_CHANGE_DELETION:
3212 case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
3226 return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
3238 throw lang::IndexOutOfBoundsException();
3245 TextSegment SAL_CALL
3254 throw lang::IndexOutOfBoundsException();
3257 i18n::Boundary aLineBound;
3260 TextSegment aTextAtLine;
3262 aTextAtLine.SegmentText = rText.copy( aLineBound.startPos,
3263 aLineBound.endPos - aLineBound.startPos );
3264 aTextAtLine.SegmentStart = aLineBound.startPos;
3265 aTextAtLine.SegmentEnd = aLineBound.endPos;
3276 if ( nLineNoOfCaret >= 0 &&
3282 return TextSegment();
3299 if ( nCaretPos != 0 )
3301 i18n::Boundary aLineBound;
3303 if ( nCaretPos == aLineBound.startPos )
3306 if ( pCursorShell !=
nullptr )
3315 throw uno::RuntimeException(
"no Window", static_cast<cppu::OWeakObject*>(
this));
3322 aScreenRect.
Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
3325 const awt::Rectangle aCursorRect( aScreenRect.
Left(),
3330 if ( aCharRect.X != aCursorRect.X ||
3331 aCharRect.Y != aCursorRect.Y )
3349 sal_Int32 * pSelection, sal_Int32& nStart, sal_Int32& nEnd)
3351 if (pSelection && *pSelection < 0)
return false;
3359 if( pCursor !=
nullptr )
3367 nLastNode = pMerged->pLastNode->GetIndex();
3371 nLastNode = nFirstNode;
3378 if( rTmpCursor.HasMark() )
3385 if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
3387 if (!pSelection || *pSelection == 0)
3392 sal_Int32 nLocalStart = -1;
3393 if (nStartIndex < nFirstNode)
3413 else if( nCoreStart <=
3420 "problem determining valid core position");
3429 sal_Int32 nLocalEnd = -1;
3430 if (nLastNode < nEndIndex)
3452 else if( nCoreEnd >=
3460 "problem determining valid core position");
3467 if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
3469 nStart = nLocalStart;
3488 if (pSelection && bRet)
3491 if( nStart == nCaretPos )
3493 sal_Int32 tmp = nStart;
3508 return AccessibleRole::HEADING;
3512 return AccessibleRole::PARAGRAPH;
3519 uno::Reference< css::beans::XPropertySet > xPortion =
CreateUnoPortion( 0, 0 );
3520 uno::Any styleAny = xPortion->getPropertyValue(
"ParaStyleName" );
3522 if (styleAny >>= sValue)
3524 sal_Int32
length = sValue.getLength();
3525 if (length == 9 || length == 10)
3527 OUString headStr = sValue.copy(0, 7);
3528 if (headStr ==
"Heading")
3530 OUString intStr = sValue.copy(8);
3531 sal_Int32 headingLevel = intStr.toInt32();
3532 return headingLevel;
3544 OUString strHeading(
"heading-level:");
3548 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
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
#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)
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
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
std::map< key_type, mapped_type, key_compare >::iterator iterator
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
css::uno::Any const & rValue
SwCursorShell * GetCursorShell()
convenience method to get SwCursorShell through accessibility map
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
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)
SwXTextPortion * CreateUnoPortion(sal_Int32 nStart, sal_Int32 nEnd)
bool isAccessibleChildSelected(sal_Int32 nChildIndex)
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
void AddRelation(const css::accessibility::AccessibleRelation &rRelation)
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
static OUString GetTypeStr(SwFieldTypesEnum nTypeId)
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 EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
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()
tools::Long Width() const
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
std::vector< SfxItemPropertyNamedEntry > PropertyEntryVector_t
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
constexpr sal_uInt16 RES_FRMATR_END(131)
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
PropertyEntryVector_t getPropertyEntries() const
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)
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
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