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 6a1e0871fceb..2191a87f5b87 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2191,8 +2191,9 @@ void CallbackFlushHandler::enqueueUpdatedTypes()
void CallbackFlushHandler::enqueueUpdatedType( int type, const 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 e35c6848c9e1..fc06eb9ddbe8 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -346,8 +346,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 e49899bc36eb..75826a28d128 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1544,7 +1544,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 edcf028d9f5d..d074f0d552a7 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -693,7 +693,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 3c355e01800c..6755b548e8a0 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -60,7 +60,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.
@@ -114,7 +114,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 d28dab2c7d98..26e43813575d 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -266,7 +266,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())
@@ -505,7 +505,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 )
{
@@ -525,12 +525,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 c86de9ef55de..77136362c81f 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -499,7 +499,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)();
void InvalidateOutlineContentVisibility();
bool GetAttrOutlineContentVisible(const size_t nPos);
- 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 84226f9e2942..7d418acd17b0 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1916,11 +1916,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 90ca5f2c9203..323ba4af1f10 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);
}
}