diff options
-rw-r--r-- | desktop/source/app/app.cxx | 23 | ||||
-rw-r--r-- | postprocess/qa/services.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 10 | ||||
-rw-r--r-- | svtools/source/uno/fpicker.cxx | 11 |
4 files changed, 18 insertions, 34 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 72674493a0fb..169330dab9f7 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1227,14 +1227,12 @@ struct ExecuteGlobals { Reference < css::document::XDocumentEventListener > xGlobalBroadcaster; bool bRestartRequested; - bool bUseSystemFileDialog; std::unique_ptr<SvtCTLOptions> pCTLLanguageOptions; std::unique_ptr<SvtPathOptions> pPathOptions; rtl::Reference< JVMloadThread > xJVMloadThread; ExecuteGlobals() : bRestartRequested( false ) - , bUseSystemFileDialog( true ) {} }; @@ -1511,18 +1509,6 @@ int Desktop::Main() } } - if ( rCmdLineArgs.IsHeadless() ) - { - // Ensure that we use not the system file dialogs as - // headless mode relies on Application::EnableHeadlessMode() - // which does only work for VCL dialogs!! - pExecGlobals->bUseSystemFileDialog = officecfg::Office::Common::Misc::UseSystemFileDialog::get(); - std::shared_ptr< comphelper::ConfigurationChanges > xChanges( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::UseSystemFileDialog::set( false, xChanges ); - xChanges->commit(); - } - pExecGlobals->bRestartRequested = xRestartManager->isRestartRequested(true); if ( !pExecGlobals->bRestartRequested ) { @@ -1635,16 +1621,7 @@ int Desktop::doShutdown() if ( pExecGlobals->bRestartRequested ) SetRestartState(); - // Restore old value const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs(); - if ( rCmdLineArgs.IsHeadless() ) - { - std::shared_ptr< comphelper::ConfigurationChanges > xChanges( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::UseSystemFileDialog::set( pExecGlobals->bUseSystemFileDialog, xChanges ); - xChanges->commit(); - } - OUString pidfileName = rCmdLineArgs.GetPidfileName(); if ( !pidfileName.isEmpty() ) { diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx index 94bd76031ff4..c332402e390d 100644 --- a/postprocess/qa/services.cxx +++ b/postprocess/qa/services.cxx @@ -365,14 +365,10 @@ void Test::createInstance( #endif } else if (name == "com.sun.star.ui.dialogs.FolderPicker") { // FolderPicker is a wrapper returning either a platform-specific or the - // generic OfficeFolderPicker: -#if defined(_WIN32) - expImpl = "com.sun.star.ui.dialogs.Win32FolderPicker"; - expServs = {"com.sun.star.ui.dialogs.SystemFolderPicker"}; -#else + // generic OfficeFolderPicker. In headless mode it is always the + // generic one. expImpl = "com.sun.star.svtools.OfficeFolderPicker"; expServs = {"com.sun.star.ui.dialogs.OfficeFolderPicker"}; -#endif } else if (expImpl == "com.sun.star.comp.Calc.SpreadsheetDocument") { expImpl = "ScModelObj"; } else if (expImpl == "com.sun.star.comp.Draw.DrawingDocument" diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index ae214842f61f..fca7e56b3f3f 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -138,11 +138,15 @@ void ShutdownIcon::deInitSystray() m_bInitialized = false; } +static bool UseSystemFileDialog() +{ + return !Application::IsHeadlessModeEnabled() && officecfg::Office::Common::Misc::UseSystemFileDialog::get(); +} ShutdownIcon::ShutdownIcon( css::uno::Reference< XComponentContext > xContext ) : m_bVeto ( false ), m_bListenForTermination ( false ), - m_bSystemDialogs(officecfg::Office::Common::Misc::UseSystemFileDialog::get()), + m_bSystemDialogs(UseSystemFileDialog()), m_xContext(std::move( xContext )), m_bInitialized( false ) { @@ -241,7 +245,7 @@ void ShutdownIcon::StartFileDialog() { ::SolarMutexGuard aGuard; - bool bDirty = ( m_bSystemDialogs != officecfg::Office::Common::Misc::UseSystemFileDialog::get() ); + bool bDirty = m_bSystemDialogs != UseSystemFileDialog(); if ( m_pFileDlg && bDirty ) { @@ -382,7 +386,7 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo // This fix is dependent on the dialog settings. Destroying the dialog here will // crash the non-native dialog implementation! Therefore make this dependent on // the settings. - if ( officecfg::Office::Common::Misc::UseSystemFileDialog::get() ) + if (UseSystemFileDialog()) { m_pFileDlg.reset(); } diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx index dbb69d601462..e02d8abebb80 100644 --- a/svtools/source/uno/fpicker.cxx +++ b/svtools/source/uno/fpicker.cxx @@ -48,6 +48,13 @@ static OUString FilePicker_getSystemPickerServiceName() #endif } +// Ensure that we use not the system file dialogs as headless mode relies on +// Application::EnableHeadlessMode() which only works for VCL dialogs +static bool UseSystemFileDialog() +{ + return !Application::IsHeadlessModeEnabled() && officecfg::Office::Common::Misc::UseSystemFileDialog::get(); +} + Reference< css::uno::XInterface > FilePicker_CreateInstance ( Reference< css::uno::XComponentContext > const & context) { @@ -57,7 +64,7 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance ( return xResult; Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); - if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get()) + if (xFactory.is() && UseSystemFileDialog()) { xResult.set( Application::createFilePicker( context ) ); @@ -125,7 +132,7 @@ Reference< css::uno::XInterface > FolderPicker_CreateInstance ( return xResult; Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); - if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get()) + if (xFactory.is() && UseSystemFileDialog()) { xResult.set( Application::createFolderPicker( context ) ); if (!xResult.is()) |