summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-02 10:56:43 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-03 16:49:53 +0100
commit99e1227e96f61c8ab82f7ff67ccb486b0386577e (patch)
tree0952cd57d4bdc61e43009df38c240d0fe6436b53
parent69de44eb55f522d961dee53d7778e0e86adfc990 (diff)
sc lok: emit RowColumnHeader info in twips
As that's the unit we use everywhere else in the LOK API. Also, make the ScGlobal::nScreenPPTX/Y calculation more precise, otherwise rounding errors occur during the pixel -> twip conversion. Example with the old precision: col height is 103 px, nScreenPPTY is 0.067, twips is 1537.3134328358208, convering it back is 102.487562189 px. Example with the new precision: col height is 103 px, nScreenPPTY is 0.0667, twips is 1544.2278860569716, convering it back is 102.948525737 px. (cherry picked from commit 708d1c5ab242b545ced598879233fc662d7e6cc0) Conflicts: libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx Change-Id: I19f5285508ef0c751614d07969b3a7a037e7d1ec
-rw-r--r--sc/source/core/data/global.cxx6
-rw-r--r--sc/source/ui/view/tabview.cxx7
2 files changed, 8 insertions, 5 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 12b7cbbe6b56..8303770a7850 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -544,9 +544,9 @@ void ScGlobal::UpdatePPT( OutputDevice* pDev )
if ( !pDev )
pDev = Application::GetDefaultDevice();
- Point aPix1000 = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
- nScreenPPTX = aPix1000.X() / 1000.0;
- nScreenPPTY = aPix1000.Y() / 1000.0;
+ Point aPix1000 = pDev->LogicToPixel( Point(10000,10000), MAP_TWIP );
+ nScreenPPTX = aPix1000.X() / 10000.0;
+ nScreenPPTY = aPix1000.Y() / 10000.0;
nPPTZoom = nCurrentZoom;
}
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index a3718f62cd7e..f2f6179eaaf9 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2313,12 +2313,15 @@ OUString ScTabView::getRowColumnHeaders()
SCROW nEndRow = 0;
pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow);
+ double nPPTX = aViewData.GetPPTX();
+ double nPPTY = aViewData.GetPPTY();
+
boost::property_tree::ptree aRows;
for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
{
boost::property_tree::ptree aRow;
sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow);
- aRow.put("size", OString::number(nSize).getStr());
+ aRow.put("size", OString::number(nSize / nPPTY).getStr());
OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow);
aRow.put("text", aText.toUtf8().getStr());
aRows.push_back(std::make_pair("", aRow));
@@ -2329,7 +2332,7 @@ OUString ScTabView::getRowColumnHeaders()
{
boost::property_tree::ptree aCol;
sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol);
- aCol.put("size", OString::number(nSize).getStr());
+ aCol.put("size", OString::number(nSize / nPPTX).getStr());
OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
aCol.put("text", aText.toUtf8().getStr());
aCols.push_back(std::make_pair("", aCol));