1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
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>
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
26 class OOO_DLLPUBLIC_TEST TestLokCallbackWrapper final
: public SfxLokCallbackInterface
, public Idle
29 TestLokCallbackWrapper(LibreOfficeKitCallback callback
, void* data
);
30 /// Discard all possibly still held events.
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
,
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
;
48 void callCallback(int nType
, const char* pPayload
, int nViewId
);
51 void discardUpdatedTypes(int nType
, int nViewId
);
52 LibreOfficeKitCallback m_callback
;
54 int m_viewId
= -1; // the associated SfxViewShell
55 std::vector
<int> m_updatedTypes
; // value is type
62 std::vector
<PerViewIdData
> m_updatedTypesPerViewId
;
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */