diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Library_test.mk | 1 | ||||
-rw-r--r-- | test/source/lokcallback.cxx | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/test/Library_test.mk b/test/Library_test.mk index 4be059857a84..8b1fd214490d 100644 --- a/test/Library_test.mk +++ b/test/Library_test.mk @@ -50,6 +50,7 @@ $(eval $(call gb_Library_add_exception_objects,test,\ test/source/htmltesttools \ test/source/screenshot_test \ test/source/unoapi_property_testers \ + test/source/lokcallback \ test/source/helper/form \ test/source/helper/shape \ test/source/helper/transferable \ diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx new file mode 100644 index 000000000000..912fe2d8c807 --- /dev/null +++ b/test/source/lokcallback.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <test/lokcallback.hxx> + +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <rtl/strbuf.hxx> +#include <tools/gen.hxx> +#include <comphelper/lok.hxx> + +TestLokCallbackWrapper::TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data) + : m_callback(callback) + , m_data(data) +{ +} + +inline void TestLokCallbackWrapper::callCallback(int nType, const char* pPayload) +{ + m_callback(nType, pPayload, m_data); +} + +void TestLokCallbackWrapper::libreOfficeKitViewCallback(int nType, const char* pPayload) +{ + callCallback(nType, pPayload); +} + +void TestLokCallbackWrapper::libreOfficeKitViewCallback(int nType, const char* pPayload, + int /*nViewId*/) +{ + callCallback(nType, pPayload); // the view id is also included in payload +} + +void TestLokCallbackWrapper::libreOfficeKitViewInvalidateTilesCallback( + const tools::Rectangle* pRect, int nPart) +{ + OStringBuffer buf(64); + if (pRect) + buf.append(pRect->toString()); + else + buf.append("EMPTY"); + if (comphelper::LibreOfficeKit::isPartInInvalidation()) + { + buf.append(", "); + buf.append(static_cast<sal_Int32>(nPart)); + } + callCallback(LOK_CALLBACK_INVALIDATE_TILES, buf.makeStringAndClear().getStr()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |