diff options
-rw-r--r-- | desktop/inc/lib/init.hxx | 1 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 6 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 1 | ||||
-rw-r--r-- | include/sfx2/lokcallback.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 5 | ||||
-rw-r--r-- | include/test/lokcallback.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/view/viewimp.cxx | 5 | ||||
-rw-r--r-- | test/source/lokcallback.cxx | 6 |
9 files changed, 35 insertions, 3 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index baa1b682de07..7346e51ff159 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -119,6 +119,7 @@ namespace desktop { virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) override; virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; + virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; virtual void dumpState(rtl::OStringBuffer &rState) override; private: diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d1b1931fc69e..bf37ae65c9d0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1490,6 +1490,12 @@ void CallbackFlushHandler::dumpState(rtl::OStringBuffer &rState) } } +void CallbackFlushHandler::libreOfficeKitViewAddPendingInvalidateTiles() +{ + // Invoke() will call flushPendingLOKInvalidateTiles(), so just make sure the timer is active. + startTimer(); +} + void CallbackFlushHandler::queue(const int type, const char* data) { CallbackData callbackData(data); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 87fabb4ee45e..c8890a89a72f 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -373,6 +373,7 @@ public: virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; + virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual ViewShellId GetViewShellId() const = 0; virtual ViewShellDocId GetDocId() const = 0; /// Wrapper around SfxLokHelper::notifyOtherViews(). diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index 95572aba1104..1b90e6c938c5 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -52,6 +52,9 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; + // There are pending invalidate tiles calls that need to be processed. + // A call to SfxViewShell::flushPendingLOKInvalidateTiles() should be scheduled. + virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual void dumpState(rtl::OStringBuffer& rState) = 0; }; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index e2ef0475dbc6..9f085fca62e3 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -346,10 +346,11 @@ public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; - // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. - virtual void flushPendingLOKInvalidateTiles(); virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; + // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. + virtual void flushPendingLOKInvalidateTiles(); + virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; // Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or // libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should // be generated, the ignore flag should be set. diff --git a/include/test/lokcallback.hxx b/include/test/lokcallback.hxx index e18724279040..75a8977938bc 100644 --- a/include/test/lokcallback.hxx +++ b/include/test/lokcallback.hxx @@ -39,6 +39,7 @@ public: virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; + virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; virtual void dumpState(rtl::OStringBuffer&) override{}; virtual void Invoke() override; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 2098e05a283f..0e9279dedeb3 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1546,6 +1546,16 @@ void SfxViewShell::libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nVi << lokCallbackTypeToString(nType)); } +void SfxViewShell::libreOfficeKitViewAddPendingInvalidateTiles() +{ + if (pImpl->m_pLibreOfficeKitViewCallback) + pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewAddPendingInvalidateTiles(); + else + SAL_INFO( + "sfx.view", + "SfxViewShell::libreOfficeKitViewAddPendingInvalidateTiles no callback set!"); +} + void SfxViewShell::afterCallbackRegistered() { } diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index f08c3305e5d6..cb3773383b95 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -36,6 +36,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <drawdoc.hxx> #include <prevwpage.hxx> +#include <sfx2/viewsh.hxx> void SwViewShellImp::Init( const SwViewOption *pNewOpt ) { @@ -161,8 +162,10 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect ) void SwViewShellImp::AddPendingLOKInvalidation( const SwRect& rRect ) { - // These are often repeated, so check first for duplicates. std::vector<SwRect>& l = m_pendingLOKInvalidations; + if(l.empty()) // Announce that these invalidations will need flushing. + m_pShell->GetSfxViewShell()->libreOfficeKitViewAddPendingInvalidateTiles(); + // These are often repeated, so check first for duplicates. if( std::find( l.begin(), l.end(), rRect ) == l.end()) l.push_back( rRect ); } diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx index c938e1e699a8..d7500cb74443 100644 --- a/test/source/lokcallback.cxx +++ b/test/source/lokcallback.cxx @@ -106,6 +106,12 @@ void TestLokCallbackWrapper::libreOfficeKitViewUpdatedCallbackPerViewId(int nTyp startTimer(); } +void TestLokCallbackWrapper::libreOfficeKitViewAddPendingInvalidateTiles() +{ + // Invoke() will call flushPendingLOKInvalidateTiles(). + startTimer(); +} + void TestLokCallbackWrapper::discardUpdatedTypes(int nType, int nViewId) { // If a callback is called directly with an event, drop the updated flag for it, since |