summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox/worksheethelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/filter/oox/worksheethelper.cxx')
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx22
1 files changed, 2 insertions, 20 deletions
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 41c7302d7b3f..c8f18dcd5600 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1197,30 +1197,12 @@ void WorksheetGlobals::convertColumns()
convertOutlines( aColLevels, nMaxCol + 1, 0, false, false );
}
-namespace {
-
-sal_Int32 getColumnWidth(UnitConverter& rConverter, double nWidth)
-{
- double nCoeff = rConverter.getCoefficient(UNIT_DIGIT);
- ScopedVclPtrInstance<VirtualDevice> aDev;
-
- long nPixel = aDev->LogicToPixel(Point(nCoeff, 0), MapMode(MAP_100TH_MM)).getX();
-
- // the 1.047 has been experimentally chosen based on measurements with a screen ruler
- // TODO: fix the display of cells so that it no longer requires this hack
- // algorithm from OOXML spec part1: 18.3.1.13
- sal_Int32 nColWidthPixel= std::floor( ( ( 256 * nWidth + std::floor( 128.0 / nPixel ) ) / 256.0 ) * nPixel ) * 1.047;
-
- return aDev->PixelToLogic(Point(nColWidthPixel, 0), MapMode(MAP_100TH_MM)).getX();
-}
-
-}
-
void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels,
const ValueRange& rColRange, const ColumnModel& rModel )
{
// column width: convert 'number of characters' to column width in 1/100 mm
- sal_Int32 nWidth = getColumnWidth(getUnitConverter(), rModel.mfWidth);
+ sal_Int32 nWidth = getUnitConverter().scaleToMm100( rModel.mfWidth, UNIT_DIGIT );
+
// macro sheets have double width
if( meSheetType == SHEETTYPE_MACROSHEET )
nWidth *= 2;