[Libreoffice-commits] core.git: include/sfx2 sfx2/source sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Aug 19 10:38:26 UTC 2016


 include/sfx2/viewsh.hxx        |    4 ++++
 sfx2/source/view/viewimp.hxx   |    2 ++
 sfx2/source/view/viewsh.cxx    |   14 ++++++++++++++
 sw/inc/viewsh.hxx              |    2 --
 sw/source/core/view/viewsh.cxx |    4 ++--
 sw/source/core/view/vnew.cxx   |    2 --
 6 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit 8b4705e0e0c76503b1ca61cb567d222f49466fc5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Aug 19 11:10:43 2016 +0200

    sw: remove never read SwViewShell::mbInLibreOfficeKitCallback
    
    This was read in the now removed SwViewShell::libreOfficeKitCallback(),
    so add a similar flag to SfxViewShell instead, and restore the lost
    condition.
    
    This fixes paint/invalidation loops when inserting the first comment to
    a Writer document in gtktiledviewer.
    
    Change-Id: Iad5ef90848f3b309ef8db4553760dd36d9b8a37c
    Reviewed-on: https://gerrit.libreoffice.org/28236
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index b4b3804..d20d4e3 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -331,6 +331,10 @@ public:
     void setTiledSearching(bool bTiledSearching);
     /// Are we doing tiled searching?
     bool isTiledSearching() const;
+    /// Set if we are doing tiled painting.
+    void setTiledPainting(bool bTiledPainting);
+    /// Are we doing tiled painting?
+    bool isTiledPainting() const;
     /// See lok::Document::getPart().
     virtual int getPart() const;
     virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 95fdf82..7848165 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -62,6 +62,8 @@ struct SfxViewShell_Impl
     void* m_pLibreOfficeKitViewData;
     /// Set if we are in the middle of a tiled search.
     bool m_bTiledSearching;
+    /// Set if we are in the middle of a tiled paint.
+    bool m_bTiledPainting;
     static sal_uInt32 m_nLastViewShellId;
     const sal_uInt32 m_nViewShellId;
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 631d712..f2d8e48 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -255,6 +255,7 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags)
 ,   m_pLibreOfficeKitViewCallback(nullptr)
 ,   m_pLibreOfficeKitViewData(nullptr)
 ,   m_bTiledSearching(false)
+,   m_bTiledPainting(false)
 ,   m_nViewShellId(SfxViewShell_Impl::m_nLastViewShellId++)
 {}
 
@@ -1473,6 +1474,9 @@ void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCa
 
 void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const
 {
+    if (pImpl->m_bTiledPainting)
+        return;
+
     if (pImpl->m_bTiledSearching)
     {
         switch (nType)
@@ -1501,6 +1505,16 @@ bool SfxViewShell::isTiledSearching() const
     return pImpl->m_bTiledSearching;
 }
 
+void SfxViewShell::setTiledPainting(bool bTiledPainting)
+{
+    pImpl->m_bTiledPainting = bTiledPainting;
+}
+
+bool SfxViewShell::isTiledPainting() const
+{
+    return pImpl->m_bTiledPainting;
+}
+
 int SfxViewShell::getPart() const
 {
     return 0;
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index abeea02..8223c0d 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -190,8 +190,6 @@ protected:
     sal_uInt16 mnLockPaint;   ///< != 0 if Paint is locked.
     bool      mbSelectAll; ///< Special select all mode: whole document selected, even if doc starts with table.
 
-    bool mbInLibreOfficeKitCallback;
-
     /// The virtual device we paint to will end up on the screen.
     bool mbOutputToWindow;
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 6c8a94b..64b6f7b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1842,7 +1842,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     // TODO clean up SwViewShell's approach to output devices (the many of
     // them - mpBufferedOut, mpOut, mpWin, ...)
     OutputDevice *pSaveOut = mpOut;
-    mbInLibreOfficeKitCallback = true;
+    GetSfxViewShell()->setTiledPainting(true);
     mpOut = &rDevice;
 
     // resizes the virtual device so to contain the entries context
@@ -1895,7 +1895,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
 
     // SwViewShell's output device tear down
     mpOut = pSaveOut;
-    mbInLibreOfficeKitCallback = false;
+    GetSfxViewShell()->setTiledPainting(false);
 }
 
 void SwViewShell::SetBrowseBorder( const Size& rNew )
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index f98cf74..dd4fc97 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -164,7 +164,6 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow,
     mnStartAction( 0 ),
     mnLockPaint( 0 ),
     mbSelectAll(false),
-    mbInLibreOfficeKitCallback(false),
     mbOutputToWindow(false),
     mpPrePostOutDev(nullptr),
     maPrePostMapMode()
@@ -241,7 +240,6 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow,
     mnStartAction( 0 ),
     mnLockPaint( 0 ),
     mbSelectAll(false),
-    mbInLibreOfficeKitCallback(false),
     mbOutputToWindow(false),
     mpPrePostOutDev(nullptr),
     maPrePostMapMode()


More information about the Libreoffice-commits mailing list