summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2022-07-27 14:02:48 +0100
committerMichael Meeks <michael.meeks@collabora.com>2022-07-28 14:49:19 +0200
commita71a5cdb972174cb7c33e67927cd519152fd3cf6 (patch)
tree2e6630ac29b4d75469fdf4cb64e7475ff47dc747 /sfx2
parent2b0626e2e9d112280e9d9a296cc7d7ba3022bdc9 (diff)
lok: add dumpState feature for better in-field diagnostics.
Always suspicious that some un-expected dialog / state can cause strange behavior in a client. An initial cut at an API to make it easier to unwind such problems by exposing the toolkit state. Change-Id: If8f17943fa4837df4f9ca659a111dcdce5c23244 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137504 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx25
-rw-r--r--sfx2/source/view/viewsh.cxx7
2 files changed, 31 insertions, 1 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 69cbc8b3d131..1d39838bfbf8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -851,4 +851,29 @@ void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, LokMo
postEventAsync(pLOKEv);
}
+void SfxLokHelper::dumpState(rtl::OStringBuffer &rState)
+{
+ SfxViewShell* pShell = SfxViewShell::Current();
+ sal_Int32 nDocId = pShell ? static_cast<sal_Int32>(pShell->GetDocId().get()) : -1;
+
+ rState.append("\n\tDocId:\t");
+ rState.append(nDocId);
+
+ if (nDocId < 0)
+ return;
+
+ rState.append("\n\tViewCount:\t");
+ rState.append(static_cast<sal_Int32>(getViewsCount(nDocId)));
+
+ const SfxViewShell* const pCurrentViewShell = SfxViewShell::Current();
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ if (pCurrentViewShell == nullptr || pViewShell->GetDocId() == pCurrentViewShell-> GetDocId())
+ pViewShell->dumpLibreOfficeKitViewState(rState);
+
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c14b31ce9862..d1f326c68b7f 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1418,7 +1418,6 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
void SfxViewShell::setLibreOfficeKitViewCallback(SfxLokCallbackInterface* pCallback)
{
- pImpl->m_pLibreOfficeKitViewCallback = nullptr;
pImpl->m_pLibreOfficeKitViewCallback = pCallback;
afterCallbackRegistered();
@@ -1436,6 +1435,12 @@ void SfxViewShell::setLibreOfficeKitViewCallback(SfxLokCallbackInterface* pCallb
}
}
+void SfxViewShell::dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState)
+{
+ if (pImpl->m_pLibreOfficeKitViewCallback)
+ pImpl->m_pLibreOfficeKitViewCallback->dumpState(rState);
+}
+
static bool ignoreLibreOfficeKitViewCallback(int nType, const SfxViewShell_Impl* pImpl)
{
if (!comphelper::LibreOfficeKit::isActive())