diff options
author | László Németh <nemeth@numbertext.org> | 2019-02-18 18:29:51 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-02-19 01:14:12 +0100 |
commit | 3707e2a7b8b05617b0afb75374f866c967593861 (patch) | |
tree | abd4602d22bdb518c648aadefa2395f1759eaf65 /sc | |
parent | 6fb9ef15aa67b91dec016873ad8224db2323291c (diff) |
tdf#122624 XLSX OLE in DOCX: export view positions
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 <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xeview.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 8 |
2 files changed, 21 insertions, 1 deletions
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 ) ); } } |