From a71a5cdb972174cb7c33e67927cd519152fd3cf6 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 27 Jul 2022 14:02:48 +0100 Subject: 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 --- include/sfx2/lokcallback.hxx | 5 +++++ include/sfx2/lokhelper.hxx | 4 ++++ include/sfx2/viewsh.hxx | 3 +++ 3 files changed, 12 insertions(+) (limited to 'include/sfx2') diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index 32b6c08f865b..a92f60572145 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -11,6 +11,10 @@ #include +namespace rtl +{ +class OStringBuffer; +} namespace tools { class Rectangle; @@ -46,6 +50,7 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; + virtual void dumpState(rtl::OStringBuffer& rState) = 0; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 4ac50a19cc69..0b18c0fa7b5e 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -147,6 +148,9 @@ public: /// This value is chosen such that sal_Int32 will not overflow when manipulated. static const tools::Long MaxTwips = 1e9; + /// Helper for diagnosing run-time problems + static void dumpState(rtl::OStringBuffer &rState); + private: static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId); }; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index ea7d966c8cc7..3faf7aeb2071 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -55,6 +55,7 @@ class SfxPrinter; class NotifyEvent; class SfxInPlaceClient; class SfxLokCallbackInterface; +namespace rtl { class OStringBuffer; } namespace vcl { class PrinterController; } namespace com::sun::star::awt{ class XPopupMenu; } @@ -341,6 +342,8 @@ public: /// Set up a more efficient internal callback instead of LibreOfficeKitCallback. void setLibreOfficeKitViewCallback(SfxLokCallbackInterface* pCallback); + /// dump view state for diagnostics + void dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState); /// Invokes the registered callback, if there are any. virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; -- cgit