[Libreoffice-commits] core.git: comphelper/source desktop/source include/comphelper include/LibreOfficeKit sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Fri Dec 15 17:24:49 UTC 2017
comphelper/source/misc/lok.cxx | 12 ++++++++++++
desktop/source/lib/init.cxx | 2 ++
include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 ++++++-
include/comphelper/lok.hxx | 4 ++++
sc/source/ui/view/tabview.cxx | 18 +++++++++++-------
5 files changed, 35 insertions(+), 8 deletions(-)
New commits:
commit 2c79d998587cb2a0a561bbbd128ffb48fd56cf5a
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Fri Dec 8 16:44:09 2017 +0100
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/46095
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
(cherry picked from commit 069cf9321be51e7203e336e0e87d8ba7dc9b729e)
Reviewed-on: https://gerrit.libreoffice.org/46570
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
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("\" }");
More information about the Libreoffice-commits
mailing list