summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorParis Oplopoios <paris.oplopoios@collabora.com>2022-11-09 13:43:46 +0200
committerAndras Timar <andras.timar@collabora.com>2023-01-10 08:12:41 +0000
commit1ecf49085ae34561ddc9ef91ded4764fbe1f0732 (patch)
treee36ae851e9fe1d8c26cf1d2a6e1882423d6af9f9 /sc
parent1293d212a148338eee4b62893e51ed0428f2fde5 (diff)
Get ScViewData through the current doc shell in headless mode
When using --convert-to, ScDocShell::GetViewData() would return nullptr so we now get the ScViewData through an alternative route. Change-Id: Ie71a4a1077b3c63c0aadd394fc0d966e679e8803 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142480 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit 95cb9a01bfacf7d9f03194b0710ca3c249bb62fb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142442 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xestream.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 315b905560f3..c201af071c21 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -53,6 +53,7 @@
#include <sfx2/app.hxx>
#include <docsh.hxx>
+#include <tabvwsh.hxx>
#include <viewdata.hxx>
#include <excdoc.hxx>
@@ -1045,6 +1046,16 @@ bool XclExpXmlStream::exportDocument()
// Get the viewsettings before processing
if( ScDocShell::GetViewData() )
ScDocShell::GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() );
+ else
+ {
+ // Try to get ScViewData through the current ScDocShell
+ ScTabViewShell* pTabViewShell = pShell->GetBestViewShell( false );
+ if ( pTabViewShell )
+ {
+ ScViewData* pViewData = &pTabViewShell->GetViewData();
+ pViewData->WriteExtOptions( mpRoot->GetExtDocOptions() );
+ }
+ }
OUString const workbook = "xl/workbook.xml";
const char* pWorkbookContentType = nullptr;