[Libreoffice-commits] core.git: compilerplugins/clang include/sfx2 sfx2/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 11 13:30:19 UTC 2021


 compilerplugins/clang/constantparam.numbers.results |    4 
 compilerplugins/clang/countusersofdefaultparams.py  |    2 
 include/sfx2/app.hxx                                |    2 
 include/sfx2/childwin.hxx                           |   76 --------------
 sfx2/source/appl/appchild.cxx                       |   68 ------------
 sfx2/source/appl/childwin.cxx                       |  106 --------------------
 sfx2/source/appl/childwinimpl.cxx                   |   20 ---
 sfx2/source/appl/workwin.cxx                        |    6 -
 sfx2/source/inc/childwinimpl.hxx                    |   12 --
 9 files changed, 296 deletions(-)

New commits:
commit feb8164afa67d3e2e5fe27dd01c5101d6d0cb847
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 9 20:22:37 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 11 14:29:30 2021 +0100

    drop newly unused code and macros
    
    Change-Id: I4b3fe1d7a62305f04589bd05a80aa771910a4f98
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112246
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/compilerplugins/clang/constantparam.numbers.results b/compilerplugins/clang/constantparam.numbers.results
index 7759f40f512d..b03d0ff7c507 100644
--- a/compilerplugins/clang/constantparam.numbers.results
+++ b/compilerplugins/clang/constantparam.numbers.results
@@ -730,10 +730,6 @@ include/sfx2/app.hxx:87
     void SfxLinkItem::SfxLinkItem(unsigned short,const class Link<const class SfxPoolItem *, void> &)
     unsigned short nWhichId
     5646
-include/sfx2/childwin.hxx:138
-    void SfxChildWindowContext::RegisterChildWindowContext(class SfxModule *,unsigned short,class std::unique_ptr<struct SfxChildWinContextFactory, struct std::default_delete<struct SfxChildWinContextFactory> >)
-    unsigned short 
-    10366
 include/sfx2/ctrlitem.hxx:91
     void SfxStatusForwarder::SfxStatusForwarder(unsigned short,class SfxControllerItem &)
     unsigned short nSlotId
diff --git a/compilerplugins/clang/countusersofdefaultparams.py b/compilerplugins/clang/countusersofdefaultparams.py
index 57af9ea29caa..a53c17283c14 100755
--- a/compilerplugins/clang/countusersofdefaultparams.py
+++ b/compilerplugins/clang/countusersofdefaultparams.py
@@ -47,8 +47,6 @@ for k,v in callDict.iteritems():
         continue
     if k.endswith("::RegisterChildWindow(_Bool,class SfxModule *,enum SfxChildWindowFlags)"):
         continue
-    if k.endswith("::RegisterChildWindowContext(unsigned short,class SfxModule *)"):
-        continue
     if k.endswith("::RegisterControl(unsigned short,class SfxModule *)"):
         continue
     if k.endswith("::RegisterFactory(unsigned short)"):
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index 26b14e2ca2d4..b3b1761baece 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -36,7 +36,6 @@ namespace weld { class Window; }
 
 class BasicManager;
 class DdeService;
-struct SfxChildWinContextFactory;
 class SfxAppData_Impl;
 class SfxChildWinFactArr_Impl;
 class SfxDispatcher;
@@ -174,7 +173,6 @@ public:
 
     // Object-Factories/global arrays
     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&);
     SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const;
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index b78f8301c653..6668ddcbee32 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -35,7 +35,6 @@ namespace com::sun::star::frame { class XFrame; }
 class SfxWorkWindow;
 class SfxModule;
 class SfxChildWindow;
-class SfxChildWindowContext;
 class SfxBindings;
 class SfxModelessDialogController;
 
@@ -83,57 +82,18 @@ typedef std::unique_ptr<SfxChildWindow> (*SfxChildWinCtor)( vcl::Window *pParent
                                             SfxBindings *pBindings,
                                             SfxChildWinInfo *pInfo);
 
-// ChildWindowsContexts factory methods
-typedef std::unique_ptr<SfxChildWindowContext> (*SfxChildWinContextCtor)( vcl::Window *pParentWindow,
-                                            SfxBindings *pBindings,
-                                            SfxChildWinInfo *pInfo);
-struct SfxChildWinContextFactory
-{
-    SfxChildWinContextCtor  pCtor;      // Factory method
-    sal_uInt16              nContextId; // Identifier for SfxInterface
-
-    SfxChildWinContextFactory( SfxChildWinContextCtor pTheCtor, sal_uInt16 nID )
-        : pCtor(pTheCtor)
-        , nContextId(nID)
-    {}
-};
-
-class SfxChildWinContextArr_Impl;
-
 struct SFX2_DLLPUBLIC SfxChildWinFactory
 {
     SfxChildWinCtor             pCtor;  // Factory method
     sal_uInt16                  nId;    // ChildWindow-Id ( SlotId )
     SfxChildWinInfo             aInfo;  // Configuration
     sal_uInt16                  nPos;   // Position in UI
-    std::unique_ptr<SfxChildWinContextArr_Impl> pArr;   // Array for Contexts
 
     SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n );
     ~SfxChildWinFactory();
 };
 
 struct SfxChildWindow_Impl;
-class SFX2_DLLPUBLIC SfxChildWindowContext
-{
-friend class SfxChildWindow;
-    VclPtr<vcl::Window> pWindow;
-    sal_uInt16          nContextId;
-
-protected:
-                        SfxChildWindowContext( sal_uInt16 nId );
-
-public:
-    virtual             ~SfxChildWindowContext();
-
-    void                SetWindow( vcl::Window* pWin )
-                        { pWindow=pWin; }
-    vcl::Window*        GetWindow() const
-                        { return pWindow; }
-    sal_uInt16          GetContextId() const
-                        { return nContextId; }
-
-    static void         RegisterChildWindowContext(SfxModule*, sal_uInt16, std::unique_ptr<SfxChildWinContextFactory>);
-};
 
 extern SFX2_DLLPUBLIC bool ParentIsFloatingWindow(vcl::Window *pParent);
 
@@ -145,7 +105,6 @@ class SFX2_DLLPUBLIC SfxChildWindow
     std::shared_ptr<SfxDialogController> xController;     // actual contents
     SfxChildAlignment          eChildAlignment; // Current css::drawing::Alignment
     std::unique_ptr< SfxChildWindow_Impl>       pImpl;            // Implementation data
-    std::unique_ptr<SfxChildWindowContext>      pContext;        // With context-sensitive ChildWindows:
                                                  // Another window in pWindow
     SAL_DLLPRIVATE void ClearWorkwin();
 
@@ -173,15 +132,6 @@ public:
     sal_uInt16          GetType() const
                         { return nType; }
 
-    void                CreateContext( sal_uInt16 nContextId, SfxBindings& );
-    sal_uInt16          GetContextId() const
-                        { return pContext ? pContext->GetContextId(): 0; }
-
-    vcl::Window*        GetContextWindow() const
-                        { return pContext ? pContext->GetWindow(): nullptr; }
-
-    vcl::Window*        GetContextWindow( SfxModule const *pModule ) const;
-
     virtual SfxChildWinInfo GetInfo() const;
     void                SaveStatus(const SfxChildWinInfo& rInfo);
 
@@ -203,36 +153,10 @@ public:
     SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
     SAL_DLLPRIVATE void Activate_Impl();
 
-    SAL_DLLPRIVATE SfxChildWindowContext*
-                        GetContext_Impl() const
-                        { return pContext.get(); }
     SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* );
 };
 
 
-//! The Macro of the future ...
-#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \
-        static  std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent, \
-                    SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
-        static  void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=nullptr); \
-
-//! The Macro of the future ...
-// As a parameter and because of ContextId, CreateImpl must be handed the
-// factory. As long as Id is set to 0 and patched in
-// SfxChildWindow::CreateContext
-#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \
-        std::unique_ptr<SfxChildWindowContext> Class::CreateImpl( vcl::Window *pParent, \
-                SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
-        {   \
-            return std::make_unique<Class>(pParent,0,pBindings,pInfo);\
-        } \
-        void    Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod)   \
-        {   \
-            auto pFact = std::make_unique<SfxChildWinContextFactory>( \
-                Class::CreateImpl, nId );   \
-            SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, std::move(pFact)); \
-        }
-
 #define SFX_DECL_CHILDWINDOW(Class) \
     public  :   \
         static  std::unique_ptr<SfxChildWindow> CreateImpl(vcl::Window *pParent, sal_uInt16 nId, \
diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx
index 9ee356566479..19b9b8344b44 100644
--- a/sfx2/source/appl/appchild.cxx
+++ b/sfx2/source/appl/appchild.cxx
@@ -52,79 +52,11 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, std::unique_ptr<
     pImpl->pFactArr->push_back( std::move(pFact) );
 }
 
-void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt16 nId,
-        std::unique_ptr<SfxChildWinContextFactory> pFact)
-{
-    SfxChildWinFactArr_Impl *pFactories;
-    SfxChildWinFactory *pF = nullptr;
-    if ( pMod )
-    {
-        // Abandon Module, search there for ChildwindowFactory
-        pFactories = pMod->GetChildWinFactories_Impl();
-        if ( pFactories )
-        {
-            sal_uInt16 nCount = pFactories->size();
-            for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory)
-            {
-                SfxChildWinFactory *pFac = &(*pFactories)[nFactory];
-                if ( nId == pFac->nId )
-                {
-                    // Factory found, register Context here.
-                    pF = pFac;
-                    break;
-                }
-            }
-        }
-    }
-
-    if ( !pF )
-    {
-        // Search for Factory in the Application
-        DBG_ASSERT( pImpl, "No AppData!" );
-        DBG_ASSERT( pImpl->pFactArr, "No Factories!" );
-
-        pFactories = pImpl->pFactArr.get();
-        sal_uInt16 nCount = pFactories->size();
-        for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory)
-        {
-            SfxChildWinFactory *pFac = &(*pFactories)[nFactory];
-            if ( nId == pFac->nId )
-            {
-                if ( pMod )
-                {
-                    // If the context of a module has been registered, then the
-                    // ChildWindowFactory must also be available there,
-                    // else the ContextFactory would have be unsubscribed on
-                    // DLL-exit
-                    pF = new SfxChildWinFactory( pFac->pCtor, pFac->nId,
-                            pFac->nPos );
-                    pMod->RegisterChildWindow( std::unique_ptr<SfxChildWinFactory>(pF) );
-                }
-                else
-                    pF = pFac;
-                break;
-            }
-        }
-    }
-
-    if ( pF )
-    {
-        if ( !pF->pArr )
-            pF->pArr.reset( new SfxChildWinContextArr_Impl );
-        pF->pArr->push_back( std::move(pFact) );
-        return;
-    }
-
-    OSL_FAIL( "No ChildWindow for this Context!" );
-}
-
-
 SfxChildWinFactArr_Impl& SfxApplication::GetChildWinFactories_Impl() const
 {
     return ( *(pImpl->pFactArr));
 }
 
-
 SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) const
 {
     if ( pFrame )
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 430593a88ab9..b833cea80c37 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -147,7 +147,6 @@ bool GetSplitSizeFromString( const OUString& rStr, Size& rSize )
     return false;
 }
 
-
 SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
     : pParent(pParentWindow)
     , nType(nId)
@@ -160,8 +159,6 @@ SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
     pImpl->bVisible = true;
     pImpl->pContextModule = nullptr;
     pImpl->pWorkWin = nullptr;
-
-    pContext = nullptr;
 }
 
 void SfxChildWindow::Destroy()
@@ -197,7 +194,6 @@ void SfxChildWindow::ClearWorkwin()
 
 SfxChildWindow::~SfxChildWindow()
 {
-    pContext.reset();
     ClearWorkwin();
     if (xController)
     {
@@ -437,98 +433,6 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI
         rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32()));
 }
 
-void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBindings )
-{
-    std::unique_ptr<SfxChildWindowContext> pCon;
-    SfxChildWinFactory* pFact=nullptr;
-    SfxApplication *pApp = SfxGetpApp();
-    SfxDispatcher *pDisp = rBindings.GetDispatcher_Impl();
-    SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :nullptr;
-    if ( pMod )
-    {
-        SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl();
-        if ( pFactories )
-        {
-            SfxChildWinFactArr_Impl &rFactories = *pFactories;
-            for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory )
-            {
-                pFact = &rFactories[nFactory];
-                if ( pFact->nId == GetType() )
-                {
-                    DBG_ASSERT( pFact->pArr, "No context registered!" );
-                    if ( !pFact->pArr )
-                        break;
-
-                    for ( size_t n=0; n<pFact->pArr->size(); ++n )
-                    {
-                        SfxChildWinContextFactory *pConFact = &(*pFact->pArr)[n];
-                        rBindings.ENTERREGISTRATIONS();
-                        if ( pConFact->nContextId == nContextId )
-                        {
-                            SfxChildWinInfo aInfo = pFact->aInfo;
-                            pCon = pConFact->pCtor( GetWindow(), &rBindings, &aInfo );
-                            pCon->nContextId = pConFact->nContextId;
-                            pImpl->pContextModule = pMod;
-                        }
-                        rBindings.LEAVEREGISTRATIONS();
-                    }
-                    break;
-                }
-            }
-        }
-    }
-
-    if ( !pCon )
-    {
-        SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl();
-        for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory )
-        {
-            pFact = &rFactories[nFactory];
-            if ( pFact->nId == GetType() )
-            {
-                DBG_ASSERT( pFact->pArr, "No context registered!" );
-                if ( !pFact->pArr )
-                    break;
-
-                for ( size_t n=0; n<pFact->pArr->size(); ++n )
-                {
-                    SfxChildWinContextFactory *pConFact = &(*pFact->pArr)[n];
-                    rBindings.ENTERREGISTRATIONS();
-                    if ( pConFact->nContextId == nContextId )
-                    {
-                        SfxChildWinInfo aInfo = pFact->aInfo;
-                        pCon = pConFact->pCtor( GetWindow(), &rBindings, &aInfo );
-                        pCon->nContextId = pConFact->nContextId;
-                        pImpl->pContextModule = nullptr;
-                    }
-                    rBindings.LEAVEREGISTRATIONS();
-                }
-                break;
-            }
-        }
-    }
-
-    if ( !pCon )
-    {
-        OSL_FAIL( "No suitable context found! ");
-        return;
-    }
-
-    pContext = std::move(pCon);
-    pContext->GetWindow()->SetSizePixel( pWindow->GetOutputSizePixel() );
-    pContext->GetWindow()->Show();
-}
-
-SfxChildWindowContext::SfxChildWindowContext( sal_uInt16 nId )
-    : nContextId( nId )
-{
-}
-
-SfxChildWindowContext::~SfxChildWindowContext()
-{
-    pWindow.disposeAndClear();
-}
-
 bool ParentIsFloatingWindow(vcl::Window *pParent)
 {
     if (pParent->GetType() == WindowType::DOCKINGWINDOW || pParent->GetType() == WindowType::TOOLBOX)
@@ -649,11 +553,6 @@ void SfxChildWindow::Show( ShowFlags nFlags )
         pWindow->Show(true, nFlags);
 }
 
-vcl::Window* SfxChildWindow::GetContextWindow( SfxModule const *pModule ) const
-{
-    return pModule == pImpl->pContextModule && pContext ? pContext->GetWindow(): nullptr;
-}
-
 void SfxChildWindow::SetWorkWindow_Impl( SfxWorkWindow* pWin )
 {
     pImpl->pWorkWin = pWin;
@@ -726,11 +625,6 @@ void SfxChildWindow::SetFrame( const css::uno::Reference< css::frame::XFrame > &
         pImpl->xFrame->addEventListener( pImpl->xListener );
 }
 
-void SfxChildWindowContext::RegisterChildWindowContext(SfxModule* pMod, sal_uInt16 nId, std::unique_ptr<SfxChildWinContextFactory> pFact)
-{
-    SfxGetpApp()->RegisterChildWindowContext_Impl( pMod, nId, std::move(pFact) );
-}
-
 void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, std::unique_ptr<SfxChildWinFactory> pFact)
 {
     SfxGetpApp()->RegisterChildWindow_Impl( pMod, std::move(pFact) );
diff --git a/sfx2/source/appl/childwinimpl.cxx b/sfx2/source/appl/childwinimpl.cxx
index d04f0c2b4089..7cce90b751d6 100644
--- a/sfx2/source/appl/childwinimpl.cxx
+++ b/sfx2/source/appl/childwinimpl.cxx
@@ -20,26 +20,6 @@
 #include <memory>
 #include <childwinimpl.hxx>
 
-size_t SfxChildWinContextArr_Impl::size() const
-{
-    return maData.size();
-}
-
-const SfxChildWinContextFactory& SfxChildWinContextArr_Impl::operator []( size_t i ) const
-{
-    return *maData[i];
-}
-
-SfxChildWinContextFactory& SfxChildWinContextArr_Impl::operator []( size_t i )
-{
-    return *maData[i];
-}
-
-void SfxChildWinContextArr_Impl::push_back( std::unique_ptr<SfxChildWinContextFactory> p )
-{
-    maData.push_back(std::move(p));
-}
-
 size_t SfxChildWinFactArr_Impl::size() const
 {
     return maData.size();
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index d3af7dfa6950..29ec2fedcd23 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1318,9 +1318,6 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
                             // The window ia within a SplitWindow
                             static_cast<SfxDockingWindow*>(pChildWin->GetWindow())->Reappear_Impl();
                     }
-
-                    if ( pCW->nInterfaceId != pChildWin->GetContextId() )
-                        pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
                 }
             }
         }
@@ -1401,9 +1398,6 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
         // This happens already in the initialization of SfxDockingWindows!
     }
 
-    if ( pCW->nInterfaceId != pChildWin->GetContextId() )
-        pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
-
     // Save the information in the INI file
     SaveStatus_Impl(pChildWin, pCW->aInfo);
 }
diff --git a/sfx2/source/inc/childwinimpl.hxx b/sfx2/source/inc/childwinimpl.hxx
index 4cc2c78e24cc..323860c52304 100644
--- a/sfx2/source/inc/childwinimpl.hxx
+++ b/sfx2/source/inc/childwinimpl.hxx
@@ -27,18 +27,6 @@
 
 class SfxFrame;
 
-class SfxChildWinContextArr_Impl
-{
-    typedef std::vector<std::unique_ptr<SfxChildWinContextFactory>> DataType;
-    DataType maData;
-
-public:
-    size_t size() const;
-    const SfxChildWinContextFactory& operator[](size_t i) const;
-    SfxChildWinContextFactory& operator[](size_t i);
-    void push_back(std::unique_ptr<SfxChildWinContextFactory> p);
-};
-
 class SfxChildWinFactArr_Impl
 {
     typedef std::vector<std::unique_ptr<SfxChildWinFactory>> DataType;


More information about the Libreoffice-commits mailing list