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 | |
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')
72 files changed, 589 insertions, 686 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; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d7e816062743..26b14aca19d1 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -394,7 +394,7 @@ handle_r1c1: { pEngine->SetUpdateMode( true ); - pDocSh->Broadcast( SfxSimpleHint( SC_HINT_SHOWRANGEFINDER ) ); + pDocSh->Broadcast( SfxHint( SC_HINT_SHOWRANGEFINDER ) ); } } @@ -484,7 +484,7 @@ void ScInputHandler::DeleteRangeFinder() { ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); pRangeFindList->SetHidden(true); - pDocSh->Broadcast( SfxSimpleHint( SC_HINT_SHOWRANGEFINDER ) ); // Steal + pDocSh->Broadcast( SfxHint( SC_HINT_SHOWRANGEFINDER ) ); // Steal DELETEZ(pRangeFindList); } } @@ -1837,7 +1837,7 @@ void ScInputHandler::ViewShellGone(ScTabViewShell* pViewSh) // Executed synchron EnterHandler(); bFormulaMode = false; pRefViewSh = nullptr; - SfxGetpApp()->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( FID_REFMODECHANGED ) ); SC_MOD()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); @@ -2359,7 +2359,7 @@ void ScInputHandler::UpdateFormulaMode() { bFormulaMode = true; pRefViewSh = pActiveViewSh; - pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + pSfxApp->Broadcast( SfxHint( FID_REFMODECHANGED ) ); SC_MOD()->SetRefInputHdl(this); if (pInputWin) pInputWin->SetFormulaMode(true); @@ -2378,7 +2378,7 @@ void ScInputHandler::UpdateFormulaMode() ShowRefFrame(); bFormulaMode = false; pRefViewSh = nullptr; - pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + pSfxApp->Broadcast( SfxHint( FID_REFMODECHANGED ) ); SC_MOD()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); @@ -2810,7 +2810,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) } bFormulaMode = false; - pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + pSfxApp->Broadcast( SfxHint( FID_REFMODECHANGED ) ); SC_MOD()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); @@ -2865,7 +2865,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) } } - pSfxApp->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW_NOPAINT ) ); + pSfxApp->Broadcast( SfxHint( FID_KILLEDITVIEW_NOPAINT ) ); if ( pExecuteSh ) { @@ -2894,7 +2894,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) pLastState = nullptr; } else - pSfxApp->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) ); + pSfxApp->Broadcast( SfxHint( FID_KILLEDITVIEW ) ); if ( bOldMod && pExecuteSh && pCellAttrs && !bForget ) { @@ -2938,7 +2938,7 @@ void ScInputHandler::CancelHandler() pExecuteSh->ActiveGrabFocus(); } bFormulaMode = false; - SfxGetpApp()->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( FID_REFMODECHANGED ) ); SC_MOD()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); @@ -3688,7 +3688,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, } if (bStopEditing) - SfxGetpApp()->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) ); + SfxGetpApp()->Broadcast( SfxHint( FID_KILLEDITVIEW ) ); // As long as the content is not edited, turn off online spelling. // Online spelling is turned back on in StartTable, after setting diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index e62888f94a30..fae016f2e89a 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2066,17 +2066,16 @@ void ScPosWnd::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( !bFormulaMode ) { // Does the list of range names need updating? - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) + if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { - const sal_uInt32 nHintId = pSimpleHint->GetId(); - if ( nHintId == SC_HINT_AREAS_CHANGED || nHintId == SC_HINT_NAVIGATOR_UPDATEALL) + sal_uLong nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); + if ( nEventId == SFX_EVENT_ACTIVATEDOC ) FillRangeNames(); } - else if ( dynamic_cast<const SfxEventHint*>(&rHint) ) + else { - sal_uLong nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); - if ( nEventId == SFX_EVENT_ACTIVATEDOC ) + const sal_uInt32 nHintId = rHint.GetId(); + if ( nHintId == SC_HINT_AREAS_CHANGED || nHintId == SC_HINT_NAVIGATOR_UPDATEALL) FillRangeNames(); } } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index ac5ddec2e46a..4a3395356084 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -319,8 +319,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3 void ScModule::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING ) + if ( rHint.GetId() == SFX_HINT_DEINITIALIZING ) { // ConfigItems must be removed before ConfigManager DeleteCfg(); @@ -1251,7 +1250,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) SetPrintOptions( rNewOpt ); // broadcast causes all previews to recalc page numbers - SfxGetpApp()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) ); + SfxGetpApp()->Broadcast( SfxHint( SID_SCPRINTOPTIONS ) ); } if ( bSaveAppOptions ) @@ -1553,7 +1552,7 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm ) } SfxApplication* pSfxApp = SfxGetpApp(); - pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); + pSfxApp->Broadcast( SfxHint( FID_REFMODECHANGED ) ); } } diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 5221907dc007..ad90f5da88ec 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -24,7 +24,6 @@ #include <comphelper/string.hxx> #include <svtools/colorcfg.hxx> -#include <svl/smplhint.hxx> #include <sal/macros.h> #include <tools/poly.hxx> #include "scmod.hxx" diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 1e5ce4c12c70..413762501e57 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -106,7 +106,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool } aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); return true; } @@ -139,7 +139,7 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName) } aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); bDone = true; } @@ -186,7 +186,7 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew ) delete pUndoColl; aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); bDone = true; } } @@ -267,7 +267,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve pOldColl = nullptr; rDocShell.PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); if (bRecord) { diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 877faddac2e1..58862d99cfa5 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2087,7 +2087,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); return bSuccess; } @@ -2583,7 +2583,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); return true; } @@ -2909,7 +2909,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); delete pClipDoc; return true; @@ -3057,7 +3057,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo rDocShell.PostPaintExtras(); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); bSuccess = true; } else if (!bApi) @@ -3153,9 +3153,9 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ ) aModificator.SetDocumentModified(); SfxApplication* pSfxApp = SfxGetpApp(); // Navigator - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); bSuccess = true; } @@ -3213,7 +3213,7 @@ void ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi ) if (!bVisible) rDocShell.Broadcast( ScTablesHint( SC_TAB_HIDDEN, nTab ) ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); rDocShell.PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_EXTRAS); aModificator.SetDocumentModified(); } @@ -3275,7 +3275,7 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo } rDocShell.PostPaintExtras(); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); bSuccess = true; } @@ -3312,7 +3312,7 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo rDocShell.PostPaintExtras(); ScDocShellModificator aModificator( rDocShell ); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); bSuccess = true; } @@ -4914,7 +4914,7 @@ void ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA if (bModifyDoc) { aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint(SC_HINT_AREAS_CHANGED) ); + SfxGetpApp()->Broadcast( SfxHint(SC_HINT_AREAS_CHANGED) ); } } @@ -4936,7 +4936,7 @@ void ScDocFunc::ModifyAllRangeNames(const std::map<OUString, std::unique_ptr<ScR rDoc.CompileHybridFormula(); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); + SfxGetpApp()->Broadcast(SfxHint(SC_HINT_AREAS_CHANGED)); } void ScDocFunc::CreateOneName( ScRangeName& rList, @@ -5332,7 +5332,7 @@ void ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter, if (pBindings) pBindings->Invalidate( SID_LINKS ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator } void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFormat* pFormat, SCTAB nTab, const ScRangeList& rRanges ) @@ -5408,7 +5408,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor rDocShell.PostPaint(*pRepaintRange, PAINT_GRID); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); + SfxGetpApp()->Broadcast(SfxHint(SC_HINT_AREAS_CHANGED)); } void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB nTab ) @@ -5436,7 +5436,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB rDoc.SetStreamValid(nTab, false); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); + SfxGetpApp()->Broadcast(SfxHint(SC_HINT_AREAS_CHANGED)); } void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction ) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 83b43f715e9b..823cf06f26c2 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -653,18 +653,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } - if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) // Without parameter - { - switch ( static_cast<const SfxSimpleHint&>(rHint).GetId() ) - { - case SFX_HINT_TITLECHANGED: - aDocument.SetName( SfxShell::GetName() ); - // RegisterNewTargetNames gibts nicht mehr - SfxGetpApp()->Broadcast(SfxSimpleHint( SC_HINT_DOCNAME_CHANGED )); // Navigator - break; - } - } - else if ( dynamic_cast<const SfxStyleSheetHint*>(&rHint) ) // Template changed + if ( dynamic_cast<const SfxStyleSheetHint*>(&rHint) ) // Template changed NotifyStyle( static_cast<const SfxStyleSheetHint&>(rHint) ); else if ( dynamic_cast<const ScAutoStyleHint*>(&rHint) ) { @@ -1000,6 +989,17 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; } } + else // Without parameter + { + switch ( rHint.GetId() ) + { + case SFX_HINT_TITLECHANGED: + aDocument.SetName( SfxShell::GetName() ); + // RegisterNewTargetNames gibts nicht mehr + SfxGetpApp()->Broadcast(SfxHint( SC_HINT_DOCNAME_CHANGED )); // Navigator + break; + } + } } // Load contents for organizer @@ -2491,7 +2491,7 @@ bool ScDocShell::DoSaveCompleted( SfxMedium * pNewStor, bool bRegisterRecent ) bool bRet = SfxObjectShell::DoSaveCompleted( pNewStor, bRegisterRecent ); // SC_HINT_DOC_SAVED for change ReadOnly -> Read/Write - Broadcast( SfxSimpleHint( SC_HINT_DOC_SAVED ) ); + Broadcast( SfxHint( SC_HINT_DOC_SAVED ) ); return bRet; } @@ -2803,7 +2803,7 @@ void ScDocShell::SetModified( bool bModified ) if ( SfxObjectShell::IsEnableSetModified() ) { SfxObjectShell::SetModified( bModified ); - Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) ); + Broadcast( SfxHint( SFX_HINT_DOCCHANGED ) ); } } @@ -2819,7 +2819,7 @@ void ScDocShell::SetDocumentModified() // of RecalcModeAlways formulas (like OFFSET) after modifying cells aDocument.Broadcast(ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS)); aDocument.InvalidateTableArea(); // #i105279# needed here - aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); pPaintLockData->SetModified(); // Later on ... return; @@ -2856,7 +2856,7 @@ void ScDocShell::SetDocumentModified() } // notify UNO objects after BCA_BRDCST_ALWAYS etc. - aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); } /** @@ -2894,7 +2894,7 @@ void ScDocShell::SetDrawModified() if ( aDocument.IsChartListenerCollectionNeedsUpdate() ) { aDocument.UpdateChartListenerCollection(); - SfxGetpApp()->Broadcast(SfxSimpleHint( SC_HINT_DRAW_CHANGED )); // Navigator + SfxGetpApp()->Broadcast(SfxHint( SC_HINT_DRAW_CHANGED )); // Navigator } SC_MOD()->AnythingChanged(); } @@ -3160,7 +3160,7 @@ void ScDocShellModificator::SetDocumentModified() { // uno broadcast is necessary for api to work // -> must also be done during xml import - rDoc.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + rDoc.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); } } diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 86055eda72f3..e211ee371c69 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -173,7 +173,7 @@ ScDrawLayer* ScDocShell::MakeDrawLayer() aDocument.InitDrawLayer(this); pDrawLayer = aDocument.GetDrawLayer(); InitItems(); // including Undo and Basic - Broadcast( SfxSimpleHint( SC_HINT_DRWLAYER_NEW ) ); + Broadcast( SfxHint( SC_HINT_DRWLAYER_NEW ) ); if (nDocumentLock) pDrawLayer->setLock(true); } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index baf390806fce..e23662089d02 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -84,8 +84,8 @@ void ScDocShell::PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddre void ScDocShell::PostDataChanged() { - Broadcast( SfxSimpleHint( FID_DATACHANGED ) ); - SfxGetpApp()->Broadcast(SfxSimpleHint( FID_ANYDATACHANGED )); // Navigator + Broadcast( SfxHint( FID_DATACHANGED ) ); + SfxGetpApp()->Broadcast(SfxHint( FID_ANYDATACHANGED )); // Navigator aDocument.ClearFormulaContext(); //! Navigator direkt benachrichtigen! } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 6d0f62a2e3d3..c992590c572a 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -456,7 +456,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) { // Formeln berechnen und painten wie im TrackTimeHdl aDocument.TrackFormulas(); - Broadcast(SfxSimpleHint(FID_DATACHANGED)); + Broadcast(SfxHint(FID_DATACHANGED)); // wenn FID_DATACHANGED irgendwann mal asynchron werden sollte // (z.B. mit Invalidate am Window), muss hier ein Update erzwungen werden. @@ -1235,7 +1235,7 @@ void ScDocShell::DoRecalc( bool bApi ) if ( pSh ) pSh->UpdateCharts(true); - aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); // Wenn es Charts gibt, dann alles painten, damit nicht // PostDataChanged und die Charts nacheinander kommen und Teile @@ -1272,8 +1272,8 @@ void ScDocShell::DoHardRecalc( bool /* bApi */ ) // CalcAll doesn't broadcast value changes, so SC_HINT_CALCALL is broadcasted globally // in addition to SFX_HINT_DATACHANGED. - aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) ); - aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + aDocument.BroadcastUno( SfxHint( SC_HINT_CALCALL ) ); + aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); // use hard recalc also to disable stream-copying of all sheets // (somewhat consistent with charts) diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 4778dc103e99..a57eb3de10ff 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -102,7 +102,7 @@ void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCR PostPaint( nX1, nY1, nTab, nX2, nY1, nTab, PAINT_GRID ); // No SetDocumentModified, as the unnamed database range might have to be restored later. // The UNO hint is broadcast directly instead, to keep UNO objects in valid state. - aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) ); } ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) @@ -314,7 +314,7 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe // "Import1" etc am Navigator bekanntmachen if (eMode==SC_DB_IMPORT) - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); } pData = pNoNameData; } @@ -758,7 +758,7 @@ void ScDocShell::ModifyScenario( SCTAB nTab, const OUString& rName, const OUStri aModificator.SetDocumentModified(); if (!aOldName.equals(rName)) - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); SfxBindings* pBindings = GetViewBindings(); if (pBindings) @@ -824,7 +824,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin PostPaintExtras(); // Tabellenreiter aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); return nNewTab; } @@ -991,7 +991,7 @@ bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRec PostPaintGridAll(); PostPaintExtras(); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); return true; } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 663cbd41c883..b34cb9d5ad52 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -42,7 +42,6 @@ #include <sfx2/sfxsids.hrc> #include <sfx2/objsh.hxx> #include <svl/broadcast.hxx> -#include <svl/smplhint.hxx> #include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <svl/urihelper.hxx> diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx index 21d7c2cab3b0..b7d53b95ccd4 100644 --- a/sc/source/ui/docshell/servobj.cxx +++ b/sc/source/ui/docshell/servobj.cxx @@ -201,8 +201,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) if ( &rBC == pDocSh ) { // from DocShell, only SFX_HINT_DYING is interesting - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocSh = nullptr; EndListening(*SfxGetpApp()); @@ -211,9 +210,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if (dynamic_cast<const SfxApplication*>( &rBC) != nullptr) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if ( !aItemStr.isEmpty() && pSimpleHint && - pSimpleHint->GetId() == SC_HINT_AREAS_CHANGED ) + if ( !aItemStr.isEmpty() && rHint.GetId() == SC_HINT_AREAS_CHANGED ) { // check if named range was modified ScRange aNew; @@ -237,9 +234,9 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) bDataChanged = true; } } - else if (const SfxSimpleHint *pSplHint = dynamic_cast<const SfxSimpleHint*>(&rHint)) + else { - if (pSplHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { // If the range is being deleted, listening must be restarted // after the deletion is complete (done in GetData) diff --git a/sc/source/ui/inc/AccessibilityHints.hxx b/sc/source/ui/inc/AccessibilityHints.hxx index 182e142f2a30..38617b3213e3 100644 --- a/sc/source/ui/inc/AccessibilityHints.hxx +++ b/sc/source/ui/inc/AccessibilityHints.hxx @@ -22,7 +22,6 @@ #include "viewdata.hxx" #include <com/sun/star/uno/XInterface.hpp> -#include <svl/smplhint.hxx> #include <svl/hint.hxx> #define SC_HINT_ACC_SIMPLE_START SFX_HINT_USER00 diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 63e6cef3ca0e..4ed52bdfa44b 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -642,7 +642,7 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId ) } SC_MOD()->SetRefDialog( nId, false, pMyViewFrm ); - pSfxApp->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) ); + pSfxApp->Broadcast( SfxHint( FID_KILLEDITVIEW ) ); ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); if ( pScViewShell ) diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 73a293b7931e..c46f17e99817 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -256,7 +256,7 @@ void ScNameDefDlg::AddPushed() // call invalidates the stream if (nTab != -1) mpDoc->SetStreamValid(nTab, false); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); mpDocShell->SetDocumentModified(); Close(); } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 73ee425b8ada..3099de828dfc 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -817,10 +817,18 @@ void ScNavigatorDlg::DoResize() void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if ( pSimpleHint ) + if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { - const sal_uInt32 nHintId = pSimpleHint->GetId(); + sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); + if ( nEventId == SFX_EVENT_ACTIVATEDOC ) + { + aLbEntries->ActiveDocChanged(); + UpdateAll(); + } + } + else + { + const sal_uInt32 nHintId = rHint.GetId(); if ( nHintId == SC_HINT_DOCNAME_CHANGED ) { @@ -876,15 +884,6 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } } - else if ( dynamic_cast<const SfxEventHint*>(&rHint) ) - { - sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); - if ( nEventId == SFX_EVENT_ACTIVATEDOC ) - { - aLbEntries->ActiveDocChanged(); - UpdateAll(); - } - } } IMPL_LINK_TYPED( ScNavigatorDlg, TimeHdl, Idle*, pIdle, void ) diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index a11065eb6701..c7bd62961c90 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -501,7 +501,7 @@ void ScUndoDeleteCells::Undo() BeginUndo(); DoChange( true ); EndUndo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Selection not until EndUndo ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); @@ -524,7 +524,7 @@ void ScUndoDeleteCells::Redo() BeginRedo(); DoChange( false); EndRedo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) @@ -683,7 +683,7 @@ void ScUndoDeleteMulti::Undo() //! since no data for selection exist EndUndo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDeleteMulti::Redo() @@ -710,7 +710,7 @@ void ScUndoDeleteMulti::Redo() DoChange(); EndRedo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDeleteMulti::Repeat(SfxRepeatTarget& rTarget) @@ -1062,7 +1062,7 @@ void ScUndoPaste::Undo() if (!maBlockRanges.empty()) ShowTable(*maBlockRanges.front()); EndUndo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoPaste::Redo() @@ -1073,7 +1073,7 @@ void ScUndoPaste::Redo() DoChange( false ); EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo? EndRedo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoPaste::Repeat(SfxRepeatTarget& rTarget) @@ -1335,7 +1335,7 @@ void ScUndoDragDrop::Undo() } EndUndo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDragDrop::Redo() @@ -1419,7 +1419,7 @@ void ScUndoDragDrop::Redo() EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo? EndRedo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDragDrop::Repeat(SfxRepeatTarget& /* rTarget */) diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 2f88c2995fb7..6f5260386d0b 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -1516,7 +1516,7 @@ void ScUndoInsertAreaLink::Undo() if (pLink) pLinkManager->Remove( pLink ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator } void ScUndoInsertAreaLink::Redo() @@ -1532,7 +1532,7 @@ void ScUndoInsertAreaLink::Redo() pLink->Update(); pLink->SetInCreate( false ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator } void ScUndoInsertAreaLink::Repeat(SfxRepeatTarget& /* rTarget */) @@ -1581,7 +1581,7 @@ void ScUndoRemoveAreaLink::Undo() pLink->Update(); pLink->SetInCreate( false ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator } void ScUndoRemoveAreaLink::Redo() @@ -1594,7 +1594,7 @@ void ScUndoRemoveAreaLink::Redo() if (pLink) pLinkManager->Remove( pLink ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator } void ScUndoRemoveAreaLink::Repeat(SfxRepeatTarget& /* rTarget */) diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 8e3c685ddd3c..dcf04dfab2be 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -986,7 +986,7 @@ void ScUndoRangeNames::DoChange( bool bUndo ) rDoc.CompileHybridFormula(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); } void ScUndoRangeNames::Undo() diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index 28d5dcf0d603..3fc8183513b6 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -1002,7 +1002,7 @@ void ScUndoDBData::Undo() rDoc.CompileHybridFormula(); rDoc.SetAutoCalc( bOldAutoCalc ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); EndUndo(); } @@ -1020,7 +1020,7 @@ void ScUndoDBData::Redo() rDoc.CompileHybridFormula(); rDoc.SetAutoCalc( bOldAutoCalc ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); EndRedo(); } @@ -1842,7 +1842,7 @@ void ScUndoDataForm::Undo() DoChange( true ); ShowTable( aBlockRange ); EndUndo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDataForm::Redo() @@ -1853,7 +1853,7 @@ void ScUndoDataForm::Redo() DoChange( false ); EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo? EndRedo(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } void ScUndoDataForm::Repeat(SfxRepeatTarget& /*rTarget*/) diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx index f775269a14cb..5ed0df811f6f 100644 --- a/sc/source/ui/undo/undorangename.cxx +++ b/sc/source/ui/undo/undorangename.cxx @@ -74,7 +74,7 @@ void ScUndoAllRangeNames::DoChange(const std::map<OUString, std::unique_ptr<ScRa rDoc.SetAllRangeNames(rNames); rDoc.CompileHybridFormula(); - SfxGetpApp()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); + SfxGetpApp()->Broadcast(SfxHint(SC_HINT_AREAS_CHANGED)); } ScUndoAddRangeData::ScUndoAddRangeData(ScDocShell* pDocSh, ScRangeData* pRangeData, SCTAB nTab) : @@ -103,7 +103,7 @@ void ScUndoAddRangeData::Undo() pRangeName = rDoc.GetRangeName( mnTab ); } pRangeName->erase(*mpRangeData); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); } @@ -120,7 +120,7 @@ void ScUndoAddRangeData::Redo() pRangeName = rDoc.GetRangeName( mnTab ); } pRangeName->insert(new ScRangeData(*mpRangeData)); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); } void ScUndoAddRangeData::Repeat(SfxRepeatTarget& /*rTarget*/) diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 4470fc1231fc..59bba809602d 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -20,7 +20,7 @@ #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include "undotab.hxx" #include "document.hxx" @@ -116,7 +116,7 @@ void ScUndoInsertTab::Undo() pChangeTrack->Undo( nEndChangeAction, nEndChangeAction ); // SetTabNo(...,sal_True) for all views to sync with drawing layer pages - pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) ); + pDocShell->Broadcast( SfxHint( SC_HINT_FORCESETTAB ) ); } void ScUndoInsertTab::Redo() @@ -215,7 +215,7 @@ void ScUndoInsertTables::Undo() pChangeTrack->Undo( nStartChangeAction, nEndChangeAction ); // SetTabNo(...,sal_True) for all views to sync with drawing layer pages - pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) ); + pDocShell->Broadcast( SfxHint( SC_HINT_FORCESETTAB ) ); } void ScUndoInsertTables::Redo() @@ -362,9 +362,9 @@ void ScUndoDeleteTab::Undo() pDocShell->Broadcast( ScTablesHint( SC_TAB_INSERTED, theTabs[i]) ); } SfxApplication* pSfxApp = SfxGetpApp(); // Navigator - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); pDocShell->PostPaint(0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_ALL ); // incl. extras @@ -390,7 +390,7 @@ void ScUndoDeleteTab::Redo() SetChangeTrack(); // SetTabNo(...,sal_True) for all views to sync with drawing layer pages - pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) ); + pDocShell->Broadcast( SfxHint( SC_HINT_FORCESETTAB ) ); } void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget) @@ -432,7 +432,7 @@ void ScUndoRenameTab::DoChange( SCTAB nTabP, const OUString& rName ) const ScDocument& rDoc = pDocShell->GetDocument(); rDoc.RenameTab( nTabP, rName ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); // Navigator pDocShell->PostPaintGridAll(); pDocShell->PostPaintExtras(); @@ -540,7 +540,7 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const } } - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); // Navigator pDocShell->PostPaintGridAll(); pDocShell->PostPaintExtras(); @@ -601,7 +601,7 @@ void ScUndoCopyTab::DoChange() const if (pViewShell) pViewShell->SetTabNo((*mpOldTabs)[0],true); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); // Navigator pDocShell->PostPaintGridAll(); pDocShell->PostPaintExtras(); @@ -820,10 +820,10 @@ void ScUndoMakeScenario::Undo() if (pViewShell) pViewShell->SetTabNo( nSrcTab, true ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); // SetTabNo(...,sal_True) for all views to sync with drawing layer pages - pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) ); + pDocShell->Broadcast( SfxHint( SC_HINT_FORCESETTAB ) ); } void ScUndoMakeScenario::Redo() @@ -844,7 +844,7 @@ void ScUndoMakeScenario::Redo() if (pViewShell) pViewShell->SetTabNo( nDestTab, true ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget) @@ -899,7 +899,7 @@ void ScUndoImportTab::DoChange() const } } - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); // Navigator pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS ); } @@ -1123,7 +1123,7 @@ void ScUndoShowHideTab::DoChange( bool bShowP ) const pViewShell->SetTabNo(nTab,true); } - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); pDocShell->SetDocumentModified(); } @@ -1400,7 +1400,7 @@ void ScUndoScenarioFlags::Undo() pViewShell->UpdateInputHandler(); if ( aOldName != aNewName ) - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } void ScUndoScenarioFlags::Redo() @@ -1417,7 +1417,7 @@ void ScUndoScenarioFlags::Redo() pViewShell->UpdateInputHandler(); if ( aOldName != aNewName ) - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } void ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */) diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index fa09033e0f6c..97566b03b265 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -50,8 +50,7 @@ ScAddressConversionObj::~ScAddressConversionObj() void ScAddressConversionObj::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 ) { pDocShell = nullptr; // invalid } diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index 4d86cd21048e..2845341982c1 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -376,7 +376,7 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( ScPrintOptions aPrintOpt(pScMod->GetPrintOptions()); aPrintOpt.SetSkipEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); // reversed pScMod->SetPrintOptions( aPrintOpt ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) ); // update previews + SfxGetpApp()->Broadcast( SfxHint( SID_SCPRINTOPTIONS ) ); // update previews } if ( bSaveApp ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 591d8ef8b57f..2085ff4a7d61 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1552,8 +1552,7 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Reference<uno::XInterface> const xThis(m_wThis); if (!xThis.is()) { // fdo#72695: if UNO object is already dead, don't revive it with event - if (dynamic_cast<const SfxSimpleHint*>(&rHint) && - SFX_HINT_DYING == static_cast<const SfxSimpleHint&>(rHint).GetId()) + if (SFX_HINT_DYING == rHint.GetId()) { // if the document dies, must reset to avoid crash in dtor! ForgetCurrentAttrs(); pDocShell = nullptr; @@ -1597,9 +1596,23 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) rDoc.AddUnoRefChange( nObjectId, *pUndoRanges ); } } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else if ( dynamic_cast<const ScUnoRefUndoHint*>(&rHint) ) + { + const ScUnoRefUndoHint& rUndoHint = static_cast<const ScUnoRefUndoHint&>(rHint); + if ( rUndoHint.GetObjectId() == nObjectId ) + { + // restore ranges from hint + + aRanges = rUndoHint.GetRanges(); + + RefChanged(); + if ( !aValueListeners.empty() ) + bGotDataChangedHint = true; // need to broadcast the undo, too + } + } + else { - const sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); + const sal_uInt32 nId = rHint.GetId(); if ( nId == SFX_HINT_DYING ) { ForgetCurrentAttrs(); @@ -1656,20 +1669,6 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) bGotDataChangedHint = true; } } - else if ( dynamic_cast<const ScUnoRefUndoHint*>(&rHint) ) - { - const ScUnoRefUndoHint& rUndoHint = static_cast<const ScUnoRefUndoHint&>(rHint); - if ( rUndoHint.GetObjectId() == nObjectId ) - { - // restore ranges from hint - - aRanges = rUndoHint.GetRanges(); - - RefChanged(); - if ( !aValueListeners.empty() ) - bGotDataChangedHint = true; // need to broadcast the undo, too - } - } } void ScCellRangesBase::RefChanged() @@ -2796,8 +2795,7 @@ void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence< IMPL_LINK_TYPED( ScCellRangesBase, ValueListenerHdl, const SfxHint&, rHint, void ) { - if ( pDocShell && dynamic_cast<const SfxSimpleHint*>(&rHint) && - (static_cast<const SfxSimpleHint&>(rHint).GetId() & SC_HINT_DATACHANGED)) + if ( pDocShell && (rHint.GetId() & SC_HINT_DATACHANGED)) { // This may be called several times for a single change, if several formulas // in the range are notified. So only a flag is set that is checked when @@ -9023,8 +9021,7 @@ void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) aRanges.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ); } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -9161,8 +9158,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -9216,8 +9212,7 @@ void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! aTotalRange... } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -9385,9 +9380,9 @@ void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! und nun ??? } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else { - const sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); + const sal_uInt32 nId = rHint.GetId(); if ( nId == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden @@ -9448,9 +9443,9 @@ void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! aTotalRange... } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else { - if ( static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pDocShell = nullptr; // ungueltig geworden } } @@ -9705,9 +9700,9 @@ void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHi { //! und nun ??? } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else { - if ( static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pDocShell = nullptr; // ungueltig geworden } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 9aa88e592822..5dafe5654af8 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1018,8 +1018,7 @@ ScChart2DataProvider::~ScChart2DataProvider() void ScChart2DataProvider::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 ) { m_pDocument = nullptr; } @@ -2405,8 +2404,7 @@ ScChart2DataSource::~ScChart2DataSource() void ScChart2DataSource::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 ) { m_pDocument = nullptr; } @@ -2807,43 +2805,7 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r) void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) - { - const sal_uInt32 nId = pSimpleHint->GetId(); - if ( nId ==SFX_HINT_DYING ) - { - m_pDocument = nullptr; - } - else if ( nId == SFX_HINT_DATACHANGED ) - { - // delayed broadcast as in ScCellRangesBase - - if ( m_bGotDataChangedHint && m_pDocument ) - { - m_aDataArray.clear(); - lang::EventObject aEvent; - aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - - if( m_pDocument ) - { - for (uno::Reference<util::XModifyListener> & xListener: m_aValueListeners) - m_pDocument->AddUnoListenerCall( xListener, aEvent ); - } - - m_bGotDataChangedHint = false; - } - } - else if ( nId == SC_HINT_CALCALL ) - { - // broadcast from DoHardRecalc - set m_bGotDataChangedHint - // (SFX_HINT_DATACHANGED follows separately) - - if ( !m_aValueListeners.empty() ) - m_bGotDataChangedHint = true; - } - } - else if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) ) + if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) ) { // Create a range list from the token list, have the range list // updated, and bring the change back to the token list. @@ -2917,12 +2879,46 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint } while (false); } + else + { + const sal_uInt32 nId = rHint.GetId(); + if ( nId ==SFX_HINT_DYING ) + { + m_pDocument = nullptr; + } + else if ( nId == SFX_HINT_DATACHANGED ) + { + // delayed broadcast as in ScCellRangesBase + + if ( m_bGotDataChangedHint && m_pDocument ) + { + m_aDataArray.clear(); + lang::EventObject aEvent; + aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); + + if( m_pDocument ) + { + for (uno::Reference<util::XModifyListener> & xListener: m_aValueListeners) + m_pDocument->AddUnoListenerCall( xListener, aEvent ); + } + + m_bGotDataChangedHint = false; + } + } + else if ( nId == SC_HINT_CALCALL ) + { + // broadcast from DoHardRecalc - set m_bGotDataChangedHint + // (SFX_HINT_DATACHANGED follows separately) + + if ( !m_aValueListeners.empty() ) + m_bGotDataChangedHint = true; + } + } } IMPL_LINK_TYPED( ScChart2DataSequence, ValueListenerHdl, const SfxHint&, rHint, void ) { - if ( m_pDocument && dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() & SC_HINT_DATACHANGED) + if ( m_pDocument && (rHint.GetId() & SC_HINT_DATACHANGED) ) { // This may be called several times for a single change, if several formulas // in the range are notified. So only a flag is set that is checked when diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 311353a1d3c1..8cb4a28ff5c2 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -107,8 +107,7 @@ void ScChartsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -468,8 +467,7 @@ void ScChartObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index bf402f013301..d64b71d9bedd 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -324,8 +324,7 @@ ScCondFormatsObj::~ScCondFormatsObj() void ScCondFormatsObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index f59c12e9b0f7..cdf794c56833 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -101,8 +101,7 @@ void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 592ec508b35b..982b085abf9a 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -18,7 +18,7 @@ */ #include <algorithm> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include "dapiuno.hxx" @@ -300,8 +300,7 @@ void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -644,8 +643,7 @@ void ScDataPilotDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update? - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index af738efb51fe..0ce78238518c 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -19,7 +19,7 @@ #include "datauno.hxx" -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svl/zforlist.hxx> #include <svl/sharedstringpool.hxx> #include <vcl/svapp.hxx> @@ -983,8 +983,7 @@ ScFilterDescriptorBase::~ScFilterDescriptorBase() void ScFilterDescriptorBase::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 ) { pDocSh = nullptr; // invalid } @@ -1628,8 +1627,7 @@ ScDatabaseRangeObj::~ScDatabaseRangeObj() void ScDatabaseRangeObj::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 ) pDocShell = nullptr; // ungueltig geworden else if ( dynamic_cast<const ScDBRangeRefreshedHint*>(&rHint) ) { @@ -2195,8 +2193,7 @@ void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -2389,8 +2386,7 @@ void ScUnnamedDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx index fa329a03ca56..dc2d2edfb30e 100644 --- a/sc/source/ui/unoobj/defltuno.cxx +++ b/sc/source/ui/unoobj/defltuno.cxx @@ -18,7 +18,7 @@ */ #include <editeng/memberids.hrc> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svl/itemprop.hxx> #include <svx/unomid.hxx> #include <vcl/svapp.hxx> @@ -89,8 +89,7 @@ ScDocDefaultsObj::~ScDocDefaultsObj() void ScDocDefaultsObj::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 ) { pDocShell = nullptr; // document gone } diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index 425816429523..a9ce806a6d0f 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -19,7 +19,7 @@ #include <sfx2/viewfrm.hxx> #include <svx/dataaccessdescriptor.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> @@ -82,8 +82,7 @@ ScDispatchProviderInterceptor::~ScDispatchProviderInterceptor() void ScDispatchProviderInterceptor::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 ) pViewShell = nullptr; } @@ -209,8 +208,7 @@ ScDispatch::~ScDispatch() void ScDispatch::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 ) pViewShell = nullptr; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index ee03313d0c16..34a3851f65e3 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -35,7 +35,7 @@ #include <officecfg/Office/Common.hxx> #include <officecfg/Office/Calc.hxx> #include <svl/numuno.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <unotools/moduleoptions.hxx> #include <sfx2/printer.hxx> #include <sfx2/bindings.hxx> @@ -1093,46 +1093,42 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { // Not interested in reference update hints here - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) + const sal_uInt32 nId = rHint.GetId(); + if ( nId == SFX_HINT_DYING ) { - const sal_uInt32 nId = pSimpleHint->GetId(); - if ( nId == SFX_HINT_DYING ) + pDocShell = nullptr; // has become invalid + if (xNumberAgg.is()) { - pDocShell = nullptr; // has become invalid - if (xNumberAgg.is()) - { - SvNumberFormatsSupplierObj* pNumFmt = - SvNumberFormatsSupplierObj::getImplementation( + SvNumberFormatsSupplierObj* pNumFmt = + SvNumberFormatsSupplierObj::getImplementation( uno::Reference<util::XNumberFormatsSupplier>(xNumberAgg, uno::UNO_QUERY) ); - if ( pNumFmt ) - pNumFmt->SetNumberFormatter( nullptr ); - } - - DELETEZ( pPrintFuncCache ); // must be deleted because it has a pointer to the DocShell + if ( pNumFmt ) + pNumFmt->SetNumberFormatter( nullptr ); } - else if ( nId == SFX_HINT_DATACHANGED ) - { - // cached data for rendering become invalid when contents change - // (if a broadcast is added to SetDrawModified, is has to be tested here, too) - DELETEZ( pPrintFuncCache ); + DELETEZ( pPrintFuncCache ); // must be deleted because it has a pointer to the DocShell + } + else if ( nId == SFX_HINT_DATACHANGED ) + { + // cached data for rendering become invalid when contents change + // (if a broadcast is added to SetDrawModified, is has to be tested here, too) - // handle "OnCalculate" sheet events (search also for VBA event handlers) - if ( pDocShell ) + DELETEZ( pPrintFuncCache ); + + // handle "OnCalculate" sheet events (search also for VBA event handlers) + if ( pDocShell ) + { + ScDocument& rDoc = pDocShell->GetDocument(); + if ( rDoc.GetVbaEventProcessor().is() ) { - ScDocument& rDoc = pDocShell->GetDocument(); - if ( rDoc.GetVbaEventProcessor().is() ) - { - // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript - if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE, true ) ) - HandleCalculateEvents(); - } - else - { - if ( rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE ) ) - HandleCalculateEvents(); - } + // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript + if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE, true ) ) + HandleCalculateEvents(); + } + else + { + if ( rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE ) ) + HandleCalculateEvents(); } } } @@ -3008,8 +3004,7 @@ void ScDrawPagesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -3120,8 +3115,7 @@ void ScTableSheetsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -3528,8 +3522,7 @@ void ScTableColumnsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update fuer Tab und Start/Ende } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -3792,8 +3785,7 @@ void ScTableRowsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update fuer Tab und Start/Ende } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -4104,8 +4096,7 @@ void ScAnnotationsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! nTab bei Referenz-Update anpassen!!! - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -4238,8 +4229,7 @@ void ScScenariosObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update fuer Tab und Start/Ende } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/drdefuno.cxx b/sc/source/ui/unoobj/drdefuno.cxx index fcfbfc3fb91e..9f9ec17a246f 100644 --- a/sc/source/ui/unoobj/drdefuno.cxx +++ b/sc/source/ui/unoobj/drdefuno.cxx @@ -43,8 +43,7 @@ ScDrawDefaultsObj::~ScDrawDefaultsObj() throw () void ScDrawDefaultsObj::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 ) { pDocShell = nullptr; // document gone } diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx index ed82fa2d9edd..d07bb30e84fd 100644 --- a/sc/source/ui/unoobj/editsrc.cxx +++ b/sc/source/ui/unoobj/editsrc.cxx @@ -200,9 +200,9 @@ void ScAnnotationEditSource::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Ref-Update } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else { - const sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); + const sal_uInt32 nId = rHint.GetId(); if ( nId == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx index aef1d663b81e..3e121f6ffa15 100644 --- a/sc/source/ui/unoobj/eventuno.cxx +++ b/sc/source/ui/unoobj/eventuno.cxx @@ -46,8 +46,7 @@ ScSheetEventsObj::~ScSheetEventsObj() void ScSheetEventsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! reference update - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { mpDocShell = nullptr; } diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index dbab4e97d107..8edc341cbcfa 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -28,7 +28,7 @@ #include "unonames.hxx" #include "editutil.hxx" -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include <editeng/eeitem.hxx> @@ -317,8 +317,7 @@ void ScCellFieldsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Ref-Update } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/forbiuno.cxx b/sc/source/ui/unoobj/forbiuno.cxx index 708543bd58e3..80330854d023 100644 --- a/sc/source/ui/unoobj/forbiuno.cxx +++ b/sc/source/ui/unoobj/forbiuno.cxx @@ -61,8 +61,7 @@ ScForbiddenCharsObj::~ScForbiddenCharsObj() void ScForbiddenCharsObj::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 ) { pDocShell = nullptr; // document gone } diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index b54e238b00ff..445b73d3cba1 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -194,8 +194,7 @@ ScFunctionAccess::~ScFunctionAccess() void ScFunctionAccess::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING ) + if ( rHint.GetId() == SFX_HINT_DEINITIALIZING ) { // document must not be used anymore aDocCache.Clear(); diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index 10d51f738bac..b0e43eb052bc 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <sfx2/linkmgr.hxx> #include <vcl/svapp.hxx> #include <svl/sharedstringpool.hxx> @@ -91,18 +91,17 @@ void ScSheetLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! notify if links in document are changed // UpdateRef is not needed here - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) + if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint); if ( rLH.GetLinkType() == ScLinkRefType::SHEET && rLH.GetUrl() == aFileName ) Refreshed_Impl(); } + else + { + if ( rHint.GetId() == SFX_HINT_DYING ) + pDocShell = nullptr; // pointer is invalid + } } ScTableLink* ScSheetLinkObj::GetLink_Impl() const @@ -384,8 +383,7 @@ void ScSheetLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -608,13 +606,7 @@ void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! notify if links in document are changed // UpdateRef is not needed here - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) + if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint); if ( rLH.GetLinkType() == ScLinkRefType::AREA ) @@ -625,6 +617,11 @@ void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) Refreshed_Impl(); } } + else + { + if ( rHint.GetId() == SFX_HINT_DYING ) + pDocShell = nullptr; // pointer is invalid + } } // XFileLink @@ -921,8 +918,7 @@ void ScAreaLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -1047,13 +1043,7 @@ void ScDDELinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! notify if links in document are changed // UpdateRef is not needed here - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) + if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint); if ( rLH.GetLinkType() == ScLinkRefType::DDE && @@ -1062,6 +1052,11 @@ void ScDDELinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) rLH.GetDdeItem() == aItem ) //! mode is ignored Refreshed_Impl(); } + else + { + if ( rHint.GetId() == SFX_HINT_DYING ) + pDocShell = nullptr; // pointer is invalid + } } // XNamed @@ -1241,8 +1236,7 @@ void ScDDELinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index f58b10adbd0d..ba00cd1f41aa 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/sheet/NamedRangeFlag.hpp> @@ -102,8 +102,7 @@ void ScNamedRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // reference update is of no interest - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pDocShell = nullptr; // became invalid } @@ -481,8 +480,7 @@ void ScNamedRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // reference update is of no interest - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // became invalid } @@ -946,8 +944,7 @@ void ScLabelRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Ref-Update !!! - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pDocShell = nullptr; // became invalid } @@ -1067,8 +1064,7 @@ void ScLabelRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // reference update is of no interest - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // became invalid } diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx index b6b5c5ff15c5..2735e588fea0 100644 --- a/sc/source/ui/unoobj/notesuno.cxx +++ b/sc/source/ui/unoobj/notesuno.cxx @@ -20,7 +20,7 @@ #include "notesuno.hxx" #include <vcl/svapp.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <editeng/unotext.hxx> #include <editeng/unoprnms.hxx> #include <svx/svdpool.hxx> @@ -81,8 +81,7 @@ void ScAnnotationObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! Ref-Update } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && - static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + else if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 1624ca5d8b37..4961b7d4418c 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -413,8 +413,7 @@ void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -622,8 +621,7 @@ void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } @@ -1012,8 +1010,7 @@ void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) { pDocShell = nullptr; // ungueltig geworden } diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index 5d714f688521..28326e49b9a5 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -21,7 +21,7 @@ #include <vcl/virdev.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <svl/itemprop.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <com/sun/star/awt/XBitmap.hpp> @@ -83,8 +83,7 @@ ScLinkTargetTypesObj::~ScLinkTargetTypesObj() void ScLinkTargetTypesObj::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 ) pDocShell = nullptr; // document gone } @@ -150,8 +149,7 @@ ScLinkTargetTypeObj::~ScLinkTargetTypeObj() void ScLinkTargetTypeObj::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 ) pDocShell = nullptr; // document gone } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 77380f65e280..041ac3d4e747 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -1031,9 +1031,9 @@ void ScCellTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! Ref-Update } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + else { - const sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); + const sal_uInt32 nId = rHint.GetId(); if ( nId == SFX_HINT_DYING ) { pDocShell = nullptr; // invalid now diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index fab7c26e8350..9077109d1711 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -80,8 +80,7 @@ ScFormulaParserObj::~ScFormulaParserObj() void ScFormulaParserObj::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 ) mpDocShell = nullptr; } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 8356c70be6c8..f7eb7561ede5 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -136,8 +136,7 @@ ScViewPaneBase::~ScViewPaneBase() void ScViewPaneBase::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 ) pViewShell = nullptr; } @@ -2331,8 +2330,7 @@ void ScPreviewObj::release() throw() void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (p && p->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) mpViewShell = nullptr; } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 5b049d98caa5..c1042038ad32 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -625,7 +625,7 @@ bool ScDBFunc::MakePivotTable( if ( bNewTable ) { pDocSh->PostPaintExtras(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } return bSuccess; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index a629d0a5fbf8..d4ee167a72f1 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -1500,7 +1500,7 @@ void ScPreview::InvalidateLocationData(sal_uLong nId) { bLocationValid = false; if (pViewShell->HasAccessibilityObjects()) - pViewShell->BroadcastAccessibility( SfxSimpleHint( nId ) ); + pViewShell->BroadcastAccessibility( SfxHint( nId ) ); } void ScPreview::GetFocus() diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index e1792b7abdc6..eb80b302b0c1 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -186,7 +186,7 @@ ScPreviewShell::~ScPreviewShell() mpFrameWindow->SetCloseHdl(Link<SystemWindow&,void>()); // Remove close handler. // #108333#; notify Accessibility that Shell is dying and before destroy all - BroadcastAccessibility( SfxSimpleHint( SFX_HINT_DYING ) ); + BroadcastAccessibility( SfxHint( SFX_HINT_DYING ) ); DELETEZ(pAccessibilityBroadcaster); SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster(); diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx index da0df15090e2..9681f33f0948 100644 --- a/sc/source/ui/view/prevwsh2.cxx +++ b/sc/source/ui/view/prevwsh2.cxx @@ -18,7 +18,7 @@ */ #include <svx/svdmodel.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include "prevwsh.hxx" #include "docsh.hxx" @@ -30,9 +30,24 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { bool bDataChanged = false; - if (dynamic_cast<const SfxSimpleHint*>(&rHint)) + if (dynamic_cast<const ScPaintHint*>(&rHint)) { - switch ( static_cast<const SfxSimpleHint&>(rHint).GetId() ) + if ( static_cast<const ScPaintHint&>(rHint).GetPrintFlag() ) + { + sal_uInt16 nParts = static_cast<const ScPaintHint&>(rHint).GetParts(); + if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE )) + bDataChanged = true; + } + } + else if (dynamic_cast<const SdrHint*>(&rHint)) + { + // SdrHints are no longer used for invalidating, thus react on objectchange instead + if(SdrHintKind::ObjectChange == static_cast<const SdrHint&>(rHint).GetKind()) + bDataChanged = true; + } + else + { + switch ( rHint.GetId() ) { case FID_DATACHANGED: case SID_SCPRINTOPTIONS: @@ -47,21 +62,6 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; } } - else if (dynamic_cast<const ScPaintHint*>(&rHint)) - { - if ( static_cast<const ScPaintHint&>(rHint).GetPrintFlag() ) - { - sal_uInt16 nParts = static_cast<const ScPaintHint&>(rHint).GetParts(); - if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE )) - bDataChanged = true; - } - } - else if (dynamic_cast<const SdrHint*>(&rHint)) - { - // SdrHints are no longer used for invalidating, thus react on objectchange instead - if(SdrHintKind::ObjectChange == static_cast<const SdrHint&>(rHint).GetKind()) - bDataChanged = true; - } if (bDataChanged) pPreview->DataChanged(true); diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 5ac34bd625a3..1686e3b18b40 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -737,7 +737,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) UpdateVarZoom(); // update variable zoom types (after resizing GridWindows) if (aViewData.GetViewShell()->HasAccessibilityObjects()) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_WINDOWRESIZED)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_WINDOWRESIZED)); } void ScTabView::UpdateVarZoom() @@ -2175,7 +2175,7 @@ void ScTabView::SetNewVisArea() } } if (aViewData.GetViewShell()->HasAccessibilityObjects()) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_VISAREACHANGED)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_VISAREACHANGED)); } bool ScTabView::HasPageFieldDataAtCursor() const diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 4b6f8d1993d8..22c7a9619b45 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -489,7 +489,7 @@ void ScTabView::SelectionChanged() rBindings.Invalidate( SID_SORT_DESCENDING ); if (aViewData.GetViewShell()->HasAccessibilityObjects()) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_CURSORCHANGED)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_CURSORCHANGED)); CellContentChanged(); } @@ -498,7 +498,7 @@ void ScTabView::CursorPosChanged() { bool bRefMode = SC_MOD()->IsFormulaMode(); if ( !bRefMode ) // check that RefMode works when switching sheets - aViewData.GetDocShell()->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) ); + aViewData.GetDocShell()->Broadcast( SfxHint( FID_KILLEDITVIEW ) ); // Broadcast, so that other Views of the document also switch @@ -1945,7 +1945,7 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW } if (aViewData.GetViewShell()->HasAccessibilityObjects()) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_ENTEREDITMODE)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_ENTEREDITMODE)); } void ScTabView::UpdateEditView() @@ -1987,7 +1987,7 @@ void ScTabView::KillEditView( bool bNoPaint ) // #108931#; notify accessibility before all things happen if ((bNotifyAcc) && (aViewData.GetViewShell()->HasAccessibilityObjects())) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_LEAVEEDITMODE)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_LEAVEEDITMODE)); aViewData.ResetEditView(); for (i=0; i<4; i++) diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 9d9368e96c07..a9d3dcab6707 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -241,7 +241,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) pFormSh->SetView(pDrawView); if (aViewData.GetViewShell()->HasAccessibilityObjects()) - aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_MAKEDRAWLAYER)); + aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SC_HINT_ACC_MAKEDRAWLAYER)); } } @@ -280,7 +280,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) if (aViewData.GetViewShell()->HasAccessibilityObjects()) { - SfxSimpleHint aAccHint(SC_HINT_ACC_TABLECHANGED); + SfxHint aAccHint(SC_HINT_ACC_TABLECHANGED); aViewData.GetViewShell()->BroadcastAccessibility(aAccHint); } diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 6da7a8a0f784..c4ff1faf96e9 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -158,7 +158,7 @@ void ScTabViewShell::Activate(bool bMDI) if ( bFirstActivate ) { - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_NAVIGATOR_UPDATEALL ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_NAVIGATOR_UPDATEALL ) ); bFirstActivate = false; // ReadExtOptions (view settings from Excel import) must also be done diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 261d2ce09bf6..6748fb558f7f 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -18,7 +18,7 @@ */ #include "scitems.hxx" -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svl/zforlist.hxx> #include <svx/numfmtsh.hxx> #include <svx/numinf.hxx> @@ -42,96 +42,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if (dynamic_cast<const SfxSimpleHint*>(&rHint)) // ohne Parameter - { - const sal_uInt32 nSlot = static_cast<const SfxSimpleHint&>(rHint).GetId(); - switch ( nSlot ) - { - case FID_DATACHANGED: - UpdateFormulas(); - break; - - case FID_REFMODECHANGED: - { - bool bRefMode = SC_MOD()->IsFormulaMode(); - if (!bRefMode) - StopRefMode(); - else - { - GetSelEngine()->Reset(); - GetFunctionSet().SetAnchorFlag(true); - // AnchorFlag, damit gleich mit Control angehaengt werden kann - } - } - break; - - case FID_KILLEDITVIEW: - case FID_KILLEDITVIEW_NOPAINT: - StopEditShell(); - KillEditView( nSlot == FID_KILLEDITVIEW_NOPAINT ); - break; - - case SFX_HINT_DOCCHANGED: - { - ScDocument* pDoc = GetViewData().GetDocument(); - if (!pDoc->HasTable( GetViewData().GetTabNo() )) - { - SetTabNo(0); - } - } - break; - - case SC_HINT_DRWLAYER_NEW: - MakeDrawView(TRISTATE_INDET); - break; - - case SC_HINT_DOC_SAVED: - { - // beim "Save as" kann ein vorher schreibgeschuetztes Dokument - // bearbeitbar werden, deshalb die Layer-Locks neu (#39884#) - // (Invalidate etc. passiert schon vom Sfx her) - // bei SID_EDITDOC kommt kein SFX_HINT_TITLECHANGED, darum - // der eigene Hint aus DoSaveCompleted - //! was ist mit SFX_HINT_SAVECOMPLETED ? - - UpdateLayerLocks(); - - // Design-Modus bei jedem Speichern anzupassen, waere zuviel - // (beim Speichern unter gleichem Namen soll er unveraendert bleiben) - // Darum nur bei SFX_HINT_MODECHANGED (vom ViewFrame) - } - break; - - case SFX_HINT_MODECHANGED: - // Da man sich nicht mehr darauf verlassen kann, woher - // dieser Hint kommt, den Design-Modus immer dann umschalten, wenn der - // ReadOnly-Status sich wirklich geaendert hat: - - if ( GetViewData().GetSfxDocShell()->IsReadOnly() != bReadOnly ) - { - bReadOnly = GetViewData().GetSfxDocShell()->IsReadOnly(); - - SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadOnly); - GetViewData().GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE, - SfxCallMode::ASYNCHRON, { &aItem }); - - UpdateInputContext(); - } - break; - - case SC_HINT_SHOWRANGEFINDER: - PaintRangeFinder(-1); - break; - - case SC_HINT_FORCESETTAB: - SetTabNo( GetViewData().GetTabNo(), true ); - break; - - default: - break; - } - } - else if (dynamic_cast<const ScPaintHint*>(&rHint)) // neu zeichnen + if (dynamic_cast<const ScPaintHint*>(&rHint)) // neu zeichnen { const ScPaintHint* pHint = static_cast<const ScPaintHint*>(&rHint); sal_uInt16 nParts = pHint->GetParts(); @@ -300,6 +211,95 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } } + else // ohne Parameter + { + const sal_uInt32 nSlot = rHint.GetId(); + switch ( nSlot ) + { + case FID_DATACHANGED: + UpdateFormulas(); + break; + + case FID_REFMODECHANGED: + { + bool bRefMode = SC_MOD()->IsFormulaMode(); + if (!bRefMode) + StopRefMode(); + else + { + GetSelEngine()->Reset(); + GetFunctionSet().SetAnchorFlag(true); + // AnchorFlag, damit gleich mit Control angehaengt werden kann + } + } + break; + + case FID_KILLEDITVIEW: + case FID_KILLEDITVIEW_NOPAINT: + StopEditShell(); + KillEditView( nSlot == FID_KILLEDITVIEW_NOPAINT ); + break; + + case SFX_HINT_DOCCHANGED: + { + ScDocument* pDoc = GetViewData().GetDocument(); + if (!pDoc->HasTable( GetViewData().GetTabNo() )) + { + SetTabNo(0); + } + } + break; + + case SC_HINT_DRWLAYER_NEW: + MakeDrawView(TRISTATE_INDET); + break; + + case SC_HINT_DOC_SAVED: + { + // beim "Save as" kann ein vorher schreibgeschuetztes Dokument + // bearbeitbar werden, deshalb die Layer-Locks neu (#39884#) + // (Invalidate etc. passiert schon vom Sfx her) + // bei SID_EDITDOC kommt kein SFX_HINT_TITLECHANGED, darum + // der eigene Hint aus DoSaveCompleted + //! was ist mit SFX_HINT_SAVECOMPLETED ? + + UpdateLayerLocks(); + + // Design-Modus bei jedem Speichern anzupassen, waere zuviel + // (beim Speichern unter gleichem Namen soll er unveraendert bleiben) + // Darum nur bei SFX_HINT_MODECHANGED (vom ViewFrame) + } + break; + + case SFX_HINT_MODECHANGED: + // Da man sich nicht mehr darauf verlassen kann, woher + // dieser Hint kommt, den Design-Modus immer dann umschalten, wenn der + // ReadOnly-Status sich wirklich geaendert hat: + + if ( GetViewData().GetSfxDocShell()->IsReadOnly() != bReadOnly ) + { + bReadOnly = GetViewData().GetSfxDocShell()->IsReadOnly(); + + SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadOnly); + GetViewData().GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE, + SfxCallMode::ASYNCHRON, { &aItem }); + + UpdateInputContext(); + } + break; + + case SC_HINT_SHOWRANGEFINDER: + PaintRangeFinder(-1); + break; + + case SC_HINT_FORCESETTAB: + SetTabNo( GetViewData().GetTabNo(), true ); + break; + + default: + break; + } + } SfxViewShell::Notify( rBC, rHint ); } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index d25958848db5..d16e7e84caf3 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -360,7 +360,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) { pDlg->Execute(); rBindings.Invalidate( nSlot ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator rReq.Done(); } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index a92d2bea2985..234299997bcf 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2135,7 +2135,7 @@ void ScViewFunc::InsertTables(std::vector<OUString>& aNames, SCTAB nTab, SetTabNo( nTab, true ); pDocSh->PostPaintExtras(); pDocSh->SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } } @@ -2161,7 +2161,7 @@ bool ScViewFunc::AppendTable( const OUString& rName, bool bRecord ) SetTabNo( nTab, true ); pDocSh->PostPaintExtras(); pDocSh->SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); return true; } else @@ -2220,9 +2220,9 @@ void ScViewFunc::DeleteTables( const SCTAB nTab, SCTAB nSheets ) pDocSh->SetDocumentModified(); SfxApplication* pSfxApp = SfxGetpApp(); // Navigator - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } } @@ -2342,9 +2342,9 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) pDocSh->SetDocumentModified(); SfxApplication* pSfxApp = SfxGetpApp(); // Navigator - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } else { @@ -2540,8 +2540,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS ); SfxApplication* pSfxApp = SfxGetpApp(); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); + pSfxApp->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); pDocSh->PostPaintExtras(); pDocSh->PostPaintGridAll(); @@ -2767,7 +2767,7 @@ void ScViewFunc::MoveTable( TheTabs.clear(); pDestShell->SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); } else { @@ -2922,7 +2922,7 @@ void ScViewFunc::ShowTable( const std::vector<OUString>& rNames ) { rDoc.SetVisible( nPos, true ); SetTabNo( nPos, true ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); if (!bFound) bFound = true; if (bUndo) @@ -2982,7 +2982,7 @@ void ScViewFunc::HideTable( const ScMarkData& rMark ) } // Update views - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) ); pDocSh->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_EXTRAS); pDocSh->SetDocumentModified(); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 5a9707c18e09..18f4ee1a836f 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1731,7 +1731,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) nCurX = static_cast<SCCOL>(aSpans[0].mnStart); SetCursor( nCurX, nCurY ); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); } // delete contents @@ -2676,7 +2676,7 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol, rDoc.CompileHybridFormula(); aModificator.SetDocumentModified(); - SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREAS_CHANGED ) ); } delete pNewEntry; // if it wasn't inserted diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 58b69b6141e9..879f41c40ba7 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -597,7 +597,7 @@ void ScXMLSourceDlg::OkPressed() // Don't forget to broadcast the change. SfxObjectShell* pShell = mpDoc->GetDocumentShell(); - pShell->Broadcast(SfxSimpleHint(FID_DATACHANGED)); + pShell->Broadcast(SfxHint(FID_DATACHANGED)); // Repaint the grid to force repaint the cell values. ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); |