summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-04 10:32:23 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-04 11:22:59 +0100
commit84dedf4ff8e7267efa95674e6545c80c9b995cb2 (patch)
tree72dd93fb101d03ed8274911155678adbe0ef26c0 /sc
parent18ce0560aa8d47e00e28bc655eaf868de1dceb51 (diff)
sc lok: return absolute positions for row/column headers
This simplifies both LOK API implementation and client code, and also clients are no longer required to floor() the twip -> pixel conversion result. Change-Id: I63dbc05f53e8f7582b964c43d5da3aad51ede10d
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/tabview.cxx26
1 files changed, 6 insertions, 20 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index d197750f68c2..b4703d993dee 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2295,6 +2295,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
{
sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo());
+ long nSizePixels = ScViewData::ToPixel(nSize, aViewData.GetPPTY());
OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow);
bool bSkip = false;
@@ -2308,22 +2309,13 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
}
if (!bSkip)
{
- if (aRows.empty() && nTotal > 0)
- {
- // The sizes are relative sizes, so include the total skipped size before the real items.
- boost::property_tree::ptree aRow;
- // Client is required to floor(), rather than round() the sizes in general, so add 0.5 here to have rounding.
- aRow.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTY())).getStr());
- aRow.put("text", "");
- aRows.push_back(std::make_pair("", aRow));
- }
boost::property_tree::ptree aRow;
- aRow.put("size", OString::number(nSize).getStr());
+ aRow.put("size", OString::number((nTotalPixels + nSizePixels) / aViewData.GetPPTY()).getStr());
aRow.put("text", aText.toUtf8().getStr());
aRows.push_back(std::make_pair("", aRow));
}
nTotal += nSize;
- nTotalPixels += long(nSize * aViewData.GetPPTY());
+ nTotalPixels += nSizePixels;
}
boost::property_tree::ptree aCols;
@@ -2332,6 +2324,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol)
{
sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo());
+ long nSizePixels = ScViewData::ToPixel(nSize, aViewData.GetPPTX());
OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
bool bSkip = false;
@@ -2345,20 +2338,13 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
}
if (!bSkip)
{
- if (aCols.empty() && nTotal > 0)
- {
- 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("size", OString::number((nTotalPixels + nSizePixels) / aViewData.GetPPTX()).getStr());
aCol.put("text", aText.toUtf8().getStr());
aCols.push_back(std::make_pair("", aCol));
}
nTotal += nSize;
- nTotalPixels += long(nSize * aViewData.GetPPTX());
+ nTotalPixels += nSizePixels;
}
boost::property_tree::ptree aTree;