Blame SOURCES/0267-sc-lok-allow-requesting-column-headers-only-for-a-lo.patch

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