summaryrefslogtreecommitdiffstats
path: root/sc/source/filter/excel/xlroot.cxx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-09-05 16:58:22 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2023-09-11 09:58:55 +0200
commit202f4119632cb845d0ba5e5fff23c1fd94c18bed (patch)
tree0cb54f2c0fd02ad3c47ac23d33ad56c8b478cba5 /sc/source/filter/excel/xlroot.cxx
parenttdf#157136: apply top context properties to the text input field (diff)
downloadcore-202f4119632cb845d0ba5e5fff23c1fd94c18bed.tar.gz
core-202f4119632cb845d0ba5e5fff23c1fd94c18bed.zip
lok: save to xlsx changes column size
When xlsx spreadsheet was opened in LOK on every save default column width was decreased. This doesn't happen in non-LOK case. Column width in Excel are defined by double value which specifies number of '0' characters which fit into the column. On export we use mnCharWidth from XclRootData to convert Calc twips size to number of characters. In LOK case it was 102 while in non-lok case 101. It was caused by different Reference Device used in ScDocument::GetRefDevice() because in LOK case we are in WYSWIG mode as introduced in ScModelObj::initializeForTiledRendering in commit c25062f: sc tiled rendering: Don't adjust the text width according to printer. Let's use for export purpose the GetVirtualDevice_100th_mm() Change-Id: I6709194d7924e8c7e0aaa75ff3901afbcc1f8c11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156576 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156750 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sc/source/filter/excel/xlroot.cxx')
-rw-r--r--sc/source/filter/excel/xlroot.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index bac3ca1b3f59..2702e85f5c56 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
#include <sot/storage.hxx>
@@ -37,6 +38,7 @@
#include <vcl/font.hxx>
#include <vcl/settings.hxx>
#include <tools/diagnose_ex.h>
+#include <vcl/virdev.hxx>
#include <editeng/editstat.hxx>
#include <scitems.hxx>
@@ -207,7 +209,8 @@ void XclRoot::SetTextEncoding( rtl_TextEncoding eTextEnc )
void XclRoot::SetCharWidth( const XclFontData& rFontData )
{
mrData.mnCharWidth = 0;
- if( OutputDevice* pPrinter = GetPrinter() )
+ bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+ if( OutputDevice* pPrinter = GetPrinter( bIsLOK ) )
{
vcl::Font aFont( rFontData.maName, Size( 0, rFontData.mnHeight ) );
aFont.SetFamily( rFontData.GetScFamily( GetTextEncoding() ) );
@@ -298,9 +301,9 @@ ScModelObj* XclRoot::GetDocModelObj() const
return pDocShell ? comphelper::getFromUnoTunnel<ScModelObj>( pDocShell->GetModel() ) : nullptr;
}
-OutputDevice* XclRoot::GetPrinter() const
+OutputDevice* XclRoot::GetPrinter(bool bForceVirtDev) const
{
- return GetDoc().GetRefDevice();
+ return GetDoc().GetRefDevice(bForceVirtDev);
}
ScStyleSheetPool& XclRoot::GetStyleSheetPool() const