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>
23 A helper to convert SfxLokCallbackInterface to a LIbreOfficeKitCallback for tests.
25 It reimplements the specialized callbacks and converts them to the generic type/payload
28 class OOO_DLLPUBLIC_TEST TestLokCallbackWrapper final
: public SfxLokCallbackInterface
, public Idle
31 TestLokCallbackWrapper(LibreOfficeKitCallback callback
, void* data
);
32 /// Discard all possibly still held events.
34 /// Set the view id of the associated SfxViewShell.
35 void setLOKViewId(int viewId
) { m_viewId
= viewId
; }
36 virtual void libreOfficeKitViewCallback(int nType
, const rtl::OString
& pPayload
) override
;
37 virtual void libreOfficeKitViewCallbackWithViewId(int nType
, const rtl::OString
& pPayload
,
38 int nViewId
) override
;
39 virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle
* pRect
, int nPart
,
41 virtual void libreOfficeKitViewUpdatedCallback(int nType
) override
;
42 virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType
, int nViewId
,
43 int nSourceViewId
) override
;
44 virtual void libreOfficeKitViewAddPendingInvalidateTiles() override
;
45 virtual void dumpState(rtl::OStringBuffer
&) override
{};
47 virtual void Invoke() override
;
49 static SfxChildWindow
* InitializeSidebar();
52 void callCallback(int nType
, const char* pPayload
, int nViewId
);
55 void discardUpdatedTypes(int nType
, int nViewId
);
56 LibreOfficeKitCallback m_callback
;
58 int m_viewId
= -1; // the associated SfxViewShell
59 std::vector
<int> m_updatedTypes
; // value is type
66 std::vector
<PerViewIdData
> m_updatedTypesPerViewId
;
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */