[Libreoffice-commits] core.git: include/sfx2 sc/source sfx2/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 21 18:08:44 UTC 2021
include/sfx2/app.hxx | 2 +-
include/sfx2/childwin.hxx | 11 +++++------
include/sfx2/module.hxx | 2 +-
sc/source/ui/inc/ChildWindowWrapper.hxx | 8 ++++----
sfx2/source/appl/appchild.cxx | 8 ++++----
sfx2/source/appl/childwin.cxx | 8 ++------
sfx2/source/appl/childwinimpl.cxx | 8 ++++----
sfx2/source/appl/module.cxx | 6 +++---
sfx2/source/dialog/dockwin.cxx | 8 ++++----
sfx2/source/inc/childwinimpl.hxx | 4 ++--
10 files changed, 30 insertions(+), 35 deletions(-)
New commits:
commit ec01d43e0a8fa560d7cd8c76c0d609b18a60cddb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 14:24:28 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 21 20:08:07 2021 +0200
pass SfxChildWinFactory around by value
no need to allocate on heap
Change-Id: I7410a6c9cb434b18ed6f7ae1dc0ccea34151921c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119331
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index b4770f409f24..d15d0645a40a 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -171,7 +171,7 @@ public:
SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pImpl.get(); }
// Object-Factories/global arrays
- SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, std::unique_ptr<SfxChildWinFactory>);
+ SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, const SfxChildWinFactory&);
SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, const SfxStbCtrlFactory&);
SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, const SfxTbxCtrlFactory&);
SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const;
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 6668ddcbee32..3788c006cf36 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -90,7 +90,6 @@ struct SFX2_DLLPUBLIC SfxChildWinFactory
sal_uInt16 nPos; // Position in UI
SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n );
- ~SfxChildWinFactory();
};
struct SfxChildWindow_Impl;
@@ -135,7 +134,7 @@ public:
virtual SfxChildWinInfo GetInfo() const;
void SaveStatus(const SfxChildWinInfo& rInfo);
- static void RegisterChildWindow(SfxModule*, std::unique_ptr<SfxChildWinFactory>);
+ static void RegisterChildWindow(SfxModule*, const SfxChildWinFactory&);
static std::unique_ptr<SfxChildWindow> CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo const &);
void SetHideNotDelete( bool bOn );
@@ -182,11 +181,11 @@ public:
} \
void Class::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChildWindowFlags nFlags) \
{ \
- auto pFact = std::make_unique<SfxChildWinFactory>( \
+ SfxChildWinFactory aFact( \
Class::CreateImpl, MyID, Pos ); \
- pFact->aInfo.nFlags |= nFlags; \
- pFact->aInfo.bVisible = bVis; \
- SfxChildWindow::RegisterChildWindow(pMod, std::move(pFact)); \
+ aFact.aInfo.nFlags |= nFlags; \
+ aFact.aInfo.bVisible = bVis; \
+ SfxChildWindow::RegisterChildWindow(pMod, aFact); \
}
#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 13cf89769703..d1ddf87128c4 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -74,7 +74,7 @@ public:
SfxSlotPool* GetSlotPool() const;
void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
- void RegisterChildWindow(std::unique_ptr<SfxChildWinFactory>);
+ void RegisterChildWindow(const SfxChildWinFactory&);
void RegisterStatusBarControl(const SfxStbCtrlFactory&);
virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
diff --git a/sc/source/ui/inc/ChildWindowWrapper.hxx b/sc/source/ui/inc/ChildWindowWrapper.hxx
index 7db2b99c53a4..afc4a2df54c7 100644
--- a/sc/source/ui/inc/ChildWindowWrapper.hxx
+++ b/sc/source/ui/inc/ChildWindowWrapper.hxx
@@ -49,10 +49,10 @@ public:
SfxModule* pModule = nullptr,
SfxChildWindowFlags nFlags = SfxChildWindowFlags::NONE)
{
- auto pFactory = std::make_unique<SfxChildWinFactory>(ChildControllerWrapper::CreateImpl, WindowID, CHILDWIN_NOPOS );
- pFactory->aInfo.nFlags |= nFlags;
- pFactory->aInfo.bVisible = bVisible;
- SfxChildWindow::RegisterChildWindow(pModule, std::move(pFactory));
+ SfxChildWinFactory aFactory(ChildControllerWrapper::CreateImpl, WindowID, CHILDWIN_NOPOS );
+ aFactory.aInfo.nFlags |= nFlags;
+ aFactory.aInfo.bVisible = bVisible;
+ SfxChildWindow::RegisterChildWindow(pModule, aFactory);
}
static sal_uInt16 GetChildWindowId()
diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx
index 19b9b8344b44..08f88191847a 100644
--- a/sfx2/source/appl/appchild.cxx
+++ b/sfx2/source/appl/appchild.cxx
@@ -30,11 +30,11 @@
#include <sfx2/viewfrm.hxx>
-void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, std::unique_ptr<SfxChildWinFactory> pFact )
+void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, const SfxChildWinFactory& rFact )
{
if ( pMod )
{
- pMod->RegisterChildWindow( std::move(pFact) );
+ pMod->RegisterChildWindow( rFact );
return;
}
@@ -43,13 +43,13 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, std::unique_ptr<
for (size_t nFactory=0; nFactory<pImpl->pFactArr->size(); ++nFactory)
{
- if (pFact->nId == (*pImpl->pFactArr)[nFactory].nId)
+ if (rFact.nId == (*pImpl->pFactArr)[nFactory].nId)
{
pImpl->pFactArr->erase( pImpl->pFactArr->begin() + nFactory );
}
}
- pImpl->pFactArr->push_back( std::move(pFact) );
+ pImpl->pFactArr->push_back( rFact );
}
SfxChildWinFactArr_Impl& SfxApplication::GetChildWinFactories_Impl() const
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 30cafa285d22..eaf7f960a8bb 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -48,10 +48,6 @@ SfxChildWinFactory::SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID
, nPos(n)
{}
-SfxChildWinFactory::~SfxChildWinFactory()
-{
-}
-
struct SfxChildWindow_Impl
{
css::uno::Reference< css::frame::XFrame > xFrame;
@@ -621,9 +617,9 @@ void SfxChildWindow::SetFrame( const css::uno::Reference< css::frame::XFrame > &
pImpl->xFrame->addEventListener( pImpl->xListener );
}
-void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, std::unique_ptr<SfxChildWinFactory> pFact)
+void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, const SfxChildWinFactory& rFact)
{
- SfxGetpApp()->RegisterChildWindow_Impl( pMod, std::move(pFact) );
+ SfxGetpApp()->RegisterChildWindow_Impl( pMod, rFact );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/childwinimpl.cxx b/sfx2/source/appl/childwinimpl.cxx
index 7cce90b751d6..d9974de2695c 100644
--- a/sfx2/source/appl/childwinimpl.cxx
+++ b/sfx2/source/appl/childwinimpl.cxx
@@ -27,17 +27,17 @@ size_t SfxChildWinFactArr_Impl::size() const
const SfxChildWinFactory& SfxChildWinFactArr_Impl::operator []( size_t i ) const
{
- return *maData[i];
+ return maData[i];
}
SfxChildWinFactory& SfxChildWinFactArr_Impl::operator []( size_t i )
{
- return *maData[i];
+ return maData[i];
}
-void SfxChildWinFactArr_Impl::push_back( std::unique_ptr<SfxChildWinFactory> p )
+void SfxChildWinFactArr_Impl::push_back( const SfxChildWinFactory& p )
{
- maData.push_back(std::move(p));
+ maData.push_back(p);
}
void SfxChildWinFactArr_Impl::erase( const iterator& it )
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 787079b09662..fe11adf1b1a5 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -107,7 +107,7 @@ SfxSlotPool* SfxModule::GetSlotPool() const
}
-void SfxModule::RegisterChildWindow(std::unique_ptr<SfxChildWinFactory> pFact)
+void SfxModule::RegisterChildWindow(const SfxChildWinFactory& rFact)
{
DBG_ASSERT( pImpl, "No real Module!" );
@@ -116,7 +116,7 @@ void SfxModule::RegisterChildWindow(std::unique_ptr<SfxChildWinFactory> pFact)
for (size_t nFactory=0; nFactory<pImpl->pFactArr->size(); ++nFactory)
{
- if (pFact->nId == (*pImpl->pFactArr)[nFactory].nId)
+ if (rFact.nId == (*pImpl->pFactArr)[nFactory].nId)
{
pImpl->pFactArr->erase( pImpl->pFactArr->begin() + nFactory );
SAL_WARN("sfx.appl", "ChildWindow registered multiple times!");
@@ -124,7 +124,7 @@ void SfxModule::RegisterChildWindow(std::unique_ptr<SfxChildWinFactory> pFact)
}
}
- pImpl->pFactArr->push_back( std::move(pFact) );
+ pImpl->pFactArr->push_back( rFact );
}
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 8198d5e837cf..e2e39bed93ca 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -216,10 +216,10 @@ void SfxDockingWrapper::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChil
for (int i=0; i < NUM_OF_DOCKINGWINDOWS; i++ )
{
sal_uInt16 nID = sal_uInt16(SID_DOCKWIN_START+i);
- auto pFact = std::make_unique<SfxChildWinFactory>( SfxDockingWrapper::CreateImpl, nID, 0xffff );
- pFact->aInfo.nFlags |= nFlags;
- pFact->aInfo.bVisible = bVis;
- SfxChildWindow::RegisterChildWindow(pMod, std::move(pFact));
+ SfxChildWinFactory aFact( SfxDockingWrapper::CreateImpl, nID, 0xffff );
+ aFact.aInfo.nFlags |= nFlags;
+ aFact.aInfo.bVisible = bVis;
+ SfxChildWindow::RegisterChildWindow(pMod, aFact);
}
}
diff --git a/sfx2/source/inc/childwinimpl.hxx b/sfx2/source/inc/childwinimpl.hxx
index 323860c52304..219632031312 100644
--- a/sfx2/source/inc/childwinimpl.hxx
+++ b/sfx2/source/inc/childwinimpl.hxx
@@ -29,7 +29,7 @@ class SfxFrame;
class SfxChildWinFactArr_Impl
{
- typedef std::vector<std::unique_ptr<SfxChildWinFactory>> DataType;
+ typedef std::vector<SfxChildWinFactory> DataType;
DataType maData;
public:
@@ -39,7 +39,7 @@ public:
size_t size() const;
const SfxChildWinFactory& operator[](size_t i) const;
SfxChildWinFactory& operator[](size_t i);
- void push_back(std::unique_ptr<SfxChildWinFactory> p);
+ void push_back(const SfxChildWinFactory&);
void erase(const iterator& it);
iterator begin();
More information about the Libreoffice-commits
mailing list