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 15:39:55 +0100
commit0fe622f66ee04f25b05c2069f573010e6f517915 (patch)
treeb376b51b4229fe9bca6b797b3eabd32e1432e4a3
parent75303695eb4bfe6c8fdea2cad0d3ed3f912f95c9 (diff)
sc lok: allow requesting column headers only for a logic area
Change-Id: Iacd8f11917e929c6a1579c6a1553eb7840df5fba
-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 e2e25f9a79e5..615f0d90d76a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2327,14 +2327,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;