From 3707e2a7b8b05617b0afb75374f866c967593861 Mon Sep 17 00:00:00 2001 From: László Németh Date: Mon, 18 Feb 2019 18:29:51 +0100 Subject: tdf#122624 XLSX OLE in DOCX: export view positions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit of the visible sheet of an embedded spreadsheet, instead of exporting always the first column and row. Change-Id: Iaf87bfc5b7658cd4d64cb9c83c50bbf66fd6e7f0 Reviewed-on: https://gerrit.libreoffice.org/67982 Tested-by: Jenkins Reviewed-by: László Németh --- sc/source/filter/excel/xeview.cxx | 14 ++++++++++++++ sc/source/ui/unoobj/docuno.cxx | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'sc/source') diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index 766601c66206..d4f9f19b08fb 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -419,6 +419,20 @@ void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_sheetViews, FSEND ); + + // handle missing viewdata at embedded XLSX OLE objects + if (maData.mbSelected) + { + SCCOL nPosLeft = rStrm.GetRoot().GetDoc().GetPosLeft(); + SCROW nPosTop = rStrm.GetRoot().GetDoc().GetPosTop(); + if (nPosLeft > 0 || nPosTop > 0) + { + ScAddress aLeftTop(nPosLeft, nPosTop, 0); + XclExpAddressConverter& rAddrConv = GetAddressConverter(); + maData.maFirstXclPos = rAddrConv.CreateValidAddress( aLeftTop, false ); + } + } + rWorksheet->startElement( XML_sheetView, // OOXTODO: XML_windowProtection, XML_showFormulas, ToPsz( maData.mbShowFormulas ), diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 497e1454b632..ae8bd965f0b2 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2443,12 +2443,18 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( ) xRet.set( xCont, uno::UNO_QUERY_THROW ); uno::Sequence< beans::PropertyValue > aSeq; - aSeq.realloc(1); + aSeq.realloc(3); OUString sName; pDocShell->GetDocument().GetName( pDocShell->GetDocument().GetVisibleTab(), sName ); OUString sOUName(sName); aSeq[0].Name = SC_ACTIVETABLE; aSeq[0].Value <<= sOUName; + SCCOL nPosLeft = pDocShell->GetDocument().GetPosLeft(); + aSeq[1].Name = SC_POSITIONLEFT; + aSeq[1].Value <<= nPosLeft; + SCROW nPosTop = pDocShell->GetDocument().GetPosTop(); + aSeq[2].Name = SC_POSITIONTOP; + aSeq[2].Value <<= nPosTop; xCont->insertByIndex( 0, uno::makeAny( aSeq ) ); } } -- cgit