LibreOffice Module test (master) 1
lokcallback.hxx
Go to the documentation of this file.
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.
4 *
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 */
9
10#pragma once
11
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>
17
18#include <vector>
19
27{
28public:
29 TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data);
31 void clear();
33 void setLOKViewId(int viewId) { m_viewId = viewId; }
34 virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) override;
35 virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* 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{};
44
45 virtual void Invoke() override;
46
47private:
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
57 {
58 int type;
59 int viewId;
61 };
62 std::vector<PerViewIdData> m_updatedTypesPerViewId;
63};
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload)=0
virtual void libreOfficeKitViewAddPendingInvalidateTiles()=0
virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle *pRect, int nPart, int nMode)=0
virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char *pPayload, int nViewId)=0
virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId)=0
virtual void libreOfficeKitViewUpdatedCallback(int nType)=0
A helper to convert SfxLokCallbackInterface to a LIbreOfficeKitCallback for tests.
Definition: lokcallback.hxx:27
std::vector< int > m_updatedTypes
Definition: lokcallback.hxx:55
void setLOKViewId(int viewId)
Set the view id of the associated SfxViewShell.
Definition: lokcallback.hxx:33
LibreOfficeKitCallback m_callback
Definition: lokcallback.hxx:52
std::vector< PerViewIdData > m_updatedTypesPerViewId
Definition: lokcallback.hxx:62
virtual void dumpState(rtl::OStringBuffer &) override
Definition: lokcallback.hxx:43
virtual void Invoke() override
#define OOO_DLLPUBLIC_TEST
Definition: testdllapi.hxx:28