24 #include <document.hxx>
27 #include <drawview.hxx>
32 #include <strings.hrc>
33 #include <strings.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>
67 #include <editeng/editeng.hxx>
90 struct ScAccessibleShapeData
92 ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_);
93 ~ScAccessibleShapeData();
95 mutable std::optional<ScAddress> xRelationCell;
96 css::uno::Reference< css::drawing::XShape > xShape;
97 mutable bool bSelected;
100 std::optional<sal_Int16> mxLayerID;
101 std::optional<sal_Int32> mxZOrder;
106 ScAccessibleShapeData::ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_)
108 bSelected(false), bSelectable(true)
110 static constexpr OUStringLiteral gsLayerId =
u"LayerID";
111 static constexpr OUStringLiteral gsZOrder =
u"ZOrder";
112 uno::Reference< beans::XPropertySet> xProps(xShape, uno::UNO_QUERY);
115 uno::Any aAny = xProps->getPropertyValue(gsLayerId);
117 if (aAny >>= nLayerID)
118 mxLayerID = nLayerID;
120 aAny = xProps->getPropertyValue(gsZOrder);
121 if (aAny >>= nZOrder)
126 ScAccessibleShapeData::~ScAccessibleShapeData()
130 pAccShape->dispose();
136 struct ScShapeDataLess
138 static void ConvertLayerId(sal_Int16& rLayerID)
158 static bool LessThanSheet(
const ScAccessibleShapeData* pData)
161 if (pData->mxLayerID)
168 bool operator()(
const ScAccessibleShapeData* pData1,
const ScAccessibleShapeData* pData2)
const
171 if (pData1 && pData2)
173 if( pData1->mxLayerID && pData2->mxLayerID )
175 sal_Int16 nLayerID1 = *pData1->mxLayerID;
176 sal_Int16 nLayerID2 = *pData2->mxLayerID;
177 if (nLayerID1 == nLayerID2)
179 if ( pData1->mxZOrder && pData2->mxZOrder )
180 bResult = (*pData1->mxZOrder < *pData2->mxZOrder);
184 ConvertLayerId(nLayerID1);
185 ConvertLayerId(nLayerID2);
186 bResult = (nLayerID1 < nLayerID2);
190 else if (pData1 && !pData2)
191 bResult = LessThanSheet(pData1);
192 else if (!pData1 && pData2)
193 bResult = !LessThanSheet(pData2);
217 const css::uno::Reference< css::drawing::XShape >& _rxShape,
219 const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
223 (css::beans::XPropertySet* pSet)
override;
224 virtual css::uno::Reference< css::accessibility::XAccessible>
230 uno::Reference< XAccessible >
Get(
const ScAccessibleShapeData* pData)
const;
231 uno::Reference< XAccessible >
Get(sal_Int32
nIndex)
const;
232 uno::Reference< XAccessible >
GetAt(
const awt::Point& rPoint)
const;
237 css::uno::Reference<css::drawing::XShape>& rShape)
const;
241 void Select(sal_Int32 nIndex);
245 uno::Reference< XAccessible >
GetSelected(sal_Int32 nSelectedChildIndex,
bool bTabSelected)
const;
246 void Deselect(sal_Int32 nChildIndex);
255 typedef std::unordered_map<css::uno::Reference< css::drawing::XShape >, ScAccessibleShapeData*>
ShapesMap;
269 void FillShapes(std::vector < uno::Reference < drawing::XShape > >& rShapes)
const;
272 std::optional<ScAddress>
GetAnchor(
const uno::Reference<drawing::XShape>& xShape)
const;
273 uno::Reference<XAccessibleRelationSet>
GetRelationSet(
const ScAccessibleShapeData* pData)
const;
274 void SetAnchor(
const uno::Reference<drawing::XShape>& xShape, ScAccessibleShapeData* pData)
const;
275 void AddShape(
const uno::Reference<drawing::XShape>& xShape,
bool bCommitChange)
const;
276 void RemoveShape(
const uno::Reference<drawing::XShape>& xShape)
const;
278 bool FindShape(
const uno::Reference<drawing::XShape>& xShape, SortedShapes::iterator& rItr)
const;
281 const ScAccessibleShapeData* pData2);
286 mbShapesNeedSorting(false),
288 mpViewShell(pViewShell),
289 mpAccessibleDocument(pAccessibleDocument),
290 meSplitPos(eSplitPos)
316 throw uno::RuntimeException();
374 if (rHint.
GetId() != SfxHintId::ThisIsAnSdrHint)
385 case SdrHintKind::ObjectChange :
387 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
397 case SdrHintKind::ObjectInserted :
399 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
404 case SdrHintKind::ObjectRemoved :
406 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
420 const css::uno::Reference< css::drawing::XShape >& _rxShape,
421 const tools::Long , const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo)
430 if (pReplacement.is())
432 OSL_ENSURE(pCurrentChild->
GetXShape().get() == pReplacement->GetXShape().get(),
"XShape changes and should be inserted sorted");
434 if (it !=
maShapesMap.end() && it->second->pAccShape.is())
436 OSL_ENSURE(it->second->pAccShape == pCurrentChild,
"wrong child found");
437 AccessibleEventObject
aEvent;
438 aEvent.EventId = AccessibleEventId::CHILD;
440 aEvent.OldValue <<= uno::Reference<XAccessible>(pCurrentChild);
444 pCurrentChild->dispose();
449 pReplacement->
Init();
453 it->second->pAccShape = pReplacement;
454 AccessibleEventObject
aEvent;
455 aEvent.EventId = AccessibleEventId::CHILD;
457 aEvent.NewValue <<= uno::Reference<XAccessible>(pReplacement.get());
485 css::uno::Reference < css::accessibility::XAccessible >
492 ScAccessibleShapeData* pShape = it->second;
493 css::uno::Reference< css::accessibility::XAccessible > xNewChild( pShape->pAccShape.get() );
511 uno::Reference< drawing::XShape > xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
524 if (!pData->pAccShape.is())
530 if (pData->pAccShape.is())
532 pData->pAccShape->Init();
533 if (pData->bSelected)
534 pData->pAccShape->SetState(AccessibleStateType::SELECTED);
535 if (!pData->bSelectable)
536 pData->pAccShape->ResetState(AccessibleStateType::SELECTABLE);
540 return pData->pAccShape.get();
562 uno::Reference<XAccessible> xAccessible;
573 while (!bFound &&
i >= 0)
578 if (!pShape->pAccShape.is())
581 if (pShape->pAccShape.is())
585 if (pShape->pAccShape->containsPoint(
AWTPoint(aPoint)))
587 xAccessible = pShape->pAccShape.get();
593 OSL_FAIL(
"I should have an accessible shape now!");
606 uno::Reference<drawing::XShape>& rShape)
const
608 bool bResult (
false);
613 throw uno::RuntimeException();
627 #if OSL_DEBUG_LEVEL > 0 // test whether it is truly selected by a slower method
628 uno::Reference< drawing::XShape > xReturnShape;
629 bool bDebugResult(
false);
634 sal_Int32
nCount(xShapes->getCount());
637 uno::Reference< drawing::XShape > xShape;
638 uno::Reference< drawing::XShape > xIndexShape =
maZOrderedShapes[nIndex]->xShape;
640 while (!bDebugResult && (i <
nCount))
642 xShapes->getByIndex(i) >>= xShape;
643 if (xShape.is() && (xIndexShape.get() == xShape.get()))
646 xReturnShape = xShape;
653 OSL_ENSURE((bResult == bDebugResult) && ((bResult && (rShape.get() == xReturnShape.get())) || !bResult),
"found the wrong shape or result");
663 throw uno::RuntimeException();
678 throw uno::RuntimeException();
689 uno::Reference<drawing::XShape> xShape;
696 xShapes = drawing::ShapeCollection::create(
706 maZOrderedShapes[nIndex]->pAccShape->SetState(AccessibleStateType::SELECTED);
708 catch (lang::IllegalArgumentException&)
716 throw uno::RuntimeException();
718 bool bSomethingSelected(
true);
723 catch (lang::IllegalArgumentException&)
725 OSL_FAIL(
"nothing selected before");
726 bSomethingSelected =
false;
729 if (bSomethingSelected)
733 pAccShapeData->bSelected =
false;
734 if (pAccShapeData->pAccShape.is())
735 pAccShapeData->pAccShape->ResetState(AccessibleStateType::SELECTED);
743 throw uno::RuntimeException();
751 uno::Reference<drawing::XShapes> xShapes = drawing::ShapeCollection::create(
758 if (pAccShapeData && pAccShapeData->bSelectable)
760 pAccShapeData->bSelected =
true;
761 if (pAccShapeData->pAccShape.is())
762 pAccShapeData->pAccShape->SetState(AccessibleStateType::SELECTED);
764 xShapes->add(pAccShapeData->xShape);
769 catch (lang::IllegalArgumentException&)
780 sal_uInt32
nCount(xShapes->getCount());
783 uno::Reference<drawing::XShape> xShape;
784 xShapes->getByIndex(
i) >>= xShape;
786 rShapes.push_back(xShape);
794 throw uno::RuntimeException();
796 std::vector < uno::Reference < drawing::XShape > > aShapes;
799 return aShapes.size();
804 uno::Reference< XAccessible > xAccessible;
811 std::vector < uno::Reference < drawing::XShape > > aShapes;
817 SortedShapes::iterator aItr;
818 if (
FindShape(aShapes[nSelectedChildIndex], aItr))
819 xAccessible =
Get(*aItr);
830 if (!rpShape || rpShape->bSelected)
832 if (nSelectedChildIndex == 0)
835 xAccessible = rpShape->pAccShape.get();
839 --nSelectedChildIndex;
849 uno::Reference<drawing::XShape> xShape;
858 xShapes->remove(xShape);
864 catch (lang::IllegalArgumentException&)
866 OSL_FAIL(
"something not selectable");
871 maZOrderedShapes[nChildIndex]->pAccShape->ResetState(AccessibleStateType::SELECTED);
883 if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
884 pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
896 ((!pAccShapeData->xRelationCell && !pAddress) ||
897 (pAccShapeData->xRelationCell && pAddress && (*(pAccShapeData->xRelationCell) == *pAddress))))
902 AccessibleRelation aRelation;
903 aRelation.TargetSet.realloc(1);
904 aRelation.TargetSet[0] =
Get(pAccShapeData);
905 aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
922 uno::Reference< drawing::XShape > xShape;
923 xShapes->getByIndex(
i) >>= xShape;
926 ScAccessibleShapeData* pShapeData =
new ScAccessibleShapeData(xShape);
927 aShapesList.push_back(pShapeData);
938 std::sort(aShapesList.begin(), aShapesList.end(), ScShapeDataLess());
941 bool bHasSelect=
false;
942 SortedShapes::iterator aXShapesItr(aShapesList.begin());
943 SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
946 SortedShapes::const_iterator aFocusedItr = aDataEndItr;
947 while(aDataItr != aDataEndItr)
952 if (aXShapesItr == aXShapesEndItr)
955 nComp =
Compare(*aDataItr, *aXShapesItr);
958 if (!(*aDataItr)->bSelected)
960 (*aDataItr)->bSelected =
true;
961 if ((*aDataItr)->pAccShape.is())
963 (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
964 (*aDataItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
966 vecSelectedShapeAdd.push_back(*aDataItr);
968 aFocusedItr = aDataItr;
979 if ((*aDataItr)->bSelected)
981 (*aDataItr)->bSelected =
false;
982 if ((*aDataItr)->pAccShape.is())
984 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
985 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
987 vecSelectedShapeRemove.push_back(*aDataItr);
994 OSL_FAIL(
"here is a selected shape which is not in the childlist");
1002 bool bWinFocus=
false;
1013 bool bIsFocuseMarked =
true;
1023 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1024 if( aFocusedItr != aDataEndItr &&
1025 (*aFocusedItr)->xShape.is() &&
1026 xMarkedXShape.is() &&
1027 (*aFocusedItr)->xShape != xMarkedXShape )
1028 bIsFocuseMarked =
false;
1033 if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape.is() && (
mnShapesSelected == 1) && bWinFocus)
1035 (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
1041 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1044 if( pMarkedObj == pFocusedObj && pUpObj )
1046 uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY);
1047 uno::Reference < XAccessible > xAccGroupShape =
1049 if( xAccGroupShape.is() )
1053 if( pAccGroupShape )
1056 for( sal_Int32
i = 0;
i < nCount;
i++ )
1062 uno::Reference< drawing::XShape > xChildShape = pChildAccShape->
GetXShape();
1063 if (xChildShape == xMarkedXShape)
1065 pChildAccShape->
SetState(AccessibleStateType::FOCUSED);
1069 pChildAccShape->
ResetState(AccessibleStateType::FOCUSED);
1078 if (vecSelectedShapeAdd.size() >= 10 )
1080 AccessibleEventObject
aEvent;
1081 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1087 for (
const auto& rpShape : vecSelectedShapeAdd)
1089 AccessibleEventObject
aEvent;
1092 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1096 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1099 uno::Reference< XAccessible > xChild( rpShape->pAccShape.get());
1100 aEvent.NewValue <<= xChild;
1104 for (
const auto& rpShape : vecSelectedShapeRemove)
1106 AccessibleEventObject
aEvent;
1107 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1109 uno::Reference< XAccessible > xChild( rpShape->pAccShape.get());
1110 aEvent.NewValue <<= xChild;
1113 for(ScAccessibleShapeData*& pShapeData : aShapesList)
1116 pShapeData =
nullptr;
1125 SvxShape* pShapeImp = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
1126 uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
1127 if (pShapeImp && xShapeProp.is())
1132 return std::optional<ScAddress>(pAnchor->maStart);
1137 return std::optional<ScAddress>();
1147 if (pData->xRelationCell && xAccessible.is())
1149 sal_Int32 nRow = pData->xRelationCell->Row();
1150 sal_Int32 nColumn = pData->xRelationCell->Col();
1151 bool bPositionUnset = nRow == -1 && nColumn == -1;
1152 if (!bPositionUnset)
1154 uno::Reference<XAccessibleTable> xAccTable(xAccessible->getAccessibleContext(), uno::UNO_QUERY);
1156 xAccessible = xAccTable->getAccessibleCellAt(nRow, nColumn);
1159 AccessibleRelation aRelation;
1160 aRelation.TargetSet.realloc(1);
1161 aRelation.TargetSet[0] = xAccessible;
1162 aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
1166 return pRelationSet;
1173 std::optional<ScAddress> xAddress =
GetAnchor(xShape);
1174 if ((xAddress && pData->xRelationCell && (*xAddress != *(pData->xRelationCell))) ||
1175 (!xAddress && pData->xRelationCell) || (xAddress && !pData->xRelationCell))
1177 pData->xRelationCell = xAddress;
1178 if (pData->pAccShape.is())
1188 ScAccessibleShapeData* pShape =
new ScAccessibleShapeData(xShape);
1194 uno::Reference< beans::XPropertySet > xShapeProp(xShape, uno::UNO_QUERY);
1195 if (xShapeProp.is())
1197 uno::Any aPropAny = xShapeProp->getPropertyValue(
"LayerID");
1198 sal_Int16 nLayerID = 0;
1199 if( aPropAny >>= nLayerID )
1202 pShape->bSelectable =
false;
1204 pShape->bSelectable =
true;
1209 throw uno::RuntimeException();
1212 uno::Reference<container::XEnumerationAccess> xEnumAcc(xShapes, uno::UNO_QUERY);
1215 uno::Reference<container::XEnumeration> xEnum = xEnumAcc->createEnumeration();
1218 uno::Reference<drawing::XShape> xSelectedShape;
1220 while (!bFound && xEnum->hasMoreElements())
1222 xEnum->nextElement() >>= xSelectedShape;
1223 if (xShape.is() && (xShape.get() == xSelectedShape.get()))
1225 pShape->bSelected =
true;
1233 AccessibleEventObject
aEvent;
1234 aEvent.EventId = AccessibleEventId::CHILD;
1236 aEvent.NewValue <<=
Get(pShape);
1249 SortedShapes::iterator aItr;
1254 uno::Reference<XAccessible> xOldAccessible (
Get(*aItr));
1260 AccessibleEventObject
aEvent;
1261 aEvent.EventId = AccessibleEventId::CHILD;
1263 aEvent.OldValue <<= xOldAccessible;
1276 OSL_FAIL(
"shape was not in internal list");
1287 bool bResult(
false);
1288 ScAccessibleShapeData aShape(xShape);
1290 if ((rItr !=
maZOrderedShapes.end()) && (*rItr !=
nullptr) && ((*rItr)->xShape.get() == xShape.get()))
1293 #if OSL_DEBUG_LEVEL > 0 // test whether it finds truly the correct shape (perhaps it is not really sorted)
1295 [&xShape](
const ScAccessibleShapeData* pShape) {
return pShape && (pShape->xShape.get() == xShape.get()); });
1297 OSL_ENSURE((bResult == bResult2) && ((bResult && (rItr == aDebugItr)) || !bResult),
"wrong Shape found");
1303 const ScAccessibleShapeData* pData2)
1305 ScShapeDataLess aLess;
1307 bool bResult1(aLess(pData1, pData2));
1308 bool bResult2(aLess(pData2, pData1));
1311 if (!bResult1 && bResult2)
1313 else if (bResult1 && !bResult2)
1322 if (pAccShapeData && pAccShapeData->pAccShape.is())
1323 pAccShapeData->pAccShape->ViewForwarderChanged();
1327 const uno::Reference<XAccessible>& rxParent,
1331 mpViewShell(pViewShell),
1332 meSplitPos(eSplitPos),
1333 mpTempAccEdit(nullptr),
1334 mbCompleteSheetSelected(false)
1350 for( sal_uInt16
i=0;
i < nCount; ++
i )
1411 OSL_ENSURE( rEvent.GetWindow(),
"Window???" );
1412 switch ( rEvent.GetId() )
1414 case VclEventId::WindowShow:
1417 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1423 case VclEventId::WindowHide:
1426 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1438 if (
auto pFocusLostHint = dynamic_cast<const ScAccGridWinFocusLostHint*>(&rHint) )
1440 if (pFocusLostHint->GetOldGridWin() ==
meSplitPos)
1450 else if (
auto pFocusGotHint = dynamic_cast<const ScAccGridWinFocusGotHint*>(&rHint) )
1452 if (pFocusGotHint->GetNewGridWin() ==
meSplitPos)
1454 uno::Reference<XAccessible> xAccessible;
1460 if( xAccessible.is() )
1463 aNewValue<<=AccessibleStateType::FOCUSED;
1483 if ((rHint.
GetId() == SfxHintId::ScAccTableChanged) &&
1492 AccessibleEventObject
aEvent;
1493 aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
1494 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1500 else if (rHint.
GetId() == SfxHintId::ScAccMakeDrawLayer)
1505 else if (rHint.
GetId() == SfxHintId::ScAccEnterEditMode)
1529 else if (rHint.
GetId() == SfxHintId::ScAccLeaveEditMode)
1553 else if ((rHint.
GetId() == SfxHintId::ScAccVisAreaChanged) || (rHint.
GetId() == SfxHintId::ScAccWindowResized))
1562 AccessibleEventObject
aEvent;
1563 aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
1564 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1588 bool bSelectionChanged(
false);
1596 bSelectionChanged =
true;
1601 bSelectionChanged =
true;
1603 if (bSelectionChanged)
1605 AccessibleEventObject
aEvent;
1606 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1607 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1636 const awt::Point& rPoint )
1638 uno::Reference<XAccessible> xAccessible;
1645 if(!xAccessible.is())
1649 uno::Reference< XAccessibleContext > xCont(
mxTempAcc->getAccessibleContext());
1650 uno::Reference< XAccessibleComponent > xComp(xCont, uno::UNO_QUERY);
1658 if (!xAccessible.is())
1673 if (xAccessibleComponent.is())
1675 xAccessibleComponent->grabFocus();
1705 uno::Reference<XAccessible> SAL_CALL
1710 uno::Reference<XAccessible> xAccessible;
1719 if (!xAccessible.is())
1721 if (nIndex < nCount)
1723 else if (nIndex == nCount &&
mxTempAcc.is())
1728 if (!xAccessible.is())
1729 throw lang::IndexOutOfBoundsException();
1735 uno::Reference<XAccessibleStateSet> SAL_CALL
1739 uno::Reference<XAccessibleStateSet> xParentStates;
1742 uno::Reference<XAccessibleContext> xParentContext =
getAccessibleParent()->getAccessibleContext();
1743 xParentStates = xParentContext->getAccessibleStateSet();
1747 pStateSet->
AddState(AccessibleStateType::DEFUNC);
1750 pStateSet->
AddState(AccessibleStateType::EDITABLE);
1751 pStateSet->
AddState(AccessibleStateType::ENABLED);
1752 pStateSet->
AddState(AccessibleStateType::OPAQUE);
1754 pStateSet->
AddState(AccessibleStateType::SHOWING);
1756 pStateSet->
AddState(AccessibleStateType::VISIBLE);
1780 if (aFileName.isEmpty())
1783 if (!aFileName.isEmpty())
1787 aReadOnly =
ScResId(STR_ACC_DOC_SPREADSHEET_READONLY);
1789 aName = aFileName + aReadOnly +
" - " + aName;
1808 if (nChildIndex < 0 || nChildIndex >=
nCount)
1809 throw lang::IndexOutOfBoundsException();
1811 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1812 if (xAccessible.is())
1816 if (bWasTableSelected)
1830 bool bResult(
false);
1837 if (nChildIndex < 0 || nChildIndex >=
nCount)
1838 throw lang::IndexOutOfBoundsException();
1840 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1841 if (xAccessible.is())
1843 uno::Reference<drawing::XShape> xShape;
1902 uno::Reference<XAccessible > SAL_CALL
1907 uno::Reference<XAccessible> xAccessible;
1911 if (nSelectedChildIndex < 0 || nSelectedChildIndex >= nCount)
1912 throw lang::IndexOutOfBoundsException();
1917 xAccessible =
mpChildrenShapes->GetSelected(nSelectedChildIndex, bTabMarked);
1918 if (
mxTempAcc.is() && nSelectedChildIndex == nCount - 1)
1920 else if (bTabMarked)
1924 OSL_ENSURE(xAccessible.is(),
"here should always be an accessible object or an exception thrown");
1941 if (nChildIndex < 0 || nChildIndex >=
nCount)
1942 throw lang::IndexOutOfBoundsException();
1946 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1947 if (xAccessible.is())
1953 else if (bTabMarked)
1962 return "ScAccessibleDocument";
1965 uno::Sequence< OUString> SAL_CALL
1968 const css::uno::Sequence<OUString> vals {
"com.sun.star.AccessibleSpreadsheetDocumentView" };
1979 uno::Sequence<sal_Int8> SAL_CALL
1982 return css::uno::Sequence<sal_Int8>();
1994 aPoint.setX(-aPoint.getX());
1995 aPoint.setY(-aPoint.getY());
2045 return pRelationSet;
2060 sal_Int32 nNumber(sal_Int32(
meSplitPos) + 1);
2061 sName += OUString::number(nNumber);
2091 SCTAB nVisibleTable(0);
2094 return nVisibleTable;
2097 uno::Reference < XAccessible >
2120 bool bResult (
false);
2135 const uno::Reference<XAccessibleStateSet>& rxParentStates)
2138 (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
2143 OSL_ENSURE(!
mxTempAcc.is(),
"this object should be removed before");
2149 AccessibleEventObject
aEvent;
2150 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2151 aEvent.EventId = AccessibleEventId::CHILD;
2160 OSL_ENSURE(
mxTempAcc.is(),
"this object should be added before");
2164 OSL_ENSURE(xAcc.get() ==
mxTempAcc.get(),
"only the same object should be removed");
2167 AccessibleEventObject
aEvent;
2168 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2169 aEvent.EventId = AccessibleEventId::CHILD;
2183 sName = sName.replaceFirst(
"%1", sAddress);
2209 sal_uInt16 sheetIndex;
2210 OUString sSheetName;
2213 return anyAttribute;
2215 OUString sValue =
"page-name:" + sSheetName +
2216 ";page-number:" + OUString::number(sheetIndex+1) +
2217 ";total-pages:" + OUString::number(
GetDocument()->GetTableCount()) +
";";
2218 anyAttribute <<= sValue;
2219 return anyAttribute;
ScMarkData & GetMarkData()
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
uno::Reference< XAccessible > GetAt(const awt::Point &rPoint) const
void SelectAll(bool bContinue=false)
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
sal_Int32 GetCount() const
void RemoveShape(const uno::Reference< drawing::XShape > &xShape) const
virtual Point LogicToPixel(const Point &rPoint) const override
Transform the specified point from internal coordinates to an absolute screen position.
IMPL_LINK(ScAccessibleDocument, WindowChildEventListener, VclWindowEvent &, rEvent, void)
SdrHintKind GetKind() const
size_t GetMarkCount() const
virtual OUString createAccessibleDescription() override
Return this object's description.
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
===== XSelectionListener =============================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Return the specified child or NULL if index is invalid.
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
sal_Int32 GetSelectedCount() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
utl::AccessibleRelationSetHelper * GetRelationSet(const ScAddress *pAddress) const
ScAddress GetCurCellAddress() const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
vcl::Window * GetAccessibleParentWindow() const
void Select(sal_Int32 nIndex)
void AddAccessibilityObject(SfxListener &rObject)
const OUString & GetName() const
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
const css::uno::Reference< css::drawing::XShape > & GetXShape() const
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
virtual void SAL_CALL acquire() override
ScTabViewShell * mpViewShell
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual void SAL_CALL grabFocus() override
bool HasEditView(ScSplitPos eWhich) const
bool FindShape(const uno::Reference< drawing::XShape > &xShape, SortedShapes::iterator &rItr) const
constexpr SdrLayerID SC_LAYER_BACK(1)
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
ScSplitPos GetActivePart() const
static OUString GetCurrentCellDescription()
SCTAB getVisibleTable() const
SdrMark * GetMark(size_t nNum) const
ScDocument & GetDocument() const
virtual tools::Rectangle GetBoundingBox() const override
Return the object's current bounding box relative to the parent object.
rtl::Reference< AccessibleShape > CreateAccessibleObject(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo) const
std::unordered_map< css::uno::Reference< css::drawing::XShape >, ScAccessibleShapeData * > ShapesMap
virtual void SAL_CALL release() override
virtual ~ScChildrenShapes() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
ScChildrenShapes(ScAccessibleDocument *pAccessibleDocument, ScTabViewShell *pViewShell, ScSplitPos eSplitPos)
virtual bool ReplaceChild(::accessibility::AccessibleShape *pCurrentChild, const css::uno::Reference< css::drawing::XShape > &_rxShape, const tools::Long _nIndex, const ::accessibility::AccessibleShapeTreeInfo &_rShapeTreeInfo) override
===== IAccessibleParent ===============================================
virtual OUString createAccessibleName() override
Return the object's current name.
css::uno::Reference< css::drawing::XShapes > getSelectedXShapes()
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
void VisAreaChanged() const
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ===================================================
virtual css::uno::Reference< css::uno::XInterface > getUnoShape()
SdrPage * getSdrPageFromSdrObject() const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Returns an implementation id.
SC_DLLPUBLIC SCROW MaxRow() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
virtual void SAL_CALL release() override
virtual OUString SAL_CALL getAccessibleName() override
Return the object's current name.
SfxFrame & GetFrame() const
uno::Reference< XAccessible > Get(const ScAccessibleShapeData *pData) const
ScAccessibleDocument * mpAccessibleDocument
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
void ActivatePart(ScSplitPos eWhich)
void AddRelation(const css::accessibility::AccessibleRelation &rRelation)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
ScDrawView * GetScDrawView()
ScViewData & GetViewData()
void Deselect(sal_Int32 nChildIndex)
virtual void SAL_CALL disposing() override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
===== XAccessibleContext ==============================================
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
Point GetPixPos(ScSplitPos eWhich) const
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
===== XAccessibleSelection ===========================================
SdrObject * GetMarkedSdrObj() const
ScAccessibleDocument(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ScTabViewShell *pViewShell, ScSplitPos eSplitPos)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SC_DLLPUBLIC SCCOL MaxCol() const
#define SFX_TITLE_APINAME
vcl::Window * GetWindowByPos(ScSplitPos ePos) const
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
===== XTypeProvider ===================================================
void IsObjectValid() const
inline::tools::Rectangle VCLRectangle(const css::awt::Rectangle &rAWTRect)
ScSplitPos GetEditActivePart() const
css::uno::Reference< css::accessibility::XAccessible > mxTempAcc
const SdrMarkList & GetMarkedObjectList() const
virtual ::accessibility::AccessibleControlShape * GetAccControlShapeFromModel(css::beans::XPropertySet *pSet) override
void AddShape(const uno::Reference< drawing::XShape > &xShape, bool bCommitChange) const
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::accessibility::XAccessible > GetAccessibleSpreadsheet()
const css::uno::Reference< css::beans::XPropertySet > & GetControlModel() const
void CommitFocusGained() const
Calls all FocusListener to tell they that the focus is gained.
static ShapeTypeHandler & Instance()
OUString ScResId(const char *pId)
void SetAnchor(const uno::Reference< drawing::XShape > &xShape, ScAccessibleShapeData *pData) const
ScTabViewShell * mpViewShell
This base class provides an implementation of the AccessibleTable service.
inline::Point VCLPoint(const css::awt::Point &rAWTPoint)
bool IsTableSelected() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
SdrPage * GetDrawPage() const
virtual void SAL_CALL acquire() override
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
ScAccessibleEditObject * mpTempAccEdit
mutable::accessibility::AccessibleShapeTreeInfo maShapeTreeInfo
bool IsSelected(sal_Int32 nIndex, css::uno::Reference< css::drawing::XShape > &rShape) const
virtual void SAL_CALL selectAllAccessibleChildren() override
ScAddress GetCurPos() const
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
void FillShapes(std::vector< uno::Reference< drawing::XShape > > &rShapes) const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
virtual tools::Rectangle GetBoundingBoxOnScreen() const override
Return the object's current bounding box relative to the desktop.
tools::Rectangle GetVisibleArea_Impl() const
===== IAccessibleViewForwarder ========================================
void FreeAccessibleSpreadsheet()
sal_uInt16 GetChildCount() const
void AddChild(const css::uno::Reference< css::accessibility::XAccessible > &xAcc, bool bFireEvent)
virtual void SAL_CALL disposing() override
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
virtual sal_Int32 SAL_CALL getForeground() override
bool mbCompleteSheetSelected
void RemoveAccessibilityObject(SfxListener &rObject)
virtual void SAL_CALL clearAccessibleSelection() override
SortedShapes maZOrderedShapes
bool GetUpdateMode() const
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return the set of current states.
constexpr SdrLayerID SC_LAYER_FRONT(0)
#define STR_ACC_DOC_DESCR
ShapeTypeId GetTypeId(const OUString &aServiceName) const
css::uno::Reference< css::frame::XController > GetController() const
sal_uInt32 mnShapesSelected
constexpr SdrLayerID SC_LAYER_INTERN(2)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
SdrObject * GetSdrObject() const
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
SfxBroadcaster * GetDrawBroadcaster()
void CommitFocusLost() const
Calls all FocusListener to tell they that the focus is lost.
Reference< XComponentContext > getProcessComponentContext()
rtl::Reference< ScAccessibleSpreadsheet > mpAccessibleSpreadsheet
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
std::unique_ptr< ScChildrenShapes > mpChildrenShapes
std::optional< ScAddress > GetAnchor(const uno::Reference< drawing::XShape > &xShape) const
tools::Rectangle maVisArea
std::vector< ScAccessibleShapeData * > SortedShapes
virtual void Init() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
OUString GetCurrentCellName() const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
===== XTypeProvider ===================================================
virtual bool ResetState(sal_Int16 aState) override
SdrObject * getParentSdrObjectFromSdrObject() const
virtual tools::Rectangle GetVisibleArea() const override
===== IAccessibleViewForwarder ========================================
void CommitChange(const css::accessibility::AccessibleEventObject &rEvent) const
Calls all Listener to tell they the change.
uno::Reference< XAccessible > GetSelected(sal_Int32 nSelectedChildIndex, bool bTabSelected) const
ScDocument * GetDocument() const
virtual bool SetState(sal_Int16 aState) override
bool FindSelectedShapesChanges(const css::uno::Reference< css::drawing::XShapes > &xShapes) const
SfxObjectShell * GetDocumentShell() const
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessibleCaption(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
static sal_Int8 Compare(const ScAccessibleShapeData *pData1, const ScAccessibleShapeData *pData2)
SdrObjList * getParentSdrObjListFromSdrObject() const
utl::AccessibleRelationSetHelper * GetRelationSet(const ScAddress *pAddress) const
======== internal =====================================================
sal_uInt16 GetAccessibleRole() const
void RemoveChild(const css::uno::Reference< css::accessibility::XAccessible > &xAcc, bool bFireEvent)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
virtual ~ScAccessibleDocument() override
void AddState(sal_Int16 aState)
css::uno::Reference< css::view::XSelectionSupplier > xSelectionSupplier
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
void SetDrawBroadcaster()
===== Internal ========================================================
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
===== XAccessible =====================================================
vcl::Window * GetChild(sal_uInt16 nChild) const
const SdrObject * GetObject() const
SfxMedium * GetMedium() const
This base class provides an implementation of the AccessibleCell service.