summaryrefslogtreecommitdiff
path: root/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx')
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx254
1 files changed, 92 insertions, 162 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 0bad15e85566..b3198242eaf1 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -329,35 +329,26 @@ void ScAccessibleSpreadsheet::CompleteSelectionChanged(bool bNewState)
}
mpMarkedRanges.reset();
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+ uno::Any aOldValue;
+ uno::Any aNewValue;
if (bNewState)
- aEvent.NewValue <<= AccessibleStateType::SELECTED;
+ aNewValue <<= AccessibleStateType::SELECTED;
else
- aEvent.OldValue <<= AccessibleStateType::SELECTED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
- CommitChange(aEvent);
+ aOldValue <<= AccessibleStateType::SELECTED;
+ CommitChange(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
}
void ScAccessibleSpreadsheet::LostFocus()
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
- aEvent.OldValue <<= uno::Reference<XAccessible>(mpAccCell);
-
- CommitChange(aEvent);
-
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ uno::Any(uno::Reference<XAccessible>(mpAccCell)), uno::Any());
CommitFocusLost();
}
void ScAccessibleSpreadsheet::GotFocus()
{
CommitFocusGained();
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
+
uno::Reference< XAccessible > xNew;
if (IsFormulaMode())
{
@@ -384,27 +375,18 @@ void ScAccessibleSpreadsheet::GotFocus()
return ;
}
}
- aEvent.NewValue <<= xNew;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(), uno::Any(xNew));
}
void ScAccessibleSpreadsheet::BoundingBoxChanged()
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::BOUNDRECT_CHANGED, uno::Any(), uno::Any());
}
void ScAccessibleSpreadsheet::VisAreaChanged()
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any());
}
//===== SfxListener =====================================================
@@ -477,13 +459,8 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
}
CommitTableModelChange(nFirstRow, nFirstCol, nLastRow, nLastCol, nId);
-
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
- aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell);
-
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(mpAccCell)));
}
}
}
@@ -511,18 +488,16 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
}
m_bFormulaLastMode = m_bFormulaMode;
- AccessibleEventObject aEvent;
- aEvent.Source = uno::Reference< XAccessible >(this);
ScAddress aNewCell = rViewData.GetCurPos();
if(aNewCell.Tab() != maActiveCell.Tab())
{
- aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
auto pAccParent = getAccessibleParent();
ScAccessibleDocument *pAccDoc =
static_cast<ScAccessibleDocument*>(pAccParent.get());
if(pAccDoc)
{
- pAccDoc->CommitChange(aEvent);
+ pAccDoc->CommitChange(AccessibleEventId::PAGE_CHANGED, uno::Any(),
+ uno::Any());
}
}
bool bNewPosCell = (aNewCell != maActiveCell) || mpViewShell->GetForceFocusOnCurCell(); // #i123629#
@@ -540,16 +515,14 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
// sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col());
sal_uInt16 nTab = rViewData.GetTabNo();
const ScRange& aMarkRange = refScMarkData.GetMarkArea();
- aEvent.OldValue.clear();
ScDocument* pDoc= GetDocument(mpViewShell);
//Mark All
if ( !bNewPosCellFocus &&
(bNewMarked || bIsMark || bIsMultMark ) &&
aMarkRange == ScRange( 0,0,nTab, pDoc->MaxCol(),pDoc->MaxRow(),nTab ) )
{
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- aEvent.NewValue.clear();
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN, uno::Any(),
+ uno::Any());
return ;
}
if (!mpMarkedRanges)
@@ -578,11 +551,8 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
!aMarkRange.Contains(m_aLastWithInMarkRange) &&
aMarkRange.Intersects(m_aLastWithInMarkRange);
if( !bSelSmaller )
- {
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- aEvent.NewValue.clear();
- CommitChange(aEvent);
- }
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN, uno::Any(),
+ uno::Any());
m_aLastWithInMarkRange = aMarkRange;
}
return ;
@@ -597,25 +567,22 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
{
CommitFocusCell(aNewCell);
}
- uno::Reference< XAccessible > xChild ;
+ rtl::Reference< ScAccessibleCell > xChild ;
if (bNewPosCellFocus)
{
- xChild = mpAccCell.get();
+ xChild = mpAccCell;
}
else
{
mpAccCell = GetAccessibleCellAt(aNewCell.Row(),aNewCell.Col());
- xChild = mpAccCell.get();
+ xChild = mpAccCell;
maActiveCell = aNewCell;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
- aEvent.NewValue <<= xChild;
- aEvent.OldValue <<= uno::Reference< XAccessible >();
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS,
+ uno::Any(), uno::Any(uno::Reference<XAccessible>(xChild)));
}
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
- aEvent.NewValue <<= xChild;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(xChild)));
OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 );
m_mapSelectionSend.emplace(aNewCell,xChild);
@@ -637,24 +604,22 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
std::vector<ScMyAddress> vecNew;
if(CalcScRangeListDifferenceMax(mpMarkedRanges.get(), &m_LastMarkedRanges,10,vecNew))
{
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- aEvent.NewValue.clear();
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN, uno::Any(),
+ uno::Any());
}
else
{
for(const auto& rAddr : vecNew)
{
- uno::Reference< XAccessible > xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col());
+ rtl::Reference< ScAccessibleCell > xChild = GetAccessibleCellAt(rAddr.Row(),rAddr.Col());
if (!(bNewPosCellFocus && rAddr == aNewCell) )
{
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
- aEvent.NewValue <<= xChild;
- CommitChange(aEvent);
+ CommitChange(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS,
+ uno::Any(), uno::Any(uno::Reference<XAccessible>(xChild)));
}
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
- aEvent.NewValue <<= xChild;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(xChild)));
m_mapSelectionSend.emplace(rAddr,xChild);
}
}
@@ -685,18 +650,17 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
OUString valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab()));
if(mpAccCell.is() && m_strCurCellValue != valStr)
{
- AccessibleEventObject aTextChangedEvent;
- (void)comphelper::OCommonAccessibleText::implInitTextChangedEvent(m_strCurCellValue, valStr,
- aTextChangedEvent.OldValue,
- aTextChangedEvent.NewValue);
- aTextChangedEvent.EventId = AccessibleEventId::TEXT_CHANGED;
- mpAccCell->CommitChange(aTextChangedEvent);
+ uno::Any aOldValue;
+ uno::Any aNewValue;
+ (void)comphelper::OCommonAccessibleText::implInitTextChangedEvent(
+ m_strCurCellValue, valStr, aOldValue, aNewValue);
+ mpAccCell->CommitChange(AccessibleEventId::TEXT_CHANGED, aOldValue,
+ aNewValue);
if (pScDoc->HasValueData(maActiveCell))
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
- mpAccCell->CommitChange(aEvent);
+ mpAccCell->CommitChange(AccessibleEventId::VALUE_CHANGED,
+ uno::Any(), uno::Any());
}
m_strCurCellValue = valStr;
@@ -705,15 +669,12 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
pScDoc->GetName( maActiveCell.Tab(), tabName );
if( m_strOldTabName != tabName )
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::NAME_CHANGED;
OUString sOldName(ScResId(STR_ACC_TABLE_NAME));
sOldName = sOldName.replaceFirst("%1", m_strOldTabName);
- aEvent.OldValue <<= sOldName;
OUString sNewName(ScResId(STR_ACC_TABLE_NAME));
sNewName = sNewName.replaceFirst("%1", tabName);
- aEvent.NewValue <<= sNewName;
- CommitChange( aEvent );
+ CommitChange(AccessibleEventId::NAME_CHANGED, uno::Any(sOldName),
+ uno::Any(sNewName));
m_strOldTabName = tabName;
}
}
@@ -745,8 +706,6 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
void ScAccessibleSpreadsheet::RemoveSelection(const ScMarkData &refScMarkData)
{
- AccessibleEventObject aEvent;
- aEvent.Source = uno::Reference< XAccessible >(this);
MAP_ADDR_XACC::iterator miRemove = m_mapSelectionSend.begin();
while (miRemove != m_mapSelectionSend.end())
{
@@ -756,9 +715,8 @@ void ScAccessibleSpreadsheet::RemoveSelection(const ScMarkData &refScMarkData)
++miRemove;
continue;
}
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
- aEvent.NewValue <<= miRemove->second;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(miRemove->second)));
miRemove = m_mapSelectionSend.erase(miRemove);
}
}
@@ -786,37 +744,31 @@ void ScAccessibleSpreadsheet::CommitFocusCell(const ScAddress &aNewCell)
OUString valStr(pScDoc->GetString(aOldActiveCell.Col(),aOldActiveCell.Row(),aOldActiveCell.Tab()));
if(m_strCurCellValue != valStr)
{
- AccessibleEventObject aTextChangedEvent;
- (void)comphelper::OCommonAccessibleText::implInitTextChangedEvent(m_strCurCellValue, valStr,
- aTextChangedEvent.OldValue,
- aTextChangedEvent.NewValue);
- aTextChangedEvent.EventId = AccessibleEventId::TEXT_CHANGED;
- mpAccCell->CommitChange(aTextChangedEvent);
+ uno::Any aOldValue;
+ uno::Any aNewValue;
+ (void)comphelper::OCommonAccessibleText::implInitTextChangedEvent(
+ m_strCurCellValue, valStr, aOldValue, aNewValue);
+ mpAccCell->CommitChange(AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue);
if (pScDoc->HasValueData(maActiveCell))
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
- mpAccCell->CommitChange(aEvent);
+ mpAccCell->CommitChange(AccessibleEventId::VALUE_CHANGED, uno::Any(), uno::Any());
}
m_strCurCellValue = valStr;
}
}
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessible >(this);
- aEvent.OldValue <<= uno::Reference<XAccessible>(mpAccCell);
+ uno::Reference<XAccessible> xOldCell = mpAccCell;
mpAccCell.clear();
mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
- aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell);
maActiveCell = aNewCell;
if (pScDoc)
{
m_strCurCellValue = pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab());
}
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(xOldCell),
+ uno::Any(uno::Reference<XAccessible>(mpAccCell)));
}
//===== XAccessibleTable ================================================
@@ -824,7 +776,7 @@ void ScAccessibleSpreadsheet::CommitFocusCell(const ScAddress &aNewCell)
uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleRowHeaders( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
uno::Reference< XAccessibleTable > xAccessibleTable;
if( mpDoc && mbIsSpreadsheet )
{
@@ -843,7 +795,7 @@ uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessib
uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleColumnHeaders( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
uno::Reference< XAccessibleTable > xAccessibleTable;
if( mpDoc && mbIsSpreadsheet )
{
@@ -862,7 +814,7 @@ uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessib
uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessibleRows( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
uno::Sequence<sal_Int32> aSequence;
if (IsFormulaMode())
{
@@ -892,7 +844,7 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessibleColumns( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
uno::Sequence<sal_Int32> aSequence;
if (IsFormulaMode() || !mpViewShell)
return aSequence;
@@ -916,7 +868,7 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nRow )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (IsFormulaMode())
{
return false;
@@ -937,7 +889,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nR
sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32 nColumn )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (IsFormulaMode())
{
@@ -1003,7 +955,7 @@ rtl::Reference<ScAccessibleCell> ScAccessibleSpreadsheet::GetAccessibleCellAt(sa
uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (!IsFormulaMode())
{
if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) ||
@@ -1019,7 +971,7 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCel
sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (IsFormulaMode())
{
@@ -1047,7 +999,7 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleAtP
if (containsPoint(rPoint))
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (mpViewShell)
{
SCCOL nX;
@@ -1083,7 +1035,7 @@ sal_Int32 SAL_CALL ScAccessibleSpreadsheet::getForeground( )
sal_Int32 SAL_CALL ScAccessibleSpreadsheet::getBackground( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
return sal_Int32(ScModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor);
}
@@ -1138,7 +1090,7 @@ sal_Int64 SAL_CALL ScAccessibleSpreadsheet::getAccessibleStateSet()
void SAL_CALL ScAccessibleSpreadsheet::selectAccessibleChild( sal_Int64 nChildIndex )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
throw lang::IndexOutOfBoundsException();
@@ -1155,7 +1107,7 @@ void SAL_CALL
ScAccessibleSpreadsheet::clearAccessibleSelection( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (mpViewShell && !IsFormulaMode())
mpViewShell->Unmark();
}
@@ -1163,7 +1115,7 @@ void SAL_CALL
void SAL_CALL ScAccessibleSpreadsheet::selectAllAccessibleChildren( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (!mpViewShell)
return;
@@ -1184,7 +1136,7 @@ sal_Int64 SAL_CALL
ScAccessibleSpreadsheet::getSelectedAccessibleChildCount( )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
sal_Int64 nResult(0);
if (mpViewShell)
{
@@ -1211,7 +1163,7 @@ uno::Reference<XAccessible > SAL_CALL
ScAccessibleSpreadsheet::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
uno::Reference < XAccessible > xAccessible;
if (IsFormulaMode())
{
@@ -1247,7 +1199,7 @@ uno::Reference<XAccessible > SAL_CALL
void SAL_CALL ScAccessibleSpreadsheet::deselectAccessibleChild( sal_Int64 nChildIndex )
{
SolarMutexGuard aGuard;
- IsObjectValid();
+ ensureAlive();
if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
throw lang::IndexOutOfBoundsException();
@@ -1364,16 +1316,6 @@ uno::Sequence<sal_Int8> SAL_CALL
return css::uno::Sequence<sal_Int8>();
}
-///===== XAccessibleEventBroadcaster =====================================
-
-void SAL_CALL ScAccessibleSpreadsheet::addAccessibleEventListener(const uno::Reference<XAccessibleEventListener>& xListener)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- ScAccessibleTableBase::addAccessibleEventListener(xListener);
-
-}
-
//==== internal =========================================================
AbsoluteScreenPixelRectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const
@@ -1541,11 +1483,8 @@ void ScAccessibleSpreadsheet::FireFirstCellFocus()
return ;
}
mbIsFocusSend = true;
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessible >(this);
- aEvent.NewValue <<= getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(),
+ uno::Any(getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col())));
}
void ScAccessibleSpreadsheet::NotifyRefMode()
@@ -1571,19 +1510,16 @@ void ScAccessibleSpreadsheet::NotifyRefMode()
m_nMinY = std::min(nRefStartY,nRefEndY);
m_nMaxY = std::max(nRefStartY,nRefEndY);
RemoveFormulaSelection();
- AccessibleEventObject aEvent;
- aEvent.Source = uno::Reference< XAccessible >(this);
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.OldValue <<= uno::Reference<XAccessible>(m_pAccFormulaCell);
+ uno::Reference<XAccessible> xOldFormulaCell = m_pAccFormulaCell;
m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(), aFormulaAddr.Col());
- uno::Reference< XAccessible > xNew = m_pAccFormulaCell;
- aEvent.NewValue <<= xNew;
- CommitChange(aEvent);
+ rtl::Reference< ScAccessibleCell > xNew = m_pAccFormulaCell;
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(xOldFormulaCell),
+ uno::Any(uno::Reference<XAccessible>(xNew)));
+
if (nRefStartX == nRefEndX && nRefStartY == nRefEndY)
{//Selection Single
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
- aEvent.NewValue <<= xNew;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED, uno::Any(xOldFormulaCell),
+ uno::Any(uno::Reference<XAccessible>(xNew)));
m_mapFormulaSelectionSend.emplace(aFormulaAddr,xNew);
m_vecFormulaLastMyAddr.clear();
m_vecFormulaLastMyAddr.emplace_back(aFormulaAddr);
@@ -1609,29 +1545,26 @@ void ScAccessibleSpreadsheet::NotifyRefMode()
int nNewSize = vecNew.size();
if ( nNewSize > 10 )
{
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- aEvent.NewValue.clear();
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN, uno::Any(), uno::Any());
}
else
{
for(const auto& rAddr : vecNew)
{
- uno::Reference< XAccessible > xChild;
+ rtl::Reference< ScAccessibleCell > xChild;
if (rAddr == aFormulaAddr)
{
- xChild = m_pAccFormulaCell.get();
+ xChild = m_pAccFormulaCell;
}
else
{
- xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col());
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
- aEvent.NewValue <<= xChild;
- CommitChange(aEvent);
+ xChild = GetAccessibleCellAt(rAddr.Row(),rAddr.Col());
+ CommitChange(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS,
+ uno::Any(xOldFormulaCell),
+ uno::Any(uno::Reference<XAccessible>(xChild)));
}
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
- aEvent.NewValue <<= xChild;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(xChild)));
m_mapFormulaSelectionSend.emplace(rAddr,xChild);
}
}
@@ -1643,9 +1576,7 @@ void ScAccessibleSpreadsheet::NotifyRefMode()
void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool bRemoveAll )
{
- AccessibleEventObject aEvent;
- aEvent.Source = uno::Reference< XAccessible >(this);
- MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin();
+ auto miRemove = m_mapFormulaSelectionSend.begin();
while (miRemove != m_mapFormulaSelectionSend.end())
{
if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) )
@@ -1653,9 +1584,8 @@ void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool bRemoveAll )
++miRemove;
continue;
}
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
- aEvent.NewValue <<= miRemove->second;
- CommitChange(aEvent);
+ CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(),
+ uno::Any(uno::Reference<XAccessible>(miRemove->second)));
miRemove = m_mapFormulaSelectionSend.erase(miRemove);
}
}