And make it a static one. The primary point of that member function is to prevent invalidations during paint, and since multiple views are allowed, it wasn't extended to filter out invalidations from all views, not just from the current one. (Same goes for other callback types.) Change-Id: I23e6b2c2ff94227f2b72c481148b2d8279ae2905
98 lines
2.1 KiB
C++
98 lines
2.1 KiB
C++
/* -*- 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 <comphelper/lok.hxx>
|
|
|
|
namespace comphelper
|
|
{
|
|
|
|
namespace LibreOfficeKit
|
|
{
|
|
|
|
static bool g_bActive(false);
|
|
|
|
static bool g_bPartInInvalidation(false);
|
|
|
|
static bool g_bTiledPainting(false);
|
|
|
|
void setActive(bool bActive)
|
|
{
|
|
g_bActive = bActive;
|
|
}
|
|
|
|
bool isActive()
|
|
{
|
|
return g_bActive;
|
|
}
|
|
|
|
void setPartInInvalidation(bool bPartInInvalidation)
|
|
{
|
|
g_bPartInInvalidation = bPartInInvalidation;
|
|
}
|
|
|
|
bool isPartInInvalidation()
|
|
{
|
|
return g_bPartInInvalidation;
|
|
}
|
|
|
|
void setTiledPainting(bool bTiledPainting)
|
|
{
|
|
g_bTiledPainting = bTiledPainting;
|
|
}
|
|
|
|
bool isTiledPainting()
|
|
{
|
|
return g_bTiledPainting;
|
|
}
|
|
|
|
static bool g_bLocalRendering(false);
|
|
|
|
void setLocalRendering(bool bLocalRendering)
|
|
{
|
|
g_bLocalRendering = bLocalRendering;
|
|
}
|
|
|
|
bool isLocalRendering()
|
|
{
|
|
return g_bLocalRendering;
|
|
}
|
|
|
|
static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr);
|
|
static void *pStatusIndicatorCallbackData(nullptr);
|
|
|
|
void setStatusIndicatorCallback(void (*callback)(void *data, statusIndicatorCallbackType type, int percent), void *data)
|
|
{
|
|
pStatusIndicatorCallback = callback;
|
|
pStatusIndicatorCallbackData = data;
|
|
}
|
|
|
|
void statusIndicatorStart()
|
|
{
|
|
if (pStatusIndicatorCallback)
|
|
pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Start, 0);
|
|
}
|
|
|
|
void statusIndicatorSetValue(int percent)
|
|
{
|
|
if (pStatusIndicatorCallback)
|
|
pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::SetValue, percent);
|
|
}
|
|
|
|
void statusIndicatorFinish()
|
|
{
|
|
if (pStatusIndicatorCallback)
|
|
pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Finish, 0);
|
|
}
|
|
|
|
} // namespace LibreOfficeKit
|
|
|
|
} // namespace comphelper
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|