bump product version to 7.6.3.2-android
[LibreOffice.git] / include / test / lokcallback.hxx
blobbba7a392ae2dadd5681ddcb4c03210cb131b6516
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <sal/config.h>
13 #include <test/testdllapi.hxx>
14 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
15 #include <sfx2/lokcallback.hxx>
16 #include <vcl/idle.hxx>
18 #include <vector>
20 /**
21 A helper to convert SfxLokCallbackInterface to a LIbreOfficeKitCallback for tests.
23 It reimplements the specialized callbacks and converts them to the generic type/payload
24 callback.
26 class OOO_DLLPUBLIC_TEST TestLokCallbackWrapper final : public SfxLokCallbackInterface, public Idle
28 public:
29 TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data);
30 /// Discard all possibly still held events.
31 void clear();
32 /// Set the view id of the associated SfxViewShell.
33 void setLOKViewId(int viewId) { m_viewId = viewId; }
34 virtual void libreOfficeKitViewCallback(int nType, const rtl::OString& pPayload) override;
35 virtual void libreOfficeKitViewCallbackWithViewId(int nType, const rtl::OString& pPayload,
36 int nViewId) override;
37 virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart,
38 int nMode) override;
39 virtual void libreOfficeKitViewUpdatedCallback(int nType) override;
40 virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId,
41 int nSourceViewId) override;
42 virtual void libreOfficeKitViewAddPendingInvalidateTiles() override;
43 virtual void dumpState(rtl::OStringBuffer&) override{};
45 virtual void Invoke() override;
47 private:
48 void callCallback(int nType, const char* pPayload, int nViewId);
49 void startTimer();
50 void flushLOKData();
51 void discardUpdatedTypes(int nType, int nViewId);
52 LibreOfficeKitCallback m_callback;
53 void* m_data;
54 int m_viewId = -1; // the associated SfxViewShell
55 std::vector<int> m_updatedTypes; // value is type
56 struct PerViewIdData
58 int type;
59 int viewId;
60 int sourceViewId;
62 std::vector<PerViewIdData> m_updatedTypesPerViewId;
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */