use unique_ptr for SfxChildWinFactory

Change-Id: I4305310ea296a5326838759742b14e687158d426
Reviewed-on: https://gerrit.libreoffice.org/64954
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index 701fa90..27653ae 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -190,7 +190,7 @@ public:
    SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pImpl.get(); }

    // Object-Factories/global arrays
    SAL_DLLPRIVATE void         RegisterChildWindow_Impl(SfxModule*, SfxChildWinFactory*);
    SAL_DLLPRIVATE void         RegisterChildWindow_Impl(SfxModule*, std::unique_ptr<SfxChildWinFactory>);
    SAL_DLLPRIVATE void         RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, std::unique_ptr<SfxChildWinContextFactory>);
    SAL_DLLPRIVATE void         RegisterStatusBarControl_Impl(SfxModule*, const SfxStbCtrlFactory&);
    SAL_DLLPRIVATE void         RegisterToolBoxControl_Impl( SfxModule*, const SfxTbxCtrlFactory&);
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 74efab5..3ddc7a3 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -191,7 +191,7 @@ public:
    virtual SfxChildWinInfo GetInfo() const;
    void                SaveStatus(const SfxChildWinInfo& rInfo);

    static void         RegisterChildWindow(SfxModule*, SfxChildWinFactory*);
    static void         RegisterChildWindow(SfxModule*, std::unique_ptr<SfxChildWinFactory>);

    static SfxChildWindow* CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo const &);
    void                SetHideNotDelete( bool bOn );
@@ -266,11 +266,11 @@ public:
                } \
        void    Class::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChildWindowFlags nFlags)   \
                {   \
                    SfxChildWinFactory *pFact = new SfxChildWinFactory( \
                    auto pFact = o3tl::make_unique<SfxChildWinFactory>( \
                        Class::CreateImpl, MyID, Pos );   \
                    pFact->aInfo.nFlags |= nFlags;  \
                    pFact->aInfo.bVisible = bVis;         \
                    SfxChildWindow::RegisterChildWindow(pMod, pFact); \
                    SfxChildWindow::RegisterChildWindow(pMod, std::move(pFact)); \
                }

#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 842cab0..5709e4a 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -75,7 +75,7 @@ public:
    SfxSlotPool*                GetSlotPool() const;

    void                        RegisterToolBoxControl(const SfxTbxCtrlFactory&);
    void                        RegisterChildWindow(SfxChildWinFactory*);
    void                        RegisterChildWindow(std::unique_ptr<SfxChildWinFactory>);
    void                        RegisterStatusBarControl(const SfxStbCtrlFactory&);

    virtual VclPtr<SfxTabPage>  CreateTabPage( sal_uInt16 nId,
diff --git a/sc/source/ui/inc/ChildWindowWrapper.hxx b/sc/source/ui/inc/ChildWindowWrapper.hxx
index 1f4920d..db6d0c7 100644
--- a/sc/source/ui/inc/ChildWindowWrapper.hxx
+++ b/sc/source/ui/inc/ChildWindowWrapper.hxx
@@ -53,10 +53,10 @@ public:
                    SfxModule* pModule  = nullptr,
                    SfxChildWindowFlags nFlags = SfxChildWindowFlags::NONE)
    {
        SfxChildWinFactory* pFactory = new SfxChildWinFactory(ChildWindowWrapper::CreateImpl, WindowID, CHILDWIN_NOPOS );
        auto pFactory = o3tl::make_unique<SfxChildWinFactory>(ChildWindowWrapper::CreateImpl, WindowID, CHILDWIN_NOPOS );
        pFactory->aInfo.nFlags |= nFlags;
        pFactory->aInfo.bVisible = bVisible;
        SfxChildWindow::RegisterChildWindow(pModule, pFactory);
        SfxChildWindow::RegisterChildWindow(pModule, std::move(pFactory));
    }

    virtual SfxChildWinInfo GetInfo() const override
diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx
index 6003a8c..05a0f18 100644
--- a/sfx2/source/appl/appchild.cxx
+++ b/sfx2/source/appl/appchild.cxx
@@ -35,11 +35,11 @@
#include <sfx2/sfxsids.hrc>


void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, SfxChildWinFactory *pFact )
void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, std::unique_ptr<SfxChildWinFactory> pFact )
{
    if ( pMod )
    {
        pMod->RegisterChildWindow( pFact );
        pMod->RegisterChildWindow( std::move(pFact) );
        return;
    }

@@ -54,7 +54,7 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, SfxChildWinFacto
        }
    }

    pImpl->pFactArr->push_back( pFact );
    pImpl->pFactArr->push_back( std::move(pFact) );
}

void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt16 nId,
@@ -103,7 +103,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1
                    // DLL-exit
                    pF = new SfxChildWinFactory( pFac->pCtor, pFac->nId,
                            pFac->nPos );
                    pMod->RegisterChildWindow( pF );
                    pMod->RegisterChildWindow( std::unique_ptr<SfxChildWinFactory>(pF) );
                }
                else
                    pF = pFac;
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index ec50cf6..2c53919 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -725,9 +725,9 @@ void SfxChildWindowContext::RegisterChildWindowContext(SfxModule* pMod, sal_uInt
    SfxGetpApp()->RegisterChildWindowContext_Impl( pMod, nId, std::move(pFact) );
}

void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, SfxChildWinFactory* pFact)
void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, std::unique_ptr<SfxChildWinFactory> pFact)
{
    SfxGetpApp()->RegisterChildWindow_Impl( pMod, pFact );
    SfxGetpApp()->RegisterChildWindow_Impl( pMod, std::move(pFact) );
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/childwinimpl.cxx b/sfx2/source/appl/childwinimpl.cxx
index 313ef0e..447df73 100644
--- a/sfx2/source/appl/childwinimpl.cxx
+++ b/sfx2/source/appl/childwinimpl.cxx
@@ -55,9 +55,9 @@ SfxChildWinFactory& SfxChildWinFactArr_Impl::operator []( size_t i )
    return *maData[i].get();
}

void SfxChildWinFactArr_Impl::push_back( SfxChildWinFactory* p )
void SfxChildWinFactArr_Impl::push_back( std::unique_ptr<SfxChildWinFactory> p )
{
    maData.push_back(std::unique_ptr<SfxChildWinFactory>(p));
    maData.push_back(std::move(p));
}

void SfxChildWinFactArr_Impl::erase( const iterator& it )
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 9624a99..f208b5a 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -108,7 +108,7 @@ SfxSlotPool* SfxModule::GetSlotPool() const
}


void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact)
void SfxModule::RegisterChildWindow(std::unique_ptr<SfxChildWinFactory> pFact)
{
    DBG_ASSERT( pImpl, "No real Module!" );

@@ -125,7 +125,7 @@ void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact)
        }
    }

    pImpl->pFactArr->push_back( pFact );
    pImpl->pFactArr->push_back( std::move(pFact) );
}


diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 8b0a5eb..5df5042 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);
        SfxChildWinFactory *pFact = new SfxChildWinFactory( SfxDockingWrapper::CreateImpl, nID, 0xffff );
        auto pFact = o3tl::make_unique<SfxChildWinFactory>( SfxDockingWrapper::CreateImpl, nID, 0xffff );
        pFact->aInfo.nFlags |= nFlags;
        pFact->aInfo.bVisible = bVis;
        SfxChildWindow::RegisterChildWindow(pMod, pFact);
        SfxChildWindow::RegisterChildWindow(pMod, std::move(pFact));
    }
}

diff --git a/sfx2/source/inc/childwinimpl.hxx b/sfx2/source/inc/childwinimpl.hxx
index 9d361e2..c9211ed 100644
--- a/sfx2/source/inc/childwinimpl.hxx
+++ b/sfx2/source/inc/childwinimpl.hxx
@@ -51,7 +51,7 @@ public:
    size_t size() const;
    const SfxChildWinFactory& operator []( size_t i ) const;
    SfxChildWinFactory& operator []( size_t i );
    void push_back( SfxChildWinFactory* p );
    void push_back( std::unique_ptr<SfxChildWinFactory> p );
    void erase( const iterator& it );

    iterator begin();