[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - 2 commits - desktop/source include/sfx2 include/vcl sc/inc sc/source sd/source sfx2/source sw/inc sw/source vcl/inc vcl/source

Jan Holesovsky kendy at collabora.com
Mon Nov 27 18:30:27 UTC 2017


 desktop/source/lib/init.cxx       |   22 ++++++----------------
 include/sfx2/viewsh.hxx           |    5 -----
 include/vcl/ITiledRenderable.hxx  |    6 ------
 include/vcl/dialog.hxx            |    1 -
 include/vcl/window.hxx            |    7 +++++++
 sc/inc/docuno.hxx                 |    3 ---
 sc/source/ui/unoobj/docuno.cxx    |    6 ------
 sd/source/ui/inc/unomodel.hxx     |    3 ---
 sd/source/ui/unoidl/unomodel.cxx  |    6 ------
 sfx2/source/dialog/basedlgs.cxx   |    6 ++----
 sfx2/source/dialog/tabdlg.cxx     |    3 +--
 sfx2/source/view/viewsh.cxx       |   31 -------------------------------
 sw/inc/unotxdoc.hxx               |    3 ---
 sw/source/uibase/uno/unotxdoc.cxx |    6 ------
 vcl/inc/window.h                  |    1 -
 vcl/source/window/dialog.cxx      |   15 ---------------
 vcl/source/window/paint.cxx       |   16 ++++++++++++++++
 vcl/source/window/window.cxx      |   31 ++++++++++++++++++++++++++++---
 18 files changed, 60 insertions(+), 111 deletions(-)

New commits:
commit 6dab8b1a2d706af5bc185d6db419e14271e6f758
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 27 19:23:22 2017 +0100

    lokdialog: Move the LOKWindowId <-> VclPtr<Window> mapping to Window.
    
    This allows registering & de-registering of non-sfx windows too, and makes the
    Calc autofilter popup to appear.
    
    Change-Id: I7cbbe94d208115aabcb6fa5f964646c7b7ce4c93

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 5e535e4be11d..9a231d0b7597 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1321,16 +1321,6 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
     return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
 }
 
-VclPtr<Window> findWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId)
-{
-    ITiledRenderable* pRenderable = getTiledRenderable(pThis);
-
-    if (!pRenderable)
-        return VclPtr<Window>();
-
-    return pRenderable->findWindow(nLOKWindowId);
-}
-
 } // anonymous namespace
 
 // Wonder global state ...
@@ -2264,7 +2254,7 @@ static void doc_postDialogKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKW
 {
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
@@ -2442,7 +2432,7 @@ static void doc_postDialogMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLO
 {
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
@@ -2473,7 +2463,7 @@ static void doc_postDialogChildMouseEvent(LibreOfficeKitDocument* pThis, unsigne
 {
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
@@ -3284,7 +3274,7 @@ static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nLOKWindow
 
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
@@ -3312,7 +3302,7 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId
 {
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
@@ -3337,7 +3327,7 @@ static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigne
 {
     SolarMutexGuard aGuard;
 
-    VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
     if (!pWindow)
     {
         gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 75a7fb7dbc41..2ec0b0c24515 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -155,7 +155,6 @@ friend class SfxPrinterController;
     VclPtr<vcl::Window>         pWindow;
     bool                        bNoNewWindow;
     bool                        mbPrinterSettingsModified;
-    std::vector<std::pair<vcl::LOKWindowId, VclPtr<Dialog> > > maOpenedDialogs;
 
 protected:
     virtual void                Activate(bool IsMDIActivate) override;
@@ -224,10 +223,6 @@ public:
     virtual       SfxShell*     GetFormShell()       { return nullptr; };
     virtual const SfxShell*     GetFormShell() const { return nullptr; };
 
-    void                        RegisterDlg(vcl::LOKWindowId nDialogId, VclPtr<Dialog> pDlg);
-    VclPtr<Dialog>              GetOpenedDlg(vcl::LOKWindowId nDialogId);
-    void                        UnregisterDlg(vcl::LOKWindowId nDialogId);
-
     // ILibreOfficeKitNotifier
     virtual void                notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
     virtual void                notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos) const override;
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 016704bb09db..7b0720a429b7 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -228,12 +228,6 @@ public:
     {
         return OUString();
     }
-
-    /**
-     * Find the window/dialog with the right ID for tunneling of windows,
-     * dialogs or pop-ups.
-     */
-    virtual VclPtr<Window> findWindow(vcl::LOKWindowId nLOKWindowId) const = 0;
 };
 } // namespace vcl
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c219147c1515..6df774ccde85 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1211,6 +1211,12 @@ public:
     const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
     vcl::LOKWindowId                    GetLOKWindowId() const;
 
+    /// Indicate that LOK is not going to use this dialog any more.
+    void                                ReleaseLOKNotifier();
+
+    /// Find an existing Window based on the LOKWindowId.
+    static VclPtr<Window>               FindLOKWindow(vcl::LOKWindowId nWindowId);
+
     /// Dialog / window tunneling related methods.
     virtual void paintDialog(VirtualDevice& rDevice);
     Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const;
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 01fc9d9be960..67ee07440884 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -363,9 +363,6 @@ public:
 
     /// @see vcl::ITiledRenderable::getPostItsPos().
     OUString getPostItsPos() override;
-
-    /// @see vcl::ITiledRenderable::findWindow().
-    VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const override;
 };
 
 class ScDrawPagesObj : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 9ee451923ab8..60bd3239cc27 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1130,12 +1130,6 @@ OUString ScModelObj::getPostItsPos()
     return OUString::fromUtf8(aStream.str().c_str());
 }
 
-VclPtr<vcl::Window> ScModelObj::findWindow(vcl::LOKWindowId nLOKWindowId) const
-{
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    return pViewShell->GetOpenedDlg(nLOKWindowId);
-}
-
 void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
 {
     SolarMutexGuard aGuard;
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index d93ccdd89da9..404c34c49b72 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -265,9 +265,6 @@ public:
     /// @see vcl::ITiledRenderable::getPostIts().
     virtual OUString getPostIts() override;
 
-    /// @see vcl::ITiledRenderable::findWindow().
-    VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const override;
-
     // XComponent
 
     /** This dispose implementation releases the resources held by the
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index ebea82464567..ab16b1b1419f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2669,12 +2669,6 @@ Pointer SdXImpressDocument::getPointer()
     return pWindow->GetPointer();
 }
 
-VclPtr<vcl::Window> SdXImpressDocument::findWindow(vcl::LOKWindowId nLOKWindowId) const
-{
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    return pViewShell->GetOpenedDlg(nLOKWindowId);
-}
-
 uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
 {
     uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbiddenCharacters);
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index fba79fdcc1b0..e9cadef82db0 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -165,7 +165,7 @@ void SfxModalDialog::dispose()
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         pViewShell->notifyWindow(GetLOKWindowId(), "close");
-        pViewShell->UnregisterDlg(GetLOKWindowId());
+        ReleaseLOKNotifier();
     }
 
     ModalDialog::dispose();
@@ -177,7 +177,6 @@ short SfxModalDialog::Execute()
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         SetLOKNotifier(pViewShell);
-        pViewShell->RegisterDlg(GetLOKWindowId(), this);
         const Size aSize = GetOptimalSize();
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back(std::make_pair("size", aSize.toString()));
@@ -249,7 +248,6 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
         if (comphelper::LibreOfficeKit::isActive() && pViewShell)
         {
             SetLOKNotifier(pViewShell);
-            pViewShell->RegisterDlg(GetLOKWindowId(), this);
             // Below method doesn't really give the exact dimensions,
             // Check GetSizePixel() ?
             const Size aOptimalSize = GetOptimalSize();
@@ -394,7 +392,7 @@ void SfxModelessDialog::dispose()
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         pViewShell->notifyWindow(GetLOKWindowId(), "close");
-        pViewShell->UnregisterDlg(GetLOKWindowId());
+        ReleaseLOKNotifier();
     }
 
     ModelessDialog::dispose();
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 10cacfb0eee2..ce9e1a753984 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -407,7 +407,7 @@ void SfxTabDialog::dispose()
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         pViewShell->notifyWindow(GetLOKWindowId(), "close");
-        pViewShell->UnregisterDlg(GetLOKWindowId());
+        ReleaseLOKNotifier();
     }
 
     TabDialog::dispose();
@@ -522,7 +522,6 @@ short SfxTabDialog::Execute()
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         SetLOKNotifier(pViewShell);
-        pViewShell->RegisterDlg(GetLOKWindowId(), this);
         const Size aSize = GetOptimalSize();
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back(std::make_pair("size", aSize.toString()));
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c286992d168e..4f08ef2298d6 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1958,37 +1958,6 @@ void SfxViewShell::notifyWindowChild(vcl::LOKWindowId nDialogId, const OUString&
     SfxLokHelper::notifyWindowChild(nDialogId, rAction, rPos);
 }
 
-void SfxViewShell::RegisterDlg(vcl::LOKWindowId nDialogId, VclPtr<Dialog> pDlg)
-{
-    if (pDlg)
-        maOpenedDialogs.push_back(std::make_pair(nDialogId, pDlg));
-}
-
-VclPtr<Dialog> SfxViewShell::GetOpenedDlg(vcl::LOKWindowId nDialogId)
-{
-    const auto it = std::find_if(maOpenedDialogs.begin(),
-                                 maOpenedDialogs.end(),
-                                 [&nDialogId](const std::pair<vcl::LOKWindowId, VclPtr<Dialog>> aItem) {
-                                     return nDialogId == aItem.first;
-                                 });
-
-    Dialog* ret = nullptr;
-    if (it != maOpenedDialogs.end())
-    {
-        ret = it->second;
-    }
-    return ret;
-}
-
-void SfxViewShell::UnregisterDlg(vcl::LOKWindowId nDialogId)
-{
-    maOpenedDialogs.erase(std::remove_if(maOpenedDialogs.begin(),
-                                         maOpenedDialogs.end(),
-                                         [&nDialogId](const std::pair<vcl::LOKWindowId, VclPtr<Dialog>> aItem) {
-                                             return aItem.first == nDialogId;
-                                         }));
-}
-
 uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier()
 {
     uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 288f32fa3df7..3f202c88ae54 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -429,9 +429,6 @@ public:
     /// @see vcl::ITiledRenderable::getPostIts().
     OUString getPostIts() override;
 
-    /// @see vcl::ITiledRenderable::findWindow().
-    VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const override;
-
     // css::tiledrendering::XTiledRenderable
     virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override;
 
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 15e6f72a45bd..0bc48bda8051 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3639,12 +3639,6 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
     #endif
 }
 
-VclPtr<vcl::Window> SwXTextDocument::findWindow(vcl::LOKWindowId nLOKWindowId) const
-{
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    return pViewShell->GetOpenedDlg(nLOKWindowId);
-}
-
 void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
 {
     return SwXTextDocumentBaseClass::operator new(t);
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 7b2222b3718b..dec452861bb1 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -378,7 +378,6 @@ public:
     css::uno::Reference< css::uno::XInterface > mxDNDListenerContainer;
 
     const vcl::ILibreOfficeKitNotifier* mpLOKNotifier; ///< To emit the LOK callbacks eg. for dialog tunneling.
-    static vcl::LOKWindowId mnLastWindowId; ///< To be able to have an unique ID for each dealog / window we tunnel.
     vcl::LOKWindowId mnLOKWindowId; ///< ID of this specific window.
 };
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 3d6fff132ad3..93f554d06dc9 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -84,6 +84,12 @@ using namespace ::com::sun::star::datatransfer::dnd;
 
 namespace vcl {
 
+/// Counter to be able to have unique id's for each window.
+static vcl::LOKWindowId sLastLOKWindowId = 1;
+
+/// Map to remember the LOKWindowId <-> Window binding.
+static std::map<vcl::LOKWindowId, VclPtr<vcl::Window>> sLOKWindows;
+
 Window::Window( WindowType nType ) :
     mpWindowImpl(new WindowImpl( nType ))
 {
@@ -592,8 +598,6 @@ Window::~Window()
 
 } /* namespace vcl */
 
-vcl::LOKWindowId WindowImpl::mnLastWindowId = 1;
-
 WindowImpl::WindowImpl( WindowType nType )
 {
     maZoom                              = Fraction( 1, 1 );
@@ -3177,11 +3181,32 @@ void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier)
     assert(pNotifier);
 
     // assign the LOK window id
-    mpWindowImpl->mnLOKWindowId = WindowImpl::mnLastWindowId++;
+    assert(mpWindowImpl->mnLOKWindowId == 0);
+    mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
+    sLOKWindows.insert(std::map<vcl::LOKWindowId, VclPtr<vcl::Window>>::value_type(mpWindowImpl->mnLOKWindowId, this));
 
     mpWindowImpl->mpLOKNotifier = pNotifier;
 }
 
+VclPtr<Window> Window::FindLOKWindow(vcl::LOKWindowId nWindowId)
+{
+    const auto it = sLOKWindows.find(nWindowId);
+    if (it != sLOKWindows.end())
+        return it->second;
+
+    return VclPtr<Window>();
+}
+
+void Window::ReleaseLOKNotifier()
+{
+    // unregister the LOK window binding
+    if (mpWindowImpl->mnLOKWindowId > 0)
+        sLOKWindows.erase(mpWindowImpl->mnLOKWindowId);
+
+    mpWindowImpl->mpLOKNotifier = nullptr;
+    mpWindowImpl->mnLOKWindowId = 0;
+}
+
 const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const
 {
     return mpWindowImpl->mpLOKNotifier;
commit 1c675d161283ab8302394db428a23f5e261ea310
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 27 15:03:19 2017 +0100

    lokdialog: Move the LogicInvalidate from Dialog down to Window.
    
    Another step towards the autofilter popup working...
    
    Change-Id: I4907a23fcd0fc64da0c7f51e2f36b1657a17638c

diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 30fae84afa9a..acc1ceef2701 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -75,7 +75,6 @@ protected:
 public:
     SAL_DLLPRIVATE bool    IsInClose() const { return mbInClose; }
     virtual        void    doDeferredInit(WinBits nBits) override;
-    virtual        void    LogicInvalidate(const tools::Rectangle* pRectangle) override;
                    void    InvalidateFloatingWindow(const Point& rPos);
                    void    CloseFloatingWindow();
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 0b61a46592a8..c219147c1515 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1068,6 +1068,7 @@ public:
     virtual void                        Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
     virtual void                        Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
     virtual void                        Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
+    virtual void                        LogicInvalidate(const tools::Rectangle* pRectangle) override;
     void                                Validate();
     bool                                HasPaintEvent() const;
     void                                Update();
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 486c15a2f095..1761c49327e6 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -892,21 +892,6 @@ void Dialog::CloseFloatingWindow()
         pNotifier->notifyWindowChild(GetLOKWindowId(), "close", Point(0, 0));
 }
 
-void Dialog::LogicInvalidate(const tools::Rectangle* pRectangle)
-{
-    if (comphelper::LibreOfficeKit::isDialogPainting())
-        return;
-
-    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-    {
-        std::vector<vcl::LOKPayloadItem> aPayload;
-        if (pRectangle)
-            aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString()));
-
-        pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
-    }
-}
-
 void Dialog::ensureRepaint()
 {
     // ensure repaint
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 04aab4ccdcaa..912f4c4c6958 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1207,6 +1207,22 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
     }
 }
 
+void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
+{
+    if (comphelper::LibreOfficeKit::isDialogPainting())
+        return;
+
+    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+    {
+        // In case we are routing the window, notify the client
+        std::vector<vcl::LOKPayloadItem> aPayload;
+        if (pRectangle)
+            aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString()));
+
+        pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
+    }
+}
+
 void Window::Validate()
 {
     if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )


More information about the Libreoffice-commits mailing list