diff options
author | Eike Rathke <erack@redhat.com> | 2016-09-22 22:20:48 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-09-23 15:14:03 +0000 |
commit | 7d8196ea2f4ec3634dbad7367345e62c4ea9893d (patch) | |
tree | 4550d4ccc4205ae5ca9f134d29927b202e10fb70 /sc/source/ui/Accessibility | |
parent | 751689283c9f3010f7978b6576b25ffc579202ef (diff) |
perf: eliminate SfxSimpleHint and move to SfxHint, tdf#87101 related
There were over 150 places in *::Notify() functions that did some
dynamic_cast<SfxSimpleHint*> of which ~98% were unnecessary because the
base class SfxHint passed was an SfxSimpleHint anyway. dynamic_cast
operations come with quite some cost, so avoid if possible. Specifically
for ScFormulaCell::Notify() that created a bottleneck in scenarios where
cells were notified that already handled a previous notification. In
mass operations doing the dynamic_cast before it could be decided
whether having to act on it or not this made 2/3 of all time spent in
the Notify() call.
To get rid of that rename/move SfxSimpleHint to SfxHint and let classes
derive from SfxHint instead of SfxSimpleHint. This comes only with a
slight cost that an additional sal_uInt32 is transported in such hints,
initialized to 0, but this is neglectable compared to the huge gain.
For the rare cases where a Notify() actually expects both, an SfxHint
(formerly SfxSimpleHint) and a derived hint, this changed order of the
dynamic_cast involved so the simple SfxHint::GetId() is handled last.
Modules using such combinations can further optimize by treating the
simple SfxHint::GetId() first once verified that none of the other
derived hints use an ID not equal to zero respectively none of the ID
values the simple hint uses.
Change-Id: I9fcf723e3a4487ceb92336189d23a62c344cf0ce
Reviewed-on: https://gerrit.libreoffice.org/29205
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/Accessibility')
10 files changed, 160 insertions, 191 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx index a044814ecae8..66ac3accfb18 100644 --- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx @@ -26,7 +26,7 @@ #include <tools/gen.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <toolkit/helper/convert.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> @@ -126,14 +126,10 @@ void SAL_CALL ScAccessibleContextBase::release() void ScAccessibleContextBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + if (rHint.GetId() == SFX_HINT_DYING) { - if (pSimpleHint->GetId() == SFX_HINT_DYING) - { - // it seems the Broadcaster is dying, since the view is dying - dispose(); - } + // it seems the Broadcaster is dying, since the view is dying + dispose(); } } diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 76a0997d3946..a21d4ffc9dd0 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -1552,11 +1552,10 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if (dynamic_cast<const SfxSimpleHint*>(&rHint)) + else { - const SfxSimpleHint* pSimpleHint = static_cast<const SfxSimpleHint*>(&rHint); // only notify if child exist, otherwise it is not necessary - if ((pSimpleHint->GetId() == SC_HINT_ACC_TABLECHANGED) && + if ((rHint.GetId() == SC_HINT_ACC_TABLECHANGED) && mpAccessibleSpreadsheet.is()) { FreeAccessibleSpreadsheet(); @@ -1580,12 +1579,12 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) if (mpAccessibleSpreadsheet.is()) mpAccessibleSpreadsheet->FireFirstCellFocus(); } - else if (pSimpleHint->GetId() == SC_HINT_ACC_MAKEDRAWLAYER) + else if (rHint.GetId() == SC_HINT_ACC_MAKEDRAWLAYER) { if (mpChildrenShapes) mpChildrenShapes->SetDrawBroadcaster(); } - else if ((pSimpleHint->GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event comes only on creating edit field of a cell + else if ((rHint.GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event comes only on creating edit field of a cell { if (mpViewShell->GetViewData().HasEditView(meSplitPos)) { @@ -1609,7 +1608,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if (pSimpleHint->GetId() == SC_HINT_ACC_LEAVEEDITMODE) + else if (rHint.GetId() == SC_HINT_ACC_LEAVEEDITMODE) { if (mxTempAcc.is()) { @@ -1624,7 +1623,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) CommitFocusGained(); } } - else if ((pSimpleHint->GetId() == SC_HINT_ACC_VISAREACHANGED) || (pSimpleHint->GetId() == SC_HINT_ACC_WINDOWRESIZED)) + else if ((rHint.GetId() == SC_HINT_ACC_VISAREACHANGED) || (rHint.GetId() == SC_HINT_ACC_WINDOWRESIZED)) { Rectangle aOldVisArea(maVisArea); maVisArea = GetVisibleArea_Impl(); diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index 6fdad87f41b0..05108da8ba07 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1230,11 +1230,18 @@ void SAL_CALL ScAccessibleDocumentPagePreview::disposing() void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + if ( dynamic_cast<const ScAccWinFocusLostHint*>(&rHint) ) + { + CommitFocusLost(); + } + else if ( dynamic_cast<const ScAccWinFocusGotHint*>(&rHint) ) + { + CommitFocusGained(); + } + else { // only notify if child exist, otherwise it is not necessary - if (pSimpleHint->GetId() == SC_HINT_DATACHANGED) + if (rHint.GetId() == SC_HINT_DATACHANGED) { if (mpTable.is()) // if there is no table there is nothing to notify, because no one recongnizes the change { @@ -1282,11 +1289,11 @@ void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const SfxHint } } } - else if (pSimpleHint->GetId() == SC_HINT_ACC_MAKEDRAWLAYER) + else if (rHint.GetId() == SC_HINT_ACC_MAKEDRAWLAYER) { GetShapeChildren()->SetDrawBroadcaster(); } - else if (pSimpleHint->GetId() == SC_HINT_ACC_VISAREACHANGED) + else if (rHint.GetId() == SC_HINT_ACC_VISAREACHANGED) { Size aOutputSize; vcl::Window* pSizeWindow = mpViewShell->GetWindow(); @@ -1304,14 +1311,6 @@ void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const SfxHint CommitChange(aEvent); } } - else if ( dynamic_cast<const ScAccWinFocusLostHint*>(&rHint) ) - { - CommitFocusLost(); - } - else if ( dynamic_cast<const ScAccWinFocusGotHint*>(&rHint) ) - { - CommitFocusGained(); - } ScAccessibleDocumentBase::Notify(rBC, rHint); } diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx index eda119923b45..956675a70fcb 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <vcl/window.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <svl/style.hxx> @@ -122,51 +122,47 @@ void SAL_CALL ScAccessiblePageHeader::disposing() void ScAccessiblePageHeader::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if (pSimpleHint) + // only notify if child exist, otherwise it is not necessary + if (rHint.GetId() == SC_HINT_DATACHANGED) { - // only notify if child exist, otherwise it is not necessary - if (pSimpleHint->GetId() == SC_HINT_DATACHANGED) + ScHFAreas aOldAreas(maAreas); + std::for_each(aOldAreas.begin(), aOldAreas.end(), Acquire()); + mnChildCount = -1; + getAccessibleChildCount(); + for (sal_uInt8 i = 0; i < MAX_AREAS; ++i) { - ScHFAreas aOldAreas(maAreas); - std::for_each(aOldAreas.begin(), aOldAreas.end(), Acquire()); - mnChildCount = -1; - getAccessibleChildCount(); - for (sal_uInt8 i = 0; i < MAX_AREAS; ++i) - { - if ((aOldAreas[i] && maAreas[i] && !ScGlobal::EETextObjEqual(aOldAreas[i]->GetEditTextObject(), maAreas[i]->GetEditTextObject())) || + if ((aOldAreas[i] && maAreas[i] && !ScGlobal::EETextObjEqual(aOldAreas[i]->GetEditTextObject(), maAreas[i]->GetEditTextObject())) || (aOldAreas[i] && !maAreas[i]) || (!aOldAreas[i] && maAreas[i])) + { + if (aOldAreas[i] && aOldAreas[i]->GetEditTextObject()) { - if (aOldAreas[i] && aOldAreas[i]->GetEditTextObject()) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::CHILD; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - aEvent.OldValue = uno::makeAny(uno::Reference<XAccessible>(aOldAreas[i])); - - CommitChange(aEvent); // child gone - event - aOldAreas[i]->dispose(); - } - if (maAreas[i] && maAreas[i]->GetEditTextObject()) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::CHILD; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - aEvent.NewValue = uno::makeAny(uno::Reference<XAccessible>(maAreas[i])); - - CommitChange(aEvent); // new child - event - } + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::CHILD; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + aEvent.OldValue = uno::makeAny(uno::Reference<XAccessible>(aOldAreas[i])); + + CommitChange(aEvent); // child gone - event + aOldAreas[i]->dispose(); + } + if (maAreas[i] && maAreas[i]->GetEditTextObject()) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::CHILD; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + aEvent.NewValue = uno::makeAny(uno::Reference<XAccessible>(maAreas[i])); + + CommitChange(aEvent); // new child - event } } - std::for_each(aOldAreas.begin(), aOldAreas.end(), Release()); - } - else if (pSimpleHint->GetId() == SC_HINT_ACC_VISAREACHANGED) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - CommitChange(aEvent); } + std::for_each(aOldAreas.begin(), aOldAreas.end(), Release()); + } + else if (rHint.GetId() == SC_HINT_ACC_VISAREACHANGED) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + CommitChange(aEvent); } ScAccessibleContextBase::Notify(rBC, rHint); diff --git a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx index 4b6f9bcabbea..669c818bf038 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx @@ -92,20 +92,16 @@ void SAL_CALL ScAccessiblePageHeaderArea::disposing() void ScAccessiblePageHeaderArea::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + // only notify if child exist, otherwise it is not necessary + if (rHint.GetId() == SC_HINT_ACC_VISAREACHANGED) { - // only notify if child exist, otherwise it is not necessary - if (pSimpleHint->GetId() == SC_HINT_ACC_VISAREACHANGED) - { - if (mpTextHelper) - mpTextHelper->UpdateChildren(); + if (mpTextHelper) + mpTextHelper->UpdateChildren(); - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - CommitChange(aEvent); - } + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + CommitChange(aEvent); } ScAccessibleContextBase::Notify(rBC, rHint); } diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index 5383e688bfcf..a1232985fc31 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -83,8 +83,7 @@ void SAL_CALL ScAccessiblePreviewCell::disposing() void ScAccessiblePreviewCell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SC_HINT_ACC_VISAREACHANGED) + if (rHint.GetId() == SC_HINT_ACC_VISAREACHANGED) { if (mpTextHelper) mpTextHelper->UpdateChildren(); diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx index 3aed647783de..31d9768ecbdb 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx @@ -55,7 +55,7 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -116,21 +116,17 @@ void SAL_CALL ScAccessiblePreviewHeaderCell::disposing() void ScAccessiblePreviewHeaderCell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + const sal_uInt32 nId = rHint.GetId(); + if (nId == SC_HINT_ACC_VISAREACHANGED) { - const sal_uInt32 nId {pSimpleHint->GetId()}; - if (nId == SC_HINT_ACC_VISAREACHANGED) - { - if (mpTextHelper) - mpTextHelper->UpdateChildren(); - } - else if ( nId == SFX_HINT_DATACHANGED ) - { - // column / row layout may change with any document change, - // so it must be invalidated - DELETEZ( mpTableInfo ); - } + if (mpTextHelper) + mpTextHelper->UpdateChildren(); + } + else if ( nId == SFX_HINT_DATACHANGED ) + { + // column / row layout may change with any document change, + // so it must be invalidated + DELETEZ( mpTableInfo ); } ScAccessibleContextBase::Notify(rBC, rHint); diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx index 4e083a6b9106..abfa70176c90 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx @@ -36,7 +36,7 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -86,23 +86,19 @@ void SAL_CALL ScAccessiblePreviewTable::disposing() void ScAccessiblePreviewTable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + const sal_uInt32 nId = rHint.GetId(); + if ( nId == SFX_HINT_DATACHANGED ) { - const sal_uInt32 nId {pSimpleHint->GetId()}; - if ( nId == SFX_HINT_DATACHANGED ) - { - // column / row layout may change with any document change, - // so it must be invalidated - DELETEZ( mpTableInfo ); - } - else if (nId == SC_HINT_ACC_VISAREACHANGED) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - CommitChange(aEvent); - } + // column / row layout may change with any document change, + // so it must be invalidated + DELETEZ( mpTableInfo ); + } + else if (nId == SC_HINT_ACC_VISAREACHANGED) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + CommitChange(aEvent); } ScAccessibleContextBase::Notify(rBC, rHint); diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 69d23e0c9f72..889e2f579df3 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -417,10 +417,69 @@ void ScAccessibleSpreadsheet::VisAreaChanged() void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pSimpleHint) + if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) ) { - if (pSimpleHint->GetId() == SC_HINT_ACC_CURSORCHANGED) + const ScUpdateRefHint& rRef = static_cast<const ScUpdateRefHint&>(rHint); + if (rRef.GetMode() == URM_INSDEL && rRef.GetDz() == 0) //test whether table is inserted or deleted + { + if (((rRef.GetRange().aStart.Col() == maRange.aStart.Col()) && + (rRef.GetRange().aEnd.Col() == maRange.aEnd.Col())) || + ((rRef.GetRange().aStart.Row() == maRange.aStart.Row()) && + (rRef.GetRange().aEnd.Row() == maRange.aEnd.Row()))) + { + // ignore next SC_HINT_DATACHANGED notification + mbDelIns = true; + + sal_Int16 nId(0); + SCsCOL nX(rRef.GetDx()); + SCsROW nY(rRef.GetDy()); + ScRange aRange(rRef.GetRange()); + if ((nX < 0) || (nY < 0)) + { + OSL_ENSURE(!((nX < 0) && (nY < 0)), "should not be possible to remove row and column at the same time"); + nId = AccessibleTableModelChangeType::DELETE; + if (nX < 0) + { + nX = -nX; + nY = aRange.aEnd.Row() - aRange.aStart.Row(); + } + else + { + nY = -nY; + nX = aRange.aEnd.Col() - aRange.aStart.Col(); + } + } + else if ((nX > 0) || (nY > 0)) + { + OSL_ENSURE(!((nX > 0) && (nY > 0)), "should not be possible to add row and column at the same time"); + nId = AccessibleTableModelChangeType::INSERT; + if (nX < 0) + nY = aRange.aEnd.Row() - aRange.aStart.Row(); + else + nX = aRange.aEnd.Col() - aRange.aStart.Col(); + } + else + { + OSL_FAIL("is it a deletion or a insertion?"); + } + + CommitTableModelChange(rRef.GetRange().aStart.Row(), + rRef.GetRange().aStart.Col(), + rRef.GetRange().aStart.Row() + nY, + rRef.GetRange().aStart.Col() + nX, nId); + + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + aEvent.Source = uno::Reference< XAccessibleContext >(this); + aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell.get()); + + CommitChange(aEvent); + } + } + } + else + { + if (rHint.GetId() == SC_HINT_ACC_CURSORCHANGED) { if (mpViewShell) { @@ -598,7 +657,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint m_LastMarkedRanges = *mpMarkedRanges; } } - else if (pSimpleHint->GetId() == SC_HINT_DATACHANGED) + else if (rHint.GetId() == SC_HINT_DATACHANGED) { if (!mbDelIns) CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE); @@ -656,66 +715,6 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint } }*/ } - else if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) ) - { - const ScUpdateRefHint& rRef = static_cast<const ScUpdateRefHint&>(rHint); - if (rRef.GetMode() == URM_INSDEL && rRef.GetDz() == 0) //test whether table is inserted or deleted - { - if (((rRef.GetRange().aStart.Col() == maRange.aStart.Col()) && - (rRef.GetRange().aEnd.Col() == maRange.aEnd.Col())) || - ((rRef.GetRange().aStart.Row() == maRange.aStart.Row()) && - (rRef.GetRange().aEnd.Row() == maRange.aEnd.Row()))) - { - // ignore next SC_HINT_DATACHANGED notification - mbDelIns = true; - - sal_Int16 nId(0); - SCsCOL nX(rRef.GetDx()); - SCsROW nY(rRef.GetDy()); - ScRange aRange(rRef.GetRange()); - if ((nX < 0) || (nY < 0)) - { - OSL_ENSURE(!((nX < 0) && (nY < 0)), "should not be possible to remove row and column at the same time"); - nId = AccessibleTableModelChangeType::DELETE; - if (nX < 0) - { - nX = -nX; - nY = aRange.aEnd.Row() - aRange.aStart.Row(); - } - else - { - nY = -nY; - nX = aRange.aEnd.Col() - aRange.aStart.Col(); - } - } - else if ((nX > 0) || (nY > 0)) - { - OSL_ENSURE(!((nX > 0) && (nY > 0)), "should not be possible to add row and column at the same time"); - nId = AccessibleTableModelChangeType::INSERT; - if (nX < 0) - nY = aRange.aEnd.Row() - aRange.aStart.Row(); - else - nX = aRange.aEnd.Col() - aRange.aStart.Col(); - } - else - { - OSL_FAIL("is it a deletion or a insertion?"); - } - - CommitTableModelChange(rRef.GetRange().aStart.Row(), - rRef.GetRange().aStart.Col(), - rRef.GetRange().aStart.Row() + nY, - rRef.GetRange().aStart.Col() + nX, nId); - - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell.get()); - - CommitChange(aEvent); - } - } - } ScAccessibleTableBase::Notify(rBC, rHint); } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 80f7393e76fc..dc7ce4175f70 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -720,8 +720,7 @@ ScAccessibleCellTextData::~ScAccessibleCellTextData() void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpViewShell = nullptr; // invalid now if (mpViewForwarder) @@ -948,8 +947,7 @@ ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData() void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpWindow = nullptr; mpEditView = nullptr; @@ -1205,8 +1203,7 @@ ScAccessiblePreviewCellTextData::~ScAccessiblePreviewCellTextData() void ScAccessiblePreviewCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpViewShell = nullptr; // invalid now if (mpViewForwarder) @@ -1279,8 +1276,7 @@ ScAccessiblePreviewHeaderCellTextData::~ScAccessiblePreviewHeaderCellTextData() void ScAccessiblePreviewHeaderCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpViewShell = nullptr; // invalid now if (mpViewForwarder) @@ -1398,8 +1394,7 @@ ScAccessibleTextData* ScAccessibleHeaderTextData::Clone() const void ScAccessibleHeaderTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpViewShell = nullptr;// invalid now mpDocSh = nullptr; @@ -1512,8 +1507,7 @@ ScAccessibleTextData* ScAccessibleNoteTextData::Clone() const void ScAccessibleNoteTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpViewShell = nullptr;// invalid now mpDocSh = nullptr; @@ -1649,8 +1643,7 @@ ScAccessibleCsvTextData::~ScAccessibleCsvTextData() void ScAccessibleCsvTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpWindow = nullptr; mpEditEngine = nullptr; |