summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/misc/lok.cxx12
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h7
-rw-r--r--include/comphelper/lok.hxx4
-rw-r--r--sc/source/ui/view/tabview.cxx18
5 files changed, 35 insertions, 8 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index a4f60ac6c565..b8324a4defcd 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -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)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2e8d876cb985..5f18a457f241 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -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,
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index cf85d7c6b592..f14ce4d36a7a 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -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;
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 7a293ca70352..c42a740822e0 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -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
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 1c6e61cc6ad4..9e88f11f36e5 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -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("\" }");