Kaydet (Commit) a900c9c8 authored tarafından Miklos Vajna's avatar Miklos Vajna

sc lok: fix rounding errors with non-100% zoom

There were two problems here:

1) ScTabView::getRowColumnHeaders() did not expose twip values directly,
but used ScRow/ColBar::GetEntrySize(), which does a twip -> pixel
conversion, and then converted it back to twip. Avoid this unnecessary
roundtrip.

2) ScViewData::ToPixel() trunaces the resulting float to an integer, so
if the result is e.g. 67.7 pixels, then Calc handled that as 67, but
gtktiledviewer rounded that up to 68, resulting in non-matching headers
for the rendered tiles.

(cherry picked from commit 861b28b8)

Conflicts:
	libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx

Change-Id: Ie6ed1ea923a423d1526eeb235b7b87106fd2f20b
üst 99e1227e
...@@ -2313,15 +2313,12 @@ OUString ScTabView::getRowColumnHeaders() ...@@ -2313,15 +2313,12 @@ OUString ScTabView::getRowColumnHeaders()
SCROW nEndRow = 0; SCROW nEndRow = 0;
pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow);
double nPPTX = aViewData.GetPPTX();
double nPPTY = aViewData.GetPPTY();
boost::property_tree::ptree aRows; boost::property_tree::ptree aRows;
for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
{ {
boost::property_tree::ptree aRow; boost::property_tree::ptree aRow;
sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo());
aRow.put("size", OString::number(nSize / nPPTY).getStr()); aRow.put("size", OString::number(nSize).getStr());
OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow);
aRow.put("text", aText.toUtf8().getStr()); aRow.put("text", aText.toUtf8().getStr());
aRows.push_back(std::make_pair("", aRow)); aRows.push_back(std::make_pair("", aRow));
...@@ -2331,8 +2328,8 @@ OUString ScTabView::getRowColumnHeaders() ...@@ -2331,8 +2328,8 @@ OUString ScTabView::getRowColumnHeaders()
for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol) for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol)
{ {
boost::property_tree::ptree aCol; boost::property_tree::ptree aCol;
sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol); sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo());
aCol.put("size", OString::number(nSize / nPPTX).getStr()); aCol.put("size", OString::number(nSize).getStr());
OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
aCol.put("text", aText.toUtf8().getStr()); aCol.put("text", aText.toUtf8().getStr());
aCols.push_back(std::make_pair("", aCol)); aCols.push_back(std::make_pair("", aCol));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment