diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-02 10:56:43 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-02 10:57:44 +0100 |
commit | 708d1c5ab242b545ced598879233fc662d7e6cc0 (patch) | |
tree | 518fe8cf520cf82dfc89e1e1f967423749f2f926 /libreofficekit/qa/gtktiledviewer | |
parent | f570f837d65c9ee79a10be823c3dc28febdebfc8 (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.
Change-Id: I19f5285508ef0c751614d07969b3a7a037e7d1ec
Diffstat (limited to 'libreofficekit/qa/gtktiledviewer')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 23233aceb424..db7beb43ed62 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -250,7 +250,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi rWindow.m_pRowBar->m_aHeaders.clear(); for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) { - Header aHeader(std::atoi(rValue.second.get<std::string>("size").c_str()), rValue.second.get<std::string>("text")); + int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str()))); + Header aHeader(nSize, rValue.second.get<std::string>("text")); rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); } gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea); @@ -259,7 +260,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi rWindow.m_pColumnBar->m_aHeaders.clear(); for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) { - Header aHeader(std::atoi(rValue.second.get<std::string>("size").c_str()), rValue.second.get<std::string>("text")); + int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str()))); + Header aHeader(nSize, rValue.second.get<std::string>("text")); rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); } gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); |