[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/vcl svx/source vcl/source

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 7 20:56:35 UTC 2021


 include/vcl/dockwin.hxx          |   16 ++++++++++++++++
 svx/source/tbxctrls/tbcontrl.cxx |   19 +++++++++++++++++++
 vcl/source/window/dockmgr.cxx    |    8 ++++++++
 vcl/source/window/dockwin.cxx    |    1 +
 4 files changed, 44 insertions(+)

New commits:
commit 4f7121822037f89a1802e00dddf9f21a8df7c91c
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Tue Mar 2 06:04:40 2021 +0530
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Mar 7 21:55:59 2021 +0100

    LOK: added missing PixelInvalidate method for currency list
    
    when docking window is displayed in popup mode,
    there are two windows created docking window and floating window,
    to make the this window work correctly with LOK,
    we have to invalidate the floating window to update floating window,
    as well as docking window.
    
    Change-Id: Ia1b4220646664aa0666a24e34fc14bf41421f9e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111892
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index 7bbbc9e49d79..e53373285f13 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -213,6 +213,16 @@ class VCL_DLLPUBLIC DockingWindow
     class   ImplData;
 private:
     VclPtr<FloatingWindow> mpFloatWin;
+
+    // in the case when docking window is displayed in popup mode
+    // there are 2 window instance docking window and floating window
+    // and to make things work correctly both needs to be invalidated together
+    // but unfortunatly from any docking window we don't have access to floating window notifier
+    // so we can use this mnPopUpWinId to store the floating win id when we can to use later
+    // this was primarily introduced to fix the currency popup window in calc LOK
+    // if there is any better approach
+    // FIXME
+    vcl::LOKWindowId mnLOKPopUpWinId;
     VclPtr<vcl::Window>    mpOldBorderWin;
     std::unique_ptr<ImplData> mpImplData;
     Point           maFloatPos;
@@ -313,6 +323,12 @@ public:
     bool            IsFloatingMode() const;
     FloatingWindow* GetFloatingWindow() const { return mpFloatWin; }
 
+    // These two methods are used when docking window is displayed in popup mode
+    // By setting this popup window id we can access floating window notifier in docking window
+    // one of the example can be found in SvxCurrencyList_Impl::PixelInvalidate
+    void SetPopUpWindowLOKId(vcl::LOKWindowId nLOKPopUpWinId) { mnLOKPopUpWinId = nLOKPopUpWinId; }
+    vcl::LOKWindowId GetPopUpWindowLOKId() const { return mnLOKPopUpWinId; }
+
     void            SetFloatingPos( const Point& rNewPos );
     Point           GetFloatingPos() const;
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ff8aeb8b6db8..0d06766d6ef2 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -321,6 +321,8 @@ public:
                           LanguageType& eSelectLanguage );
     virtual ~SvxCurrencyList_Impl() override { disposeOnce(); }
     virtual void dispose() override;
+
+    void PixelInvalidate(const tools::Rectangle* pRectangle) override;
 };
 
 class SvxStyleToolBoxControl;
@@ -2352,15 +2354,32 @@ SvxCurrencyList_Impl::SvxCurrencyList_Impl(
     if ( nSelectedPos >= 0 )
         m_pCurrencyLb->SelectEntryPos( nSelectedPos );
     m_pCurrencyLb->Show();
+
+    auto parentNotifier = GetParentWithLOKNotifier();
+    if (parentNotifier)
+        SetLOKNotifier(parentNotifier->GetLOKNotifier());
 }
 
 void SvxCurrencyList_Impl::dispose()
 {
+    ReleaseLOKNotifier();
     m_xControl.clear();
     m_pCurrencyLb.disposeAndClear();
     ToolbarPopup::dispose();
 }
 
+void SvxCurrencyList_Impl::PixelInvalidate(const tools::Rectangle* pRectangle)
+{
+    const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
+    if (pNotifier && pRectangle && GetPopUpWindowLOKId() != 0)
+    {
+        std::vector<vcl::LOKPayloadItem> aPayload;
+        aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString()));
+        pNotifier->notifyWindow(GetPopUpWindowLOKId(), "invalidate", aPayload);
+    }
+    svtools::ToolbarPopup::PixelInvalidate(pRectangle);
+}
+
 SvxLineWindow_Impl::SvxLineWindow_Impl( svt::ToolboxController& rController, vcl::Window* pParentWindow ) :
     ToolbarPopup( rController.getFrameInterface(), pParentWindow, WB_STDPOPUP | WB_MOVEABLE | WB_CLOSEABLE ),
     m_aLineStyleLb( VclPtr<LineListBox>::Create(this) ),
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index c5d6a93798d4..34065088f137 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -809,6 +809,10 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
     mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
     GetWindow()->Show();
 
+    DockingWindow* pDockWin = dynamic_cast< DockingWindow* >(mpDockingWindow.get());
+    if (pDockWin)
+        pDockWin->SetPopUpWindowLOKId(mpFloatWin->GetLOKWindowId());
+
     if( pParentToolBox->IsKeyEvent() )
     {
         // send HOME key to subtoolbar in order to select first item
@@ -830,6 +834,10 @@ void ImplDockingWindowWrapper::StartPopupMode( const tools::Rectangle& rRect, Fl
 
 IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
 {
+    DockingWindow* pDockWin = dynamic_cast< DockingWindow* >(mpDockingWindow.get());
+    if (pDockWin)
+        pDockWin->SetPopUpWindowLOKId(0);
+
     GetWindow()->Show( false, ShowFlags::NoFocusChange );
 
     // set parameter for handler before destroying floating window
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index fa402bb3aa2c..5b0f7243f268 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -300,6 +300,7 @@ void DockingWindow::ImplInitDockingWindowData()
     mbIsDeferredInit = false;
     mbIsCalculatingInitialLayoutSize = false;
     mpDialogParent = nullptr;
+    mnLOKPopUpWinId = 0;
 
     //To-Do, reuse maResizeTimer
     maLayoutIdle.SetPriority(TaskPriority::RESIZE);


More information about the Libreoffice-commits mailing list