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/undo | |
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/undo')
-rw-r--r-- | sc/source/ui/undo/undoblk.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk3.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/undo/undocell.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undodat.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/undo/undorangename.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 34 |
6 files changed, 37 insertions, 37 deletions
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 */) |