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)
310 throw uno::RuntimeException();
368 if (rHint.
GetId() != SfxHintId::ThisIsAnSdrHint)
379 case SdrHintKind::ObjectChange :
381 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
391 case SdrHintKind::ObjectInserted :
393 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
398 case SdrHintKind::ObjectRemoved :
400 uno::Reference<drawing::XShape> xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
414 const css::uno::Reference< css::drawing::XShape >& _rxShape,
415 const tools::Long , const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo)
424 if (pReplacement.is())
426 OSL_ENSURE(pCurrentChild->
GetXShape().get() == pReplacement->GetXShape().get(),
"XShape changes and should be inserted sorted");
428 if (it !=
maShapesMap.end() && it->second->pAccShape.is())
430 OSL_ENSURE(it->second->pAccShape == pCurrentChild,
"wrong child found");
431 AccessibleEventObject
aEvent;
432 aEvent.EventId = AccessibleEventId::CHILD;
434 aEvent.OldValue <<= uno::Reference<XAccessible>(pCurrentChild);
439 pCurrentChild->dispose();
444 pReplacement->Init();
448 it->second->pAccShape = pReplacement;
449 AccessibleEventObject
aEvent;
450 aEvent.EventId = AccessibleEventId::CHILD;
452 aEvent.NewValue <<= uno::Reference<XAccessible>(pReplacement);
481css::uno::Reference < css::accessibility::XAccessible >
488 ScAccessibleShapeData* pShape = it->second;
489 css::uno::Reference< css::accessibility::XAccessible > xNewChild( pShape->pAccShape );
502 for (
size_t i = 0;
i < nSdrObjCount; ++
i)
507 uno::Reference< drawing::XShape > xShape (pObj->
getUnoShape(), uno::UNO_QUERY);
520 if (!
pData->pAccShape.is())
526 if (
pData->pAccShape.is())
528 pData->pAccShape->Init();
529 if (
pData->bSelected)
530 pData->pAccShape->SetState(AccessibleStateType::SELECTED);
531 if (!
pData->bSelectable)
532 pData->pAccShape->ResetState(AccessibleStateType::SELECTABLE);
536 return pData->pAccShape;
558 uno::Reference<XAccessible> xAccessible;
569 while (!bFound &&
i >= 0)
574 if (!pShape->pAccShape.is())
577 if (pShape->pAccShape.is())
581 if (pShape->pAccShape->containsPoint(
AWTPoint(aPoint)))
583 xAccessible = pShape->pAccShape.get();
589 OSL_FAIL(
"I should have an accessible shape now!");
602 uno::Reference<drawing::XShape>& rShape)
const
604 bool bResult (
false);
609 throw uno::RuntimeException();
623#if OSL_DEBUG_LEVEL > 0
624 uno::Reference< drawing::XShape > xReturnShape;
625 bool bDebugResult(
false);
630 sal_Int32
nCount(xShapes->getCount());
633 uno::Reference< drawing::XShape > xShape;
636 while (!bDebugResult && (
i <
nCount))
638 xShapes->getByIndex(
i) >>= xShape;
639 if (xShape.is() && (xIndexShape.get() == xShape.get()))
642 xReturnShape = xShape;
649 OSL_ENSURE((bResult == bDebugResult) && ((bResult && (rShape.get() == xReturnShape.get())) || !bResult),
"found the wrong shape or result");
659 throw uno::RuntimeException();
674 throw uno::RuntimeException();
685 uno::Reference<drawing::XShape> xShape;
692 xShapes = drawing::ShapeCollection::create(
704 catch (lang::IllegalArgumentException&)
712 throw uno::RuntimeException();
714 bool bSomethingSelected(
true);
719 catch (lang::IllegalArgumentException&)
721 OSL_FAIL(
"nothing selected before");
722 bSomethingSelected =
false;
725 if (bSomethingSelected)
729 pAccShapeData->bSelected =
false;
730 if (pAccShapeData->pAccShape.is())
731 pAccShapeData->pAccShape->ResetState(AccessibleStateType::SELECTED);
739 throw uno::RuntimeException();
747 uno::Reference<drawing::XShapes> xShapes = drawing::ShapeCollection::create(
754 if (pAccShapeData && pAccShapeData->bSelectable)
756 pAccShapeData->bSelected =
true;
757 if (pAccShapeData->pAccShape.is())
758 pAccShapeData->pAccShape->SetState(AccessibleStateType::SELECTED);
760 xShapes->add(pAccShapeData->xShape);
765 catch (lang::IllegalArgumentException&)
776 sal_uInt32
nCount(xShapes->getCount());
779 uno::Reference<drawing::XShape> xShape;
780 xShapes->getByIndex(
i) >>= xShape;
782 rShapes.push_back(xShape);
790 throw uno::RuntimeException();
792 std::vector < uno::Reference < drawing::XShape > > aShapes;
795 return aShapes.size();
800 uno::Reference< XAccessible > xAccessible;
807 std::vector < uno::Reference < drawing::XShape > > aShapes;
813 SortedShapes::iterator aItr;
814 if (
FindShape(aShapes[nSelectedChildIndex], aItr))
815 xAccessible =
Get(*aItr);
826 if (!rpShape || rpShape->bSelected)
828 if (nSelectedChildIndex == 0)
831 xAccessible = rpShape->pAccShape.get();
835 --nSelectedChildIndex;
845 uno::Reference<drawing::XShape> xShape;
854 xShapes->remove(xShape);
860 catch (lang::IllegalArgumentException&)
862 OSL_FAIL(
"something not selectable");
867 maZOrderedShapes[nChildIndex]->pAccShape->ResetState(AccessibleStateType::SELECTED);
879 if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
880 pDrawPage = pDrawLayer->GetPage(
static_cast<sal_uInt16
>(
static_cast<sal_Int16
>(nTab)));
892 ((!pAccShapeData->xRelationCell && !pAddress) ||
893 (pAccShapeData->xRelationCell && pAddress && (*(pAccShapeData->xRelationCell) == *pAddress))))
898 AccessibleRelation aRelation;
899 aRelation.TargetSet = {
Get(pAccShapeData) };
900 aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
902 pRelationSet->AddRelation(aRelation);
917 uno::Reference< drawing::XShape > xShape;
918 xShapes->getByIndex(
i) >>= xShape;
921 ScAccessibleShapeData* pShapeData =
new ScAccessibleShapeData(xShape);
922 aShapesList.push_back(pShapeData);
933 std::sort(aShapesList.begin(), aShapesList.end(), ScShapeDataLess());
936 bool bHasSelect=
false;
937 SortedShapes::iterator aXShapesItr(aShapesList.begin());
938 SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
941 SortedShapes::const_iterator aFocusedItr = aDataEndItr;
942 while(aDataItr != aDataEndItr)
947 if (aXShapesItr == aXShapesEndItr)
950 nComp =
Compare(*aDataItr, *aXShapesItr);
953 if (!(*aDataItr)->bSelected)
955 (*aDataItr)->bSelected =
true;
956 if ((*aDataItr)->pAccShape.is())
958 (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
959 (*aDataItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
961 vecSelectedShapeAdd.push_back(*aDataItr);
963 aFocusedItr = aDataItr;
974 if ((*aDataItr)->bSelected)
976 (*aDataItr)->bSelected =
false;
977 if ((*aDataItr)->pAccShape.is())
979 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
980 (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
982 vecSelectedShapeRemove.push_back(*aDataItr);
989 OSL_FAIL(
"here is a selected shape which is not in the childlist");
997 bool bWinFocus=
false;
1008 bool bIsFocuseMarked =
true;
1018 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1019 if( aFocusedItr != aDataEndItr &&
1020 (*aFocusedItr)->xShape.is() &&
1021 xMarkedXShape.is() &&
1022 (*aFocusedItr)->xShape != xMarkedXShape )
1023 bIsFocuseMarked =
false;
1028 if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape.is() && (
mnShapesSelected == 1) && bWinFocus)
1030 (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
1036 uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->
getUnoShape(), uno::UNO_QUERY);
1039 if( pMarkedObj == pFocusedObj && pUpObj )
1041 uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->
getUnoShape(), uno::UNO_QUERY);
1042 uno::Reference < XAccessible > xAccGroupShape =
1044 if( xAccGroupShape.is() )
1048 if( pAccGroupShape )
1057 uno::Reference< drawing::XShape > xChildShape = pChildAccShape->
GetXShape();
1058 if (xChildShape == xMarkedXShape)
1060 pChildAccShape->
SetState(AccessibleStateType::FOCUSED);
1064 pChildAccShape->
ResetState(AccessibleStateType::FOCUSED);
1073 if (vecSelectedShapeAdd.size() >= 10 )
1075 AccessibleEventObject
aEvent;
1076 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1082 for (
const auto& rpShape : vecSelectedShapeAdd)
1084 AccessibleEventObject
aEvent;
1087 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1091 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1094 uno::Reference< XAccessible > xChild( rpShape->pAccShape );
1095 aEvent.NewValue <<= xChild;
1099 for (
const auto& rpShape : vecSelectedShapeRemove)
1101 AccessibleEventObject
aEvent;
1102 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1104 uno::Reference< XAccessible > xChild( rpShape->pAccShape );
1105 aEvent.NewValue <<= xChild;
1108 for(ScAccessibleShapeData*& pShapeData : aShapesList)
1111 pShapeData =
nullptr;
1121 uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
1122 if (pSdrObj && xShapeProp.is())
1125 return std::optional<ScAddress>(pAnchor->maStart);
1129 return std::optional<ScAddress>();
1139 if (
pData->xRelationCell && xAccessible.is())
1141 sal_Int32 nRow =
pData->xRelationCell->Row();
1142 sal_Int32 nColumn =
pData->xRelationCell->Col();
1143 bool bPositionUnset = nRow == -1 && nColumn == -1;
1144 if (!bPositionUnset)
1146 uno::Reference<XAccessibleTable> xAccTable(xAccessible->getAccessibleContext(), uno::UNO_QUERY);
1148 xAccessible = xAccTable->getAccessibleCellAt(nRow, nColumn);
1151 AccessibleRelation aRelation;
1152 aRelation.TargetSet = { xAccessible };
1153 aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
1154 pRelationSet->AddRelation(aRelation);
1157 return pRelationSet;
1164 std::optional<ScAddress> xAddress =
GetAnchor(xShape);
1165 if ((xAddress &&
pData->xRelationCell && (*xAddress != *(
pData->xRelationCell))) ||
1166 (!xAddress &&
pData->xRelationCell) || (xAddress && !
pData->xRelationCell))
1168 pData->xRelationCell = xAddress;
1169 if (
pData->pAccShape.is())
1179 ScAccessibleShapeData* pShape =
new ScAccessibleShapeData(xShape);
1185 uno::Reference< beans::XPropertySet > xShapeProp(xShape, uno::UNO_QUERY);
1186 if (xShapeProp.is())
1188 uno::Any aPropAny = xShapeProp->getPropertyValue(
"LayerID");
1189 sal_Int16 nLayerID = 0;
1190 if( aPropAny >>= nLayerID )
1193 pShape->bSelectable =
false;
1195 pShape->bSelectable =
true;
1200 throw uno::RuntimeException();
1203 uno::Reference<container::XEnumerationAccess> xEnumAcc(xShapes, uno::UNO_QUERY);
1206 uno::Reference<container::XEnumeration> xEnum = xEnumAcc->createEnumeration();
1209 uno::Reference<drawing::XShape> xSelectedShape;
1211 while (!bFound && xEnum->hasMoreElements())
1213 xEnum->nextElement() >>= xSelectedShape;
1214 if (xShape.is() && (xShape.get() == xSelectedShape.get()))
1216 pShape->bSelected =
true;
1224 AccessibleEventObject
aEvent;
1225 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;
1269 OSL_FAIL(
"shape was not in internal list");
1280 bool bResult(
false);
1281 ScAccessibleShapeData aShape(xShape);
1283 if ((rItr !=
maZOrderedShapes.end()) && (*rItr !=
nullptr) && ((*rItr)->xShape.get() == xShape.get()))
1286#if OSL_DEBUG_LEVEL > 0
1288 [&xShape](
const ScAccessibleShapeData* pShape) { return pShape && (pShape->xShape.get() == xShape.get()); });
1290 OSL_ENSURE((bResult == bResult2) && ((bResult && (rItr == aDebugItr)) || !bResult),
"wrong Shape found");
1296 const ScAccessibleShapeData* pData2)
1298 ScShapeDataLess aLess;
1300 bool bResult1(aLess(pData1, pData2));
1301 bool bResult2(aLess(pData2, pData1));
1304 if (!bResult1 && bResult2)
1306 else if (bResult1 && !bResult2)
1315 if (pAccShapeData && pAccShapeData->pAccShape.is())
1316 pAccShapeData->pAccShape->ViewForwarderChanged();
1320 const uno::Reference<XAccessible>& rxParent,
1324 mpViewShell(pViewShell),
1325 meSplitPos(eSplitPos),
1326 mbCompleteSheetSelected(false)
1403 OSL_ENSURE( rEvent.GetWindow(),
"Window???" );
1404 switch ( rEvent.GetId() )
1406 case VclEventId::WindowShow:
1409 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1415 case VclEventId::WindowHide:
1418 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
1432 if (pFocusLostHint->GetOldGridWin() ==
meSplitPos)
1444 if (pFocusGotHint->GetNewGridWin() ==
meSplitPos)
1446 uno::Reference<XAccessible> xAccessible;
1452 if( xAccessible.is() )
1455 aNewValue<<=AccessibleStateType::FOCUSED;
1475 if ((rHint.
GetId() == SfxHintId::ScAccTableChanged) &&
1484 AccessibleEventObject
aEvent;
1485 aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
1486 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1492 else if (rHint.
GetId() == SfxHintId::ScAccMakeDrawLayer)
1497 else if (rHint.
GetId() == SfxHintId::ScAccEnterEditMode)
1521 else if (rHint.
GetId() == SfxHintId::ScAccLeaveEditMode)
1545 else if ((rHint.
GetId() == SfxHintId::ScAccVisAreaChanged) || (rHint.
GetId() == SfxHintId::ScAccWindowResized))
1554 AccessibleEventObject
aEvent;
1555 aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
1556 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1580 bool bSelectionChanged(
false);
1588 bSelectionChanged =
true;
1593 bSelectionChanged =
true;
1595 if (bSelectionChanged)
1597 AccessibleEventObject
aEvent;
1598 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1599 aEvent.Source = uno::Reference< XAccessibleContext >(
this);
1610 return aAny.
hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
1616 ScAccessibleContextBase::acquire();
1622 ScAccessibleContextBase::release();
1628 const awt::Point& rPoint )
1630 uno::Reference<XAccessible> xAccessible;
1637 if(!xAccessible.is())
1641 uno::Reference< XAccessibleContext > xCont(
mxTempAcc->getAccessibleContext());
1642 uno::Reference< XAccessibleComponent > xComp(xCont, uno::UNO_QUERY);
1650 if (!xAccessible.is())
1665 if (xAccessibleComponent.is())
1667 xAccessibleComponent->grabFocus();
1697uno::Reference<XAccessible> SAL_CALL
1702 uno::Reference<XAccessible> xAccessible;
1711 if (!xAccessible.is())
1720 if (!xAccessible.is())
1721 throw lang::IndexOutOfBoundsException();
1731 sal_Int64 nParentStates = 0;
1734 uno::Reference<XAccessibleContext> xParentContext =
getAccessibleParent()->getAccessibleContext();
1735 nParentStates = xParentContext->getAccessibleStateSet();
1737 sal_Int64 nStateSet = 0;
1739 nStateSet |= AccessibleStateType::DEFUNC;
1742 nStateSet |= AccessibleStateType::EDITABLE;
1743 nStateSet |= AccessibleStateType::ENABLED;
1744 nStateSet |= AccessibleStateType::OPAQUE;
1746 nStateSet |= AccessibleStateType::SHOWING;
1748 nStateSet |= AccessibleStateType::VISIBLE;
1772 if (aFileName.isEmpty())
1775 if (!aFileName.isEmpty())
1779 aReadOnly =
ScResId(STR_ACC_DOC_SPREADSHEET_READONLY);
1781 aName = aFileName + aReadOnly +
" - " +
aName;
1800 if (nChildIndex < 0 || nChildIndex >=
nCount)
1801 throw lang::IndexOutOfBoundsException();
1803 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1804 if (xAccessible.is())
1808 if (bWasTableSelected)
1822 bool bResult(
false);
1829 if (nChildIndex < 0 || nChildIndex >=
nCount)
1830 throw lang::IndexOutOfBoundsException();
1832 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1833 if (xAccessible.is())
1835 uno::Reference<drawing::XShape> xShape;
1894uno::Reference<XAccessible > SAL_CALL
1899 uno::Reference<XAccessible> xAccessible;
1903 if (nSelectedChildIndex < 0 || nSelectedChildIndex >=
nCount)
1904 throw lang::IndexOutOfBoundsException();
1909 xAccessible =
mpChildrenShapes->GetSelected(nSelectedChildIndex, bTabMarked);
1912 else if (bTabMarked)
1916 OSL_ENSURE(xAccessible.is(),
"here should always be an accessible object or an exception thrown");
1933 if (nChildIndex < 0 || nChildIndex >=
nCount)
1934 throw lang::IndexOutOfBoundsException();
1938 uno::Reference < XAccessible > xAccessible =
mpChildrenShapes->Get(nChildIndex);
1939 if (xAccessible.is())
1945 else if (bTabMarked)
1954 return "ScAccessibleDocument";
1957uno::Sequence< OUString> SAL_CALL
1960 const css::uno::Sequence<OUString> vals {
"com.sun.star.AccessibleSpreadsheetDocumentView" };
1971uno::Sequence<sal_Int8> SAL_CALL
1974 return css::uno::Sequence<sal_Int8>();
2037 return pRelationSet;
2052 sal_Int32 nNumber(sal_Int32(
meSplitPos) + 1);
2053 sName += OUString::number(nNumber);
2083 SCTAB nVisibleTable(0);
2086 return nVisibleTable;
2089uno::Reference < XAccessible >
2112 bool bResult (
false);
2128 (nParentStates & AccessibleStateType::DEFUNC);
2133 OSL_ENSURE(!
mxTempAcc.is(),
"this object should be removed before");
2139 AccessibleEventObject
aEvent;
2140 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2141 aEvent.EventId = AccessibleEventId::CHILD;
2151 OSL_ENSURE(
mxTempAcc.is(),
"this object should be added before");
2155 OSL_ENSURE(xAcc.get() ==
mxTempAcc.get(),
"only the same object should be removed");
2158 AccessibleEventObject
aEvent;
2159 aEvent.Source = uno::Reference<XAccessibleContext>(
this);
2160 aEvent.EventId = AccessibleEventId::CHILD;
2201 sal_uInt16 sheetIndex;
2202 OUString sSheetName;
2205 return anyAttribute;
2207 OUString sValue =
"page-name:" + sSheetName +
2208 ";page-number:" + OUString::number(sheetIndex+1) +
2209 ";total-pages:" + OUString::number(
GetDocument()->GetTableCount()) +
";";
2210 anyAttribute <<= sValue;
2211 return anyAttribute;
2223 return sal_Int32(
SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
IMPL_LINK(ScAccessibleDocument, WindowChildEventListener, VclWindowEvent &, rEvent, void)
bool IsUpdateLayout() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
void IsObjectValid() const
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::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.
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
tools::Rectangle GetWindowExtentsAbsolute() const
sal_uInt16 GetAccessibleRole() const
Point LogicToPixel(const Point &rLogicPt) const
sal_uInt16 GetChildCount() const
vcl::Window * GetAccessibleParentWindow() 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)
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
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