summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx5
-rw-r--r--include/sfx2/viewsh.hxx5
-rw-r--r--sfx2/source/view/viewsh.cxx2
-rw-r--r--sw/inc/view.hxx2
-rw-r--r--sw/inc/viscrs.hxx4
-rw-r--r--sw/source/core/crsr/viscrs.cxx6
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx2
-rw-r--r--sw/source/uibase/uiview/view.cxx4
-rw-r--r--sw/source/uibase/wrtsh/wrtsh4.cxx6
-rw-r--r--test/source/lokcallback.cxx10
10 files changed, 26 insertions, 20 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d3353e441474..e71e62929903 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2197,8 +2197,9 @@ void CallbackFlushHandler::enqueueUpdatedTypes()
void CallbackFlushHandler::enqueueUpdatedType( int type, SfxViewShell* viewShell, int viewId )
{
- OString payload = viewShell->getLOKPayload( type, viewId );
- if(payload.isEmpty())
+ bool ignore = false;
+ OString payload = viewShell->getLOKPayload( type, viewId, &ignore );
+ if(ignore)
return; // No actual payload to send.
CallbackData callbackData(payload.getStr(), viewId);
m_queue1.emplace_back(type);
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index f0d71bc542e6..26a2324c7ca0 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -345,8 +345,9 @@ public:
virtual void libreOfficeKitViewUpdatedCallback(int nType) const override;
virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override;
// Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or
- // libreOfficeKitViewUpdatedCallbackPerViewId() were called.
- virtual OString getLOKPayload(int nType, int nViewId) const;
+ // libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should
+ // be generated, the ignore flag should be set.
+ virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const;
/// Set if we are doing tiled searching.
void setTiledSearching(bool bTiledSearching);
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 325c9ffa71cc..d1c0e48ba18e 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1552,7 +1552,7 @@ void SfxViewShell::flushPendingLOKInvalidateTiles()
// SfxViewShell itself does not delay any tile invalidations.
}
-OString SfxViewShell::getLOKPayload(int nType, int /*nViewId*/) const
+OString SfxViewShell::getLOKPayload(int nType, int /*nViewId*/, bool* /*ignore*/) const
{
// SfxViewShell itself currently doesn't handle any updated-payload types.
SAL_WARN("sfx.view", "SfxViewShell::getLOKPayload unhandled type " << lokCallbackTypeToString(nType));
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index b793614f58f7..0f062d3bedf3 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -680,7 +680,7 @@ public:
virtual tools::Rectangle getLOKVisibleArea() const override;
virtual void flushPendingLOKInvalidateTiles() override;
- virtual OString getLOKPayload(int nType, int nViewId) const override;
+ virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const override;
};
inline tools::Long SwView::GetXScroll() const
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index b2ceb9c67c79..dc7e020ad103 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -61,7 +61,7 @@ public:
void SetPosAndShow(SfxViewShell const * pViewShell);
const vcl::Cursor& GetTextCursor() const;
- OString getLOKPayload(int nType, int nViewId) const;
+ OString getLOKPayload(int nType, int nViewId, bool* ignore) const;
};
// From here classes/methods for selections.
@@ -115,7 +115,7 @@ public:
static void Get1PixelInLogic( const SwViewShell& rSh,
tools::Long* pX = nullptr, tools::Long* pY = nullptr );
- OString getLOKPayload(int nType, int nViewId) const;
+ OString getLOKPayload(int nType, int nViewId, bool* ignore) const;
};
class SW_DLLPUBLIC SwShellCursor : public virtual SwCursor, public SwSelPaintRects
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 7d9564295fab..f81f9750b312 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -265,7 +265,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
m_aTextCursor.Show();
}
-OString SwVisibleCursor::getLOKPayload(int nType, int nViewId) const
+OString SwVisibleCursor::getLOKPayload(int nType, int nViewId, bool*) const
{
assert(nType == LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR || nType == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
if (comphelper::LibreOfficeKit::isActive())
@@ -508,7 +508,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
pSelectionRectangles->push_back(sRect);
}
-OString SwSelPaintRects::getLOKPayload( int nType, int nViewId ) const
+OString SwSelPaintRects::getLOKPayload( int nType, int nViewId, bool* ignore ) const
{
switch( nType )
{
@@ -528,12 +528,14 @@ OString SwSelPaintRects::getLOKPayload( int nType, int nViewId ) const
{
if (aStartRect.HasArea())
return aStartRect.SVRect().toString();
+ *ignore = true;
return OString();
}
else // LOK_CALLBACK_TEXT_SELECTION_END
{
if (aEndRect.HasArea())
return aEndRect.SVRect().toString();
+ *ignore = true;
return OString();
}
}
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 3374c10e55dc..4cc8c0ffa166 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -493,7 +493,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)();
void ToggleOutlineContentVisibility(SwNode* pNd, bool bForceFold = false);
void ToggleOutlineContentVisibility(const size_t nPos, bool bForceFold = false);
- OString getLOKPayload(int nType, int nViewId) const;
+ OString getLOKPayload(int nType, int nViewId, bool* ignore) const;
private:
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index ebf2a31fc08c..fc1e3593e803 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1892,11 +1892,11 @@ void SwView::flushPendingLOKInvalidateTiles()
pSh->FlushPendingLOKInvalidateTiles();
}
-OString SwView::getLOKPayload(int nType, int nViewId) const
+OString SwView::getLOKPayload(int nType, int nViewId, bool* ignore) const
{
SwWrtShell* pSh = GetWrtShellPtr();
assert(pSh);
- return pSh->getLOKPayload(nType, nViewId);
+ return pSh->getLOKPayload(nType, nViewId, ignore);
}
OUString SwView::GetDataSourceName() const
diff --git a/sw/source/uibase/wrtsh/wrtsh4.cxx b/sw/source/uibase/wrtsh/wrtsh4.cxx
index 0bafa1e75941..36cec11cc09c 100644
--- a/sw/source/uibase/wrtsh/wrtsh4.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh4.cxx
@@ -234,18 +234,18 @@ bool SwWrtShell::BwdPara_()
return bRet;
}
-OString SwWrtShell::getLOKPayload(int nType, int nViewId) const
+OString SwWrtShell::getLOKPayload(int nType, int nViewId, bool* ignore) const
{
switch(nType)
{
case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
- return GetVisibleCursor()->getLOKPayload(nType, nViewId);
+ return GetVisibleCursor()->getLOKPayload(nType, nViewId, ignore);
case LOK_CALLBACK_TEXT_SELECTION:
case LOK_CALLBACK_TEXT_SELECTION_START:
case LOK_CALLBACK_TEXT_SELECTION_END:
case LOK_CALLBACK_TEXT_VIEW_SELECTION:
- return GetCursor_()->getLOKPayload( nType, nViewId );
+ return GetCursor_()->getLOKPayload( nType, nViewId, ignore );
}
abort();
}
diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx
index 0f6970d2af9c..440aae461eee 100644
--- a/test/source/lokcallback.cxx
+++ b/test/source/lokcallback.cxx
@@ -151,8 +151,9 @@ void TestLokCallbackWrapper::flushLOKData()
for (int type : updatedTypes)
{
- OString payload = viewShell->getLOKPayload(type, m_viewId);
- if (!payload.isEmpty())
+ bool ignore = false;
+ OString payload = viewShell->getLOKPayload(type, m_viewId, &ignore);
+ if (!ignore)
libreOfficeKitViewCallback(type, payload.getStr());
}
for (const PerViewIdData& data : updatedTypesPerViewId)
@@ -161,8 +162,9 @@ void TestLokCallbackWrapper::flushLOKData()
return shell->GetViewShellId().get() == data.sourceViewId;
});
assert(viewShell != nullptr);
- OString payload = viewShell->getLOKPayload(data.type, data.viewId);
- if (!payload.isEmpty())
+ bool ignore = false;
+ OString payload = viewShell->getLOKPayload(data.type, data.viewId, &ignore);
+ if (!ignore)
libreOfficeKitViewCallbackWithViewId(data.type, payload.getStr(), data.viewId);
}
}