summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-12-08 16:44:09 +0100
committerMarco Cecchetti <mrcekets@gmail.com>2017-12-15 18:20:36 +0100
commit2c79d998587cb2a0a561bbbd128ffb48fd56cf5a (patch)
tree96a4f9236343a2c79e9b738429c2a7b13f8fc603 /sc
parentb77881366b17230908f441dfa27afcafc4374708 (diff)
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@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit 069cf9321be51e7203e336e0e87d8ba7dc9b729e) Reviewed-on: https://gerrit.libreoffice.org/46570 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/tabview.cxx18
1 files changed, 11 insertions, 7 deletions
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("\" }");