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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 15 21:12:52 UTC 2020


 compilerplugins/clang/constantparam.numbers.results |    4 
 include/sfx2/tbxctrl.hxx                            |   57 -----
 sfx2/source/appl/module.cxx                         |    1 
 sfx2/source/control/bindings.cxx                    |    2 
 sfx2/source/toolbox/tbxitem.cxx                     |  228 --------------------
 5 files changed, 3 insertions(+), 289 deletions(-)

New commits:
commit 32c8e953662fa2cdbcf2a43f7c217f75b5a808c8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 15 19:36:29 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 15 22:12:17 2020 +0100

    SfxPopupWindow is now unused
    
    Change-Id: Idd4f2854eb0746a0648df30a5815bfaf8ef6a9ef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86879
    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 ef6f9ae21d47..876f8da673f5 100644
--- a/compilerplugins/clang/constantparam.numbers.results
+++ b/compilerplugins/clang/constantparam.numbers.results
@@ -822,10 +822,6 @@ include/sfx2/tabdlg.hxx:46
     void SfxTabDialogItem::SfxTabDialogItem(unsigned short,const class SfxItemSet &)
     unsigned short nId
     11022
-include/sfx2/tbxctrl.hxx:88
-    void SfxPopupWindow::SfxPopupWindow(unsigned short,class vcl::Window *,const class com::sun::star::uno::Reference<class com::sun::star::frame::XFrame> &,long)
-    long nBits
-    1610612810
 include/sfx2/templatelocalview.hxx:228
     class BitmapEx SfxTemplateLocalView::fetchThumbnail(const class rtl::OUString &,long,long)
     long height
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 5503aaae997d..f12878564e87 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -24,9 +24,9 @@
 #include <sfx2/dllapi.h>
 #include <sal/types.h>
 #include <svl/poolitem.hxx>
-#include <vcl/floatwin.hxx>
 #include <svtools/toolboxcontroller.hxx>
 #include <rtl/ref.hxx>
+#include <vcl/window.hxx>
 
 namespace com::sun::star::frame { class XDispatchProvider; }
 namespace com::sun::star::frame { class XFrame; }
@@ -53,54 +53,6 @@ struct SfxTbxCtrlFactory
 };
 
 
-/* Floating windows that can be torn from tool boxes should be derived from
-   this class. Since it is also derived from SfxControllerItem, its instances
-   will also receive the StateChanged calls.
-*/
-class SfxFrameStatusListener;
-class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow
-{
-friend class SfxFrameStatusListener;
-    bool                                                   m_bFloating;
-    Link<SfxPopupWindow*,void>                             m_aDeleteLink;
-    sal_uInt16 const                                       m_nId;
-    css::uno::Reference< css::frame::XFrame > const        m_xFrame;
-    rtl::Reference<SfxFrameStatusListener>                 m_xStatusListener;
-
-private:
-    SfxPopupWindow(SfxPopupWindow const &) = delete;
-    SfxPopupWindow& operator =(SfxPopupWindow const &) = delete;
-    void Delete();
-
-protected:
-    virtual void            PopupModeEnd() override;
-    virtual bool            Close() override;
-
-    sal_uInt16              GetId() const { return m_nId; }
-    const css::uno::Reference< css::frame::XFrame >& GetFrame() const { return m_xFrame; }
-
-    void                    AddStatusListener( const OUString& rCommandURL );
-
-    virtual void            statusChanged( const css::frame::FeatureStateEvent& rEvent );
-
-public:
-                            SfxPopupWindow(sal_uInt16 nId, vcl::Window *pParent,
-                                            const css::uno::Reference< css::frame::XFrame >& rFrame,
-                                            WinBits nBits );
-                            SfxPopupWindow(sal_uInt16 nId, vcl::Window *pParent,
-                                           const OString& rID, const OUString& rUIXMLDescription,
-                                           const css::uno::Reference<css::frame::XFrame> &rFrame =
-                                               css::uno::Reference<css::frame::XFrame>());
-                            virtual ~SfxPopupWindow() override;
-    virtual void            dispose() override;
-
-    SAL_DLLPRIVATE void SetDeleteLink_Impl( const Link<SfxPopupWindow*,void>& rLink )
-                            {
-                                m_aDeleteLink = rLink;
-                            }
-};
-
-
 #define SFX_DECL_TOOLBOX_CONTROL() \
         static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \
         static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr)
@@ -117,15 +69,11 @@ public:
 struct SfxToolBoxControl_Impl;
 class SFX2_DLLPUBLIC SfxToolBoxControl: public svt::ToolboxController
 {
-friend class SfxPopupWindow;
 friend struct SfxTbxCtrlFactory;
 
     std::unique_ptr< SfxToolBoxControl_Impl>    pImpl;
 
 protected:
-    DECL_LINK( PopupModeEndHdl, FloatingWindow*, void );
-    DECL_LINK( ClosePopupWindow, SfxPopupWindow *, void );
-
     // old SfxToolBoxControl methods
     virtual void               StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
     virtual void               Select( sal_uInt16 nSelectModifier );
@@ -135,9 +83,6 @@ protected:
     virtual void               CreatePopupWindow();
     virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent );
 
-    // Must be called by subclass to set a new popup window instance
-    void                       SetPopupWindow( SfxPopupWindow* pWindow );
-
 public:
     // XComponent
     virtual void SAL_CALL dispose() override;
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 693f584ac326..0825c2430754 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -30,6 +30,7 @@
 #include <sfx2/sfxsids.hrc>
 #include <svl/intitem.hxx>
 #include <tools/diagnose_ex.h>
+#include <unotools/resmgr.hxx>
 #include <sal/log.hxx>
 
 #define ShellClass_SfxModule
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index e29d51ac294f..b3e630fd73bd 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -184,7 +184,7 @@ SfxBindings::~SfxBindings()
 
 void SfxBindings::DeleteControllers_Impl()
 {
-    // in the first round delete SfxPopupWindows
+    // in the first round delete Controllers
     std::size_t nCount = pImpl->pCaches.size();
     std::size_t nCache;
     for ( nCache = 0; nCache < nCount; ++nCache )
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 04cc9dee983c..28813ad2f04b 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -96,29 +96,6 @@ using namespace ::com::sun::star::ui;
 
 SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, true);
 
-static vcl::Window* GetTopMostParentSystemWindow( vcl::Window* pWindow )
-{
-    OSL_ASSERT( pWindow );
-    if ( pWindow )
-    {
-        // ->manually search topmost system window
-        // required because their might be another system window between this and the top window
-        pWindow = pWindow->GetParent();
-        SystemWindow* pTopMostSysWin = nullptr;
-        while ( pWindow )
-        {
-            if ( pWindow->IsSystemWindow() )
-                pTopMostSysWin = static_cast<SystemWindow*>(pWindow);
-            pWindow = pWindow->GetParent();
-        }
-        pWindow = pTopMostSysWin;
-        OSL_ASSERT( pWindow );
-        return pWindow;
-    }
-
-    return nullptr;
-}
-
 svt::ToolboxController* SfxToolBoxControllerFactory( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL )
 {
     SolarMutexGuard aGuard;
@@ -178,26 +155,8 @@ struct SfxToolBoxControl_Impl
     bool                    bShowString;
     sal_uInt16              nTbxId;
     sal_uInt16              nSlotId;
-    VclPtr<SfxPopupWindow>  mpFloatingWindow;
-    VclPtr<SfxPopupWindow>  mpPopupWindow;
-    DECL_LINK( WindowEventListener, VclWindowEvent&, void );
 };
 
-IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclWindowEvent&, rEvent, void )
-{
-    if ( ( rEvent.GetId() == VclEventId::WindowMove ) ||
-         ( rEvent.GetId() == VclEventId::WindowActivate ))
-    {
-        vcl::Window* pWindow( rEvent.GetWindow() );
-        if (( pWindow == mpFloatingWindow ) &&
-            ( mpPopupWindow != nullptr ))
-        {
-            mpPopupWindow.disposeAndClear();
-        }
-    }
-}
-
-
 SfxToolBoxControl::SfxToolBoxControl(
     sal_uInt16      nSlotID,
     sal_uInt16      nID,
@@ -209,8 +168,6 @@ SfxToolBoxControl::SfxToolBoxControl(
     pImpl->bShowString = bShowStringItems;
     pImpl->nTbxId = nID;
     pImpl->nSlotId = nSlotID;
-    pImpl->mpFloatingWindow = nullptr;
-    pImpl->mpPopupWindow = nullptr;
 }
 
 
@@ -245,10 +202,6 @@ void SAL_CALL SfxToolBoxControl::dispose()
     VclPtr< vcl::Window > pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
     pImpl->pBox->SetItemWindow( pImpl->nTbxId, nullptr );
     pWindow.disposeAndClear();
-
-    // Delete my popup windows
-    pImpl->mpFloatingWindow.disposeAndClear();
-    pImpl->mpPopupWindow.disposeAndClear();
 }
 
 
@@ -557,45 +510,6 @@ Reference< css::awt::XWindow > SAL_CALL SfxToolBoxControl::createItemWindow( con
     return VCLUnoHelper::GetInterface( CreateItemWindow( VCLUnoHelper::GetWindow( rParent )));
 }
 
-void SfxToolBoxControl::SetPopupWindow( SfxPopupWindow* pWindow )
-{
-    pImpl->mpPopupWindow = pWindow;
-    pImpl->mpPopupWindow->SetPopupModeEndHdl( LINK( this, SfxToolBoxControl, PopupModeEndHdl ));
-    pImpl->mpPopupWindow->SetDeleteLink_Impl( LINK( this, SfxToolBoxControl, ClosePopupWindow ));
-}
-
-
-IMPL_LINK_NOARG(SfxToolBoxControl, PopupModeEndHdl, FloatingWindow*, void)
-{
-    if ( pImpl->mpPopupWindow->IsVisible() )
-    {
-        // Replace floating window with popup window and destroy
-        // floating window instance.
-        pImpl->mpFloatingWindow.disposeAndClear();
-        pImpl->mpFloatingWindow = pImpl->mpPopupWindow;
-        pImpl->mpPopupWindow.clear();
-        // We also need to know when the user tries to use the
-        // floating window.
-        pImpl->mpFloatingWindow->AddEventListener( LINK( pImpl.get(), SfxToolBoxControl_Impl, WindowEventListener ));
-    }
-    else
-    {
-        // Popup window has been closed by the user. No replacement, instance
-        // will destroy itself.
-        pImpl->mpPopupWindow.clear();
-    }
-}
-
-
-IMPL_LINK( SfxToolBoxControl, ClosePopupWindow, SfxPopupWindow *, pWindow, void )
-{
-    if ( pWindow == pImpl->mpFloatingWindow )
-        pImpl->mpFloatingWindow = nullptr;
-    else
-        pImpl->mpPopupWindow = nullptr;
-}
-
-
 void SfxToolBoxControl::StateChanged
 (
     sal_uInt16              nId,
@@ -675,146 +589,4 @@ VclPtr<vcl::Window> SfxToolBoxControl::CreateItemWindow( vcl::Window * )
     return VclPtr<vcl::Window>();
 }
 
-class SfxFrameStatusListener : public svt::FrameStatusListener
-{
-    public:
-        SfxFrameStatusListener( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
-                                const css::uno::Reference< css::frame::XFrame >& xFrame,
-                                SfxPopupWindow* pCallee );
-
-        // XStatusListener
-        virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
-
-    private:
-        VclPtr<SfxPopupWindow> m_pCallee;
-};
-SfxFrameStatusListener::SfxFrameStatusListener(
-    const Reference< XComponentContext >& rxContext,
-    const Reference< XFrame >& xFrame,
-    SfxPopupWindow* pCallee ) :
-    svt::FrameStatusListener( rxContext, xFrame ),
-    m_pCallee( pCallee )
-{
-}
-
-// XStatusListener
-void SAL_CALL SfxFrameStatusListener::statusChanged( const css::frame::FeatureStateEvent& rEvent )
-{
-    m_pCallee->statusChanged( rEvent );
-}
-
-SfxPopupWindow::SfxPopupWindow(
-    sal_uInt16 nId,
-    vcl::Window* pParentWindow,
-    const Reference< XFrame >& rFrame,
-    WinBits nBits ) :
-    FloatingWindow( pParentWindow, nBits )
-    , m_bFloating( false )
-    , m_nId( nId )
-    , m_xFrame( rFrame )
-{
-    vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
-    if ( pWindow )
-        static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this );
-}
-
-SfxPopupWindow::SfxPopupWindow(
-    sal_uInt16 nId,
-    vcl::Window* pParentWindow,
-    const OString& rID, const OUString& rUIXMLDescription,
-    const Reference< XFrame >& rFrame ) :
-    FloatingWindow( pParentWindow, rID, rUIXMLDescription, rFrame)
-    , m_bFloating( false )
-    , m_nId( nId )
-    , m_xFrame( rFrame )
-{
-    vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
-    if ( pWindow )
-        static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this );
-}
-
-SfxPopupWindow::~SfxPopupWindow()
-{
-    disposeOnce();
-}
-
-void SfxPopupWindow::dispose()
-{
-    if ( m_xStatusListener.is() )
-    {
-        m_xStatusListener->dispose();
-        m_xStatusListener.clear();
-    }
-
-    vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
-    if ( pWindow )
-        static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
-    FloatingWindow::dispose();
-}
-
-
-void SfxPopupWindow::AddStatusListener( const OUString& rCommandURL )
-{
-    if ( !m_xStatusListener.is() )
-    {
-        m_xStatusListener = new SfxFrameStatusListener(
-                                    ::comphelper::getProcessComponentContext(),
-                                    m_xFrame,
-                                    this );
-    }
-    if ( m_xStatusListener.is() )
-        m_xStatusListener->addStatusListener( rCommandURL );
-}
-
-
-bool SfxPopupWindow::Close()
-{
-    m_bFloating = false;
-    FloatingWindow::Close();
-
-    Delete();
-    return true;
-}
-
-
-void SfxPopupWindow::PopupModeEnd()
-{
-    //! to allow PopupModeEndHdl to be called
-    FloatingWindow::PopupModeEnd();
-
-    if ( IsVisible() )
-    {
-        // was teared-off
-        if ( m_bFloating )
-        {
-            Hide();
-            Delete();
-        }
-        m_bFloating = true;
-    }
-    else
-        Close();
-}
-
-
-void SfxPopupWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
-{
-    if ( !rEvent.IsEnabled )
-    {
-        Hide();
-    }
-    else if ( m_bFloating )
-    {
-        Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
-    }
-}
-
-
-void SfxPopupWindow::Delete()
-{
-    VclPtr<SfxPopupWindow> xThis(this);
-    m_aDeleteLink.Call( this );
-    disposeOnce();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list