summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/app.cxx2
-rw-r--r--sfx2/source/appl/appbaslib.cxx3
-rw-r--r--sfx2/source/appl/appcfg.cxx3
-rw-r--r--sfx2/source/appl/appinit.cxx2
-rw-r--r--sfx2/source/control/bindings.cxx6
-rw-r--r--sfx2/source/control/request.cxx5
-rw-r--r--sfx2/source/dialog/basedlgs.cxx24
-rw-r--r--sfx2/source/dialog/templdlg.cxx44
-rw-r--r--sfx2/source/doc/objmisc.cxx20
-rw-r--r--sfx2/source/doc/objserv.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx8
-rw-r--r--sfx2/source/doc/objxtor.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx22
-rw-r--r--sfx2/source/inc/openurlhint.hxx4
-rw-r--r--sfx2/source/notify/openurlhint.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx1
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx173
-rw-r--r--sfx2/source/view/viewprn.cxx14
19 files changed, 155 insertions, 184 deletions
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<SfxSimpleHint const*>(&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<const SfxSimpleHint*>(&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 <comphelper/processfactory.hxx>
-#include <svl/smplhint.hxx>
+#include <svl/hint.hxx>
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
@@ -95,8 +95,7 @@ struct SfxRequest_Impl: public SfxListener
void SfxRequest_Impl::Notify( SfxBroadcaster&, const SfxHint &rHint )
{
- const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
- if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING )
+ if ( rHint.GetId() == SFX_HINT_DYING )
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<const SfxSimpleHint*>(&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<const SfxSimpleHint*>(&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<const SfxSimpleHint*>(&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<const SfxStyleSheetPoolHint*>(&rHint) ||
dynamic_cast<const SfxStyleSheetHint*>(&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<const SfxSimpleHint*>(&rHint);
- if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DOCCHANGED )
+ if ( rHint.GetId() == SFX_HINT_DOCCHANGED )
changing();
const SfxEventHint* pNamedHint = dynamic_cast<const SfxEventHint*>(&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 <svl/smplhint.hxx>
+#include <svl/hint.hxx>
#include <rtl/ustring.hxx>
-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 <sfx2/sfxsids.hrc>
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 <vcl/floatwin.hxx>
#include <vcl/fixed.hxx>
#include "splitwin.hxx"
-#include <svl/smplhint.hxx>
#include <tools/link.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
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<const SfxSimpleHint*>(&rHint);
- if ( pSimpleHint )
+ switch( rHint.GetId() )
{
- switch( pSimpleHint->GetId() )
- {
- case SFX_HINT_DYING:
- SfxViewFrame* pFrame = dynamic_cast<SfxViewFrame*>(&rBC);
- if( pFrame )
- {
- iterator it = std::find( begin(), end(), pFrame );
- if( it != end() )
- erase( it );
- }
- break;
- }
+ case SFX_HINT_DYING:
+ SfxViewFrame* pFrame = dynamic_cast<SfxViewFrame*>(&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<const SfxSimpleHint*>(&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<const SfxEventHint*>(&rHint) )
+ // we know only SfxEventHint or simple SfxHint
+ if ( dynamic_cast<const SfxEventHint*>(&rHint) )
{
const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&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<Printer>& i_rPrinter,
void SfxPrinterController::Notify( SfxBroadcaster& , const SfxHint& rHint )
{
- const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
- if ( pSimpleHint )
+ if ( rHint.GetId() == SFX_HINT_DYING )
{
- if ( pSimpleHint->GetId() == SFX_HINT_DYING )
- {
- EndListening(*mpViewShell);
- EndListening(*mpObjectShell);
- mpViewShell = nullptr;
- mpObjectShell = nullptr;
- }
+ EndListening(*mpViewShell);
+ EndListening(*mpObjectShell);
+ mpViewShell = nullptr;
+ mpObjectShell = nullptr;
}
}