diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 09:13:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 10:15:36 +0200 |
commit | 27dadc070ec2c2a602d3c5b3494dd0bdc15c785f (patch) | |
tree | 79d9acfb57f8431b0ab224d9d2c6a5d2c840c540 /sfx2 | |
parent | 20a872d21602409cda873bb1f4830d50be3b6f8b (diff) |
loplugin:singlevalfields in sfx2
pParent in SfxDispatch_Impl was always nullptr, which led to a bunch of
dead code
similarly with pParent in SfxWorkWindow
Change-Id: I964a43fe094409ab4b6d1eda7225af997092e81c
Reviewed-on: https://gerrit.libreoffice.org/61811
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/app.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 148 | ||||
-rw-r--r-- | sfx2/source/bastyp/progress.cxx | 52 | ||||
-rw-r--r-- | sfx2/source/control/bindings.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 157 | ||||
-rw-r--r-- | sfx2/source/control/statcach.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/splitwin.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/inc/workwin.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/printer.cxx | 30 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm2.cxx | 2 |
11 files changed, 52 insertions, 356 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 605de4d76195..6ff4e5c5cea6 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -353,7 +353,6 @@ void SfxApplication::SetProgress_Impl if ( pImpl->pProgress && pProgress ) { pImpl->pProgress->Suspend(); - pImpl->pProgress->UnLock(); delete pImpl->pProgress; } diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 7128131c141b..363b3005d1f9 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -339,19 +339,6 @@ static OUString GetResourceURLFromToolbarId(ToolbarId eId) return theFilledToolBarResIdToResourceURLMap::get().findURL(eId); } -static bool IsAppWorkWinToolbox_Impl( sal_uInt16 nPos ) -{ - switch ( nPos ) - { - case SFX_OBJECTBAR_APPLICATION : - case SFX_OBJECTBAR_MACRO: - case SFX_OBJECTBAR_FULLSCREEN: - return true; - default: - return false; - } -} - static sal_uInt16 TbxMatch( sal_uInt16 nPos ) { switch ( nPos ) @@ -463,7 +450,6 @@ static constexpr OUStringLiteral g_aProgressBarResName( "private:resource/progre // constructor for workwin of a Frame SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster ) : - pParent( nullptr ), pBindings(&pFrm->GetCurrentViewFrame()->GetBindings()), pWorkWin (pWin), pActiveChild( nullptr ), @@ -519,7 +505,7 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMast n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT : n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP : SfxChildAlignment::BOTTOM ); - VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==nullptr ); + VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, true ); pSplit[n] = pSplitWin; } @@ -1007,17 +993,10 @@ void SfxWorkWindow::ResetObjectBars_Impl() n->nId = 0; } -void SfxWorkWindow::SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, - SfxInterface* pIFace) +void SfxWorkWindow::SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId) { DBG_ASSERT( nPos < SFX_OBJECTBAR_MAX, "object bar position overflow" ); - if ( pParent && IsAppWorkWinToolbox_Impl( nPos ) ) - { - pParent->SetObjectBar_Impl(nPos, nFlags, eId, pIFace); - return; - } - SfxObjectBar_Impl aObjBar; aObjBar.eId = eId; aObjBar.nMode = nFlags; @@ -1056,32 +1035,11 @@ void SfxWorkWindow::UpdateObjectBars_Impl() if ( pFrame->IsClosing_Impl() ) return; - SfxWorkWindow *pWork = pParent; - while ( pWork ) - { - pWork->UpdateObjectBars_Impl2(); - pWork = pWork->GetParent_Impl(); - } - UpdateObjectBars_Impl2(); { - pWork = pParent; - while ( pWork ) - { - pWork->ArrangeChildren_Impl(); - pWork = pWork->GetParent_Impl(); - } - ArrangeChildren_Impl( false ); - pWork = pParent; - while ( pWork ) - { - pWork->ShowChildren_Impl(); - pWork = pWork->GetParent_Impl(); - } - ShowChildren_Impl(); } @@ -1475,7 +1433,7 @@ bool SfxWorkWindow::IsVisible_Impl() } -void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId ) +void SfxWorkWindow::HidePopups_Impl(bool bHide, sal_uInt16 nId ) { if (comphelper::LibreOfficeKit::isActive() && bHide) return; @@ -1501,9 +1459,6 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId ) } } } - - if ( bParent && pParent ) - pParent->HidePopups_Impl( bHide, bParent, nId ); } @@ -1568,11 +1523,6 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, } DBG_ASSERT( pCW, "Unknown window!" ); - if ( !pCW && pParent ) - { - pParent->ConfigChild_Impl( eChild, eConfig, nId ); - return; - } if ( !bSorted ) // windows may have been registered and released without an update until now @@ -1738,24 +1688,6 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, bool bEnabled, S sal_uInt16 nId = static_cast<sal_uInt16>( lId & 0xFFFF ); SfxChildWin_Impl *pCW=nullptr; - SfxWorkWindow *pWork = pParent; - - // Get the top parent, child windows are always registered at the - // task of the WorkWindow for example the frame or on AppWorkWindow - while ( pWork && pWork->pParent ) - pWork = pWork->pParent; - - if ( pWork ) - { - // The Parent already known? - sal_uInt16 nCount = pWork->aChildWins.size(); - for (sal_uInt16 n=0; n<nCount; n++) - if (pWork->aChildWins[n]->nSaveId == nId) - { - pCW = pWork->aChildWins[n].get(); - break; - } - } if ( !pCW ) { @@ -1776,10 +1708,7 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, bool bEnabled, S pCW = new SfxChildWin_Impl( lId ); pCW->nId = nId; InitializeChild_Impl( pCW ); - if ( pWork && !( pCW->aInfo.nFlags & SfxChildWindowFlags::TASK ) ) - pWork->aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); - else - aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); + aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); } pCW->nId = nId; @@ -1868,11 +1797,6 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) return; } - else if ( pParent ) - { - pParent->ToggleChildWindow_Impl( nId, bSetFocus ); - return; - } #ifdef DBG_UTIL nCount = aChildWins.size(); @@ -1907,33 +1831,12 @@ bool SfxWorkWindow::HasChildWindow_Impl(sal_uInt16 nId) return ( pChild && pCW->bCreate ); } - if ( pParent ) - return pParent->HasChildWindow_Impl( nId ); - return false; } bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) { SfxChildWin_Impl *pCW=nullptr; - SfxWorkWindow *pWork = pParent; - - // Get the top parent, child windows are always registered at the - // task of the WorkWindow for example the frame or on AppWorkWindow - while ( pWork && pWork->pParent ) - pWork = pWork->pParent; - - if ( pWork ) - { - // The Parent already known? - sal_uInt16 nCount = pWork->aChildWins.size(); - for (sal_uInt16 n=0; n<nCount; n++) - if (pWork->aChildWins[n]->nSaveId == nId) - { - pCW = pWork->aChildWins[n].get(); - break; - } - } if ( !pCW ) { @@ -1956,10 +1859,7 @@ bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) pCW->nId = 0; pCW->nVisibility = SfxVisibilityFlags::Invisible; InitializeChild_Impl( pCW ); - if ( pWork && !( pCW->aInfo.nFlags & SfxChildWindowFlags::TASK ) ) - pWork->aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); - else - aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); + aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) ); } SfxChildAlignment eAlign; @@ -1988,8 +1888,6 @@ bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId) return false; return pCW->bEnable; } - else if ( pParent ) - return pParent->KnowsChildWindow_Impl( nId ); else return false; } @@ -1998,24 +1896,7 @@ bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId) void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, bool bOn, bool bSetFocus) { SfxChildWin_Impl *pCW=nullptr; - SfxWorkWindow *pWork = pParent; - - // Get the top parent, child windows are always registered at the - // task of the WorkWindow for example the frame or on AppWorkWindow - while ( pWork && pWork->pParent ) - pWork = pWork->pParent; - - if ( pWork ) - { - // The Parent already known? - sal_uInt16 nCount = pWork->aChildWins.size(); - for (sal_uInt16 n=0; n<nCount; n++) - if (pWork->aChildWins[n]->nSaveId == nId) - { - pCW = pWork->aChildWins[n].get(); - break; - } - } + SfxWorkWindow *pWork = nullptr; if ( !pCW ) { @@ -2109,12 +1990,6 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe return; } - if ( pParent ) - { - pParent->ShowChildWindow_Impl( nId, bVisible, bSetFocus ); - return; - } - #ifdef DBG_UTIL nCount = aChildWins.size(); for (n=0; n<nCount; n++) @@ -2143,8 +2018,6 @@ SfxChildWindow* SfxWorkWindow::GetChildWindow_Impl(sal_uInt16 nId) if (n<nCount) return aChildWins[n]->pWin; - else if ( pParent ) - return pParent->GetChildWindow_Impl( nId ); return nullptr; } @@ -2289,9 +2162,6 @@ SfxSplitWindow* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign ) void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) { - if ( pParent ) - pParent->MakeChildrenVisible_Impl( bVis ); - bAllChildrenVisible = bVis; if ( bVis ) { @@ -2329,9 +2199,6 @@ bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin ) void SfxWorkWindow::EndAutoShow_Impl( Point aPos ) { - if ( pParent ) - pParent->EndAutoShow_Impl( aPos ); - for (VclPtr<SfxSplitWindow> & p : pSplit) { if ( p && p->IsAutoHide(false) ) @@ -2349,9 +2216,6 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) if ( m_nLock ) return; - if ( pParent ) - pParent->ArrangeAutoHideWindows( pActSplitWin ); - tools::Rectangle aArea( aUpperClientArea ); for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 91f24110e3c9..0659564edf16 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -53,7 +53,6 @@ struct SfxProgress_Impl OUString aText, aStateText; sal_uIntPtr nMax; clock_t nCreate; - bool bLocked; bool bWaitMode; bool bRunning; @@ -63,37 +62,11 @@ struct SfxProgress_Impl SfxViewFrame* pView; explicit SfxProgress_Impl(); - void Enable_Impl(); - }; - -void SfxProgress_Impl::Enable_Impl() -{ - SfxObjectShell* pDoc = xObjSh.get(); - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pDoc); - while ( pFrame ) - { - pFrame->Enable(true/*bEnable*/); - pFrame->GetDispatcher()->Lock( false ); - pFrame = SfxViewFrame::GetNext(*pFrame, pDoc); - } - - if ( pView ) - { - pView->Enable( true/*bEnable*/ ); - pView->GetDispatcher()->Lock( false ); - } - - if ( !pDoc ) - SfxGetpApp()->GetAppDispatcher_Impl()->Lock( false ); -} - - SfxProgress_Impl::SfxProgress_Impl() : nMax(0) , nCreate(0) - , bLocked(false) , bWaitMode(false) , bRunning(false) , pActiveProgress(nullptr) @@ -136,7 +109,6 @@ SfxProgress::SfxProgress pImpl->xObjSh = pObjSh; pImpl->aText = rText; pImpl->nMax = nRange; - pImpl->bLocked = false; pImpl->bWaitMode = bWait; pImpl->nCreate = Get10ThSec(); SAL_INFO( @@ -196,8 +168,6 @@ void SfxProgress::Stop() pImpl->xObjSh->SetProgress_Impl(nullptr); else SfxGetpApp()->SetProgress_Impl(nullptr); - if ( pImpl->bLocked ) - pImpl->Enable_Impl(); } void SfxProgress::SetStateText @@ -371,18 +341,6 @@ void SfxProgress::Suspend() } -void SfxProgress::UnLock() -{ - if( pImpl->pActiveProgress ) return; - if ( !pImpl->bLocked ) - return; - - SAL_INFO("sfx.bastyp", "SfxProgress: unlocked"); - pImpl->bLocked = false; - pImpl->Enable_Impl(); -} - - void SfxProgress::Reschedule() /* [Description] @@ -392,16 +350,6 @@ void SfxProgress::Reschedule() { SFX_STACK(SfxProgress::Reschedule); - - if( pImpl->pActiveProgress ) return; - SfxApplication* pApp = SfxGetpApp(); - if ( pImpl->bLocked && 0 == pApp->Get_Impl()->nRescheduleLocks ) - { - SfxAppData_Impl *pAppData = pApp->Get_Impl(); - ++pAppData->nInReschedule; - Application::Reschedule(); - --pAppData->nInReschedule; - } } diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index d583ab7123de..55372be656a6 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -242,7 +242,7 @@ void SfxBindings::HidePopups( bool bHide ) // Hide SfxChildWindows DBG_ASSERT( pDispatcher, "HidePopups not allowed without dispatcher" ); if ( pImpl->pWorkWin ) - pImpl->pWorkWin->HidePopups_Impl( bHide, true ); + pImpl->pWorkWin->HidePopups_Impl( bHide ); } void SfxBindings::Update_Impl(SfxStateCache& rCache /*The up to date SfxStatusCache*/) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index edbb2d2f9387..cf1cd460020a 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -115,7 +115,6 @@ struct SfxDispatcher_Impl Idle aIdle; // for Flush std::deque<SfxToDo_Impl> aToDoStack; // not processed Push/Pop SfxViewFrame* pFrame; // NULL or associated Frame - SfxDispatcher* pParent; // AppDispatcher, NULL if possible tools::SvRef<SfxHintPoster> xPoster; // Execute asynchronous bool bFlushing; // sal_True during Flush //? @@ -130,7 +129,6 @@ struct SfxDispatcher_Impl bool bNoUI; // UI only from Parent Dispatcher bool bReadOnly; // Document is ReadOnly bool bQuiet; // Only use parent dispatcher - bool bModal; // Only slots from parent dispatcher SfxSlotFilterState nFilterEnabling; // 1==filter enabled slots, // 2==ReadOnlyDoc overturned @@ -394,17 +392,13 @@ void SfxDispatcher::Construct_Impl() xImp->bUpdated = false; xImp->bLocked = false; xImp->bActive = false; - xImp->pParent = nullptr; xImp->bNoUI = false; xImp->bReadOnly = false; xImp->bQuiet = false; - xImp->bModal = false; xImp->pInCallAliveFlag = nullptr; xImp->nFilterEnabling = SfxSlotFilterState::DISABLED; xImp->nDisableFlags = SfxDisableFlags::NONE; - xImp->pParent = nullptr; - xImp->bInvalidateOnUnlock = false; for (SfxObjectBars_Impl & rObjBar : xImp->aObjBars) @@ -623,13 +617,6 @@ sal_uInt16 SfxDispatcher::GetShellLevel(const SfxShell& rShell) for ( size_t n = 0; n < xImp->aStack.size(); ++n ) if ( *( xImp->aStack.rbegin() + n ) == &rShell ) return n; - if ( xImp->pParent ) - { - sal_uInt16 nRet = xImp->pParent->GetShellLevel(rShell); - if ( nRet == USHRT_MAX ) - return nRet; - return nRet + xImp->aStack.size(); - } return USHRT_MAX; } @@ -646,8 +633,6 @@ SfxShell *SfxDispatcher::GetShell(sal_uInt16 nIdx) const sal_uInt16 nShellCount = xImp->aStack.size(); if ( nIdx < nShellCount ) return *(xImp->aStack.rbegin() + nIdx); - else if ( xImp->pParent ) - return xImp->pParent->GetShell( nIdx - nShellCount ); return nullptr; } @@ -717,7 +702,7 @@ void SfxDispatcher::DoActivate_Impl(bool bMDI) if ( bMDI && xImp->pFrame ) { - xImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( false, false, 1 ); + xImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( false, 1 ); } if(!xImp->aToDoStack.empty()) @@ -791,7 +776,7 @@ void SfxDispatcher::DoDeactivate_Impl(bool bMDI, SfxViewFrame const * pNew) if ( bHidePopups ) { - xImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( true, false, 1 ); + xImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( true, 1 ); } Flush(); @@ -811,13 +796,13 @@ void SfxDispatcher::DoDeactivate_Impl(bool bMDI, SfxViewFrame const * pNew) The SfxShell was not found, ppShell and ppSlot are invalid. */ bool SfxDispatcher::GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell** ppShell, - const SfxSlot** ppSlot, bool bOwnShellsOnly, bool bModal, bool bRealSlot) + const SfxSlot** ppSlot, bool bOwnShellsOnly, bool bRealSlot) { SFX_STACK(SfxDispatcher::GetShellAndSlot_Impl); Flush(); SfxSlotServer aSvr; - if ( FindServer_(nSlot, aSvr, bModal) ) + if ( FindServer_(nSlot, aSvr) ) { if ( bOwnShellsOnly && aSvr.GetShellLevel() >= xImp->aStack.size() ) return false; @@ -854,22 +839,16 @@ void SfxDispatcher::Execute_(SfxShell& rShell, const SfxSlot& rSlot, ( (eCallMode & SfxCallMode::SYNCHRON) == SfxCallMode::SLOT && rSlot.IsMode(SfxSlotMode::ASYNCHRON) ) ) { - SfxDispatcher *pDispat = this; - while ( pDispat ) + sal_uInt16 nShellCount = xImp->aStack.size(); + for ( sal_uInt16 n=0; n<nShellCount; n++ ) { - sal_uInt16 nShellCount = pDispat->xImp->aStack.size(); - for ( sal_uInt16 n=0; n<nShellCount; n++ ) + if ( &rShell == *(xImp->aStack.rbegin() + n) ) { - if ( &rShell == *(pDispat->xImp->aStack.rbegin() + n) ) - { - if ( bool(eCallMode & SfxCallMode::RECORD) ) - rReq.AllowRecording( true ); - pDispat->xImp->xPoster->Post(o3tl::make_unique<SfxRequest>(rReq)); - return; - } + if ( bool(eCallMode & SfxCallMode::RECORD) ) + rReq.AllowRecording( true ); + xImp->xPoster->Post(o3tl::make_unique<SfxRequest>(rReq)); + return; } - - pDispat = pDispat->xImp->pParent; } } else @@ -894,15 +873,6 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand ) // Count the number of Shells on the linked Dispatcher Flush(); sal_uInt16 nTotCount = xImp->aStack.size(); - if ( xImp->pParent ) - { - SfxDispatcher *pParent = xImp->pParent; - while ( pParent ) - { - nTotCount = nTotCount + pParent->xImp->aStack.size(); - pParent = pParent->xImp->pParent; - } - } for ( sal_uInt16 i = 0; i < nTotCount; ++i ) { @@ -924,8 +894,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall, SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, - SfxCallMode::MODAL==(nCall&SfxCallMode::MODAL) ) ) + if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, true ) ) { SfxAllItemSet aSet( pShell->GetPool() ); if ( pArgs ) @@ -969,8 +938,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode eCall, SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, - SfxCallMode::MODAL==(eCall&SfxCallMode::MODAL) ) ) + if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, true ) ) { SfxRequest* pReq; if ( pArgs && *pArgs ) @@ -1018,8 +986,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode eCall, SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, - SfxCallMode::MODAL==(eCall&SfxCallMode::MODAL) ) ) + if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, true ) ) { SfxAllItemSet aSet( pShell->GetPool() ); SfxItemIter aIter(rArgs); @@ -1070,8 +1037,7 @@ const SfxPoolItem* SfxDispatcher::ExecuteList(sal_uInt16 nSlot, SfxCallMode eCal SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, - SfxCallMode::MODAL==(eCall&SfxCallMode::MODAL) ) ) + if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, true ) ) { SfxAllItemSet aSet( pShell->GetPool() ); @@ -1114,7 +1080,7 @@ void SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest> pReq) { Flush(); SfxSlotServer aSvr; - if ( FindServer_(pReq->GetSlot(), aSvr, true ) ) // HACK(x), whatever that was supposed to mean + if ( FindServer_(pReq->GetSlot(), aSvr ) ) // HACK(x), whatever that was supposed to mean { const SfxSlot *pSlot = aSvr.GetSlot(); SfxShell *pSh = GetShell(aSvr.GetShellLevel()); @@ -1174,22 +1140,17 @@ void SfxDispatcher::Update_Impl( bool bForce ) if ( !xImp->pFrame ) return; - SfxDispatcher *pDisp = this; bool bUpdate = bForce; - while ( pDisp && pDisp->xImp->pFrame ) + if ( xImp->pFrame ) { - SfxWorkWindow *pWork = pDisp->xImp->pFrame->GetFrame().GetWorkWindow_Impl(); + SfxWorkWindow *pWork = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); - if ( pAct == pDisp || pAct == this ) + if ( pAct == this || pAct == this ) { if ( !bUpdate ) - bUpdate = !pDisp->xImp->bUpdated; - pDisp->xImp->bUpdated = true; + bUpdate = !xImp->bUpdated; + xImp->bUpdated = true; } - else - break; - - pDisp = pDisp->xImp->pParent; } if ( !bUpdate || xImp->pFrame->GetFrame().IsClosing_Impl() ) @@ -1234,28 +1195,22 @@ void SfxDispatcher::Update_Impl( bool bForce ) SfxWorkWindow *pWorkWin = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); pWorkWin->ResetStatusBar_Impl(); - SfxDispatcher *pDispat = this; - while ( pDispat ) { - SfxWorkWindow *pWork = pDispat->xImp->pFrame->GetFrame().GetWorkWindow_Impl(); + SfxWorkWindow *pWork = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); - if ( pAct == pDispat || pAct == this ) + if ( pAct == this || pAct == this ) { pWork->ResetObjectBars_Impl(); pWork->ResetChildWindows_Impl(); } - - pDispat = pDispat->xImp->pParent; } bool bIsActive = false; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); - pDispat = this; - while ( pActDispat && !bIsActive ) + if ( !bIsActive ) { - if ( pDispat == pActDispat ) + if ( this == pActDispat ) bIsActive = true; - pActDispat = pActDispat->xImp->pParent; } Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pWorkWin ); @@ -1280,17 +1235,12 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne SfxWorkWindow *pWorkWin = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); bool bIsActive = false; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); - SfxDispatcher *pDispat = this; - while ( pActDispat && !bIsActive ) + if ( pActDispat && !bIsActive ) { - if ( pDispat == pActDispat ) + if ( this == pActDispat ) bIsActive = true; - pActDispat = pActDispat->xImp->pParent; } - if ( xImp->pParent && !xImp->bQuiet /* && bUIActive */ ) - xImp->pParent->Update_Impl_( bUIActive, bIsMDIApp, bIsIPOwner, pTaskWin ); - for (SfxObjectBars_Impl & rObjBar : xImp->aObjBars) rObjBar.eId = ToolbarId::None; xImp->aChildWins.clear(); @@ -1348,7 +1298,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne if ( bUIActive || bIsActive ) { - pWorkWin->SetObjectBar_Impl(nPos, nFlags, rBar.eId, rBar.pIFace); + pWorkWin->SetObjectBar_Impl(nPos, nFlags, rBar.eId); } if ( !bVisible ) @@ -1409,7 +1359,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne SfxObjectBars_Impl& rBar = xImp->aObjBars[nPos]; rBar = rFixed; pWorkWin->SetObjectBar_Impl(rFixed.nPos, rFixed.nFlags, - rFixed.eId, rFixed.pIFace); + rFixed.eId); } } @@ -1418,12 +1368,10 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne bool bIsTaskActive = false; SfxDispatcher *pActDispatcher = pTaskWin->GetBindings().GetDispatcher_Impl(); - SfxDispatcher *pDispatcher = this; - while ( pActDispatcher && !bIsTaskActive ) + if ( pActDispatcher && !bIsTaskActive ) { - if ( pDispatcher == pActDispatcher ) + if ( this == pActDispatcher ) bIsTaskActive = true; - pActDispatcher = pActDispatcher->xImp->pParent; } if (bIsTaskActive && eStatBarId != StatusBarId::None && xImp->pFrame) @@ -1444,9 +1392,6 @@ void SfxDispatcher::FlushImpl() xImp->aIdle.Stop(); - if ( xImp->pParent ) - xImp->pParent->Flush(); - xImp->bFlushing = !xImp->bFlushing; if ( !xImp->bFlushing ) { @@ -1662,7 +1607,6 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) @param nSlot Slot-Id to search for @param rServer <SfxSlotServer>-Instance to fill - @param bModal Despite ModalMode @return true The Slot was found, rServer is valid. @@ -1670,7 +1614,7 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) false The Slot is currently not served, rServer is invalid. */ -bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer, bool bModal) +bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) { SFX_STACK(SfxDispatcher::FindServer_); @@ -1684,15 +1628,6 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b // Count the number of Shells in the linked dispatchers. Flush(); sal_uInt16 nTotCount = xImp->aStack.size(); - if ( xImp->pParent ) - { - SfxDispatcher *pParent = xImp->pParent; - while ( pParent ) - { - nTotCount = nTotCount + pParent->xImp->aStack.size(); - pParent = pParent->xImp->pParent; - } - } // Verb-Slot? if (nSlot >= SID_VERB_START && nSlot <= SID_VERB_END) @@ -1727,22 +1662,14 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b // In Quiet-Mode only Parent-Dispatcher if ( xImp->bQuiet ) { - if ( xImp->pParent ) - { - bool bRet = xImp->pParent->FindServer_( nSlot, rServer, bModal ); - rServer.SetShellLevel - ( rServer.GetShellLevel() + xImp->aStack.size() ); - return bRet; - } - else - return false; + return false; } bool bReadOnly = ( SfxSlotFilterState::ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly ); // search through all the shells of the chained dispatchers // from top to bottom - sal_uInt16 nFirstShell = xImp->bModal && !bModal ? xImp->aStack.size() : 0; + sal_uInt16 nFirstShell = 0; for ( sal_uInt16 i = nFirstShell; i < nTotCount; ++i ) { SfxShell *pObjShell = GetShell(i); @@ -2021,7 +1948,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSlot, const SfxPoolItem* &rp { SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, false ) ) + if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, false, true ) ) { rpState = pShell->GetSlotState(nSlot); if ( !rpState ) @@ -2037,7 +1964,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, css::uno::Any& rAny ) { SfxShell *pShell = nullptr; const SfxSlot *pSlot = nullptr; - if ( GetShellAndSlot_Impl( nSID, &pShell, &pSlot, false, false ) ) + if ( GetShellAndSlot_Impl( nSID, &pShell, &pSlot, false, true ) ) { const SfxPoolItem* pItem( nullptr ); @@ -2076,8 +2003,6 @@ bool SfxDispatcher::IsReadOnlyShell_Impl( sal_uInt16 nShell ) const else return xImp->bReadOnly; } - else if ( xImp->pParent ) - return xImp->pParent->IsReadOnlyShell_Impl( nShell - nShellCount ); return true; } @@ -2117,15 +2042,9 @@ void SfxDispatcher::InvalidateBindings_Impl( bool bModify ) else { SfxDispatcher *pDisp = GetBindings()->GetDispatcher_Impl(); - while ( pDisp ) + if ( pDisp == this ) { - if ( pDisp == this ) - { - GetBindings()->InvalidateAll( bModify ); - break; - } - - pDisp = pDisp->xImp->pParent; + GetBindings()->InvalidateAll( bModify ); } } } diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 71658da4e654..db9c1e6945eb 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -223,7 +223,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons if ( bSlotDirty ) { // get the SlotServer; we need it for internal controllers anyway, but also in most cases - rDispat.FindServer_( nId, aSlotServ, false ); + rDispat.FindServer_( nId, aSlotServ ); DBG_ASSERT( !mxDispatch.is(), "Old Dispatch not removed!" ); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 52792be21741..2af30984afe9 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -713,8 +713,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, if ( !pDispatcher->IsLocked() ) { const SfxSlot *pSlot = nullptr; - if ( pDispatcher->GetShellAndSlot_Impl( GetId(), &pShell, &pSlot, false, - SfxCallMode::MODAL==(nCall&SfxCallMode::MODAL), false ) ) + if ( pDispatcher->GetShellAndSlot_Impl( GetId(), &pShell, &pSlot, false, false ) ) { if ( bMasterSlave ) { diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 88f0c860f7d4..36302fb5957f 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -282,8 +282,7 @@ SfxSplitWindow::~SfxSplitWindow() void SfxSplitWindow::dispose() { - if ( !pWorkWin->GetParent_Impl() ) - SaveConfig_Impl(); + SaveConfig_Impl(); if ( pEmptyWin ) { diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index 5ae37b970810..7b37d065afa4 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -185,7 +185,6 @@ class SfxWorkWindow final std::vector< SfxObjectBar_Impl > aObjBarList; tools::Rectangle aClientArea; tools::Rectangle aUpperClientArea; - SfxWorkWindow* pParent; VclPtr<SfxSplitWindow> pSplit[SFX_SPLITWINDOWS_MAX]; std::vector<SfxChild_Impl*> aChildren; @@ -236,8 +235,6 @@ public: { return bDockingAllowed; } bool IsInternalDockingAllowed() const { return bInternalDockingAllowed; } - SfxWorkWindow* GetParent_Impl() const - { return pParent; } // Methods for all Child windows void DataChanged_Impl(); @@ -248,7 +245,7 @@ public: bool PrepareClose_Impl(); void ArrangeChildren_Impl( bool bForce = true ); void DeleteControllers_Impl(); - void HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId=0); + void HidePopups_Impl(bool bHide, sal_uInt16 nId=0); void ConfigChild_Impl(SfxChildIdentifier, SfxDockingConfig, sal_uInt16); void MakeChildrenVisible_Impl( bool bVis ); @@ -261,8 +258,7 @@ public: void UpdateObjectBars_Impl(); void UpdateObjectBars_Impl2(); void ResetObjectBars_Impl(); - void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, - SfxInterface *pIFace); + void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId); bool IsVisible_Impl(); void MakeVisible_Impl( bool ); void Lock_Impl( bool ); diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx index 31139afaca0d..cc96ee0e6c46 100644 --- a/sfx2/source/view/printer.cxx +++ b/sfx2/source/view/printer.cxx @@ -34,20 +34,6 @@ // struct SfxPrinter_Impl ------------------------------------------------ -struct SfxPrinter_Impl -{ - bool mbAll; - bool mbSelection; - bool mbFromTo; - bool mbRange; - - SfxPrinter_Impl() : - mbAll ( true ), - mbSelection ( true ), - mbFromTo ( true ), - mbRange ( true ) {} -}; - struct SfxPrintOptDlg_Impl { bool mbHelpDisabled; @@ -101,7 +87,6 @@ SfxPrinter::SfxPrinter( std::unique_ptr<SfxItemSet>&& pTheOptions ) : This constructor creates a default printer. */ pOptions( std::move(pTheOptions) ), - pImpl( new SfxPrinter_Impl ), bKnown( true ) { assert(pOptions); @@ -111,8 +96,7 @@ SfxPrinter::SfxPrinter( std::unique_ptr<SfxItemSet>&& pTheOptions ) : SfxPrinter::SfxPrinter( std::unique_ptr<SfxItemSet>&& pTheOptions, const JobSetup& rTheOrigJobSetup ) : Printer( rTheOrigJobSetup.GetPrinterName() ), - pOptions( std::move(pTheOptions) ), - pImpl( new SfxPrinter_Impl ) + pOptions( std::move(pTheOptions) ) { assert(pOptions); bKnown = GetName() == rTheOrigJobSetup.GetPrinterName(); @@ -126,7 +110,6 @@ SfxPrinter::SfxPrinter( std::unique_ptr<SfxItemSet>&& pTheOptions, const OUString& rPrinterName ) : Printer( rPrinterName ), pOptions( std::move(pTheOptions) ), - pImpl( new SfxPrinter_Impl ), bKnown( GetName() == rPrinterName ) { assert(pOptions); @@ -137,18 +120,12 @@ SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) : VclReferenceBase(), Printer( rPrinter.GetName() ), pOptions( rPrinter.GetOptions().Clone() ), - pImpl( new SfxPrinter_Impl ), bKnown( rPrinter.IsKnown() ) { assert(pOptions); SetJobSetup( rPrinter.GetJobSetup() ); SetPrinterProps( &rPrinter ); SetMapMode( rPrinter.GetMapMode() ); - - pImpl->mbAll = rPrinter.pImpl->mbAll; - pImpl->mbSelection = rPrinter.pImpl->mbSelection; - pImpl->mbFromTo = rPrinter.pImpl->mbFromTo; - pImpl->mbRange = rPrinter.pImpl->mbRange; } @@ -160,10 +137,6 @@ VclPtr<SfxPrinter> SfxPrinter::Clone() const pNewPrinter->SetJobSetup( GetJobSetup() ); pNewPrinter->SetPrinterProps( this ); pNewPrinter->SetMapMode( GetMapMode() ); - pNewPrinter->pImpl->mbAll = pImpl->mbAll; - pNewPrinter->pImpl->mbSelection =pImpl->mbSelection; - pNewPrinter->pImpl->mbFromTo = pImpl->mbFromTo; - pNewPrinter->pImpl->mbRange =pImpl->mbRange; return pNewPrinter; } else @@ -179,7 +152,6 @@ SfxPrinter::~SfxPrinter() void SfxPrinter::dispose() { pOptions.reset(); - pImpl.reset(); Printer::dispose(); } diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 0357d90c987e..af3b990234a5 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -172,7 +172,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) } else { - pWorkWin->HidePopups_Impl( !bShow, true ); + pWorkWin->HidePopups_Impl( !bShow ); pWorkWin->MakeChildrenVisible_Impl( bShow ); } |