From 7d8196ea2f4ec3634dbad7367345e62c4ea9893d Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 22 Sep 2016 22:20:48 +0200 Subject: perf: eliminate SfxSimpleHint and move to SfxHint, tdf#87101 related There were over 150 places in *::Notify() functions that did some dynamic_cast 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 Tested-by: Eike Rathke --- accessibility/inc/pch/precompiled_acc.hxx | 1 - basctl/inc/pch/precompiled_basctl.hxx | 1 - basctl/source/basicide/basidesh.cxx | 107 ++++++------ basic/source/basmgr/basicmanagerrepository.cxx | 5 +- basic/source/basmgr/basmgr.cxx | 4 +- chart2/inc/pch/precompiled_chartcontroller.hxx | 1 - cui/inc/pch/precompiled_cui.hxx | 1 - dbaccess/source/ui/control/sqledit.cxx | 1 - editeng/source/editeng/impedit5.cxx | 6 +- include/basic/sbx.hxx | 6 +- include/sfx2/app.hxx | 1 - include/svl/hint.hxx | 30 +++- include/svl/smplhint.hxx | 60 ------- include/svx/svdpntv.hxx | 1 - include/vcl/textdata.hxx | 6 +- reportdesign/inc/pch/precompiled_rptui.hxx | 1 - reportdesign/source/core/sdr/UndoActions.cxx | 1 - reportdesign/source/core/sdr/UndoEnv.cxx | 5 +- reportdesign/source/ui/misc/ColorListener.cxx | 5 +- .../source/ui/report/ReportControllerObserver.cxx | 1 - reportdesign/source/ui/report/StartMarker.cxx | 4 +- sc/inc/brdcst.hxx | 2 +- sc/inc/bulkdatahint.hxx | 2 +- sc/inc/pch/precompiled_sc.hxx | 1 - sc/inc/refhint.hxx | 2 +- sc/inc/simplehintids.hxx | 2 +- sc/source/core/data/colorscale.cxx | 3 +- sc/source/core/data/documen2.cxx | 2 +- sc/source/core/data/documen3.cxx | 5 +- sc/source/core/data/documen7.cxx | 2 +- sc/source/core/data/documen8.cxx | 2 +- sc/source/core/data/formulacell.cxx | 6 +- sc/source/core/data/stlsheet.cxx | 5 +- sc/source/core/tool/addinlis.cxx | 2 +- sc/source/core/tool/adiasync.cxx | 2 +- sc/source/core/tool/brdcst.cxx | 2 +- sc/source/core/tool/bulkdatahint.cxx | 2 +- sc/source/core/tool/cellform.cxx | 1 - sc/source/core/tool/grouparealistener.cxx | 10 +- sc/source/core/tool/refhint.cxx | 2 +- .../ui/Accessibility/AccessibleContextBase.cxx | 12 +- sc/source/ui/Accessibility/AccessibleDocument.cxx | 13 +- .../AccessibleDocumentPagePreview.cxx | 25 ++- .../ui/Accessibility/AccessiblePageHeader.cxx | 74 ++++----- .../ui/Accessibility/AccessiblePageHeaderArea.cxx | 20 +-- .../ui/Accessibility/AccessiblePreviewCell.cxx | 3 +- .../Accessibility/AccessiblePreviewHeaderCell.cxx | 26 ++- .../ui/Accessibility/AccessiblePreviewTable.cxx | 30 ++-- .../ui/Accessibility/AccessibleSpreadsheet.cxx | 127 +++++++------- sc/source/ui/Accessibility/AccessibleText.cxx | 21 +-- sc/source/ui/app/inputhdl.cxx | 20 +-- sc/source/ui/app/inputwin.cxx | 13 +- sc/source/ui/app/scmod.cxx | 7 +- sc/source/ui/dbgui/csvgrid.cxx | 1 - sc/source/ui/docshell/dbdocfun.cxx | 8 +- sc/source/ui/docshell/docfunc.cxx | 30 ++-- sc/source/ui/docshell/docsh.cxx | 36 ++-- sc/source/ui/docshell/docsh2.cxx | 2 +- sc/source/ui/docshell/docsh3.cxx | 4 +- sc/source/ui/docshell/docsh4.cxx | 8 +- sc/source/ui/docshell/docsh5.cxx | 10 +- sc/source/ui/docshell/externalrefmgr.cxx | 1 - sc/source/ui/docshell/servobj.cxx | 11 +- sc/source/ui/inc/AccessibilityHints.hxx | 1 - sc/source/ui/miscdlgs/anyrefdg.cxx | 2 +- sc/source/ui/namedlg/namedefdlg.cxx | 2 +- sc/source/ui/navipi/navipi.cxx | 23 ++- sc/source/ui/undo/undoblk.cxx | 16 +- sc/source/ui/undo/undoblk3.cxx | 8 +- sc/source/ui/undo/undocell.cxx | 2 +- sc/source/ui/undo/undodat.cxx | 8 +- sc/source/ui/undo/undorangename.cxx | 6 +- sc/source/ui/undo/undotab.cxx | 34 ++-- sc/source/ui/unoobj/addruno.cxx | 3 +- sc/source/ui/unoobj/appluno.cxx | 2 +- sc/source/ui/unoobj/cellsuno.cxx | 59 +++---- sc/source/ui/unoobj/chart2uno.cxx | 82 +++++----- sc/source/ui/unoobj/chartuno.cxx | 6 +- sc/source/ui/unoobj/condformatuno.cxx | 3 +- sc/source/ui/unoobj/confuno.cxx | 3 +- sc/source/ui/unoobj/dapiuno.cxx | 8 +- sc/source/ui/unoobj/datauno.cxx | 14 +- sc/source/ui/unoobj/defltuno.cxx | 5 +- sc/source/ui/unoobj/dispuno.cxx | 8 +- sc/source/ui/unoobj/docuno.cxx | 82 ++++------ sc/source/ui/unoobj/drdefuno.cxx | 3 +- sc/source/ui/unoobj/editsrc.cxx | 4 +- sc/source/ui/unoobj/eventuno.cxx | 3 +- sc/source/ui/unoobj/fielduno.cxx | 5 +- sc/source/ui/unoobj/forbiuno.cxx | 3 +- sc/source/ui/unoobj/funcuno.cxx | 3 +- sc/source/ui/unoobj/linkuno.cxx | 50 +++--- sc/source/ui/unoobj/nameuno.cxx | 14 +- sc/source/ui/unoobj/notesuno.cxx | 5 +- sc/source/ui/unoobj/styleuno.cxx | 9 +- sc/source/ui/unoobj/targuno.cxx | 8 +- sc/source/ui/unoobj/textuno.cxx | 4 +- sc/source/ui/unoobj/tokenuno.cxx | 3 +- sc/source/ui/unoobj/viewuno.cxx | 6 +- sc/source/ui/view/dbfunc3.cxx | 2 +- sc/source/ui/view/preview.cxx | 2 +- sc/source/ui/view/prevwsh.cxx | 2 +- sc/source/ui/view/prevwsh2.cxx | 36 ++-- sc/source/ui/view/tabview.cxx | 4 +- sc/source/ui/view/tabview3.cxx | 8 +- sc/source/ui/view/tabview5.cxx | 4 +- sc/source/ui/view/tabvwsh4.cxx | 2 +- sc/source/ui/view/tabvwsh5.cxx | 182 ++++++++++----------- sc/source/ui/view/tabvwshb.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 26 +-- sc/source/ui/view/viewfunc.cxx | 4 +- sc/source/ui/xmlsource/xmlsourcedlg.cxx | 2 +- scripting/source/basprov/basscript.cxx | 3 +- sd/inc/pch/precompiled_sd.hxx | 2 +- sd/inc/pch/precompiled_sdui.hxx | 1 - sd/source/core/anminfo.cxx | 1 - sd/source/core/drawdoc3.cxx | 2 +- sd/source/core/sdpage.cxx | 8 +- sd/source/core/stlpool.cxx | 8 +- sd/source/core/stlsheet.cxx | 19 +-- .../accessibility/AccessibleOutlineEditSource.cxx | 3 +- sd/source/ui/app/sdmod.cxx | 3 +- sd/source/ui/app/sdxfer.cxx | 3 +- sd/source/ui/dlg/docprev.cxx | 3 +- sd/source/ui/dlg/unchss.cxx | 10 +- sd/source/ui/docshell/docshell.cxx | 4 +- sd/source/ui/framework/tools/FrameworkHelper.cxx | 3 +- sd/source/ui/func/fupage.cxx | 4 +- sd/source/ui/func/fuprlout.cxx | 1 - sd/source/ui/func/fuprobjs.cxx | 4 +- sd/source/ui/func/futempl.cxx | 8 +- .../ui/slidesorter/controller/SlsListener.cxx | 5 +- .../slidesorter/controller/SlsTransferableData.cxx | 5 +- sd/source/ui/tools/EventMultiplexer.cxx | 5 +- sd/source/ui/tools/PreviewRenderer.cxx | 3 +- sd/source/ui/unoidl/unomodel.cxx | 4 +- sd/source/ui/view/DocumentRenderer.cxx | 3 +- sd/source/ui/view/FormShellManager.cxx | 3 +- sd/source/ui/view/WindowUpdater.cxx | 1 - sd/source/ui/view/drawview.cxx | 10 +- sd/source/ui/view/drviewsa.cxx | 3 +- sd/source/ui/view/viewoverlaymanager.cxx | 8 +- sfx2/source/appl/app.cxx | 2 +- sfx2/source/appl/appbaslib.cxx | 3 +- sfx2/source/appl/appcfg.cxx | 3 +- sfx2/source/appl/appinit.cxx | 2 +- sfx2/source/control/bindings.cxx | 6 +- sfx2/source/control/request.cxx | 5 +- sfx2/source/dialog/basedlgs.cxx | 24 +-- sfx2/source/dialog/templdlg.cxx | 44 +++-- sfx2/source/doc/objmisc.cxx | 20 +-- sfx2/source/doc/objserv.cxx | 2 +- sfx2/source/doc/objstor.cxx | 8 +- sfx2/source/doc/objxtor.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 22 +-- sfx2/source/inc/openurlhint.hxx | 4 +- sfx2/source/notify/openurlhint.cxx | 2 +- sfx2/source/sidebar/SidebarController.cxx | 1 - sfx2/source/view/frame.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 173 ++++++++++---------- sfx2/source/view/viewprn.cxx | 14 +- starmath/inc/format.hxx | 4 +- starmath/inc/pch/precompiled_sm.hxx | 1 - starmath/source/cfgitem.cxx | 2 +- starmath/source/document.cxx | 6 +- starmath/source/view.cxx | 18 +- svl/source/config/ctloptions.cxx | 2 +- svl/source/items/itempool.cxx | 4 +- svl/source/items/style.cxx | 4 +- svl/source/notify/SfxBroadcaster.cxx | 4 +- svl/source/notify/broadcast.cxx | 4 +- svtools/inc/pch/precompiled_svt.hxx | 1 - svtools/source/config/accessibilityoptions.cxx | 10 +- svtools/source/config/colorcfg.cxx | 1 - svtools/source/config/extcolorcfg.cxx | 8 +- svx/inc/pch/precompiled_svx.hxx | 1 - svx/inc/pch/precompiled_svxcore.hxx | 1 - svx/source/accessibility/AccessibleTextHelper.cxx | 10 +- .../accessibility/GraphCtlAccessibleContext.cxx | 5 +- svx/source/dialog/svxruler.cxx | 9 +- svx/source/form/fmundo.cxx | 4 +- svx/source/form/navigatortreemodel.cxx | 4 +- svx/source/sdr/properties/attributeproperties.cxx | 2 - .../sdr/properties/customshapeproperties.cxx | 5 +- svx/source/sdr/properties/textproperties.cxx | 5 +- svx/source/svdraw/svdoattr.cxx | 5 +- svx/source/svdraw/svdoedge.cxx | 9 +- svx/source/svdraw/svdomeas.cxx | 1 - svx/source/svdraw/svdotxat.cxx | 1 - svx/source/svdraw/svdpage.cxx | 13 +- svx/source/svdraw/svdpntv.cxx | 5 +- svx/source/tbxctrls/tbcontrl.cxx | 1 - svx/source/unodraw/unoshtxt.cxx | 17 +- sw/inc/fmtfld.hxx | 1 - sw/inc/pch/precompiled_msword.hxx | 1 - sw/inc/pch/precompiled_sw.hxx | 1 - sw/inc/pch/precompiled_swui.hxx | 1 - sw/inc/redline.hxx | 1 - sw/inc/section.hxx | 6 +- sw/inc/swhints.hxx | 2 +- sw/source/core/doc/DocumentDrawModelManager.cxx | 4 +- sw/source/core/docnode/ndsect.cxx | 1 - sw/source/core/docnode/nodes.cxx | 1 - sw/source/core/docnode/section.cxx | 1 - sw/source/core/layout/frmtool.cxx | 3 +- sw/source/core/layout/pagechg.cxx | 2 +- sw/source/core/txtnode/atrfld.cxx | 1 - sw/source/core/txtnode/ndtxt.cxx | 4 +- sw/source/core/txtnode/thints.cxx | 1 - sw/source/core/unocore/unostyle.cxx | 12 +- sw/source/uibase/app/apphdl.cxx | 4 +- sw/source/uibase/app/docsh2.cxx | 18 +- sw/source/uibase/app/docstyle.cxx | 1 - sw/source/uibase/docvw/PostItMgr.cxx | 92 +++++------ sw/source/uibase/misc/redlndlg.cxx | 3 +- sw/source/uibase/uiview/srcview.cxx | 10 +- sw/source/uibase/uiview/view.cxx | 26 +-- sw/source/uibase/uno/unoatxt.cxx | 22 +-- sw/source/uibase/utlui/content.cxx | 3 +- sw/source/uibase/utlui/glbltree.cxx | 3 +- sw/source/uibase/utlui/navipi.cxx | 3 +- vbahelper/inc/pch/precompiled_msforms.hxx | 1 - vbahelper/inc/pch/precompiled_vbahelper.hxx | 2 +- vcl/source/edit/textdata.cxx | 4 +- vcl/source/edit/vclmedit.cxx | 1 - 225 files changed, 1092 insertions(+), 1368 deletions(-) delete mode 100644 include/svl/smplhint.hxx diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index f0c4ba2f934a..e50eaef3d3b7 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -286,7 +286,6 @@ #include #include #include -#include #include #include #include diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx index 6cb86b18461e..ace1ace83800 100644 --- a/basctl/inc/pch/precompiled_basctl.hxx +++ b/basctl/inc/pch/precompiled_basctl.hxx @@ -418,7 +418,6 @@ #include #include #include -#include #include #include #include diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 75a75c04c072..e919ebe43ab2 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -480,71 +480,68 @@ void Shell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if (GetShell()) { - if (SfxSimpleHint const* pSimpleHint = dynamic_cast(&rHint)) + switch (rHint.GetId()) { - switch (pSimpleHint->GetId()) - { - case SFX_HINT_DYING: + case SFX_HINT_DYING: { EndListening( rBC, true /* log off all */ ); aObjectCatalog->UpdateEntries(); } - break; - } + break; + } - if (SbxHint const* pSbxHint = dynamic_cast(&rHint)) + if (SbxHint const* pSbxHint = dynamic_cast(&rHint)) + { + const sal_uInt32 nHintId = pSbxHint->GetId(); + if ( ( nHintId == SBX_HINT_BASICSTART ) || + ( nHintId == SBX_HINT_BASICSTOP ) ) { - const sal_uInt32 nHintId = pSbxHint->GetId(); - if ( ( nHintId == SBX_HINT_BASICSTART ) || - ( nHintId == SBX_HINT_BASICSTOP ) ) + if (SfxBindings* pBindings = GetBindingsPtr()) { - if (SfxBindings* pBindings = GetBindingsPtr()) - { - pBindings->Invalidate( SID_BASICRUN ); - pBindings->Update( SID_BASICRUN ); - pBindings->Invalidate( SID_BASICCOMPILE ); - pBindings->Update( SID_BASICCOMPILE ); - pBindings->Invalidate( SID_BASICSTEPOVER ); - pBindings->Update( SID_BASICSTEPOVER ); - pBindings->Invalidate( SID_BASICSTEPINTO ); - pBindings->Update( SID_BASICSTEPINTO ); - pBindings->Invalidate( SID_BASICSTEPOUT ); - pBindings->Update( SID_BASICSTEPOUT ); - pBindings->Invalidate( SID_BASICSTOP ); - pBindings->Update( SID_BASICSTOP ); - pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS ); - pBindings->Update( SID_BASICIDE_MANAGEBRKPNTS ); - pBindings->Invalidate( SID_BASICIDE_MODULEDLG ); - pBindings->Update( SID_BASICIDE_MODULEDLG ); - pBindings->Invalidate( SID_BASICLOAD ); - pBindings->Update( SID_BASICLOAD ); - } + pBindings->Invalidate( SID_BASICRUN ); + pBindings->Update( SID_BASICRUN ); + pBindings->Invalidate( SID_BASICCOMPILE ); + pBindings->Update( SID_BASICCOMPILE ); + pBindings->Invalidate( SID_BASICSTEPOVER ); + pBindings->Update( SID_BASICSTEPOVER ); + pBindings->Invalidate( SID_BASICSTEPINTO ); + pBindings->Update( SID_BASICSTEPINTO ); + pBindings->Invalidate( SID_BASICSTEPOUT ); + pBindings->Update( SID_BASICSTEPOUT ); + pBindings->Invalidate( SID_BASICSTOP ); + pBindings->Update( SID_BASICSTOP ); + pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT ); + pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT ); + pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS ); + pBindings->Update( SID_BASICIDE_MANAGEBRKPNTS ); + pBindings->Invalidate( SID_BASICIDE_MODULEDLG ); + pBindings->Update( SID_BASICIDE_MODULEDLG ); + pBindings->Invalidate( SID_BASICLOAD ); + pBindings->Update( SID_BASICLOAD ); + } - if ( nHintId == SBX_HINT_BASICSTOP ) - { - // not only at error/break or explicit stoppage, - // if the update is turned off due to a programming bug - BasicStopped(); - if (pLayout) - pLayout->UpdateDebug(true); // clear... - if( m_pCurLocalizationMgr ) - m_pCurLocalizationMgr->handleBasicStopped(); - } - else if( m_pCurLocalizationMgr ) - { - m_pCurLocalizationMgr->handleBasicStarted(); - } + if ( nHintId == SBX_HINT_BASICSTOP ) + { + // not only at error/break or explicit stoppage, + // if the update is turned off due to a programming bug + BasicStopped(); + if (pLayout) + pLayout->UpdateDebug(true); // clear... + if( m_pCurLocalizationMgr ) + m_pCurLocalizationMgr->handleBasicStopped(); + } + else if( m_pCurLocalizationMgr ) + { + m_pCurLocalizationMgr->handleBasicStarted(); + } - for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) - { - BaseWindow* pWin = it->second; - if ( nHintId == SBX_HINT_BASICSTART ) - pWin->BasicStarted(); - else - pWin->BasicStopped(); - } + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) + { + BaseWindow* pWin = it->second; + if ( nHintId == SBX_HINT_BASICSTART ) + pWin->BasicStarted(); + else + pWin->BasicStopped(); } } } diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 25b71c757333..cb09047ec184 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -577,8 +577,7 @@ namespace basic void ImplRepository::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 ) // not interested in return; diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 55ccad287424..66e16c5b5a5e 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -851,7 +851,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) BasicManager::~BasicManager() { // Notify listener if something needs to be saved - Broadcast( SfxSimpleHint( SFX_HINT_DYING) ); + Broadcast( SfxHint( SFX_HINT_DYING) ); } void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager ) diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx index b74e19a0502a..458f9b952255 100644 --- a/chart2/inc/pch/precompiled_chartcontroller.hxx +++ b/chart2/inc/pch/precompiled_chartcontroller.hxx @@ -382,7 +382,6 @@ #include #include #include -#include #include #include #include diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index bd28f0068276..a071f598c8f6 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -348,7 +348,6 @@ #include #include #include -#include #include #include #include diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx index 8fa8486c3a38..d06125abc262 100644 --- a/dbaccess/source/ui/control/sqledit.cxx +++ b/dbaccess/source/ui/control/sqledit.cxx @@ -33,7 +33,6 @@ #include "querycontroller.hxx" #include "undosqledit.hxx" #include "QueryDesignView.hxx" -#include #include #include diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index e360c0ad3c00..e091a142cec2 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool ) @@ -153,10 +153,10 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) pStyle = static_cast( pStyleSheetHint->GetStyleSheet() ); nId = pStyleSheetHint->GetHint(); } - else if ( dynamic_cast(&rHint) && dynamic_cast< const SfxStyleSheet* >(&rBC) != nullptr ) + else if ( dynamic_cast< const SfxStyleSheet* >(&rBC) != nullptr ) { pStyle = static_cast(&rBC); - nId = dynamic_cast(&rHint)->GetId(); + nId = rHint.GetId(); } if ( pStyle ) diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx index 96fe6dbff9b1..35d09c45d450 100644 --- a/include/basic/sbx.hxx +++ b/include/basic/sbx.hxx @@ -21,7 +21,7 @@ #define INCLUDED_BASIC_SBX_HXX #include -#include +#include #include #include @@ -90,11 +90,11 @@ public: void SetComment( const OUString& r ) { aComment = r; } }; -class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint +class BASIC_DLLPUBLIC SbxHint : public SfxHint { SbxVariable* pVar; public: - SbxHint( sal_uInt32 n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {} + SbxHint( sal_uInt32 n, SbxVariable* v ) : SfxHint( n ), pVar( v ) {} SbxVariable* GetVar() const { return pVar; } }; diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 947387a1a090..7117b6c0bb3c 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 4aec70090c54..8de965d73af5 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -19,15 +19,43 @@ #ifndef INCLUDED_SVL_HINT_HXX #define INCLUDED_SVL_HINT_HXX +#include #include +#define SFX_HINT_DYING 0x00000001 +#define SFX_HINT_NAMECHANGED 0x00000002 +#define SFX_HINT_TITLECHANGED 0x00000004 +#define SFX_HINT_DATACHANGED 0x00000008 +#define SFX_HINT_DOCCHANGED 0x00000010 +#define SFX_HINT_UPDATEDONE 0x00000020 +#define SFX_HINT_DEINITIALIZING 0x00000040 +#define SFX_HINT_MODECHANGED 0x00000080 + // unused, formerly SFX_HINT_CANCELLABLE + // unused, formerly SFX_HINT_DATAAVAILABLE + // unused, formerly SFX_HINT_SAVECOMPLETED + // unused, formerly SFX_HINT_RELEASEREF +#define SFX_HINT_COLORS_CHANGED 0x00001000 +#define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000 +#define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000 + // unused, formerly SFX_HINT_VIEWCREATED +#define SFX_HINT_USER00 0x00010000 +#define SFX_HINT_USER01 0x00020000 +#define SFX_HINT_USER02 0x00040000 +#define SFX_HINT_USER03 0x00080000 +#define SFX_HINT_USER04 0x00100000 +#define SFX_HINT_USER05 0x00200000 + class SVL_DLLPUBLIC SfxHint { +private: + sal_uInt32 mnId; public: + SfxHint() : mnId(0) {} + explicit SfxHint( sal_uInt32 nId ) : mnId(nId) {} virtual ~SfxHint(); + sal_uInt32 GetId() const { return mnId; } }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/smplhint.hxx b/include/svl/smplhint.hxx deleted file mode 100644 index bdf980073ab1..000000000000 --- a/include/svl/smplhint.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVL_SMPLHINT_HXX -#define INCLUDED_SVL_SMPLHINT_HXX - -#include -#include -#include - -#define SFX_HINT_DYING 0x00000001 -#define SFX_HINT_NAMECHANGED 0x00000002 -#define SFX_HINT_TITLECHANGED 0x00000004 -#define SFX_HINT_DATACHANGED 0x00000008 -#define SFX_HINT_DOCCHANGED 0x00000010 -#define SFX_HINT_UPDATEDONE 0x00000020 -#define SFX_HINT_DEINITIALIZING 0x00000040 -#define SFX_HINT_MODECHANGED 0x00000080 - // unused, formerly SFX_HINT_CANCELLABLE - // unused, formerly SFX_HINT_DATAAVAILABLE - // unused, formerly SFX_HINT_SAVECOMPLETED - // unused, formerly SFX_HINT_RELEASEREF -#define SFX_HINT_COLORS_CHANGED 0x00001000 -#define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000 -#define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000 - // unused, formerly SFX_HINT_VIEWCREATED -#define SFX_HINT_USER00 0x00010000 -#define SFX_HINT_USER01 0x00020000 -#define SFX_HINT_USER02 0x00040000 -#define SFX_HINT_USER03 0x00080000 -#define SFX_HINT_USER04 0x00100000 -#define SFX_HINT_USER05 0x00200000 - -class SVL_DLLPUBLIC SfxSimpleHint: public SfxHint -{ -private: - sal_uInt32 mnId; -public: - SfxSimpleHint( sal_uInt32 nId ) { mnId = nId; } - sal_uInt32 GetId() const { return mnId; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 158111542f3d..07cacf1ebfd7 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx index 7339f0f876b4..abcd6629dad3 100644 --- a/include/vcl/textdata.hxx +++ b/include/vcl/textdata.hxx @@ -20,8 +20,10 @@ #ifndef INCLUDED_VCL_TEXTDATA_HXX #define INCLUDED_VCL_TEXTDATA_HXX +#include +#include #include -#include +#include #include enum class ExtTextInputAttr; @@ -125,7 +127,7 @@ inline bool TextSelection::operator != ( const TextSelection& rSel ) const #define TEXT_HINT_VIEWSELECTIONCHANGED 101 #define TEXT_HINT_VIEWCARETCHANGED 102 -class VCL_DLLPUBLIC TextHint : public SfxSimpleHint +class VCL_DLLPUBLIC TextHint : public SfxHint { private: sal_uLong mnValue; diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx index 7b366c818f33..d7b6b8505467 100644 --- a/reportdesign/inc/pch/precompiled_rptui.hxx +++ b/reportdesign/inc/pch/precompiled_rptui.hxx @@ -400,7 +400,6 @@ #include #include #include -#include #include #include #include diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx index c029bae1a6f4..390b9a0b8540 100644 --- a/reportdesign/source/core/sdr/UndoActions.cxx +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index 4d20683c8d1f..0b0fcf1696be 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -191,8 +191,7 @@ void OXUndoEnvironment::ModeChanged() void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_MODECHANGED ) + if (rHint.GetId() == SFX_HINT_MODECHANGED ) ModeChanged(); } diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx index a4ec6faf4ddd..b119a1bdcc9a 100644 --- a/reportdesign/source/ui/misc/ColorListener.cxx +++ b/reportdesign/source/ui/misc/ColorListener.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include "ColorListener.hxx" -#include +#include #include #include "uistrings.hrc" @@ -51,8 +51,7 @@ void OColorListener::dispose() void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_COLORS_CHANGED) + if (rHint.GetId() == SFX_HINT_COLORS_CHANGED) { m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor(); m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor; diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx index 801880dbb0c3..6e3dc687ba8e 100644 --- a/reportdesign/source/ui/report/ReportControllerObserver.cxx +++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index 7bbf48877a58..0e1d0f3b385b 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -32,7 +32,6 @@ #include #include -#include #define CORNER_SPACE 5 @@ -254,8 +253,7 @@ void OStartMarker::setTitle(const OUString& _sTitle) void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint) { OColorListener::Notify(rBc, rHint); - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_COLORS_CHANGED) + if (rHint.GetId() == SFX_HINT_COLORS_CHANGED) { setColor(); Invalidate(InvalidateFlags::Children); diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx index 5c91138defd8..5a283bce71fe 100644 --- a/sc/inc/brdcst.hxx +++ b/sc/inc/brdcst.hxx @@ -25,7 +25,7 @@ class SvtBroadcaster; -class ScHint : public SfxSimpleHint +class ScHint : public SfxHint { ScAddress aAddress; diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx index 4bd02c644d7f..96ee1035cf14 100644 --- a/sc/inc/bulkdatahint.hxx +++ b/sc/inc/bulkdatahint.hxx @@ -19,7 +19,7 @@ namespace sc { class ColumnSpanSet; -class BulkDataHint : public SfxSimpleHint +class BulkDataHint : public SfxHint { struct Impl; std::unique_ptr mpImpl; diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index db6cd2720f6c..986f9e30cbd0 100644 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -454,7 +454,6 @@ #include #include #include -#include #include #include #include diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx index 209d35c2001d..a1627748cb23 100644 --- a/sc/inc/refhint.hxx +++ b/sc/inc/refhint.hxx @@ -18,7 +18,7 @@ namespace sc { struct RefUpdateContext; class ColRowReorderMapType; -class RefHint : public SfxSimpleHint +class RefHint : public SfxHint { public: enum Type { diff --git a/sc/inc/simplehintids.hxx b/sc/inc/simplehintids.hxx index 64d2b08c970b..97940728602f 100644 --- a/sc/inc/simplehintids.hxx +++ b/sc/inc/simplehintids.hxx @@ -10,7 +10,7 @@ #ifndef INCLUDED_SC_INC_SIMPLEHINTIDS_HXX #define INCLUDED_SC_INC_SIMPLEHINTIDS_HXX -#include +#include #define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED #define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 4d38970723f3..2f816b0289a4 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -135,8 +135,7 @@ void ScFormulaListener::Notify(const SfxHint& rHint) { mbDirty = true; - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) return; if (maCallbackFunction) diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index dddcde6aed63..1de362027221 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -328,7 +328,7 @@ IMPL_LINK_NOARG_TYPED(ScDocument, TrackTimeHdl, Idle *, void) else if (pShell) // execute { TrackFormulas(); - pShell->Broadcast( SfxSimpleHint( FID_DATACHANGED ) ); + pShell->Broadcast( SfxHint( FID_DATACHANGED ) ); // modified... diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 2bfff6a1205b..5aa0fcf2e115 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -940,9 +940,8 @@ void ScDocument::BroadcastUno( const SfxHint &rHint ) // The listener calls must be processed after completing the broadcast, // because they can add or remove objects from pUnoBroadcaster. - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pUnoListenerCalls && pSimpleHint && - pSimpleHint->GetId() == SFX_HINT_DATACHANGED && + if ( pUnoListenerCalls && + rHint.GetId() == SFX_HINT_DATACHANGED && !bInUnoListenerCall ) { // Listener calls may lead to BroadcastUno calls again. The listener calls diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index d956ba41e469..1a61323fa1f5 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -126,7 +126,7 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uInt32 nHint, bool b pTab->SetStreamValid(false); } - BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED)); + BroadcastUno(SfxHint(SC_HINT_DATACHANGED)); } namespace { diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 85957cc9d1ac..e0992b534b6c 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -849,7 +849,7 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) if (bAny) { TrackFormulas(); - pShell->Broadcast( SfxSimpleHint(FID_DATACHANGED) ); + pShell->Broadcast( SfxHint(FID_DATACHANGED) ); // #i101960# set document modified, as in TrackTimeHdl for DDE links if (!pShell->IsModified()) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 5968110c5f2b..322f0d5180c1 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2205,11 +2205,7 @@ void ScFormulaCell::SetInChangeTrack( bool bVal ) void ScFormulaCell::Notify( const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (!pSimpleHint) - return; - - const sal_uInt32 nHint = pSimpleHint->GetId(); + const sal_uInt32 nHint = rHint.GetId(); if (nHint == SC_HINT_REFERENCE) { const sc::RefHint& rRefHint = static_cast(rHint); diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 323545cc2897..fedd318decf0 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "attrib.hxx" #include @@ -269,8 +269,7 @@ bool ScStyleSheet::IsUsed() const void ScStyleSheet::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) GetItemSet().SetParent( nullptr ); } diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx index 845b5567e4aa..73e73a6367f6 100644 --- a/sc/source/core/tool/addinlis.cxx +++ b/sc/source/core/tool/addinlis.cxx @@ -120,7 +120,7 @@ void SAL_CALL ScAddInListener::modified( const css::sheet::ResultEvent& aEvent ) { ScDocument* pDoc = *it; pDoc->TrackFormulas(); - pDoc->GetDocumentShell()->Broadcast( SfxSimpleHint( FID_DATACHANGED ) ); + pDoc->GetDocumentShell()->Broadcast( SfxHint( FID_DATACHANGED ) ); } } diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx index 06e22f16f808..83548bda687b 100644 --- a/sc/source/core/tool/adiasync.cxx +++ b/sc/source/core/tool/adiasync.cxx @@ -112,7 +112,7 @@ void ScAddInAsync::CallBack( sal_uLong nHandleP, void* pData ) { ScDocument* pDoc = *it; pDoc->TrackFormulas(); - pDoc->GetDocumentShell()->Broadcast( SfxSimpleHint( FID_DATACHANGED ) ); + pDoc->GetDocumentShell()->Broadcast( SfxHint( FID_DATACHANGED ) ); } } diff --git a/sc/source/core/tool/brdcst.cxx b/sc/source/core/tool/brdcst.cxx index d5730944e16d..ce740c000928 100644 --- a/sc/source/core/tool/brdcst.cxx +++ b/sc/source/core/tool/brdcst.cxx @@ -20,6 +20,6 @@ #include "brdcst.hxx" ScHint::ScHint( sal_uInt32 n, const ScAddress& a ) : - SfxSimpleHint(n), aAddress(a) {} + SfxHint(n), aAddress(a) {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/bulkdatahint.cxx b/sc/source/core/tool/bulkdatahint.cxx index e21df7615f8f..bdd02152105d 100644 --- a/sc/source/core/tool/bulkdatahint.cxx +++ b/sc/source/core/tool/bulkdatahint.cxx @@ -22,7 +22,7 @@ struct BulkDataHint::Impl }; BulkDataHint::BulkDataHint( ScDocument& rDoc ) : - SfxSimpleHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc)) {} + SfxHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc)) {} BulkDataHint::~BulkDataHint() { diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index a9877cec9c0a..38bf70ff5d88 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -20,7 +20,6 @@ #include "cellform.hxx" #include -#include #include #include diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx index 70847d826fcb..c4f27730f0c0 100644 --- a/sc/source/core/tool/grouparealistener.cxx +++ b/sc/source/core/tool/grouparealistener.cxx @@ -107,18 +107,14 @@ ScRange FormulaGroupAreaListener::getListeningRange() const void FormulaGroupAreaListener::Notify( const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (!pSimpleHint) - return; - - switch (pSimpleHint->GetId()) + switch (rHint.GetId()) { case SC_HINT_DATACHANGED: - notifyCellChange(rHint, static_cast(pSimpleHint)->GetAddress()); + notifyCellChange(rHint, static_cast(&rHint)->GetAddress()); break; case SC_HINT_BULK_DATACHANGED: { - const BulkDataHint& rBulkHint = static_cast(*pSimpleHint); + const BulkDataHint& rBulkHint = static_cast(rHint); notifyBulkChange(rBulkHint); } break; diff --git a/sc/source/core/tool/refhint.cxx b/sc/source/core/tool/refhint.cxx index c159e9695b18..3f64ef8b772d 100644 --- a/sc/source/core/tool/refhint.cxx +++ b/sc/source/core/tool/refhint.cxx @@ -11,7 +11,7 @@ namespace sc { -RefHint::RefHint( Type eType ) : SfxSimpleHint(SC_HINT_REFERENCE), meType(eType) {} +RefHint::RefHint( Type eType ) : SfxHint(SC_HINT_REFERENCE), meType(eType) {} RefHint::~RefHint() {} RefHint::Type RefHint::getType() const 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 #include #include -#include +#include #include #include #include @@ -126,14 +126,10 @@ void SAL_CALL ScAccessibleContextBase::release() void ScAccessibleContextBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&rHint)) + else { - const SfxSimpleHint* pSimpleHint = static_cast(&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(&rHint); - if (pSimpleHint) + if ( dynamic_cast(&rHint) ) + { + CommitFocusLost(); + } + else if ( dynamic_cast(&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(&rHint) ) - { - CommitFocusLost(); - } - else if ( dynamic_cast(&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 #include -#include +#include #include #include #include @@ -122,51 +122,47 @@ void SAL_CALL ScAccessiblePageHeader::disposing() void ScAccessiblePageHeader::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast( &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(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(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(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(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(&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(&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 #include -#include +#include #include #include #include @@ -116,21 +116,17 @@ void SAL_CALL ScAccessiblePreviewHeaderCell::disposing() void ScAccessiblePreviewHeaderCell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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 #include -#include +#include #include #include #include @@ -86,23 +86,19 @@ void SAL_CALL ScAccessiblePreviewTable::disposing() void ScAccessiblePreviewTable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&rHint); - if (pSimpleHint) + if ( dynamic_cast(&rHint) ) { - if (pSimpleHint->GetId() == SC_HINT_ACC_CURSORCHANGED) + const ScUpdateRefHint& rRef = static_cast(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(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(&rHint) ) - { - const ScUpdateRefHint& rRef = static_cast(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(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(&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(&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(&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(&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(&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(&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(&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(&rHint); - if ( pSimpleHint ) + if ( dynamic_cast(&rHint) ) { - const sal_uInt32 nHintId = pSimpleHint->GetId(); - if ( nHintId == SC_HINT_AREAS_CHANGED || nHintId == SC_HINT_NAVIGATOR_UPDATEALL) + sal_uLong nEventId = static_cast(&rHint)->GetEventId(); + if ( nEventId == SFX_EVENT_ACTIVATEDOC ) FillRangeNames(); } - else if ( dynamic_cast(&rHint) ) + else { - sal_uLong nEventId = static_cast(&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(&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 #include -#include #include #include #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::mapBroadcast(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(&rHint) ) // Without parameter - { - switch ( static_cast(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(&rHint) ) // Template changed + if ( dynamic_cast(&rHint) ) // Template changed NotifyStyle( static_cast(rHint) ); else if ( dynamic_cast(&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 #include #include -#include #include #include #include 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( &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( &rBC) != nullptr) { - const SfxSimpleHint* pSimpleHint = dynamic_cast( &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(&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 -#include #include #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( &rHint ); - if ( pSimpleHint ) + if ( dynamic_cast(&rHint) ) { - const sal_uInt32 nHintId = pSimpleHint->GetId(); + sal_uLong nEventId = static_cast(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(&rHint) ) - { - sal_uLong nEventId = static_cast(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::mapBroadcast(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 #include #include -#include +#include #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( &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 const xThis(m_wThis); if (!xThis.is()) { // fdo#72695: if UNO object is already dead, don't revive it with event - if (dynamic_cast(&rHint) && - SFX_HINT_DYING == static_cast(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(&rHint) ) + else if ( dynamic_cast(&rHint) ) + { + const ScUnoRefUndoHint& rUndoHint = static_cast(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(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(&rHint) ) - { - const ScUnoRefUndoHint& rUndoHint = static_cast(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(&rHint) && - (static_cast(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(&rHint) && - static_cast(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(&rHint) && - static_cast(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(&rHint) && - static_cast(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(&rHint) ) + else { - const sal_uInt32 nId = static_cast(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(&rHint) ) + else { - if ( static_cast(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(&rHint) ) + else { - if ( static_cast(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(&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(&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(&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(this)); - - if( m_pDocument ) - { - for (uno::Reference & 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(&rHint) ) + if ( dynamic_cast(&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(this)); + + if( m_pDocument ) + { + for (uno::Reference & 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(&rHint) && - static_cast(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(&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(&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(&rHint) && - static_cast(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(&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 -#include +#include #include #include "dapiuno.hxx" @@ -300,8 +300,7 @@ void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Referenz-Update - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&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 +#include #include #include #include @@ -983,8 +983,7 @@ ScFilterDescriptorBase::~ScFilterDescriptorBase() void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pDocShell = nullptr; // ungueltig geworden else if ( dynamic_cast(&rHint) ) { @@ -2195,8 +2193,7 @@ void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // Referenz-Update interessiert hier nicht - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&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 -#include +#include #include #include #include @@ -89,8 +89,7 @@ ScDocDefaultsObj::~ScDocDefaultsObj() void ScDocDefaultsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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 #include -#include +#include #include #include @@ -82,8 +82,7 @@ ScDispatchProviderInterceptor::~ScDispatchProviderInterceptor() void ScDispatchProviderInterceptor::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&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 #include #include -#include +#include #include #include #include @@ -1093,46 +1093,42 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { // Not interested in reference update hints here - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(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(&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(&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(&rHint) && - static_cast(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(&rHint) && - static_cast(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(&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(&rHint) && - static_cast(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(&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(&rHint) ) + else { - const sal_uInt32 nId = static_cast(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(&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 +#include #include #include @@ -317,8 +317,7 @@ void ScCellFieldsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { //! Ref-Update } - else if ( dynamic_cast(&rHint) && - static_cast(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(&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(&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 +#include #include #include #include @@ -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(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast(&rHint) ) + if ( dynamic_cast(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast(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(&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(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast(&rHint) ) + if ( dynamic_cast(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast(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(&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(&rHint); - if ( pSimpleHint ) - { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - pDocShell = nullptr; // pointer is invalid - } - else if ( dynamic_cast(&rHint) ) + if ( dynamic_cast(&rHint) ) { const ScLinkRefreshedHint& rLH = static_cast(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(&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 +#include #include #include @@ -102,8 +102,7 @@ void ScNamedRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // reference update is of no interest - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&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(&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(&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 -#include +#include #include #include #include @@ -81,8 +81,7 @@ void ScAnnotationObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) //! Ref-Update } - else if ( dynamic_cast(&rHint) && - static_cast(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(&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(&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(&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 #include #include -#include +#include #include #include #include @@ -83,8 +83,7 @@ ScLinkTargetTypesObj::~ScLinkTargetTypesObj() void ScLinkTargetTypesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&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(&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(&rHint) ) + else { - const sal_uInt32 nId = static_cast(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(&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(&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(&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()); // 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 -#include +#include #include "prevwsh.hxx" #include "docsh.hxx" @@ -30,9 +30,24 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { bool bDataChanged = false; - if (dynamic_cast(&rHint)) + if (dynamic_cast(&rHint)) { - switch ( static_cast(rHint).GetId() ) + if ( static_cast(rHint).GetPrintFlag() ) + { + sal_uInt16 nParts = static_cast(rHint).GetParts(); + if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE )) + bDataChanged = true; + } + } + else if (dynamic_cast(&rHint)) + { + // SdrHints are no longer used for invalidating, thus react on objectchange instead + if(SdrHintKind::ObjectChange == static_cast(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(&rHint)) - { - if ( static_cast(rHint).GetPrintFlag() ) - { - sal_uInt16 nParts = static_cast(rHint).GetParts(); - if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE )) - bDataChanged = true; - } - } - else if (dynamic_cast(&rHint)) - { - // SdrHints are no longer used for invalidating, thus react on objectchange instead - if(SdrHintKind::ObjectChange == static_cast(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 +#include #include #include #include @@ -42,96 +42,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if (dynamic_cast(&rHint)) // ohne Parameter - { - const sal_uInt32 nSlot = static_cast(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(&rHint)) // neu zeichnen + if (dynamic_cast(&rHint)) // neu zeichnen { const ScPaintHint* pHint = static_cast(&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& 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 &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& 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(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(); diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index 42935f05d179..37a2554ac955 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -100,8 +100,7 @@ namespace basprov // not interested in return; } - const SfxSimpleHint* pSimpleHint = dynamic_cast( &rHint ); - if ( pSimpleHint && ( pSimpleHint->GetId() == SFX_HINT_DYING ) ) + if ( rHint.GetId() == SFX_HINT_DYING ) { m_documentBasicManager = nullptr; EndListening( rBC ); // prevent multiple notifications diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 2d4b06902513..bb12f7c1a65b 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -384,7 +384,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx index e24f81916021..c4e11c489ed4 100644 --- a/sd/inc/pch/precompiled_sdui.hxx +++ b/sd/inc/pch/precompiled_sdui.hxx @@ -378,7 +378,6 @@ #include #include #include -#include #include #include #include diff --git a/sd/source/core/anminfo.cxx b/sd/source/core/anminfo.cxx index 1783bec9eae8..4b31dc1a82cd 100644 --- a/sd/source/core/anminfo.cxx +++ b/sd/source/core/anminfo.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include #include "svx/xtable.hxx" #include #include diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 0db59ddd32c7..65905c697c96 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1601,7 +1601,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, pUndoMgr->AddUndoAction(pUndoChStyle); } pMySheet->GetItemSet().Put(pHisSheet->GetItemSet()); - pMySheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pMySheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } else { diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index c541afe979ce..733ab02a982d 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -1940,7 +1940,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL)); } - pTitleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pTitleSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } else if (pObj == GetPresObj(PRESOBJ_OUTLINE, nIndexOutline)) @@ -2000,7 +2000,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR } pOutlineSheet->GetItemSet().Put(aTempSet); - pOutlineSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pOutlineSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } } @@ -2016,7 +2016,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT )); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK )); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL )); - pNotesSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pNotesSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } } diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 78bc0ad586fe..fe1cc0754fb2 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -1117,7 +1117,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, } rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); - static_cast(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast(pSheet)->Broadcast(SfxHint( SFX_HINT_DATACHANGED ) ); } break; @@ -1150,7 +1150,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, } rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); - static_cast(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast(pSheet)->Broadcast(SfxHint( SFX_HINT_DATACHANGED ) ); } } break; @@ -1175,7 +1175,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, } rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); - static_cast(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast(pSheet)->Broadcast(SfxHint( SFX_HINT_DATACHANGED ) ); } break; } diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 2ddbdb199f31..a6652f7025a3 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -192,14 +192,14 @@ bool SdStyleSheet::SetParent(const OUString& rParentName) bResult = true; SfxItemSet& rParentSet = pStyle->GetItemSet(); GetItemSet().SetParent(&rParentSet); - Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); } } else { bResult = true; GetItemSet().SetParent(nullptr); - Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); } } else @@ -526,8 +526,7 @@ void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) /* if the dummy gets a notify about a changed attribute, he takes care that the actual ment style sheet sends broadcasts. */ - const SfxSimpleHint* pSimple = dynamic_cast(&rHint); - if (pSimple && pSimple->GetId() == SFX_HINT_DATACHANGED) + if (rHint.GetId() == SFX_HINT_DATACHANGED) { SdStyleSheet* pRealStyle = GetRealStyleSheet(); if (pRealStyle) @@ -889,7 +888,7 @@ void SAL_CALL SdStyleSheet::setName( const OUString& rName ) throw(RuntimeExcep if( SetName( rName ) ) { msApiName = rName; - Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } @@ -1054,7 +1053,7 @@ void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, con } rStyleSet.Put( aSet ); - Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } @@ -1287,7 +1286,7 @@ void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName ) { rStyleSet.ClearItem( pEntry->nWID ); } - Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) @@ -1335,7 +1334,7 @@ void SdStyleSheet::BroadcastSdStyleSheetChange(SfxStyleSheetBase* pStyleSheet, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool) { SdStyleSheet* pRealSheet = static_cast(pStyleSheet)->GetRealStyleSheet(); - pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pRealSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) ) { @@ -1350,7 +1349,7 @@ void SdStyleSheet::BroadcastSdStyleSheetChange(SfxStyleSheetBase* pStyleSheet, if(pSheet) { SdStyleSheet* pRealStyleSheet = static_cast(pSheet)->GetRealStyleSheet(); - pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pRealStyleSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } } diff --git a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx index a586545cb2f2..d4c517726379 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx @@ -175,8 +175,7 @@ namespace accessibility if( &rBroadcaster == mpOutliner ) { - const SfxSimpleHint* pHint = dynamic_cast< const SfxSimpleHint * >( &rHint ); - if( pHint && (pHint->GetId() == SFX_HINT_DYING) ) + if( rHint.GetId() == SFX_HINT_DYING ) { bDispose = true; mpOutliner = nullptr; diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 3da56e0ece1d..5ecdd8dfa36c 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -117,8 +117,7 @@ SdModule::~SdModule() /// get notifications void SdModule::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING ) + if( rHint.GetId() == SFX_HINT_DEINITIALIZING ) { delete pImpressOptions; pImpressOptions = nullptr; diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index cdf627953bfe..27b8aab55a38 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -809,8 +809,7 @@ void SdTransferable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else { - const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint * >(&rHint); - if(pSimpleHint && (pSimpleHint->GetId() == SFX_HINT_DYING) ) + if( rHint.GetId() == SFX_HINT_DYING ) { if( &rBC == mpSourceDoc ) mpSourceDoc = nullptr; diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index e90752452106..e141119de251 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -268,8 +268,7 @@ void SdDocPreviewWin::updateViewSettings() void SdDocPreviewWin::Notify(SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_COLORS_CHANGED ) + if( rHint.GetId() == SFX_HINT_COLORS_CHANGED ) { updateViewSettings(); } diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx index 397af1cc1f8c..f568d9513b8e 100644 --- a/sd/source/ui/dlg/unchss.cxx +++ b/sd/source/ui/dlg/unchss.cxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -101,9 +101,9 @@ void StyleSheetUndoAction::Undo() mpStyleSheet->GetItemSet().Set(aNewSet); if( mpStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) - static_cast(mpStyleSheet)->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + static_cast(mpStyleSheet)->GetRealStyleSheet()->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); else - mpStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + mpStyleSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } void StyleSheetUndoAction::Redo() @@ -113,9 +113,9 @@ void StyleSheetUndoAction::Redo() mpStyleSheet->GetItemSet().Set(aNewSet); if( mpStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) - static_cast(mpStyleSheet)->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + static_cast(mpStyleSheet)->GetRealStyleSheet()->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); else - mpStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + mpStyleSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } OUString StyleSheetUndoAction::GetComment() const diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 2cd6107d1b26..843235c4b018 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -172,7 +172,7 @@ DrawDocShell::~DrawDocShell() // destroyed. This has been introduced for the PreviewRenderer to // free its view (that uses the item poll of the doc shell) but // may be useful in other places as well. - Broadcast(SfxSimpleHint(SFX_HINT_DYING)); + Broadcast(SfxHint(SFX_HINT_DYING)); mbInDestruction = true; @@ -426,7 +426,7 @@ void DrawDocShell::SetModified( bool bSet /* = true */ ) if ( mpDoc ) mpDoc->NbcSetChanged( bSet ); - Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) ); + Broadcast( SfxHint( SFX_HINT_DOCCHANGED ) ); } } diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index 8a9728ffd227..7c9efb6af117 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -980,8 +980,7 @@ void SAL_CALL LifetimeController::disposing (const lang::EventObject& rEvent) void LifetimeController::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) { (void)rBroadcaster; - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint != nullptr && pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { mbListeningToViewShellBase = false; Update(); diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index b4c6095b64c1..5b669d32646c 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -412,7 +412,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) mpDocSh->GetUndoManager()->AddUndoAction(pAction); pStyleSheet->GetItemSet().Put( *(pTempSet.get()) ); sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() ); - pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pStyleSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } else if( bSetToAllPages ) { @@ -434,7 +434,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) pUndoGroup->AddAction(pAction); pStyle->GetItemSet().Put( *(pTempSet.get()) ); sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() ); - pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pStyle->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } //Remove background from all pages to reset to the master bg diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx index de294488ba78..b480102ca97a 100644 --- a/sd/source/ui/func/fuprlout.cxx +++ b/sd/source/ui/func/fuprlout.cxx @@ -20,7 +20,6 @@ #include "fuprlout.hxx" #include #include -#include #include #include #include diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx index b19b68fa98a6..daa979bf1fc5 100644 --- a/sd/source/ui/func/fuprobjs.cxx +++ b/sd/source/ui/func/fuprobjs.cxx @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "app.hrc" #include "res_bmp.hrc" @@ -149,7 +149,7 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) mpDocSh->GetUndoManager()->AddUndoAction(pAction); pStyleSheet->GetItemSet().Put( *pOutSet ); - static_cast( pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast( pStyleSheet )->Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); } } } diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index 29b23f1d5694..a7a657239064 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -420,7 +420,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET )); SdStyleSheet* pRealSheet = static_cast(pFirstStyleSheet)->GetRealStyleSheet(); - pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pRealSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } aTempSet.ClearItem( EE_PARA_NUMBULLET ); @@ -507,7 +507,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) } } - static_cast( pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast( pStyleSheet )->Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell ); if( pDrawViewShell ) @@ -596,7 +596,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) mpView->SetStyleSheet( static_cast(pStyleSheet)); } - static_cast( pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast( pStyleSheet )->Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); mpDoc->SetChanged(); mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 ); @@ -623,7 +623,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) mpView->SetStyleSheet( static_cast(pStyleSheet)); - static_cast( pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + static_cast( pStyleSheet )->Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); mpDoc->SetChanged(); mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 ); } diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index a775b80e6a97..c85ea076aa60 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -332,10 +332,9 @@ void Listener::Notify ( break; } } - else if (dynamic_cast(&rHint)) + else { - const SfxSimpleHint& rSfxSimpleHint = static_cast(rHint); - switch (rSfxSimpleHint.GetId()) + switch (rHint.GetId()) { case SFX_HINT_DOCCHANGED: mrController.CheckForMasterPageAssignment(); diff --git a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx index 8d0aa3ab17ba..34b85638bd31 100644 --- a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx +++ b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx @@ -70,10 +70,9 @@ TransferableData::~TransferableData() void TransferableData::Notify (SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && mpViewShell) + if (mpViewShell) { - if (pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { // This hint may come either from the ViewShell or from the // document (registered by SdTransferable). We do not know diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 8d0522c1e5f6..a208144a93ee 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -667,10 +667,9 @@ void EventMultiplexer::Implementation::Notify ( break; } } - else if (dynamic_cast(&rHint)) + else { - const SfxSimpleHint& rSimpleHint = static_cast(rHint); - if (rSimpleHint.GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) mpDocument = nullptr; } } diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 3113e5069653..d4b8aca487cf 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -482,8 +482,7 @@ void PreviewRenderer::Notify(SfxBroadcaster&, const SfxHint& rHint) if (!mpDocShellOfView) return; - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { // The doc shell is dying. Our view uses its item pool and // has to be destroyed as well. The next call to diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 34b9d7021073..72d53f7375e5 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -427,10 +427,8 @@ void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else { - const SfxSimpleHint* pSfxHint = dynamic_cast( &rHint ); - // did our SdDrawDocument just died? - if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING) + if(rHint.GetId() == SFX_HINT_DYING) { // yes, so we ask for a new one if( mpDocShell ) diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 86aa5e15cf19..5361f5abc725 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1180,8 +1180,7 @@ public: if (&rBroadcaster != &static_cast(mrBase)) return; - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint != nullptr && pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { Dispose(); } diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index 373e72a1c3cd..62c69b622095 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -261,8 +261,7 @@ IMPL_LINK_TYPED(FormShellManager, WindowEventHandler, VclWindowEvent&, rEvent, v void FormShellManager::Notify(SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint!=nullptr && pSimpleHint->GetId()==SFX_HINT_DYING) + if (rHint.GetId()==SFX_HINT_DYING) { // If all goes well this listener is called after the // FormShellManager was notified about the dying form shell by the diff --git a/sd/source/ui/view/WindowUpdater.cxx b/sd/source/ui/view/WindowUpdater.cxx index 1eb5e524d501..4ed9b9fa93d6 100644 --- a/sd/source/ui/view/WindowUpdater.cxx +++ b/sd/source/ui/view/WindowUpdater.cxx @@ -26,7 +26,6 @@ #include #include #include -#include #include diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 2e9e42cd92d0..81a0e0f39e46 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -167,7 +167,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, mpDocSh->GetUndoManager()->AddUndoAction(pAction); pSheet->GetItemSet().Put(aTempSet); - pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); bOk = true; } else if (eObjKind == OBJ_OUTLINETEXT) @@ -218,7 +218,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, mpDocSh->GetUndoManager()->AddUndoAction(pAction); pSheet->GetItemSet().Put(aTempSet); - pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); // now also broadcast any child sheets sal_Int16 nChild; @@ -229,7 +229,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE)); if( pOutlSheet ) - pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pOutlSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } } @@ -294,7 +294,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, mpDocSh->GetUndoManager()->AddUndoAction(pAction); pSheet->GetItemSet().Put(aTempSet,false); - pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); bOk = true; } else if (eObjKind == OBJ_OUTLINETEXT) @@ -337,7 +337,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, mpDocSh->GetUndoManager()->AddUndoAction(pAction); pSheet->GetItemSet().Set(aTempSet,false); - pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + pSheet->Broadcast(SfxHint(SFX_HINT_DATACHANGED)); } // remove all hard set items from shape that are now set in style diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 623392411dd2..1d7c6d895142 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -729,8 +729,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* pSimple = dynamic_cast< const SfxSimpleHint* >(&rHint); - if (pSimple!=nullptr && pSimple->GetId()==SFX_HINT_MODECHANGED) + if (rHint.GetId()==SFX_HINT_MODECHANGED) { // Change to selection when turning on read-only mode. if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) ) diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index e38765c55f28..86f87872af04 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -424,13 +424,9 @@ ViewOverlayManager::~ViewOverlayManager() void ViewOverlayManager::Notify(SfxBroadcaster&, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint != nullptr) + if (rHint.GetId() == SFX_HINT_DOCCHANGED) { - if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED) - { - UpdateTags(); - } + UpdateTags(); } } diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index f5c5725b658c..be3bd16731dc 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -219,7 +219,7 @@ SfxApplication::~SfxApplication() { OSL_ENSURE( GetObjectShells_Impl().size() == 0, "Memory leak: some object shells were not removed!" ); - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxHint(SFX_HINT_DYING) ); for (auto &module : pImpl->aModules) // Clear modules module.reset(); diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index fff3f664d4f7..48a0839aef4f 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -45,8 +45,7 @@ void SfxBasicManagerHolder::Notify(SfxBroadcaster& rBC, SfxHint const& rHint) { if (!mpBasicManager || &rBC != mpBasicManager) return; - SfxSimpleHint const*const pSimpleHint(dynamic_cast(&rHint)); - if (pSimpleHint && SFX_HINT_DYING == pSimpleHint->GetId()) + if (SFX_HINT_DYING == rHint.GetId()) { mpBasicManager = nullptr; mxBasicContainer.clear(); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index af0cf2ce28bd..7b47221cfec4 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -95,8 +95,7 @@ public: void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pHint = dynamic_cast(&rHint); - if( pHint && pHint->GetId() == SFX_HINT_DYING && pIdle->IsActive() ) + if( rHint.GetId() == SFX_HINT_DYING && pIdle->IsActive() ) { pIdle->Stop(); delete this; diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 8daf1fa1a94d..5dcdaf2778e9 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -111,7 +111,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a Scheduler::ImplDeInitScheduler(); SfxApplication* pApp = SfxGetpApp(); - pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) ); + pApp->Broadcast( SfxHint( SFX_HINT_DEINITIALIZING ) ); pApp->Get_Impl()->pAppDispatch->ReleaseAll(); pApp->Get_Impl()->pAppDispatch->release(); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 371ff8f0d4ee..61d1630ccca2 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1198,7 +1198,7 @@ void SfxBindings::UpdateSlotServer_Impl() } pImpl->bMsgDirty = pImpl->bAllMsgDirty = false; - Broadcast( SfxSimpleHint(SFX_HINT_DOCCHANGED) ); + Broadcast( SfxHint(SFX_HINT_DOCCHANGED) ); } @@ -1537,7 +1537,7 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer) // Update round is finished pImpl->bInNextJob = false; - Broadcast(SfxSimpleHint(SFX_HINT_UPDATEDONE)); + Broadcast(SfxHint(SFX_HINT_UPDATEDONE)); return true; #ifdef DBG_UTIL } @@ -1704,7 +1704,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) } } - Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + Broadcast( SfxHint( SFX_HINT_DATACHANGED ) ); if ( pDisp ) { diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index ccefe9573b9f..2cadc7924525 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -32,7 +32,7 @@ #include -#include +#include #include #include @@ -95,8 +95,7 @@ struct SfxRequest_Impl: public SfxListener void SfxRequest_Impl::Notify( SfxBroadcaster&, const SfxHint &rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + if ( rHint.GetId() == SFX_HINT_DYING ) pAnti->Cancel(); } diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index d97ae949afeb..953e8da4d6eb 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -64,15 +64,11 @@ public: void SfxModelessDialog_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) + switch( rHint.GetId() ) { - switch( pSimpleHint->GetId() ) - { - case SFX_HINT_DYING: - pMgr->Destroy(); - break; - } + case SFX_HINT_DYING: + pMgr->Destroy(); + break; } } @@ -89,15 +85,11 @@ public: void SfxFloatingWindow_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) + switch( rHint.GetId() ) { - switch( pSimpleHint->GetId() ) - { - case SFX_HINT_DYING: - pMgr->Destroy(); - break; - } + case SFX_HINT_DYING: + pMgr->Destroy(); + break; } } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 2519c8ae9f85..66da9470e6e7 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1463,22 +1463,21 @@ IMPL_LINK_NOARG_TYPED( SfxCommonTemplateDialog_Impl, TimeOut, Idle *, void ) void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { + const sal_uInt32 nId = rHint.GetId(); + // tap update - const SfxSimpleHint* pSfxSimpleHint = dynamic_cast(&rHint); - if(pSfxSimpleHint) + switch(nId) { - switch(pSfxSimpleHint->GetId()) - { - case SFX_HINT_UPDATEDONE: + case SFX_HINT_UPDATEDONE: { SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); SfxObjectShell *pDocShell = pViewFrame->GetObjectShell(); if ( - bUpdate && - ( - !IsCheckedItem(SID_STYLE_WATERCAN) || - (pDocShell && pDocShell->GetStyleSheetPool() != pStyleSheetPool) - ) + bUpdate && + ( + !IsCheckedItem(SID_STYLE_WATERCAN) || + (pDocShell && pDocShell->GetStyleSheetPool() != pStyleSheetPool) + ) ) { bUpdate = false; @@ -1516,27 +1515,24 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint break; } - // Necessary if switching between documents and in both documents - // the same template is used. Do not immediately call Update_Impl, - // for the case that one of the documents is an internal InPlaceObjekt! - case SFX_HINT_DOCCHANGED: + // Necessary if switching between documents and in both documents + // the same template is used. Do not immediately call Update_Impl, + // for the case that one of the documents is an internal InPlaceObjekt! + case SFX_HINT_DOCCHANGED: bUpdate = true; - break; - case SFX_HINT_DYING: - { - EndListening(*pStyleSheetPool); - pStyleSheetPool=nullptr; - break; - } - } + break; + case SFX_HINT_DYING: + { + EndListening(*pStyleSheetPool); + pStyleSheetPool=nullptr; + break; + } } // Do not set timer when the stylesheet pool is in the box, because it is // possible that a new one is registered after the timer is up - // works bad in UpdateStyles_Impl ()! - const sal_uInt32 nId = pSfxSimpleHint ? pSfxSimpleHint->GetId() : 0; - if(!bDontUpdate && nId != SFX_HINT_DYING && (dynamic_cast(&rHint) || dynamic_cast(&rHint) || diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5dfaf72859fd..60f4c6345f74 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -345,7 +345,7 @@ void SfxObjectShell::ModifyChanged() Invalidate( SID_SIGNATURE ); Invalidate( SID_MACRO_SIGNATURE ); - Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... + Broadcast( SfxHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(GlobalEventId::MODIFYCHANGED), this ) ); } @@ -400,7 +400,7 @@ void SfxObjectShell::SetReadOnlyUI( bool bReadOnly ) if ( bReadOnly != pImpl->bReadOnlyUI ) { pImpl->bReadOnlyUI = bReadOnly; - Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); } } @@ -426,7 +426,7 @@ void SfxObjectShell::SetReadOnly() pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) ); if ( !bWasROUI ) - Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); } } @@ -453,7 +453,7 @@ void SfxObjectShell::SetMacroMode_Impl( bool bModal ) if ( !pImpl->bRunningMacro != !bModal ) { pImpl->bRunningMacro = bModal; - Broadcast( SfxSimpleHint( SFX_HINT_MODECHANGED ) ); + Broadcast( SfxHint( SFX_HINT_MODECHANGED ) ); } } @@ -473,7 +473,7 @@ void SfxObjectShell::SetModalMode_Impl( bool bModal ) // Switch pImpl->bModalMode = bModal; - Broadcast( SfxSimpleHint( SFX_HINT_MODECHANGED ) ); + Broadcast( SfxHint( SFX_HINT_MODECHANGED ) ); } } @@ -719,7 +719,7 @@ void SfxObjectShell::SetTitle if ( GetMedium() ) { SfxShell::SetName( GetTitle(SFX_TITLE_APINAME) ); - Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); + Broadcast( SfxHint(SFX_HINT_TITLECHANGED) ); } } @@ -913,7 +913,7 @@ void SfxObjectShell::InvalidateName() pImpl->aTitle.clear(); SetName( GetTitle( SFX_TITLE_APINAME ) ); - Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); + Broadcast( SfxHint(SFX_HINT_TITLECHANGED) ); } @@ -925,7 +925,7 @@ void SfxObjectShell::SetNamedVisibility_Impl() if ( !HasName() && USHRT_MAX == pImpl->nVisualDocumentNumber && pImpl->aTitle.isEmpty() ) { pImpl->nVisualDocumentNumber = SfxGetpApp()->GetFreeIndex(); - Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); + Broadcast( SfxHint(SFX_HINT_TITLECHANGED) ); } } @@ -1223,7 +1223,7 @@ void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) SetInitialized_Impl( false ); // Title is not available until loading has finished - Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); + Broadcast( SfxHint( SFX_HINT_TITLECHANGED ) ); if ( pImpl->nEventId ) PostActivateEvent_Impl(SfxViewFrame::GetFirst(this)); } @@ -1314,7 +1314,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad() pTmpMedium->SetOpenMode( SFX_STREAM_READWRITE, true ); // notifications about possible changes in readonly state and document info - Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); // created untitled document can't be modified SetModified( false ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 2ff94f7cb5a3..2ba4ffdbe08f 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1478,7 +1478,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) Invalidate( SID_SIGNATURE ); Invalidate( SID_MACRO_SIGNATURE ); - Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); + Broadcast( SfxHint(SFX_HINT_TITLECHANGED) ); } } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 0bcb90bcf40a..3de2dc38b6fe 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -838,7 +838,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if( IsOwnStorageFormat(*pMed) && pMed->GetFilter() ) { } - Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) ); + Broadcast( SfxHint(SFX_HINT_NAMECHANGED) ); if ( SfxObjectCreateMode::EMBEDDED != eCreateMode ) { @@ -1959,7 +1959,7 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent ) { if (!pNewMed->GetName().isEmpty()) bHasName = true; - Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) ); + Broadcast( SfxHint(SFX_HINT_NAMECHANGED) ); EnableSetModified(false); getDocProperties()->setGenerator( ::utl::DocInfoHelper::GetGeneratorString() ); @@ -2073,7 +2073,7 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent ) if (!pNewMed->GetName().isEmpty() && SfxObjectCreateMode::EMBEDDED != eCreateMode) InvalidateName(); SetModified(false); // reset only by set medium - Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); // this is the end of the saving process, it is possible that // the file was changed @@ -2734,7 +2734,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString } if ( bWasReadonly && !bSaveTo ) - Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); return true; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 7f92db707fc3..c68e2dcc83ef 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -168,7 +168,7 @@ void SAL_CALL SfxModelListener_Impl::queryClosing( const css::lang::EventObject& void SAL_CALL SfxModelListener_Impl::notifyClosing( const css::lang::EventObject& ) throw ( css::uno::RuntimeException, std::exception ) { SolarMutexGuard aSolarGuard; - mpDoc->Broadcast( SfxSimpleHint(SFX_HINT_DEINITIALIZING) ); + mpDoc->Broadcast( SfxHint(SFX_HINT_DEINITIALIZING) ); } void SAL_CALL SfxModelListener_Impl::disposing( const css::lang::EventObject& _rEvent ) throw ( css::uno::RuntimeException, std::exception ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a421ea81fbed..a08c3543017b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2726,8 +2726,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( &rBC == m_pData->m_pObjectShell ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DOCCHANGED ) + if ( rHint.GetId() == SFX_HINT_DOCCHANGED ) changing(); const SfxEventHint* pNamedHint = dynamic_cast(&rHint); @@ -2803,18 +2802,15 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , postEvent_Impl( pNamedHint->GetEventName(), pViewHint ? pViewHint->GetController() : Reference< frame::XController2 >() ); } - if ( pSimpleHint ) + if ( rHint.GetId() == SFX_HINT_TITLECHANGED ) { - if ( pSimpleHint->GetId() == SFX_HINT_TITLECHANGED ) - { - OUString aTitle = m_pData->m_pObjectShell->GetTitle(); - addTitle_Impl( m_pData->m_seqArguments, aTitle ); - postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::TITLECHANGED ) ); - } - if ( pSimpleHint->GetId() == SFX_HINT_MODECHANGED ) - { - postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::MODECHANGED ) ); - } + OUString aTitle = m_pData->m_pObjectShell->GetTitle(); + addTitle_Impl( m_pData->m_seqArguments, aTitle ); + postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::TITLECHANGED ) ); + } + if ( rHint.GetId() == SFX_HINT_MODECHANGED ) + { + postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::MODECHANGED ) ); } } } diff --git a/sfx2/source/inc/openurlhint.hxx b/sfx2/source/inc/openurlhint.hxx index 229194bea743..026d72636157 100644 --- a/sfx2/source/inc/openurlhint.hxx +++ b/sfx2/source/inc/openurlhint.hxx @@ -20,10 +20,10 @@ #ifndef INCLUDED_SFX2_STRINGHINT_HXX #define INCLUDED_SFX2_STRINGHINT_HXX -#include +#include #include -class SfxOpenUrlHint: public SfxSimpleHint +class SfxOpenUrlHint: public SfxHint { OUString msDocumentURL; diff --git a/sfx2/source/notify/openurlhint.cxx b/sfx2/source/notify/openurlhint.cxx index 1eba43b358dc..2ac7a0c5a67b 100644 --- a/sfx2/source/notify/openurlhint.cxx +++ b/sfx2/source/notify/openurlhint.cxx @@ -21,7 +21,7 @@ #include SfxOpenUrlHint::SfxOpenUrlHint( const OUString& sDocumentURL ) : - SfxSimpleHint( SID_OPENURL ), + SfxHint( SID_OPENURL ), msDocumentURL(sDocumentURL) { } const OUString& SfxOpenUrlHint::GetDocumentURL() const diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 0aa352c1666f..686707a27c2c 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -39,7 +39,6 @@ #include #include #include "splitwin.hxx" -#include #include #include #include diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 9c7fcdfa1749..ba1e6152fef6 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -292,7 +292,7 @@ void SfxFrame::CancelTransfers() if( !pFrm ) { pObj->CancelTransfers(); - GetCurrentDocument()->Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); + GetCurrentDocument()->Broadcast( SfxHint(SFX_HINT_TITLECHANGED) ); } } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 963876a8a859..197b842a5d22 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -222,21 +222,17 @@ public: void SfxViewNotificatedFrameList_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) + switch( rHint.GetId() ) { - switch( pSimpleHint->GetId() ) - { - case SFX_HINT_DYING: - SfxViewFrame* pFrame = dynamic_cast(&rBC); - if( pFrame ) - { - iterator it = std::find( begin(), end(), pFrame ); - if( it != end() ) - erase( it ); - } - break; - } + case SFX_HINT_DYING: + SfxViewFrame* pFrame = dynamic_cast(&rBC); + if( pFrame ) + { + iterator it = std::find( begin(), end(), pFrame ); + if( it != end() ) + erase( it ); + } + break; } } @@ -499,7 +495,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) else { pSh->DoSaveCompleted( pMed ); - pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + pSh->Broadcast( SfxHint(SFX_HINT_MODECHANGED) ); rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), true ) ); rReq.Done( true ); return; @@ -1032,8 +1028,8 @@ void SfxViewFrame::ReleaseObjectShell_Impl() m_pDispatcher->Flush(); EndListening( *m_xObjSh ); - Notify( *m_xObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - Notify( *m_xObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); + Notify( *m_xObjSh, SfxHint(SFX_HINT_TITLECHANGED) ); + Notify( *m_xObjSh, SfxHint(SFX_HINT_DOCCHANGED) ); if ( 1 == m_xObjSh->GetOwnerLockCount() && m_pImpl->bObjLocked && m_xObjSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) m_xObjSh->DoClose(); @@ -1060,7 +1056,7 @@ bool SfxViewFrame::Close() // not be saved automatically anymore. if ( GetViewShell() ) GetViewShell()->DiscardClients_Impl(); - Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + Broadcast( SfxHint( SFX_HINT_DYING ) ); if (SfxViewFrame::Current() == this) SfxViewFrame::SetViewFrame( nullptr ); @@ -1178,75 +1174,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if( IsDowning_Impl()) return; - // we know only SimpleHints - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) - { - switch( pSimpleHint->GetId() ) - { - case SFX_HINT_MODECHANGED: - { - UpdateTitle(); - - if ( !m_xObjSh.Is() ) - break; - - // Switch r/o? - SfxBindings& rBind = GetBindings(); - rBind.Invalidate( SID_RELOAD ); - SfxDispatcher *pDispat = GetDispatcher(); - bool bWasReadOnly = pDispat->GetReadOnly_Impl(); - bool bIsReadOnly = m_xObjSh->IsReadOnly(); - if ( bWasReadOnly != bIsReadOnly ) - { - // Then also TITLE_CHANGED - UpdateTitle(); - rBind.Invalidate( SID_FILE_NAME ); - rBind.Invalidate( SID_DOCINFO_TITLE ); - rBind.Invalidate( SID_EDITDOC ); - - pDispat->GetBindings()->InvalidateAll(true); - pDispat->SetReadOnly_Impl( bIsReadOnly ); - - // Only force and Dispatcher-Update, if it is done next - // anyway, otherwise flickering or GPF is possibel since - // the Writer for example prefers in Resize perform some - // actions which has a SetReadOnlyUI in Dispatcher as a - // result! - - if ( pDispat->IsUpdated_Impl() ) - pDispat->Update_Impl(true); - } - - Enable( !m_xObjSh->IsInModalMode() ); - break; - } - - case SFX_HINT_TITLECHANGED: - { - UpdateTitle(); - SfxBindings& rBind = GetBindings(); - rBind.Invalidate( SID_FILE_NAME ); - rBind.Invalidate( SID_DOCINFO_TITLE ); - rBind.Invalidate( SID_EDITDOC ); - rBind.Invalidate( SID_RELOAD ); - break; - } - - case SFX_HINT_DEINITIALIZING: - GetFrame().DoClose(); - break; - case SFX_HINT_DYING: - // when the Object is being deleted, destroy the view too - if ( m_xObjSh.Is() ) - ReleaseObjectShell_Impl(); - else - GetFrame().DoClose(); - break; - - } - } - else if ( dynamic_cast(&rHint) ) + // we know only SfxEventHint or simple SfxHint + if ( dynamic_cast(&rHint) ) { const SfxEventHint* pEventHint = dynamic_cast(&rHint); // When the Document is loaded asynchronously, was the Dispatcher @@ -1320,6 +1249,72 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } } + else + { + switch( rHint.GetId() ) + { + case SFX_HINT_MODECHANGED: + { + UpdateTitle(); + + if ( !m_xObjSh.Is() ) + break; + + // Switch r/o? + SfxBindings& rBind = GetBindings(); + rBind.Invalidate( SID_RELOAD ); + SfxDispatcher *pDispat = GetDispatcher(); + bool bWasReadOnly = pDispat->GetReadOnly_Impl(); + bool bIsReadOnly = m_xObjSh->IsReadOnly(); + if ( bWasReadOnly != bIsReadOnly ) + { + // Then also TITLE_CHANGED + UpdateTitle(); + rBind.Invalidate( SID_FILE_NAME ); + rBind.Invalidate( SID_DOCINFO_TITLE ); + rBind.Invalidate( SID_EDITDOC ); + + pDispat->GetBindings()->InvalidateAll(true); + pDispat->SetReadOnly_Impl( bIsReadOnly ); + + // Only force and Dispatcher-Update, if it is done next + // anyway, otherwise flickering or GPF is possibel since + // the Writer for example prefers in Resize perform some + // actions which has a SetReadOnlyUI in Dispatcher as a + // result! + + if ( pDispat->IsUpdated_Impl() ) + pDispat->Update_Impl(true); + } + + Enable( !m_xObjSh->IsInModalMode() ); + break; + } + + case SFX_HINT_TITLECHANGED: + { + UpdateTitle(); + SfxBindings& rBind = GetBindings(); + rBind.Invalidate( SID_FILE_NAME ); + rBind.Invalidate( SID_DOCINFO_TITLE ); + rBind.Invalidate( SID_EDITDOC ); + rBind.Invalidate( SID_RELOAD ); + break; + } + + case SFX_HINT_DEINITIALIZING: + GetFrame().DoClose(); + break; + case SFX_HINT_DYING: + // when the Object is being deleted, destroy the view too + if ( m_xObjSh.Is() ) + ReleaseObjectShell_Impl(); + else + GetFrame().DoClose(); + break; + + } + } } IMPL_LINK_NOARG_TYPED(SfxViewFrame, SwitchReadOnlyHandler, Button*, void) @@ -1362,8 +1357,8 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) m_pDispatcher->Push( *pObjSh ); m_pDispatcher->Flush(); StartListening( *pObjSh ); - Notify( *pObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - Notify( *pObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); + Notify( *pObjSh, SfxHint(SFX_HINT_TITLECHANGED) ); + Notify( *pObjSh, SfxHint(SFX_HINT_DOCCHANGED) ); m_pDispatcher->SetReadOnly_Impl( pObjSh->IsReadOnly() ); } else diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index e2f91107fba0..94ac3dcc413b 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -169,16 +169,12 @@ SfxPrinterController::SfxPrinterController( const VclPtr& i_rPrinter, void SfxPrinterController::Notify( SfxBroadcaster& , const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) + if ( rHint.GetId() == SFX_HINT_DYING ) { - if ( pSimpleHint->GetId() == SFX_HINT_DYING ) - { - EndListening(*mpViewShell); - EndListening(*mpObjectShell); - mpViewShell = nullptr; - mpObjectShell = nullptr; - } + EndListening(*mpViewShell); + EndListening(*mpObjectShell); + mpViewShell = nullptr; + mpObjectShell = nullptr; } } diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx index 05a294d0aa1a..69d1bf6dcc01 100644 --- a/starmath/inc/format.hxx +++ b/starmath/inc/format.hxx @@ -20,7 +20,7 @@ #define INCLUDED_STARMATH_INC_FORMAT_HXX -#include +#include #include #include "utility.hxx" #include @@ -140,7 +140,7 @@ public: void RequestApplyChanges() { - Broadcast(SfxSimpleHint(HINT_FORMATCHANGED)); + Broadcast(SfxHint(HINT_FORMATCHANGED)); } }; diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx index 7decc8c2dae5..d63c2f0ad3d5 100644 --- a/starmath/inc/pch/precompiled_sm.hxx +++ b/starmath/inc/pch/precompiled_sm.hxx @@ -133,7 +133,6 @@ #include #include #include -#include #include #include #include diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 5cf881739aa8..1daf41e62359 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -1196,7 +1196,7 @@ void SmMathConfig::ItemSetToConfig(const SfxItemSet &rSet) SetIgnoreSpacesRight( bVal ); // reformat (displayed) formulas accordingly - Broadcast(SfxSimpleHint(HINT_FORMATCHANGED)); + Broadcast(SfxHint(HINT_FORMATCHANGED)); } } if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, true, &pItem) == SfxItemState::SET) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 1a984526dbdc..1af687b4ce21 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include @@ -115,7 +115,7 @@ SFX_IMPL_OBJECTFACTORY(SmDocShell, SvGlobalName(SO3_SM_CLASSID), SfxObjectShellF void SmDocShell::Notify(SfxBroadcaster&, const SfxHint& rHint) { - switch (static_cast(rHint).GetId()) + switch (rHint.GetId()) { case HINT_FORMATCHANGED: SetFormulaArranged(false); @@ -1321,7 +1321,7 @@ void SmDocShell::SetModified(bool bModified) if( IsEnableSetModified() ) { SfxObjectShell::SetModified( bModified ); - Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); + Broadcast(SfxHint(SFX_HINT_DOCCHANGED)); } } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 605fe7539c4b..03d8d403adaf 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2041,18 +2041,14 @@ IMPL_LINK_TYPED( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDl void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint ) + switch( rHint.GetId() ) { - switch( pSimpleHint->GetId() ) - { - case SFX_HINT_MODECHANGED: - case SFX_HINT_DOCCHANGED: - GetViewFrame()->GetBindings().InvalidateAll(false); - break; - default: - break; - } + case SFX_HINT_MODECHANGED: + case SFX_HINT_DOCCHANGED: + GetViewFrame()->GetBindings().InvalidateAll(false); + break; + default: + break; } } diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 3c3fa2302e08..311a56a84fda 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -26,9 +26,9 @@ #include #include #include -#include #include #include +#include #include "itemholder2.hxx" using namespace ::com::sun::star; diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 15333f2f1aff..fbf1281169b7 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -25,7 +25,7 @@ #include #include "whassert.hxx" #include -#include +#include #include "poolio.hxx" #include @@ -490,7 +490,7 @@ void SfxItemPool::Delete() return; // Inform e.g. running Requests - pImpl->aBC.Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + pImpl->aBC.Broadcast( SfxHint( SFX_HINT_DYING ) ); // Iterate through twice: first for the SetItems. if (pImpl->ppStaticDefaults != nullptr) { diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index c6cd0324249a..f4ab21c60f6e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -608,7 +608,7 @@ SfxStyleSheetBasePool::~SfxStyleSheetBasePool() aDbgStyleSheetReferences.mnPools--; #endif - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxHint(SFX_HINT_DYING) ); Clear(); } diff --git a/svl/source/notify/SfxBroadcaster.cxx b/svl/source/notify/SfxBroadcaster.cxx index eaeed4dbee49..3b069b1989fc 100644 --- a/svl/source/notify/SfxBroadcaster.cxx +++ b/svl/source/notify/SfxBroadcaster.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -55,7 +55,7 @@ void SfxBroadcaster::Broadcast( const SfxHint &rHint ) SfxBroadcaster::~SfxBroadcaster() { - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxHint(SFX_HINT_DYING) ); // remove all still registered listeners for (size_t i = 0; i < mpImpl->m_Listeners.size(); ++i) diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index 2a9338ca787e..cd110e19e66e 100644 --- a/svl/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include void SvtBroadcaster::Normalize() const @@ -101,7 +101,7 @@ SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC ) : SvtBroadcaster::~SvtBroadcaster() { mbDisposing = true; - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxHint(SFX_HINT_DYING) ); Normalize(); diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index f330e081d7de..55c4d03ac730 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -349,7 +349,6 @@ #include #include #include -#include #include #include #include diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 1e7267835d60..0e874b0097fc 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -407,12 +407,8 @@ SvtAccessibilityOptions::~SvtAccessibilityOptions() void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) { NotifyListeners(0); - const SfxSimpleHint* pSfxSimpleHint = dynamic_cast(&rHint); - if ( pSfxSimpleHint ) - { - if ( pSfxSimpleHint->GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) - SetVCLSettings(); - } + if ( rHint.GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) + SetVCLSettings(); } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 4af1d69ecf86..1f8eb4361311 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "itemholder2.hxx" diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 18c1807aa862..f800ff6f3584 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -402,7 +402,7 @@ void ExtendedColorConfig_Impl::Notify( const uno::Sequence& /*rProp m_bBroadcastWhenUnlocked = true; } else - Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); + Broadcast(SfxHint(SFX_HINT_COLORS_CHANGED)); } void ExtendedColorConfig_Impl::ImplCommit() @@ -501,7 +501,7 @@ void ExtendedColorConfig_Impl::SettingsChanged() { SolarMutexGuard aVclGuard; - Broadcast( SfxSimpleHint( SFX_HINT_COLORS_CHANGED ) ); + Broadcast( SfxHint( SFX_HINT_COLORS_CHANGED ) ); } void ExtendedColorConfig_Impl::LockBroadcast() @@ -519,7 +519,7 @@ void ExtendedColorConfig_Impl::UnlockBroadcast() if ( ExtendedColorConfig_Impl::IsEnableBroadcast() ) { m_bBroadcastWhenUnlocked = false; - ExtendedColorConfig::m_pImpl->Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); + ExtendedColorConfig::m_pImpl->Broadcast(SfxHint(SFX_HINT_COLORS_CHANGED)); } } } diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index fb2da6743768..726dee0fc1f0 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -354,7 +354,6 @@ #include #include #include -#include #include #include #include diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index 17dee4ebbbf8..9dc699275b39 100644 --- a/svx/inc/pch/precompiled_svxcore.hxx +++ b/svx/inc/pch/precompiled_svxcore.hxx @@ -391,7 +391,6 @@ #include #include #include -#include #include #include #include diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 9ebfa8f9f63c..f0bdc4c67b37 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -1174,7 +1174,6 @@ namespace accessibility // determine hint type const SdrHint* pSdrHint = dynamic_cast( &rHint ); - const SfxSimpleHint* pSimpleHint = dynamic_cast( &rHint ); const TextHint* pTextHint = dynamic_cast( &rHint ); const SvxViewChangedHint* pViewHint = dynamic_cast( &rHint ); const SvxEditSourceHint* pEditSourceHint = dynamic_cast( &rHint ); @@ -1308,9 +1307,9 @@ namespace accessibility } } // it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above! - else if( pSimpleHint ) + else if( rHint.GetId() ) { - switch( pSimpleHint->GetId() ) + switch( rHint.GetId() ) { case SFX_HINT_DYING: // edit source is dying under us, become defunc then @@ -1349,7 +1348,6 @@ namespace accessibility // determine hint type const SdrHint* pSdrHint = dynamic_cast( &rHint ); - const SfxSimpleHint* pSimpleHint = dynamic_cast( &rHint ); const TextHint* pTextHint = dynamic_cast( &rHint ); const SvxViewChangedHint* pViewHint = dynamic_cast( &rHint ); const SvxEditSourceHint* pEditSourceHint = dynamic_cast( &rHint ); @@ -1432,10 +1430,10 @@ namespace accessibility ProcessQueue(); } // it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above! - else if( pSimpleHint ) + else if( rHint.GetId() ) { // handle this event _at once_, because after that, objects are invalid - switch( pSimpleHint->GetId() ) + switch( rHint.GetId() ) { case SFX_HINT_DYING: // edit source is dying under us, become defunc then diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 47eca9687a46..7e6b09cdbfda 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -754,10 +753,8 @@ void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHi } else { - const SfxSimpleHint* pSfxHint = dynamic_cast( &rHint ); - // Has our SdDrawDocument just died? - if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING) + if(rHint.GetId() == SFX_HINT_DYING) { dispose(); } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index a46c459a8308..48aa1c068ae1 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -3336,11 +3336,8 @@ void SvxRuler::Notify(SfxBroadcaster&, const SfxHint& rHint) */ // start update - const SfxSimpleHint* pSimpleHint = dynamic_cast( &rHint ); - if(bActive && - pSimpleHint && - pSimpleHint->GetId() == SFX_HINT_UPDATEDONE ) - { + if (bActive && rHint.GetId() == SFX_HINT_UPDATEDONE) + { Update(); EndListening(*pBindings); bValid = true; diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 9059a1431d95..38f2e20b8ba4 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -305,9 +305,9 @@ void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } } - else if (const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint)) + else if (rHint.GetId()) { - switch (pSimpleHint->GetId()) + switch (rHint.GetId()) { case SFX_HINT_DYING: dispose(); diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx index 675cad5a6ff7..db20c2f75650 100644 --- a/svx/source/form/navigatortreemodel.cxx +++ b/svx/source/form/navigatortreemodel.cxx @@ -701,9 +701,9 @@ namespace svxform } } // is shell gone? - else if (const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint)) + else if (rHint.GetId()) { - if (pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) UpdateContent(nullptr); } // changed mark of controls? diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 9507d4e067a8..23cb3d0e945c 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -40,8 +40,6 @@ #include #include -#include - namespace sdr { diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index ac387cc747f5..6246d5804971 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace sdr @@ -212,7 +212,6 @@ namespace sdr bool bRemoveRenderGeometry = false; const SfxStyleSheetHint* pStyleHint = dynamic_cast(&rHint); - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() ) { @@ -224,7 +223,7 @@ namespace sdr break; }; } - else if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DATACHANGED ) + else if ( rHint.GetId() == SFX_HINT_DATACHANGED ) { bRemoveRenderGeometry = true; } diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index de35ec39e3b9..5f76ca86b9f5 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -556,8 +556,7 @@ namespace sdr const svx::ITextProvider& rTextProvider(getTextProvider()); if(dynamic_cast(&rBC) != nullptr) { - const SfxSimpleHint* pSimple = dynamic_cast(&rHint); - sal_uInt32 nId(pSimple ? pSimple->GetId() : 0L); + sal_uInt32 nId(rHint.GetId()); if(SFX_HINT_DATACHANGED == nId) { diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx index 2caab9295711..a188e1d2a105 100644 --- a/svx/source/svdraw/svdoattr.cxx +++ b/svx/source/svdraw/svdoattr.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -121,8 +121,7 @@ void SdrAttrObj::SetModel(SdrModel* pNewModel) void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - const SfxSimpleHint* pSimple = dynamic_cast(&rHint); - bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId()); + bool bDataChg(SFX_HINT_DATACHANGED == rHint.GetId()); if(bDataChg) { diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index db40a25c2477..7b5ce5678631 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -1559,8 +1559,7 @@ line (CL). The number of object margins per object varies between 0 and 3: void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { - const SfxSimpleHint* pSimple = dynamic_cast(&rHint); - const sal_uInt32 nId = pSimple==nullptr ? 0 : pSimple->GetId(); + const sal_uInt32 nId = rHint.GetId(); bool bDataChg=nId==SFX_HINT_DATACHANGED; bool bDying=nId==SFX_HINT_DYING; bool bObj1=aCon1.pObj!=nullptr && aCon1.pObj->GetBroadcaster()==&rBC; @@ -1608,13 +1607,13 @@ void SdrEdgeObj::Reformat() { if( nullptr != aCon1.pObj ) { - SfxSimpleHint aHint( SFX_HINT_DATACHANGED ); + SfxHint aHint( SFX_HINT_DATACHANGED ); Notify( *const_cast(aCon1.pObj->GetBroadcaster()), aHint ); } if( nullptr != aCon2.pObj ) { - SfxSimpleHint aHint( SFX_HINT_DATACHANGED ); + SfxHint aHint( SFX_HINT_DATACHANGED ); Notify( *const_cast(aCon2.pObj->GetBroadcaster()), aHint ); } } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 41146cdbaeb5..dcfda7e93744 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index 170a2677e62c..f4e39095895f 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -34,7 +34,6 @@ #include -#include #include #include #include diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 9b987a725659..3bb3fe977f09 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include @@ -1099,25 +1099,20 @@ SdrPageProperties::~SdrPageProperties() void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); - - if(pSimpleHint) + switch(rHint.GetId()) { - switch(pSimpleHint->GetId()) - { - case SFX_HINT_DATACHANGED : + case SFX_HINT_DATACHANGED : { // notify change, broadcast ImpPageChange(*mpSdrPage); break; } - case SFX_HINT_DYING : + case SFX_HINT_DYING : { // Style needs to be forgotten ImpRemoveStyleSheet(); break; } - } } } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index f9b2b19a619e..2e26091d99c8 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -30,7 +30,7 @@ #endif #include #include -#include +#include #include #include @@ -236,8 +236,7 @@ void SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) //If the stylesheet has been destroyed if (&rBC == mpDefaultStyleSheet) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) mpDefaultStyleSheet = nullptr; return; } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index def93ad20d9b..bf0dd8031620 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 73543f01d74c..6f8ff3920025 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -317,18 +317,15 @@ void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) // #i105988 keep reference to this object rtl::Reference< SvxTextEditSourceImpl > xThis( this ); - if (const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint)) + if (SFX_HINT_DYING == rHint.GetId()) { - if (SFX_HINT_DYING == pSimpleHint->GetId()) + if (&rBC == mpView) { - if (&rBC == mpView) + mpView = nullptr; + if (mpViewForwarder) { - mpView = nullptr; - if (mpViewForwarder) - { - delete mpViewForwarder; - mpViewForwarder = nullptr; - } + delete mpViewForwarder; + mpViewForwarder = nullptr; } } } @@ -448,7 +445,7 @@ void SvxTextEditSourceImpl::ObjectInDestruction(const SdrObject&) { mpObject = nullptr; dispose(); - Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + Broadcast( SfxHint( SFX_HINT_DYING ) ); } /* unregister at all objects and set all references to 0 */ diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 341f7d3445da..f6e00bf05905 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -25,7 +25,6 @@ #include #include #include -#include #include "swdllapi.h" #include diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx index 9e6a8a8f66e8..f595cb805e5a 100644 --- a/sw/inc/pch/precompiled_msword.hxx +++ b/sw/inc/pch/precompiled_msword.hxx @@ -521,7 +521,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 374228bfcad8..86738867aff1 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -437,7 +437,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx index 0d13d925c1f4..974fcb88910f 100644 --- a/sw/inc/pch/precompiled_swui.hxx +++ b/sw/inc/pch/precompiled_swui.hxx @@ -516,7 +516,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index ad25d87fa1c7..fe55dd657452 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -27,7 +27,6 @@ #include -#include #include class SfxItemSet; diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index a84df08797dd..83f2b938c134 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -248,11 +248,11 @@ public: }; // #i117863# -class SwSectionFrameMoveAndDeleteHint : public SfxSimpleHint +class SwSectionFrameMoveAndDeleteHint : public SfxHint { public: SwSectionFrameMoveAndDeleteHint( const bool bSaveContent ) - : SfxSimpleHint( SFX_HINT_DYING ) + : SfxHint( SFX_HINT_DYING ) , mbSaveContent( bSaveContent ) {} diff --git a/sw/inc/swhints.hxx b/sw/inc/swhints.hxx index ea4a57700505..04361fbe1af4 100644 --- a/sw/inc/swhints.hxx +++ b/sw/inc/swhints.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SW_INC_SWHINTS_HXX #define INCLUDED_SW_INC_SWHINTS_HXX -#include +#include #define SW_BROADCASTID_START SFX_HINT_USER00 #define SW_BROADCAST_DRAWVIEWS_CREATED SW_BROADCASTID_START diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index ae8facee14b3..bde43a81c846 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -226,7 +226,7 @@ SwDrawModel* DocumentDrawModelManager::MakeDrawModel_() // Broadcast, so that the FormShell can be connected to the DrawView if( m_rDoc.GetDocShell() ) { - SfxSimpleHint aHint( SW_BROADCAST_DRAWVIEWS_CREATED ); + SfxHint aHint( SW_BROADCAST_DRAWVIEWS_CREATED ); m_rDoc.GetDocShell()->Broadcast( aHint ); } } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 774f783057a3..a7eff368be4e 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include #include #include #include diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 058d10247767..2186a0add942 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -45,7 +45,6 @@ #include #include -#include typedef std::vector SwSttNdPtrs; diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 0e1065d479ed..cae15e316a47 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -62,7 +62,6 @@ #include #include #include -#include #include #include diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d42ba3348a3a..986f7bb239e8 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3263,8 +3263,7 @@ void SwFrameHolder::Reset() void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING && &rBC == pFrame ) + if ( rHint.GetId() == SFX_HINT_DYING && &rBC == pFrame ) { pFrame = nullptr; } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 8113d539300a..50d910bae579 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2246,7 +2246,7 @@ void SwRootFrame::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* p if (bOldCallbackActionEnabled) { pSh->InvalidateWindows( SwRect( 0, 0, SAL_MAX_INT32, SAL_MAX_INT32 ) ); - pSh->GetDoc()->GetDocShell()->Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); + pSh->GetDoc()->GetDocShell()->Broadcast(SfxHint(SFX_HINT_DOCCHANGED)); } } } diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 5d4f18f43bbe..cd434dc7a910 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -39,7 +39,6 @@ #include "hints.hxx" #include #include -#include // constructor for default item in attribute-pool diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 19aec8d817aa..3a601cf458c4 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2139,7 +2139,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart, // do not delete note and later add it -> sidebar flickering if (GetDoc()->GetDocShell()) { - GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04)); + GetDoc()->GetDocShell()->Broadcast( SfxHint(SFX_HINT_USER04)); } // Attribut verschieben m_pSwpHints->Delete( pHt ); @@ -2162,7 +2162,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart, | SetAttrMode::DONTREPLACE ); if (GetDoc()->GetDocShell()) { - GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04)); + GetDoc()->GetDocShell()->Broadcast( SfxHint(SFX_HINT_USER04)); } continue; // while-Schleife weiter, ohne ++ ! } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index d51b84d75cfb..b091b6fe920c 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -72,7 +72,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index f631625bb76e..5070ffacf149 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -245,8 +245,7 @@ namespace sw //SfxListener virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override { - const SfxSimpleHint *pHint = dynamic_cast( &rHint ); - if(pHint && (pHint->GetId() & SFX_HINT_DYING)) + if(rHint.GetId() & SFX_HINT_DYING) { m_pBasePool = nullptr; m_pDocShell = nullptr; @@ -2776,15 +2775,12 @@ uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName) void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { - const SfxSimpleHint* pHint = dynamic_cast(&rHint); - if(!pHint) - return; - if((pHint->GetId() & SFX_HINT_DYING) || (pHint->GetId() & SfxStyleSheetHintId::ERASED)) + if((rHint.GetId() & SFX_HINT_DYING) || (rHint.GetId() & SfxStyleSheetHintId::ERASED)) { m_pBasePool = nullptr; EndListening(rBC); } - else if(pHint->GetId() & (SfxStyleSheetHintId::CHANGED)) + else if(rHint.GetId() & (SfxStyleSheetHintId::CHANGED)) { static_cast(rBC).SetSearchMask(m_rEntry.m_eFamily); SfxStyleSheetBase* pOwnBase = static_cast(rBC).Find(m_sStyleName); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 5b5e8e06637b..0b8196c16eb9 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -879,9 +879,9 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pList->Update(); } } - else if(dynamic_cast(&rHint)) + else { - if (static_cast(rHint).GetId() == SFX_HINT_DEINITIALIZING) + if (rHint.GetId() == SFX_HINT_DEINITIALIZING) { DELETEZ(m_pWebUsrPref); DELETEZ(m_pUsrPref); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 23d88a0baadb..92c6b1b83715 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -248,10 +248,16 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) lcl_processCompatibleSfxHint( xVbaEvents, rHint ); sal_uInt16 nAction = 0; - if( dynamic_cast(&rHint) ) + if( dynamic_cast(&rHint) && + static_cast( rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) + { + // #i38126# - own action id + nAction = 3; + } + else { // switch for more actions - switch( static_cast( rHint).GetId() ) + switch( rHint.GetId() ) { case SFX_HINT_TITLECHANGED: if( GetMedium() ) @@ -259,12 +265,6 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; } } - else if( dynamic_cast(&rHint) && - static_cast( rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) - { - // #i38126# - own action id - nAction = 3; - } if( nAction ) { @@ -1262,7 +1262,7 @@ void SwDocShell::SetModified( bool bSet ) } UpdateChildWindows(); - Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); + Broadcast(SfxHint(SFX_HINT_DOCCHANGED)); } } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 0203ee42c9d9..52f1737b7fe9 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -21,7 +21,6 @@ #include -#include #include #include #include diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 6be0a87fd6f2..c417b9185fa3 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -64,7 +64,7 @@ #include #include -#include +#include #include #include @@ -267,51 +267,6 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( dynamic_cast(&rHint) ) - { - sal_uInt32 nId = static_cast(rHint).GetId(); - switch ( nId ) - { - case SFX_HINT_MODECHANGED: - { - if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) ) - { - mbReadOnly = !mbReadOnly; - SetReadOnlyState(); - mbLayout = true; - } - break; - } - case SFX_HINT_DOCCHANGED: - { - if ( mpView->GetDocShell() == &rBC ) - { - if ( !mbWaitingForCalcRects && !mvPostItFields.empty()) - { - mbWaitingForCalcRects = true; - mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl) ); - } - } - break; - } - case SFX_HINT_USER04: - { - // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker - mbDeleteNote = !mbDeleteNote; - break; - } - case SFX_HINT_DYING: - { - if ( mpView->GetDocShell() != &rBC ) - { - // field to be removed is the broadcaster - OSL_FAIL("Notification for removed SwFormatField was not sent!"); - RemoveItem(&rBC); - } - break; - } - } - } else if ( dynamic_cast(&rHint) ) { const SwFormatFieldHint& rFormatHint = static_cast(rHint); @@ -406,6 +361,51 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } + else + { + sal_uInt32 nId = rHint.GetId(); + switch ( nId ) + { + case SFX_HINT_MODECHANGED: + { + if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) ) + { + mbReadOnly = !mbReadOnly; + SetReadOnlyState(); + mbLayout = true; + } + break; + } + case SFX_HINT_DOCCHANGED: + { + if ( mpView->GetDocShell() == &rBC ) + { + if ( !mbWaitingForCalcRects && !mvPostItFields.empty()) + { + mbWaitingForCalcRects = true; + mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl) ); + } + } + break; + } + case SFX_HINT_USER04: + { + // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker + mbDeleteNote = !mbDeleteNote; + break; + } + case SFX_HINT_DYING: + { + if ( mpView->GetDocShell() != &rBC ) + { + // field to be removed is the broadcaster + OSL_FAIL("Notification for removed SwFormatField was not sent!"); + RemoveItem(&rBC); + } + break; + } + } + } } void SwPostItMgr::Focus(SfxBroadcaster& rBC) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 670e3b31de8f..8afcea8794e9 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1254,8 +1254,7 @@ void SwRedlineAcceptPanel::dispose() void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - const SfxSimpleHint *pHint = dynamic_cast(&rHint); - if (mpImplDlg && pHint && pHint->GetId() == SFX_HINT_DOCCHANGED) + if (mpImplDlg && rHint.GetId() == SFX_HINT_DOCCHANGED) mpImplDlg->Activate(); } diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 0735970b5bd8..b900589433f2 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -752,14 +752,10 @@ sal_Int32 SwSrcView::PrintSource( void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint); - if ( pSimpleHint && + if ( rHint.GetId() == SFX_HINT_MODECHANGED || ( - pSimpleHint->GetId() == SFX_HINT_MODECHANGED || - ( - pSimpleHint->GetId() == SFX_HINT_TITLECHANGED && - !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() - ) + rHint.GetId() == SFX_HINT_TITLECHANGED && + !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() ) ) { diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 2674f3e5ac39..8052a712534d 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1566,9 +1566,20 @@ SwGlossaryHdl* SwView::GetGlosHdl() void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { bool bCallBase = true; - if (const SfxSimpleHint* pSimpleHint = dynamic_cast(&rHint)) + if(dynamic_cast(&rHint)) { - sal_uInt32 nId = pSimpleHint->GetId(); + bool bDesignMode = static_cast(rHint).GetDesignMode(); + if (!bDesignMode && GetDrawFuncPtr()) + { + GetDrawFuncPtr()->Deactivate(); + SetDrawFuncPtr(nullptr); + LeaveDrawCreate(); + AttrChangedNotify(m_pWrtShell); + } + } + else + { + sal_uInt32 nId = rHint.GetId(); switch ( nId ) { // sub shells will be destroyed by the @@ -1637,17 +1648,6 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } } - else if(dynamic_cast(&rHint)) - { - bool bDesignMode = static_cast(rHint).GetDesignMode(); - if (!bDesignMode && GetDrawFuncPtr()) - { - GetDrawFuncPtr()->Deactivate(); - SetDrawFuncPtr(nullptr); - LeaveDrawCreate(); - AttrChangedNotify(m_pWrtShell); - } - } if ( bCallBase ) SfxViewShell::Notify(rBC, rHint); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 7de2f70f6d38..e61116d03218 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -763,25 +763,25 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint ) { if ( &_rBC == &xDocSh ) { // it's our document - if (const SfxSimpleHint* pSimpleHint = dynamic_cast(&_rHint)) + if (const SfxEventHint* pEventHint = dynamic_cast(&_rHint)) { - if ( SFX_HINT_DEINITIALIZING == pSimpleHint->GetId() ) + if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId()) { - // our document is dying (possibly because we're shuting down, and the document was notified - // earlier than we are?) - // stop listening at the docu + implFlushDocument(); + xBodyText = nullptr; EndListening( *&xDocSh ); - // and release our reference xDocSh.Clear(); } } - else if (const SfxEventHint* pEventHint = dynamic_cast(&_rHint)) + else { - if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId()) + if ( SFX_HINT_DEINITIALIZING == _rHint.GetId() ) { - implFlushDocument(); - xBodyText = nullptr; + // our document is dying (possibly because we're shuting down, and the document was notified + // earlier than we are?) + // stop listening at the docu EndListening( *&xDocSh ); + // and release our reference xDocSh.Clear(); } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index b49503448d18..f6a4cc1a30b2 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -2198,8 +2198,7 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh) void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint) { - SfxSimpleHint const*const pHint(dynamic_cast(&rHint)); - if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId()) + if (SFX_HINT_DOCCHANGED == rHint.GetId()) { m_bActiveDocModified = true; return; diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 1a0a5a2810a4..46902cc28a3d 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -140,8 +140,7 @@ public: void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast( &rHint ); - if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) + if( rHint.GetId() == SFX_HINT_DYING) bValid = false; } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 9212c076ae47..cb68eb601121 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -962,8 +962,7 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) { if(&rBrdc == m_pCreateView) { - const SfxSimpleHint* pHint = dynamic_cast(&rHint); - if (pHint && pHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { m_pCreateView = nullptr; } diff --git a/vbahelper/inc/pch/precompiled_msforms.hxx b/vbahelper/inc/pch/precompiled_msforms.hxx index 51c918632ec3..d94941fc2973 100644 --- a/vbahelper/inc/pch/precompiled_msforms.hxx +++ b/vbahelper/inc/pch/precompiled_msforms.hxx @@ -307,7 +307,6 @@ #include #include #include -#include #include #include #include diff --git a/vbahelper/inc/pch/precompiled_vbahelper.hxx b/vbahelper/inc/pch/precompiled_vbahelper.hxx index ec068e80b275..23efed0561c5 100644 --- a/vbahelper/inc/pch/precompiled_vbahelper.hxx +++ b/vbahelper/inc/pch/precompiled_vbahelper.hxx @@ -125,7 +125,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index cc7e79a4a87e..5a3b15c3ceaf 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -311,11 +311,11 @@ void IdleFormatter::ForceTimeout() } } -TextHint::TextHint( sal_uInt32 Id ) : SfxSimpleHint( Id ), mnValue(0) +TextHint::TextHint( sal_uInt32 Id ) : SfxHint( Id ), mnValue(0) { } -TextHint::TextHint( sal_uInt32 Id, sal_uLong nValue ) : SfxSimpleHint( Id ), mnValue(nValue) +TextHint::TextHint( sal_uInt32 Id, sal_uLong nValue ) : SfxHint( Id ), mnValue(nValue) { } diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 35798c6da052..1ee606a08b90 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include -- cgit