[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Xisco Fauli
anistenis at gmail.com
Sun May 22 14:46:44 UTC 2016
include/sfx2/basedlgs.hxx | 9 +--
sfx2/source/dialog/basedlgs.cxx | 120 +++++++++++++++++++---------------------
2 files changed, 64 insertions(+), 65 deletions(-)
New commits:
commit 369ca1d72bc877c6ccce991c92ae1a246956ca57
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun May 22 14:58:51 2016 +0200
tdf#89329: use unique_ptr for pImpl in basedlgs
Change-Id: I02838652d59933218055a8a67ea3a865cd10c192
Reviewed-on: https://gerrit.libreoffice.org/25302
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 5d4a83b..911e2da 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -92,7 +92,7 @@ class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
{
SfxBindings* pBindings;
Size aSize;
- SfxModelessDialog_Impl* pImp;
+ std::unique_ptr< SfxModelessDialog_Impl > pImpl;
SfxModelessDialog(SfxModelessDialog &) = delete;
void operator =(SfxModelessDialog &) = delete;
@@ -126,7 +126,7 @@ class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
{
SfxBindings* pBindings;
Size aSize;
- SfxFloatingWindow_Impl* pImp;
+ std::unique_ptr< SfxFloatingWindow_Impl > pImpl;
SfxFloatingWindow(SfxFloatingWindow &) = delete;
void operator =(SfxFloatingWindow &) = delete;
@@ -198,9 +198,10 @@ protected:
VclPtr<CancelButton> pCancelBtn;
VclPtr<HelpButton> pHelpBtn;
- SingleTabDlgImpl* pImpl;
-
DECL_DLLPRIVATE_LINK_TYPED(OKHdl_Impl, Button*, void);
+
+private:
+ std::unique_ptr<SingleTabDlgImpl> pImpl;
};
#endif
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 37bef85..adea3458 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -201,9 +201,9 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
{
if ( nStateChange == StateChangedType::InitShow )
{
- if ( !pImp->aWinState.isEmpty() )
+ if ( !pImpl->aWinState.isEmpty() )
{
- SetWindowState( pImp->aWinState );
+ SetWindowState( pImpl->aWinState );
}
else
{
@@ -236,7 +236,7 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
}
}
- pImp->bConstructed = true;
+ pImpl->bConstructed = true;
}
ModelessDialog::StateChanged( nStateChange );
@@ -254,7 +254,7 @@ void SfxModelessDialog::Initialize(SfxChildWinInfo *pInfo)
{
if (pInfo)
- pImp->aWinState = pInfo->aWinState;
+ pImpl->aWinState = pInfo->aWinState;
}
void SfxModelessDialog::Resize()
@@ -268,20 +268,20 @@ void SfxModelessDialog::Resize()
{
ModelessDialog::Resize();
- if ( pImp->bConstructed && pImp->pMgr )
+ if ( pImpl->bConstructed && pImpl->pMgr )
{
// start timer for saving window status information
- pImp->aMoveIdle.Start();
+ pImpl->aMoveIdle.Start();
}
}
void SfxModelessDialog::Move()
{
ModelessDialog::Move();
- if ( pImp->bConstructed && pImp->pMgr && IsReallyVisible() )
+ if ( pImpl->bConstructed && pImpl->pMgr && IsReallyVisible() )
{
// start timer for saving window status information
- pImp->aMoveIdle.Start();
+ pImpl->aMoveIdle.Start();
}
}
@@ -291,16 +291,16 @@ void SfxModelessDialog::Move()
*/
IMPL_LINK_NOARG_TYPED(SfxModelessDialog, TimerHdl, Idle *, void)
{
- pImp->aMoveIdle.Stop();
- if ( pImp->bConstructed && pImp->pMgr )
+ pImpl->aMoveIdle.Stop();
+ if ( pImpl->bConstructed && pImpl->pMgr )
{
if ( !IsRollUp() )
aSize = GetSizePixel();
WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
if ( GetStyle() & WB_SIZEABLE )
nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
- pImp->aWinState = GetWindowState( nMask );
- GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, pImp->pMgr->GetType() );
+ pImpl->aWinState = GetWindowState( nMask );
+ GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, pImpl->pMgr->GetType() );
}
}
@@ -315,14 +315,14 @@ SfxModelessDialog::SfxModelessDialog(SfxBindings* pBindinx,
void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
{
pBindings = pBindinx;
- pImp = new SfxModelessDialog_Impl;
- pImp->pMgr = pCW;
- pImp->bConstructed = false;
+ pImpl.reset(new SfxModelessDialog_Impl);
+ pImpl->pMgr = pCW;
+ pImpl->bConstructed = false;
SetUniqueId( GetHelpId() );
if ( pBindinx )
- pImp->StartListening( *pBindinx );
- pImp->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
- pImp->aMoveIdle.SetIdleHdl(LINK(this,SfxModelessDialog,TimerHdl));
+ pImpl->StartListening( *pBindinx );
+ pImpl->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
+ pImpl->aMoveIdle.SetIdleHdl(LINK(this,SfxModelessDialog,TimerHdl));
}
/* [Description]
@@ -332,17 +332,17 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
*/
bool SfxModelessDialog::Notify( NotifyEvent& rEvt )
{
- if ( pImp )
+ if ( pImpl )
{
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{
- pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
- pImp->pMgr->Activate_Impl();
+ pBindings->SetActiveFrame( pImpl->pMgr->GetFrame() );
+ pImpl->pMgr->Activate_Impl();
}
else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() )
{
pBindings->SetActiveFrame( css::uno::Reference< css::frame::XFrame > () );
- pImp->pMgr->Deactivate_Impl();
+ pImpl->pMgr->Deactivate_Impl();
}
else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
@@ -364,10 +364,9 @@ SfxModelessDialog::~SfxModelessDialog()
void SfxModelessDialog::dispose()
{
- if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
+ if ( pImpl->pMgr->GetFrame().is() && pImpl->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( nullptr );
- delete pImp;
- pImp = nullptr;
+ pImpl.reset();
ModelessDialog::dispose();
}
@@ -384,9 +383,9 @@ bool SfxModelessDialog::Close()
{
// Execute with Parameters, since Toggle is ignored by some ChildWindows.
- SfxBoolItem aValue( pImp->pMgr->GetType(), false);
+ SfxBoolItem aValue( pImpl->pMgr->GetType(), false);
pBindings->GetDispatcher_Impl()->ExecuteList(
- pImp->pMgr->GetType(),
+ pImpl->pMgr->GetType(),
SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue } );
return true;
}
@@ -419,19 +418,19 @@ bool SfxFloatingWindow::Notify( NotifyEvent& rEvt )
*/
{
- if ( pImp )
+ if ( pImpl )
{
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{
- pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
- pImp->pMgr->Activate_Impl();
+ pBindings->SetActiveFrame( pImpl->pMgr->GetFrame() );
+ pImpl->pMgr->Activate_Impl();
}
else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
{
if ( !HasChildPathFocus() )
{
pBindings->SetActiveFrame( nullptr );
- pImp->pMgr->Deactivate_Impl();
+ pImpl->pMgr->Deactivate_Impl();
}
}
else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
@@ -452,16 +451,16 @@ SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx,
vcl::Window* pParent, WinBits nWinBits) :
FloatingWindow (pParent, nWinBits),
pBindings(pBindinx),
- pImp( new SfxFloatingWindow_Impl )
+ pImpl( new SfxFloatingWindow_Impl )
{
- pImp->pMgr = pCW;
- pImp->bConstructed = false;
+ pImpl->pMgr = pCW;
+ pImpl->bConstructed = false;
SetUniqueId( GetHelpId() );
SetHelpId("");
if ( pBindinx )
- pImp->StartListening( *pBindinx );
- pImp->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
- pImp->aMoveIdle.SetIdleHdl(LINK(this,SfxFloatingWindow,TimerHdl));
+ pImpl->StartListening( *pBindinx );
+ pImpl->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
+ pImpl->aMoveIdle.SetIdleHdl(LINK(this,SfxFloatingWindow,TimerHdl));
}
SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx,
@@ -470,19 +469,19 @@ SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx,
const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame) :
FloatingWindow(pParent, rID, rUIXMLDescription, rFrame),
pBindings(pBindinx),
- pImp( new SfxFloatingWindow_Impl )
+ pImpl( new SfxFloatingWindow_Impl )
{
- pImp->pMgr = pCW;
- pImp->bConstructed = false;
+ pImpl->pMgr = pCW;
+ pImpl->bConstructed = false;
//do we really need this odd helpid/uniqueid dance ?
SetUniqueId( GetHelpId() );
SetHelpId("");
if ( pBindinx )
- pImp->StartListening( *pBindinx );
- pImp->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
- pImp->aMoveIdle.SetIdleHdl(LINK(this,SfxFloatingWindow,TimerHdl));
+ pImpl->StartListening( *pBindinx );
+ pImpl->aMoveIdle.SetPriority(SchedulerPriority::RESIZE);
+ pImpl->aMoveIdle.SetIdleHdl(LINK(this,SfxFloatingWindow,TimerHdl));
}
bool SfxFloatingWindow::Close()
@@ -497,9 +496,9 @@ bool SfxFloatingWindow::Close()
{
// Execute with Parameters, since Toggle is ignored by some ChildWindows.
- SfxBoolItem aValue( pImp->pMgr->GetType(), false);
+ SfxBoolItem aValue( pImpl->pMgr->GetType(), false);
pBindings->GetDispatcher_Impl()->ExecuteList(
- pImp->pMgr->GetType(),
+ pImpl->pMgr->GetType(),
SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue });
return true;
}
@@ -512,10 +511,9 @@ SfxFloatingWindow::~SfxFloatingWindow()
void SfxFloatingWindow::dispose()
{
- if ( pImp && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
+ if ( pImpl && pImpl->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( nullptr );
- delete pImp;
- pImp = nullptr;
+ pImpl.reset();
FloatingWindow::dispose();
}
@@ -530,20 +528,20 @@ void SfxFloatingWindow::Resize()
{
FloatingWindow::Resize();
- if ( pImp->bConstructed && pImp->pMgr )
+ if ( pImpl->bConstructed && pImpl->pMgr )
{
// start timer for saving window status information
- pImp->aMoveIdle.Start();
+ pImpl->aMoveIdle.Start();
}
}
void SfxFloatingWindow::Move()
{
FloatingWindow::Move();
- if ( pImp->bConstructed && pImp->pMgr )
+ if ( pImpl->bConstructed && pImpl->pMgr )
{
// start timer for saving window status information
- pImp->aMoveIdle.Start();
+ pImpl->aMoveIdle.Start();
}
}
@@ -553,16 +551,16 @@ void SfxFloatingWindow::Move()
*/
IMPL_LINK_NOARG_TYPED(SfxFloatingWindow, TimerHdl, Idle *, void)
{
- pImp->aMoveIdle.Stop();
- if ( pImp->bConstructed && pImp->pMgr )
+ pImpl->aMoveIdle.Stop();
+ if ( pImpl->bConstructed && pImpl->pMgr )
{
if ( !IsRollUp() )
aSize = GetSizePixel();
WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
if ( GetStyle() & WB_SIZEABLE )
nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
- pImp->aWinState = GetWindowState( nMask );
- GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, pImp->pMgr->GetType() );
+ pImpl->aWinState = GetWindowState( nMask );
+ GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, pImpl->pMgr->GetType() );
}
}
@@ -572,9 +570,9 @@ void SfxFloatingWindow::StateChanged( StateChangedType nStateChange )
if ( nStateChange == StateChangedType::InitShow )
{
// FloatingWindows are not centered by default
- if ( !pImp->aWinState.isEmpty() )
- SetWindowState( pImp->aWinState );
- pImp->bConstructed = true;
+ if ( !pImpl->aWinState.isEmpty() )
+ SetWindowState( pImpl->aWinState );
+ pImpl->bConstructed = true;
}
FloatingWindow::StateChanged( nStateChange );
@@ -592,7 +590,7 @@ void SfxFloatingWindow::Initialize(SfxChildWinInfo *pInfo)
*/
{
if (pInfo)
- pImp->aWinState = pInfo->aWinState;
+ pImpl->aWinState = pInfo->aWinState;
}
@@ -706,7 +704,7 @@ void SfxSingleTabDialog::dispose()
{
pImpl->m_pSfxPage.disposeAndClear();
pImpl->m_pLine.disposeAndClear();
- delete pImpl;
+ pImpl.reset();
pOKBtn.clear();
pCancelBtn.clear();
pHelpBtn.clear();
More information about the Libreoffice-commits
mailing list