From fb9903c682fdabcc425caea737d81eda1a33f902 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 3 Nov 2015 15:37:31 +0100
Subject: [PATCH 267/398] sc lok: allow requesting column headers only for a
logic area
Change-Id: Iacd8f11917e929c6a1579c6a1553eb7840df5fba
(cherry picked from commit 0fe622f66ee04f25b05c2069f573010e6f517915)
---
sc/source/ui/view/tabview.cxx | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 1cb869cbd432..ab77b47bed0c 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2351,14 +2351,38 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
}
boost::property_tree::ptree aCols;
+ nTotal = 0;
+ nTotalPixels = 0;
for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol)
{
- boost::property_tree::ptree aCol;
sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo());
- aCol.put("size", OString::number(nSize).getStr());
OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
- aCol.put("text", aText.toUtf8().getStr());
- aCols.push_back(std::make_pair("", aCol));
+
+ bool bSkip = false;
+ if (!rRectangle.IsEmpty())
+ {
+ long nLeft = std::max(rRectangle.Left(), nTotal);
+ long nRight = std::min(rRectangle.Right(), nTotal + nSize);
+ if (nRight < nLeft)
+ // They do not intersect.
+ bSkip = true;
+ }
+ if (!bSkip)
+ {
+ if (aCols.empty())
+ {
+ boost::property_tree::ptree aCol;
+ aCol.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTX())).getStr());
+ aCol.put("text", "");
+ aCols.push_back(std::make_pair("", aCol));
+ }
+ boost::property_tree::ptree aCol;
+ aCol.put("size", OString::number(nSize).getStr());
+ aCol.put("text", aText.toUtf8().getStr());
+ aCols.push_back(std::make_pair("", aCol));
+ }
+ nTotal += nSize;
+ nTotalPixels += long(nSize * aViewData.GetPPTX());
}
boost::property_tree::ptree aTree;
--
2.12.0