Kaydet (Commit) 2c79d998 authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

lok: calc: LOK_FEATURE_RANGE_HEADERS

For allowing the client to enable/disable the new range based header
data

Change-Id: I95da8ec3e48137fb75b9b22af3bb1296001ba9ca
Reviewed-on: https://gerrit.libreoffice.org/46095Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
(cherry picked from commit 069cf932)
Reviewed-on: https://gerrit.libreoffice.org/46570Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
Tested-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst b7788136
......@@ -25,6 +25,8 @@ static bool g_bDialogPainting(false);
static bool g_bTiledAnnotations(true);
static bool g_bRangeHeaders(false);
void setActive(bool bActive)
{
g_bActive = bActive;
......@@ -75,6 +77,16 @@ bool isTiledAnnotations()
return g_bTiledAnnotations;
}
void setRangeHeaders(bool bRangeHeaders)
{
g_bRangeHeaders = bRangeHeaders;
}
bool isRangeHeaders()
{
return g_bRangeHeaders;
}
static bool g_bLocalRendering(false);
void setLocalRendering(bool bLocalRendering)
......
......@@ -3366,6 +3366,8 @@ static void lo_setOptionalFeatures(LibreOfficeKit* pThis, unsigned long long con
comphelper::LibreOfficeKit::setPartInInvalidation(true);
if (features & LOK_FEATURE_NO_TILED_ANNOTATIONS)
comphelper::LibreOfficeKit::setTiledAnnotations(false);
if (features & LOK_FEATURE_RANGE_HEADERS)
comphelper::LibreOfficeKit::setRangeHeaders(true);
}
static void lo_setDocumentPassword(LibreOfficeKit* pThis,
......
......@@ -79,7 +79,12 @@ typedef enum
/**
* Turn off tile rendering for annotations
*/
LOK_FEATURE_NO_TILED_ANNOTATIONS = (1ULL << 3)
LOK_FEATURE_NO_TILED_ANNOTATIONS = (1ULL << 3),
/**
* Enable range based header data
*/
LOK_FEATURE_RANGE_HEADERS = (1ULL << 4)
}
LibreOfficeKitOptionalFeatures;
......
......@@ -60,6 +60,10 @@ COMPHELPER_DLLPUBLIC void setDialogPainting(bool bDialogPainting);
COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations);
/// Check if annotations rendering is turned off
COMPHELPER_DLLPUBLIC bool isTiledAnnotations();
/// Set if we want range based header data
COMPHELPER_DLLPUBLIC void setRangeHeaders(bool bTiledAnnotations);
/// Check if range based header data is enabled
COMPHELPER_DLLPUBLIC bool isRangeHeaders();
// Status indicator handling. Even if in theory there could be several status indicators active at
// the same time, in practice there is only one at a time, so we don't handle any identification of
......
......@@ -2719,6 +2719,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (rRectangle.IsEmpty())
return OUString();
bool bRangeHeaderSupport = comphelper::LibreOfficeKit::isRangeHeaders();
rtl::OUStringBuffer aBuffer(256);
aBuffer.append("{ \"commandName\": \".uno:ViewRowColumnHeaders\",\n");
......@@ -2776,7 +2778,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
const ScOutlineArray* pRowArray = pTable ? &(pTable->GetRowArray()) : nullptr;
size_t nRowGroupDepth = 0;
std::vector<size_t> aRowGroupIndexes;
if (pTable)
if (bRangeHeaderSupport && pTable)
{
nRowGroupDepth = pRowArray->GetDepth();
lcl_getGroupIndexes(*pRowArray, nStartRow, nEndRow, aRowGroupIndexes);
......@@ -2850,13 +2852,13 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
nTotalPixels += nSizePx;
const long nTotalTwips = nTotalPixels * TWIPS_PER_PIXEL;
if (nRowGroupDepth > 0)
if (bRangeHeaderSupport && nRowGroupDepth > 0)
{
lcl_createGroupsData(nRow, nEndRow, nSizePx, nTotalTwips,
*pRowArray, aRowGroupIndexes, aRowGroupStartPositions, aRowGroupsBuffer);
}
if (nRow < nEndRow && nSizePx == nPrevSizePx)
if (bRangeHeaderSupport && nRow < nEndRow && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;
......@@ -2917,7 +2919,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
const ScOutlineArray* pColArray = pTable ? &(pTable->GetColArray()) : nullptr;
size_t nColGroupDepth = 0;
std::vector<size_t> aColGroupIndexes;
if (pTable)
if (bRangeHeaderSupport && pTable)
{
nColGroupDepth = pColArray->GetDepth();
lcl_getGroupIndexes(*pColArray, nStartCol, nEndCol, aColGroupIndexes);
......@@ -2989,17 +2991,19 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
nTotalPixels += nSizePx;
const long nTotalTwips = nTotalPixels * TWIPS_PER_PIXEL;
if (nColGroupDepth > 0)
if (bRangeHeaderSupport && nColGroupDepth > 0)
{
lcl_createGroupsData(nCol, nEndCol, nSizePx, nTotalTwips,
*pColArray, aColGroupIndexes, aColGroupStartPositions, aColGroupsBuffer);
}
if (nCol < nEndCol && nSizePx == nPrevSizePx)
if (bRangeHeaderSupport && nCol < nEndCol && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;
OUString aText = OUString::number(nCol + 1);
OUString aText = bRangeHeaderSupport ?
OUString::number(nCol + 1) : pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
aBuffer.append(", ");
aBuffer.append("{ \"text\": \"").append(aText).append("\", ");
aBuffer.append("\"size\": \"").append(OUString::number(nTotalTwips)).append("\" }");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment