summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/docsh2.cxx7
-rw-r--r--sc/source/ui/docshell/docsh3.cxx8
2 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 0c8da05362b0..e02b815d2181 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -26,6 +26,7 @@
#include <config_folders.h>
#include <unotools/configmgr.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/unit_conversion.hxx>
#include <drwlayer.hxx>
#include <stlpool.hxx>
@@ -46,8 +47,10 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
// Additional tables are created by the first View, if bIsEmpty is still sal_True
if( bRet )
{
- Size aSize( tools::Long( STD_COL_WIDTH * HMM_PER_TWIPS * OLE_STD_CELLS_X ),
- static_cast<tools::Long>( ScGlobal::nStdRowHeight * HMM_PER_TWIPS * OLE_STD_CELLS_Y ) );
+ Size aSize(
+ o3tl::convert(STD_COL_WIDTH * OLE_STD_CELLS_X, o3tl::Length::twip, o3tl::Length::mm100),
+ o3tl::convert(ScGlobal::nStdRowHeight * OLE_STD_CELLS_Y, o3tl::Length::twip,
+ o3tl::Length::mm100));
// Also adjust start here
SetVisAreaOrSize( tools::Rectangle( Point(), aSize ) );
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index a31d73e5802c..37e1bc773859 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -25,6 +25,7 @@
#include <editeng/flstitem.hxx>
#include <editeng/paperinf.hxx>
#include <editeng/sizeitem.hxx>
+#include <o3tl/unit_conversion.hxx>
#include <officecfg/Office/Common.hxx>
#include <sal/log.hxx>
#include <sfx2/viewfrm.hxx>
@@ -367,7 +368,6 @@ void ScDocShell::CalcOutputFactor()
OUString aTestString(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789");
tools::Long nPrinterWidth = 0;
- tools::Long nWindowWidth = 0;
const ScPatternAttr* pPattern = &m_aDocument.GetPool()->GetDefaultItem(ATTR_PATTERN);
vcl::Font aDefFont;
@@ -386,11 +386,11 @@ void ScDocShell::CalcOutputFactor()
pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // font color doesn't matter here
pVirtWindow->SetFont(aDefFont);
- nWindowWidth = pVirtWindow->GetTextWidth(aTestString);
- nWindowWidth = static_cast<tools::Long>( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS );
+ double nWindowWidth = pVirtWindow->GetTextWidth(aTestString) / ScGlobal::nScreenPPTX;
+ nWindowWidth = o3tl::convert(nWindowWidth, o3tl::Length::twip, o3tl::Length::mm100);
if (nPrinterWidth && nWindowWidth)
- m_nPrtToScreenFactor = nPrinterWidth / static_cast<double>(nWindowWidth);
+ m_nPrtToScreenFactor = nPrinterWidth / nWindowWidth;
else
{
OSL_FAIL("GetTextSize returns 0 ??");