24#include <document.hxx>
27#include <drawview.hxx>
36#include <com/sun/star/accessibility/AccessibleEventId.hpp>
37#include <com/sun/star/accessibility/AccessibleStateType.hpp>
38#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
39#include <com/sun/star/accessibility/AccessibleRole.hpp>
40#include <com/sun/star/view/XSelectionSupplier.hpp>
41#include <com/sun/star/drawing/ShapeCollection.hpp>
42#include <com/sun/star/drawing/XShape.hpp>
43#include <com/sun/star/drawing/XShapes.hpp>
44#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
66#include <editeng/editeng.hxx>
88struct ScAccessibleShapeData
90 ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_);
91 ~ScAccessibleShapeData();
93 mutable std::optional<ScAddress> xRelationCell;
94 css::uno::Reference< css::drawing::XShape > xShape;
95 mutable bool bSelected;
98 std::optional<sal_Int16> mxLayerID;
99 std::optional<sal_Int32> mxZOrder;
104ScAccessibleShapeData::ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_)
105 : xShape(
std::move(xShape_)),
106 bSelected(false), bSelectable(true)
108 static constexpr OUStringLiteral gsLayerId =
u"LayerID";
109 static constexpr OUStringLiteral gsZOrder =
u"ZOrder";
110 uno::Reference< beans::XPropertySet> xProps(xShape, uno::UNO_QUERY);
113 uno::Any aAny = xProps->getPropertyValue(gsLayerId);
115 if (aAny >>= nLayerID)
116 mxLayerID = nLayerID;
118 aAny = xProps->getPropertyValue(gsZOrder);
119 if (aAny >>= nZOrder)
124ScAccessibleShapeData::~ScAccessibleShapeData()
128 pAccShape->dispose();
134struct ScShapeDataLess
136 static void ConvertLayerId(sal_Int16& rLayerID)
156 static bool LessThanSheet(
const ScAccessibleShapeData* pData)
159 if (
pData->mxLayerID)
166 bool operator()(
const ScAccessibleShapeData* pData1,
const ScAccessibleShapeData* pData2)
const
169 if (pData1 && pData2)
171 if( pData1->mxLayerID && pData2->mxLayerID )
173 sal_Int16 nLayerID1 = *pData1->mxLayerID;
174 sal_Int16 nLayerID2 = *pData2->mxLayerID;
175 if (nLayerID1 == nLayerID2)
177 if ( pData1->mxZOrder && pData2->mxZOrder )
178 bResult = (*pData1->mxZOrder < *pData2->mxZOrder);
182 ConvertLayerId(nLayerID1);
183 ConvertLayerId(nLayerID2);
184 bResult = (nLayerID1 < nLayerID2);
188 else if (pData1 && !pData2)
189 bResult = LessThanSheet(pData1);
190 else if (!pData1 && pData2)
191 bResult = !LessThanSheet(pData2);
215 const css::uno::Reference< css::drawing::XShape >& _rxShape,
217 const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
221 (css::beans::XPropertySet* pSet)
override;
222 virtual css::uno::Reference< css::accessibility::XAccessible>
228 uno::Reference< XAccessible >
Get(
const ScAccessibleShapeData*
pData)
const;
229 uno::Reference< XAccessible >
Get(sal_Int32
nIndex)
const;
230 uno::Reference< XAccessible >
GetAt(
const awt::Point& rPoint)
const;
235 css::uno::Reference<css::drawing::XShape>& rShape)
const;
243 uno::Reference< XAccessible >
GetSelected(sal_Int32 nSelectedChildIndex,
bool bTabSelected)
const;
244 void Deselect(sal_Int32 nChildIndex);
253 typedef std::unordered_map<css::uno::Reference< css::drawing::XShape >, ScAccessibleShapeData*>
ShapesMap;
266 void FillShapes(std::vector < uno::Reference < drawing::XShape > >& rShapes)
const;
269 std::optional<ScAddress>
GetAnchor(
const uno::Reference<drawing::XShape>& xShape)
const;
270 uno::Reference<XAccessibleRelationSet>
GetRelationSet(
const ScAccessibleShapeData* pData)
const;
271 void SetAnchor(
const uno::Reference<drawing::XShape>& xShape, ScAccessibleShapeData* pData)
const;
272 void AddShape(
const uno::Reference<drawing::XShape>& xShape,
bool bCommitChange)
const;
273 void RemoveShape(
const uno::Reference<drawing::XShape>& xShape)
const;
275 bool FindShape(
const uno::Reference<drawing::XShape>& xShape, SortedShapes::iterator& rItr)
const;
278 const ScAccessibleShapeData* pData2);
283 mbShapesNeedSorting(false),
285 mpViewShell(pViewShell),
286 mpAccessibleDocument(pAccessibleDocument),
287 meSplitPos(eSplitPos)
313 throw uno::RuntimeException();
371 if (rHint.
GetId() != SfxHintId::ThisIsAnSdrHint)
382 case SdrHintKind::ObjectChange :
384 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
394 case SdrHintKind::ObjectInserted :
396 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
401 case SdrHintKind::ObjectRemoved :
403 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
417 const css::uno::Reference< css::drawing::XShape >& _rxShape,
418 const tools::Long , const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo)
427 if (pReplacement.is())
429 OSL_ENSURE(pCurrentChild->
GetXShape().get() == pReplacement->GetXShape().get(),
"XShape changes and should be inserted sorted");
431 if (it !=
maShapesMap.end() && it->second->pAccShape.is())
433 OSL_ENSURE(it->second->pAccShape == pCurrentChild,
"wrong child found");
434 AccessibleEventObject
aEvent;
435 aEvent.EventId = AccessibleEventId::CHILD;
437 aEvent.OldValue <<= uno::Reference<XAccessible>(pCurrentChild);
441 pCurrentChild->dispose();
446 pReplacement->Init();
450 it->second->pAccShape = pReplacement;
451 AccessibleEventObject
aEvent;
452 aEvent.EventId = AccessibleEventId::CHILD;
454 aEvent.NewValue <<= uno::Reference<XAccessible>(pReplacement);
482css::uno::Reference < css::accessibility::XAccessible >
489 ScAccessibleShapeData* pShape = it->second;
490 css::uno::Reference< css::accessibility::XAccessible > xNewChild( pShape->pAccShape );
503 for (
size_t i = 0;
i < nSdrObjCount; ++
i)
508 uno::Reference< drawing::XShape > xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
521 if (!
pData->pAccShape.is())
527 if (
pData->pAccShape.is())
529 pData->pAccShape->Init();
530 if (
pData->bSelected)
531 pData->pAccShape->SetState(AccessibleStateType::SELECTED);
532 if (!
pData->bSelectable)
533 pData->pAccShape->ResetState(AccessibleStateType::SELECTABLE);
537 return pData->pAccShape;
559 uno::Reference<XAccessible> xAccessible;
570 while (!bFound &&
i >= 0)
575 if (!pShape->pAccShape.is())
578 if (pShape->pAccShape.is())
582 if (pShape->pAccShape->containsPoint(
AWTPoint(aPoint)))
584 xAccessible = pShape->pAccShape.get();
590 OSL_FAIL(
"I should have an accessible shape now!");
603 uno::Reference<drawing::XShape>& rShape)
const
605 bool bResult (
false);
610 throw uno::RuntimeException();
624#if OSL_DEBUG_LEVEL > 0
625 uno::Reference< drawing::XShape > xReturnShape;
626 bool bDebugResult(
false);
631 sal_Int32
nCount(xShapes->getCount());
634 uno::Reference< drawing::XShape > xShape;
637 while (!bDebugResult && (
i <
nCount))
639 xShapes->getByIndex(
i) >>= xShape;
640 if (xShape.is() && (xIndexShape.get() == xShape.get()))
643 xReturnShape = xShape;
650 OSL_ENSURE((bResult == bDebugResult) && ((bResult && (rShape.get() == xReturnShape.get())) || !bResult),
"found the wrong shape or result");
660 throw uno::RuntimeException();
675 throw uno::RuntimeException();
686 uno::Reference<drawing::XShape> xShape;
693 xShapes = drawing::ShapeCollection::create(
705 catch (lang::IllegalArgumentException&)
713 throw uno::RuntimeException();
715 bool bSomethingSelected(
true);
720 catch (lang::IllegalArgumentException&)
722 OSL_FAIL(
"nothing selected before");
723 bSomethingSelected =
false;
726 if (bSomethingSelected)
730 pAccShapeData->bSelected =
false;
731 if (pAccShapeData->pAccShape.is())
732 pAccShapeData->pAccShape->ResetState(AccessibleStateType::SELECTED);
740 throw uno::RuntimeException();
748 uno::Reference<drawing::XShapes> xShapes = drawing::ShapeCollection::create(
755 if (pAccShapeData && pAccShapeData->bSelectable)
757 pAccShapeData->bSelected =
true;
758 if (pAccShapeData->pAccShape.is())
759 pAccShapeData->pAccShape->SetState(AccessibleStateType::SELECTED);
761 xShapes->add(pAccShapeData->xShape);
766 catch (lang::IllegalArgumentException&)
777 sal_uInt32
nCount(xShapes->getCount());
780 uno::Reference<drawing::XShape> xShape;
781 xShapes->getByIndex(
i) >>= xShape;
783 rShapes.push_back(xShape);
791 throw uno::RuntimeException();
793 std::vector < uno::Reference < drawing::XShape > > aShapes;
796 return aShapes.size();
801 uno::Reference< XAccessible > xAccessible;
808 std::vector < uno::Reference < drawing::XShape > > aShapes;
814 SortedShapes::iterator aItr;
815 if (
FindShape(aShapes[nSelectedChildIndex], aItr))
816 xAccessible =
Get(*aItr);
827 if (!rpShape || rpShape->bSelected)
829 if (nSelectedChildIndex == 0)
832 xAccessible = rpShape->pAccShape.get();
836 --nSelectedChildIndex;
846 uno::Reference<drawing::XShape> xShape;
855 xShapes->remove(xShape);
861 catch (lang::IllegalArgumentException&)
863 OSL_FAIL(
"something not selectable");
868 maZOrderedShapes[nChildIndex]->pAccShape->ResetState(AccessibleStateType::SELECTED);
880 if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
881 pDrawPage = pDrawLayer->GetPage(
static_cast<sal_uInt16
>(
static_cast<sal_Int16
>(nTab)));
893 ((!pAccShapeData->xRelationCell && !pAddress) ||
894 (pAccShapeData->xRelationCell && pAddress && (*(pAccShapeData->xRelationCell) == *pAddress))))
899 AccessibleRelation aRelation;
900 aRelation.TargetSet = {
Get(pAccShapeData) };
901 aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
903 pRelationSet->AddRelation(aRelation);
918 uno::Reference< drawing::XShape > xShape;
919 xShapes->getByIndex(
i) >>= xShape;
922 ScAccessibleShapeData* pShapeData =
new ScAccessibleShapeData(xShape);
923 aShapesList.push_back(pShapeData);
934 std::sort(aShapesList.begin(), aShapesList.end(), ScShapeDataLess());
937 bool bHasSelect=
false;
938 SortedShapes::iterator aXShapesItr(aShapesList.begin());
939 SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
942 SortedShapes::const_iterator aFocusedItr = aDataEndItr;
943 while(aDataItr != aDataEndItr)
948 if (aXShapesItr == aXShapesEndItr)
951 nComp =
Compare(*aDataItr, *aXShapesItr);
954 if (!(*aDataItr)->bSelected)
956 (*aDataItr)->bSelected =
true;
957 if ((*aDataItr)->pAccShape.is())
959 (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
960 (*aDataItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
962 vecSelectedShapeAdd.push_back(*aDataItr);
964 aFocusedItr = aDataItr;
975 if ((*aDataItr)->bSelected)
977 (*aDataItr)->bSelected =
false;
978 if ((*aDataItr)->pAccShape.is())
980 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
981 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
983 vecSelectedShapeRemove.push_back(*aDataItr);
990 OSL_FAIL(
"here is a selected shape which is not in the childlist");
998 bool bWinFocus=
false;
1009 bool bIsFocuseMarked =
true;
1019 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1020 if( aFocusedItr != aDataEndItr &&
1021 (*aFocusedItr)->xShape.is() &&
1022 xMarkedXShape.is() &&
1023 (*aFocusedItr)->xShape != xMarkedXShape )
1024 bIsFocuseMarked =
false;
1029 if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape.is() && (
mnShapesSelected == 1) && bWinFocus)
1031 (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
1037 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1040 if( pMarkedObj == pFocusedObj && pUpObj )
1042 uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->
getUnoShape(), uno::UNO_QUERY);
1043 uno::Reference < XAccessible > xAccGroupShape =
1045 if( xAccGroupShape.is() )
1049 if( pAccGroupShape )
1058 uno::Reference< drawing::XShape > xChildShape = pChildAccShape->
GetXShape();
1059 if (xChildShape == xMarkedXShape)
1061 pChildAccShape->
SetState(AccessibleStateType::FOCUSED);
1065 pChildAccShape->
ResetState(AccessibleStateType::FOCUSED);
1074 if (vecSelectedShapeAdd.size() >= 10 )
1076 AccessibleEventObject
aEvent;
1077 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1083 for (
const auto& rpShape : vecSelectedShapeAdd)
1085 AccessibleEventObject
aEvent;
1088 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1092 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1095 uno::Reference< XAccessible > xChild( rpShape->pAccShape );
1096 aEvent.NewValue <<= xChild;
1100 for (
const auto& rpShape : vecSelectedShapeRemove)
1102 AccessibleEventObject
aEvent;
1103 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1105 uno::Reference< XAccessible > xChild( rpShape->pAccShape );
1106 aEvent.NewValue <<= xChild;
1109 for(ScAccessibleShapeData*& pShapeData : aShapesList)
1112 pShapeData =
nullptr;
1122 uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
1123 if (pSdrObj && xShapeProp.is())
1126 return std::optional<ScAddress>(pAnchor->maStart);
1130 return std::optional<ScAddress>();
1140 if (
pData->xRelationCell && xAccessible.is())
1142 sal_Int32 nRow =
pData->xRelationCell->Row();
1143 sal_Int32 nColumn =
pData->xRelationCell->Col();
1144 bool bPositionUnset = nRow == -1 && nColumn == -1;
1145 if (!bPositionUnset)
1147 uno::Reference<XAccessibleTable> xAccTable(xAccessible->getAccessibleContext(), uno::UNO_QUERY);
1149 xAccessible = xAccTable->getAccessibleCellAt(nRow, nColumn);
1152 AccessibleRelation aRelation;
1153 aRelation.TargetSet = { xAccessible };
1154 aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
1155 pRelationSet->AddRelation(aRelation);
1158 return pRelationSet;
1165 std::optional<ScAddress> xAddress =
GetAnchor(xShape);
1166 if ((xAddress &&
pData->xRelationCell && (*xAddress != *(
pData->xRelationCell))) ||
1167 (!xAddress &&
pData->xRelationCell) || (xAddress && !
pData->xRelationCell))
1169 pData->xRelationCell = xAddress;
1170 if (
pData->pAccShape.is())
1180 ScAccessibleShapeData* pShape =
new ScAccessibleShapeData(xShape);
1186 uno::Reference< beans::XPropertySet > xShapeProp(xShape, uno::UNO_QUERY);
1187 if (xShapeProp.is())
1189 uno::Any aPropAny = xShapeProp->getPropertyValue(
"LayerID");
1190 sal_Int16 nLayerID = 0;
1191 if( aPropAny >>= nLayerID )
1194 pShape->bSelectable =
false;
1196 pShape->bSelectable =
true;
1201 throw uno::RuntimeException();
1204 uno::Reference<container::XEnumerationAccess> xEnumAcc(xShapes, uno::UNO_QUERY);
1207 uno::Reference<container::XEnumeration> xEnum = xEnumAcc->createEnumeration();
1210 uno::Reference<drawing::XShape> xSelectedShape;
1212 while (!bFound && xEnum->hasMoreElements())
1214 xEnum->nextElement() >>= xSelectedShape;
1215 if (xShape.is() && (xShape.get() == xSelectedShape.get()))
1217 pShape->bSelected =
true;
1225 AccessibleEventObject
aEvent;
1226 aEvent.EventId = AccessibleEventId::CHILD;
1241 SortedShapes::iterator aItr;
1246 uno::Reference<XAccessible> xOldAccessible (
Get(*aItr));
1252 AccessibleEventObject
aEvent;
1253 aEvent.EventId = AccessibleEventId::CHILD;
1255 aEvent.OldValue <<= xOldAccessible;
1268 OSL_FAIL(
"shape was not in internal list");
1279 bool bResult(
false);
1280 ScAccessibleShapeData aShape(xShape);
1282 if ((rItr !=
maZOrderedShapes.end()) && (*rItr !=
nullptr) && ((*rItr)->xShape.get() == xShape.get()))
1285#if OSL_DEBUG_LEVEL > 0
1287 [&xShape](
const ScAccessibleShapeData* pShape) { return pShape && (pShape->xShape.get() == xShape.get()); });
1289 OSL_ENSURE((bResult == bResult2) && ((bResult && (rItr == aDebugItr)) || !bResult),
"wrong Shape found");
1295 const ScAccessibleShapeData* pData2)
1297 ScShapeDataLess aLess;
1299 bool bResult1(aLess(pData1, pData2));
1300 bool bResult2(aLess(pData2, pData1));
1303 if (!bResult1 && bResult2)
1305 else if (bResult1 && !bResult2)
1314 if (pAccShapeData && pAccShapeData->pAccShape.is())
1315 pAccShapeData->pAccShape->ViewForwarderChanged();
1319 const uno::Reference<XAccessible>& rxParent,
1323 mpViewShell(pViewShell),
1324 meSplitPos(eSplitPos),
1325 mbCompleteSheetSelected(false)
1402 OSL_ENSURE( rEvent.GetWindow(),
"Window???" );
1403 switch ( rEvent.GetId() )
1405 case VclEventId::WindowShow:
1408 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1414 case VclEventId::WindowHide:
1417 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1431 if (pFocusLostHint->GetOldGridWin() ==
meSplitPos)
1443 if (pFocusGotHint->GetNewGridWin() ==
meSplitPos)
1445 uno::Reference<XAccessible> xAccessible;
1451 if( xAccessible.is() )
1454 aNewValue<<=AccessibleStateType::FOCUSED;
1474 if ((rHint.
GetId() == SfxHintId::ScAccTableChanged) &&
1483 AccessibleEventObject
aEvent;
1484 aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
1485 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1491 else if (rHint.
GetId() == SfxHintId::ScAccMakeDrawLayer)
1496 else if (rHint.
GetId() == SfxHintId::ScAccEnterEditMode)
1520 else if (rHint.
GetId() == SfxHintId::ScAccLeaveEditMode)
1544 else if ((rHint.
GetId() == SfxHintId::ScAccVisAreaChanged) || (rHint.
GetId() == SfxHintId::ScAccWindowResized))
1553 AccessibleEventObject
aEvent;
1554 aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
1555 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1579 bool bSelectionChanged(
false);
1587 bSelectionChanged =
true;
1592 bSelectionChanged =
true;
1594 if (bSelectionChanged)
1596 AccessibleEventObject
aEvent;
1597 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1598 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1627 const awt::Point& rPoint )
1629 uno::Reference<XAccessible> xAccessible;
1636 if(!xAccessible.is())
1640 uno::Reference< XAccessibleContext > xCont(
mxTempAcc->getAccessibleContext());
1641 uno::Reference< XAccessibleComponent > xComp(xCont, uno::UNO_QUERY);
1649 if (!xAccessible.is())
1664 if (xAccessibleComponent.is())
1666 xAccessibleComponent->grabFocus();
1696uno::Reference<XAccessible> SAL_CALL
1701 uno::Reference<XAccessible> xAccessible;
1710 if (!xAccessible.is())
1719 if (!xAccessible.is())
1720 throw lang::IndexOutOfBoundsException();
1730 sal_Int64 nParentStates = 0;
1733 uno::Reference<XAccessibleContext> xParentContext =
getAccessibleParent()->getAccessibleContext();
1734 nParentStates = xParentContext->getAccessibleStateSet();
1736 sal_Int64 nStateSet = 0;
1738 nStateSet |= AccessibleStateType::DEFUNC;
1741 nStateSet |= AccessibleStateType::EDITABLE;
1742 nStateSet |= AccessibleStateType::ENABLED;
1743 nStateSet |= AccessibleStateType::OPAQUE;
1745 nStateSet |= AccessibleStateType::SHOWING;
1747 nStateSet |= AccessibleStateType::VISIBLE;
1771 if (aFileName.isEmpty())
1774 if (!aFileName.isEmpty())
1778 aReadOnly =
ScResId(STR_ACC_DOC_SPREADSHEET_READONLY);
1780 aName = aFileName + aReadOnly +
" - " +
aName;
1799 if (nChildIndex < 0 || nChildIndex >=
nCount)
1800 throw lang::IndexOutOfBoundsException();
1802 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1803 if (xAccessible.is())
1807 if (bWasTableSelected)
1821 bool bResult(
false);
1828 if (nChildIndex < 0 || nChildIndex >=
nCount)
1829 throw lang::IndexOutOfBoundsException();
1831 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1832 if (xAccessible.is())
1834 uno::Reference<drawing::XShape> xShape;
1893uno::Reference<XAccessible > SAL_CALL
1898 uno::Reference<XAccessible> xAccessible;
1902 if (nSelectedChildIndex < 0 || nSelectedChildIndex >=
nCount)
1903 throw lang::IndexOutOfBoundsException();
1908 xAccessible =
mpChildrenShapes->GetSelected(nSelectedChildIndex, bTabMarked);
1911 else if (bTabMarked)
1915 OSL_ENSURE(xAccessible.is(),
"here should always be an accessible object or an exception thrown");
1932 if (nChildIndex < 0 || nChildIndex >=
nCount)
1933 throw lang::IndexOutOfBoundsException();
1937 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1938 if (xAccessible.is())
1944 else if (bTabMarked)
1953 return "ScAccessibleDocument";
1956uno::Sequence< OUString> SAL_CALL
1959 const css::uno::Sequence<OUString> vals {
"com.sun.star.AccessibleSpreadsheetDocumentView" };
1970uno::Sequence<sal_Int8> SAL_CALL
1973 return css::uno::Sequence<sal_Int8>();
1985 aPoint.setX(-aPoint.getX());
1986 aPoint.setY(-aPoint.getY());
2036 return pRelationSet;
2051 sal_Int32 nNumber(sal_Int32(
meSplitPos) + 1);
2052 sName += OUString::number(nNumber);
2082 SCTAB nVisibleTable(0);
2085 return nVisibleTable;
2088uno::Reference < XAccessible >
2111 bool bResult (
false);
2127 (nParentStates & AccessibleStateType::DEFUNC);
2132 OSL_ENSURE(!
mxTempAcc.is(),
"this object should be removed before");
2138 AccessibleEventObject
aEvent;
2139 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2140 aEvent.EventId = AccessibleEventId::CHILD;
2149 OSL_ENSURE(
mxTempAcc.is(),
"this object should be added before");
2153 OSL_ENSURE(xAcc.get() ==
mxTempAcc.get(),
"only the same object should be removed");
2156 AccessibleEventObject
aEvent;
2157 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2158 aEvent.EventId = AccessibleEventId::CHILD;
2198 sal_uInt16 sheetIndex;
2199 OUString sSheetName;
2202 return anyAttribute;
2204 OUString sValue =
"page-name:" + sSheetName +
2205 ";page-number:" + OUString::number(sheetIndex+1) +
2206 ";total-pages:" + OUString::number(
GetDocument()->GetTableCount()) +
";";
2207 anyAttribute <<= sValue;
2208 return anyAttribute;
2220 return sal_Int32(
SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
IMPL_LINK(ScAccessibleDocument, WindowChildEventListener, VclWindowEvent &, rEvent, void)
bool IsUpdateLayout() const
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
void IsObjectValid() const
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
===== XAccessible =====================================================
virtual void SAL_CALL disposing() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
void CommitFocusLost() const
Calls all FocusListener to tell they that the focus is lost.
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
===== XTypeProvider ===================================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
void CommitFocusGained() const
Calls all FocusListener to tell they that the focus is gained.
void CommitChange(const css::accessibility::AccessibleEventObject &rEvent) const
Calls all Listener to tell they the change.
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL acquire() noexcept override
tools::Rectangle GetVisibleArea_Impl() const
===== IAccessibleViewForwarder ========================================
virtual void SAL_CALL selectAllAccessibleChildren() override
void AddChild(const css::uno::Reference< css::accessibility::XAccessible > &xAcc, bool bFireEvent)
ScAddress GetCurCellAddress() const
virtual void SAL_CALL clearAccessibleSelection() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
===== XAccessibleContext ==============================================
virtual void Init() override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Returns an implementation id.
rtl::Reference< ScAccessibleSpreadsheet > mpAccessibleSpreadsheet
ScAccessibleDocument(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ScTabViewShell *pViewShell, ScSplitPos eSplitPos)
virtual tools::Rectangle GetVisibleArea() const override
===== IAccessibleViewForwarder ========================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual tools::Rectangle GetBoundingBoxOnScreen() const override
Return the object's current bounding box relative to the desktop.
css::uno::Reference< css::accessibility::XAccessible > GetAccessibleSpreadsheet()
ScDocument * GetDocument() const
virtual OUString createAccessibleName() override
Return the object's current name.
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
bool mbCompleteSheetSelected
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
virtual OUString SAL_CALL getAccessibleName() override
Return the object's current name.
std::unique_ptr< ScChildrenShapes > mpChildrenShapes
static OUString GetCurrentCellDescription()
void FreeAccessibleSpreadsheet()
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
virtual void SAL_CALL grabFocus() override
virtual tools::Rectangle GetBoundingBox() const override
Return the object's current bounding box relative to the parent object.
OUString GetCurrentCellName() const
virtual Point LogicToPixel(const Point &rPoint) const override
Transform the specified point from internal coordinates to an absolute screen position.
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
===== XSelectionListener =============================================
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
bool IsTableSelected() const
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual sal_Int32 SAL_CALL getForeground() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
===== XAccessibleSelection ===========================================
ScTabViewShell * mpViewShell
SCTAB getVisibleTable() const
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
Return the specified child or NULL if index is invalid.
virtual ~ScAccessibleDocument() override
tools::Rectangle maVisArea
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
rtl::Reference< ScAccessibleEditObject > mpTempAccEdit
rtl::Reference< utl::AccessibleRelationSetHelper > GetRelationSet(const ScAddress *pAddress) const
======== internal =====================================================
css::uno::Reference< css::accessibility::XAccessible > mxTempAcc
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
void RemoveChild(const css::uno::Reference< css::accessibility::XAccessible > &xAcc, bool bFireEvent)
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Return the set of current states.
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ===================================================
virtual OUString createAccessibleDescription() override
Return this object's description.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
===== XTypeProvider ===================================================
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nChildIndex) override
@descr This base class provides an implementation of the AccessibleCell service.
@descr This base class provides an implementation of the AccessibleTable service.
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
void Select(sal_Int32 nIndex)
ScTabViewShell * mpViewShell
void VisAreaChanged() const
virtual ::accessibility::AccessibleControlShape * GetAccControlShapeFromModel(css::beans::XPropertySet *pSet) override
uno::Reference< XAccessible > GetAt(const awt::Point &rPoint) const
ScAccessibleDocument * mpAccessibleDocument
void AddShape(const uno::Reference< drawing::XShape > &xShape, bool bCommitChange) const
void RemoveShape(const uno::Reference< drawing::XShape > &xShape) const
uno::Reference< XAccessible > GetSelected(sal_Int32 nSelectedChildIndex, bool bTabSelected) const
std::vector< ScAccessibleShapeData * > SortedShapes
mutable::accessibility::AccessibleShapeTreeInfo maShapeTreeInfo
virtual bool ReplaceChild(::accessibility::AccessibleShape *pCurrentChild, const css::uno::Reference< css::drawing::XShape > &_rxShape, const tools::Long _nIndex, const ::accessibility::AccessibleShapeTreeInfo &_rShapeTreeInfo) override
===== IAccessibleParent ===============================================
void SetAnchor(const uno::Reference< drawing::XShape > &xShape, ScAccessibleShapeData *pData) const
bool FindShape(const uno::Reference< drawing::XShape > &xShape, SortedShapes::iterator &rItr) const
virtual ~ScChildrenShapes() override
std::optional< ScAddress > GetAnchor(const uno::Reference< drawing::XShape > &xShape) const
SdrPage * GetDrawPage() const
sal_Int32 GetCount() const
void FillShapes(std::vector< uno::Reference< drawing::XShape > > &rShapes) const
SortedShapes maZOrderedShapes
rtl::Reference< utl::AccessibleRelationSetHelper > GetRelationSet(const ScAddress *pAddress) const
void Deselect(sal_Int32 nChildIndex)
sal_Int32 GetSelectedCount() const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
static sal_Int8 Compare(const ScAccessibleShapeData *pData1, const ScAccessibleShapeData *pData2)
sal_uInt32 mnShapesSelected
std::unordered_map< css::uno::Reference< css::drawing::XShape >, ScAccessibleShapeData * > ShapesMap
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessibleCaption(const css::uno::Reference< css::drawing::XShape > &xShape) override
bool FindSelectedShapesChanges(const css::uno::Reference< css::drawing::XShapes > &xShapes) const
ScChildrenShapes(ScAccessibleDocument *pAccessibleDocument, ScTabViewShell *pViewShell, ScSplitPos eSplitPos)
void SetDrawBroadcaster()
===== Internal ========================================================
css::uno::Reference< css::view::XSelectionSupplier > xSelectionSupplier
uno::Reference< XAccessible > Get(const ScAccessibleShapeData *pData) const
bool IsSelected(sal_Int32 nIndex, css::uno::Reference< css::drawing::XShape > &rShape) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SfxBroadcaster * GetDrawBroadcaster()
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsAllMarked(const ScRange &rRange) const
void AddAccessibilityObject(SfxListener &rObject)
void RemoveAccessibilityObject(SfxListener &rObject)
css::uno::Reference< css::drawing::XShapes > getSelectedXShapes()
ScViewData & GetViewData()
void SelectAll(bool bContinue=false)
void ActivatePart(ScSplitPos eWhich)
vcl::Window * GetWindowByPos(ScSplitPos ePos) const
ScMarkData & GetMarkData()
ScDocument & GetDocument() const
ScSplitPos GetEditActivePart() const
Point GetPixPos(ScSplitPos eWhich) const
ScSplitPos GetActivePart() const
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
ScAddress GetCurPos() const
bool HasEditView(ScSplitPos eWhich) const
ScDrawView * GetScDrawView()
SdrHintKind GetKind() const
const SdrObject * GetObject() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
SdrObjList * getParentSdrObjListFromSdrObject() const
SdrPage * getSdrPageFromSdrObject() const
SdrObject * getParentSdrObjectFromSdrObject() const
css::uno::Reference< css::frame::XController > GetController() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
const OUString & GetName() const
SfxMedium * GetMedium() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
SfxFrame & GetFrame() const
SfxViewFrame * GetViewFrame() const
const css::uno::Reference< css::beans::XPropertySet > & GetControlModel() const
virtual bool ResetState(sal_Int64 aState) override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
const css::uno::Reference< css::drawing::XShape > & GetXShape() const
virtual bool SetState(sal_Int64 aState) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
rtl::Reference< AccessibleShape > CreateAccessibleObject(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo) const
ShapeTypeId GetTypeId(const OUString &aServiceName) const
static ShapeTypeHandler & Instance()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
sal_uInt16 GetAccessibleRole() const
Point LogicToPixel(const Point &rLogicPt) const
sal_uInt16 GetChildCount() const
vcl::Window * GetAccessibleParentWindow() const
tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Point PixelToLogic(const Point &rDevicePt) const
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
vcl::Window * GetChild(sal_uInt16 nChild) const
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
inline ::tools::Rectangle VCLRectangle(const css::awt::Rectangle &rAWTRect)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
#define LINK(Instance, Class, Member)
std::unique_ptr< sal_Int32[]> pData
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
Reference< XComponentContext > getProcessComponentContext()
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
#define SFX_TITLE_APINAME
OUString ScResId(TranslateId aId)
constexpr OUStringLiteral STR_ACC_DOC_DESCR
UNDERLYING_TYPE get() const