Kaydet (Commit) 27dadc07 authored tarafından Noel Grandin's avatar Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 20a872d2
......@@ -101,7 +101,7 @@ friend class SfxHelp;
SAL_DLLPRIVATE void Update_Impl_( bool,bool,bool,SfxWorkWindow*);
bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer, bool bModal );
bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer );
bool FillState_( const SfxSlotServer &rServer,
SfxItemSet &rState, const SfxSlot *pRealSlot );
void Execute_( SfxShell &rShell, const SfxSlot &rSlot,
......@@ -176,7 +176,7 @@ public:
SAL_DLLPRIVATE void Update_Impl( bool bForce = false ); // ObjectBars etc.
SAL_DLLPRIVATE bool IsUpdated_Impl() const;
SAL_DLLPRIVATE bool GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot,
bool bOwnShellsOnly, bool bModal, bool bRealSlot=true );
bool bOwnShellsOnly, bool bRealSlot );
SAL_DLLPRIVATE void SetReadOnly_Impl( bool bOn );
SAL_DLLPRIVATE bool GetReadOnly_Impl() const;
SAL_DLLPRIVATE SfxSlotFilterState IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const;
......
......@@ -28,15 +28,12 @@
class SfxTabPage;
class SfxItemSet;
struct SfxPrinter_Impl;
// class SfxPrinter ------------------------------------------------------
class SFX2_DLLPUBLIC SfxPrinter : public Printer
{
private:
std::unique_ptr<SfxItemSet> pOptions;
std::unique_ptr< SfxPrinter_Impl > pImpl;
bool bKnown;
SAL_DLLPRIVATE void operator =(SfxPrinter &) = delete;
......
......@@ -55,7 +55,6 @@ public:
void Suspend();
bool IsSuspended() const { return bSuspended; }
void UnLock();
void Reschedule();
void Stop();
......
......@@ -353,7 +353,6 @@ void SfxApplication::SetProgress_Impl
if ( pImpl->pProgress && pProgress )
{
pImpl->pProgress->Suspend();
pImpl->pProgress->UnLock();
delete pImpl->pProgress;
}
......
......@@ -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++ )
{
......
......@@ -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;
}
}
......
......@@ -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*/)
......
......@@ -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!" );
......
......@@ -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 )
{
......
......@@ -282,8 +282,7 @@ SfxSplitWindow::~SfxSplitWindow()
void SfxSplitWindow::dispose()
{
if ( !pWorkWin->GetParent_Impl() )
SaveConfig_Impl();
SaveConfig_Impl();
if ( pEmptyWin )
{
......
......@@ -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 );
......
......@@ -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();
}
......
......@@ -172,7 +172,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq )
}
else
{
pWorkWin->HidePopups_Impl( !bShow, true );
pWorkWin->HidePopups_Impl( !bShow );
pWorkWin->MakeChildrenVisible_Impl( bShow );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment