summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-03 15:37:31 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-03 16:56:48 +0100
commit326b9f5e19b0ad2f7fb5dcc078e55c7ed9b3b265 (patch)
tree83730e516307c30cab4831e14023620c42eca6fb
parent8a284e678e50c875c68f7d3e155fe92cc43393c9 (diff)
sc lok: allow requesting column headers only for a logic area
Change-Id: Iacd8f11917e929c6a1579c6a1553eb7840df5fba (cherry picked from commit 0fe622f66ee04f25b05c2069f573010e6f517915)
-rw-r--r--sc/source/ui/view/tabview.cxx32
1 files 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;