[Libreoffice-commits] core.git: cui/source desktop/source include/svtools sfx2/source svtools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 1 16:11:58 UTC 2020


 cui/source/options/optgdlg.cxx    |   11 +++---
 desktop/source/app/app.cxx        |   16 ++++++--
 include/svtools/miscopt.hxx       |    4 --
 sfx2/source/appl/shutdownicon.cxx |    8 ++--
 svtools/source/config/miscopt.cxx |   68 +++-----------------------------------
 svtools/source/uno/fpicker.cxx    |    6 +--
 6 files changed, 30 insertions(+), 83 deletions(-)

New commits:
commit fabaabbd01c84cbdea465382e42387a452b54046
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Oct 31 14:53:19 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Nov 1 17:11:17 2020 +0100

    use officecfg for UseSystemFileDialog
    
    Change-Id: I1419af229a67d6ebb1cf2c63757656beb3f512db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105142
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 487cff1f6883..6b71b125e078 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -268,7 +268,7 @@ OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* p
 {
     if (!lcl_HasSystemFilePicker())
         m_xFileDlgFrame->hide();
-    else if (SvtMiscOptions().IsUseSystemFileDialogReadOnly())
+    else if (officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly())
     {
         m_xFileDlgROImage->show();
         m_xFileDlgCB->set_sensitive(false);
@@ -330,8 +330,10 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
 
     if ( m_xFileDlgCB->get_state_changed_from_saved() )
     {
-        SvtMiscOptions aMiscOpt;
-        aMiscOpt.SetUseSystemFileDialog( !m_xFileDlgCB->get_active() );
+        std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
+                comphelper::ConfigurationChanges::create());
+        officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), xChanges );
+        xChanges->commit();
         bModified = true;
     }
 
@@ -392,8 +394,7 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
     m_xPopUpNoHelpCB->save_state();
     m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() );
     m_xShowTipOfTheDay->save_state();
-    SvtMiscOptions aMiscOpt;
-    m_xFileDlgCB->set_active( !aMiscOpt.UseSystemFileDialog() );
+    m_xFileDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
     m_xFileDlgCB->save_state();
     m_xPrintDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemPrintDialog::get() );
     m_xPrintDlgCB->save_state();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 19883d351691..c54aea9dd4f7 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -98,7 +98,6 @@
 #include <osl/process.h>
 #include <rtl/byteseq.hxx>
 #include <unotools/pathoptions.hxx>
-#include <svtools/miscopt.hxx>
 #include <svtools/menuoptions.hxx>
 #include <rtl/bootstrap.hxx>
 #include <vcl/glxtestprocess.hxx>
@@ -1493,9 +1492,11 @@ int Desktop::Main()
         // Ensure that we use not the system file dialogs as
         // headless mode relies on Application::EnableHeadlessMode()
         // which does only work for VCL dialogs!!
-        SvtMiscOptions aMiscOptions;
-        pExecGlobals->bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
-        aMiscOptions.SetUseSystemFileDialog( false );
+        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);
@@ -1620,7 +1621,12 @@ int Desktop::doShutdown()
     // Restore old value
     const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
     if ( rCmdLineArgs.IsHeadless() || rCmdLineArgs.IsEventTesting() )
-        SvtMiscOptions().SetUseSystemFileDialog( pExecGlobals->bUseSystemFileDialog );
+    {
+        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/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
index 5d1e24490417..cbaf146f607e 100644
--- a/include/svtools/miscopt.hxx
+++ b/include/svtools/miscopt.hxx
@@ -55,10 +55,6 @@ class SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options
         void        AddListenerLink( const Link<LinkParamNone*,void>& rLink );
         void        RemoveListenerLink( const Link<LinkParamNone*,void>& rLink );
 
-        bool        UseSystemFileDialog() const;
-        void        SetUseSystemFileDialog( bool bSet );
-        bool        IsUseSystemFileDialogReadOnly() const;
-
         bool        DisableUICustomization() const;
 
         bool        IsPluginsEnabled() const;
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index a23b2888b747..84d169cf708a 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -28,7 +28,6 @@
 #include <sfx2/app.hxx>
 #include <osl/mutex.hxx>
 #include <svtools/imagemgr.hxx>
-#include <svtools/miscopt.hxx>
 #include <com/sun/star/task/InteractionHandler.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/TerminationVetoException.hpp>
@@ -53,6 +52,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/extract.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/debug.hxx>
 #include <osl/file.hxx>
@@ -175,7 +175,7 @@ ShutdownIcon::ShutdownIcon( const css::uno::Reference< XComponentContext > & rxC
     m_xContext( rxContext ),
     m_bInitialized( false )
 {
-    m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog();
+    m_bSystemDialogs = officecfg::Office::Common::Misc::UseSystemFileDialog::get();
 }
 
 ShutdownIcon::~ShutdownIcon()
@@ -276,7 +276,7 @@ void ShutdownIcon::StartFileDialog()
 {
     ::SolarMutexGuard aGuard;
 
-    bool bDirty = ( m_bSystemDialogs != SvtMiscOptions().UseSystemFileDialog() );
+    bool bDirty = ( m_bSystemDialogs != officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
 
     if ( m_pFileDlg && bDirty )
     {
@@ -419,7 +419,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 ( SvtMiscOptions().UseSystemFileDialog() )
+    if ( officecfg::Office::Common::Misc::UseSystemFileDialog::get() )
     {
         m_pFileDlg.reset();
     }
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index bca5b5a760fb..592f05b5c4eb 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -50,27 +50,23 @@ using namespace ::com::sun::star;
 #define PROPERTYHANDLE_SYMBOLSET                1
 #define PROPERTYNAME_TOOLBOXSTYLE           "ToolboxStyle"
 #define PROPERTYHANDLE_TOOLBOXSTYLE             2
-#define PROPERTYNAME_USESYSTEMFILEDIALOG    "UseSystemFileDialog"
-#define PROPERTYHANDLE_USESYSTEMFILEDIALOG      3
 #define PROPERTYNAME_ICONTHEME              "SymbolStyle"
-#define PROPERTYHANDLE_SYMBOLSTYLE              4
+#define PROPERTYHANDLE_SYMBOLSTYLE              3
 #define PROPERTYNAME_SHOWLINKWARNINGDIALOG  "ShowLinkWarningDialog"
-#define PROPERTYHANDLE_SHOWLINKWARNINGDIALOG    5
+#define PROPERTYHANDLE_SHOWLINKWARNINGDIALOG    4
 #define PROPERTYNAME_DISABLEUICUSTOMIZATION "DisableUICustomization"
-#define PROPERTYHANDLE_DISABLEUICUSTOMIZATION   6
+#define PROPERTYHANDLE_DISABLEUICUSTOMIZATION   5
 #define PROPERTYNAME_MACRORECORDERMODE       "MacroRecorderMode"
-#define PROPERTYHANDLE_MACRORECORDERMODE        7
+#define PROPERTYHANDLE_MACRORECORDERMODE        6
 #define PROPERTYNAME_SIDEBARICONSIZE        "SidebarIconSize"
-#define PROPERTYHANDLE_SIDEBARICONSIZE          8
+#define PROPERTYHANDLE_SIDEBARICONSIZE          7
 #define PROPERTYNAME_NOTEBOOKBARICONSIZE    "NotebookbarIconSize"
-#define PROPERTYHANDLE_NOTEBOOKBARICONSIZE      9
+#define PROPERTYHANDLE_NOTEBOOKBARICONSIZE      8
 
 class SvtMiscOptions_Impl : public ConfigItem
 {
 private:
     ::std::vector<Link<LinkParamNone*,void>> aList;
-    bool        m_bUseSystemFileDialog;
-    bool        m_bIsUseSystemFileDialogRO;
     bool        m_bPluginsEnabled;
     bool        m_bIsPluginsEnabledRO;
     sal_Int16   m_nSymbolsSize;
@@ -116,16 +112,6 @@ public:
 
         //  public interface
 
-
-        bool UseSystemFileDialog() const
-        { return m_bUseSystemFileDialog; }
-
-        void SetUseSystemFileDialog( bool bSet )
-        {  m_bUseSystemFileDialog = bSet; SetModified(); }
-
-        bool IsUseSystemFileDialogReadOnly() const
-        { return m_bIsUseSystemFileDialogRO; }
-
         bool DisableUICustomization() const
         { return m_bDisableUICustomization; }
 
@@ -218,8 +204,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
     // Init baseclasses first
     : ConfigItem( ROOTNODE_MISC )
 
-    , m_bUseSystemFileDialog( false )
-    , m_bIsUseSystemFileDialogRO( false )
     , m_bPluginsEnabled( false )
     , m_bIsPluginsEnabledRO( false )
     , m_nSymbolsSize( 0 )
@@ -309,16 +293,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
                 break;
             }
 
-            case PROPERTYHANDLE_USESYSTEMFILEDIALOG :
-            {
-                if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) )
-                {
-                    OSL_FAIL("Wrong type of \"Misc\\UseSystemFileDialog\"!" );
-                }
-                m_bIsUseSystemFileDialogRO = seqRO[nProperty];
-                break;
-            }
-
             case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG :
             {
                 if( !(seqValues[nProperty] >>= m_bShowLinkWarningDialog) )
@@ -426,13 +400,6 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
                                                             }
                                                         }
                                                     break;
-            case PROPERTYHANDLE_USESYSTEMFILEDIALOG      :   {
-                                                            if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) )
-                                                            {
-                                                                OSL_FAIL("Wrong type of \"Misc\\UseSystemFileDialog\"!" );
-                                                            }
-                                                        }
-                                                    break;
             case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG     :   {
                                                             if( !(seqValues[nProperty] >>= m_bShowLinkWarningDialog) )
                                                             {
@@ -589,13 +556,6 @@ void SvtMiscOptions_Impl::ImplCommit()
                 break;
             }
 
-            case PROPERTYHANDLE_USESYSTEMFILEDIALOG :
-            {
-                if ( !m_bIsUseSystemFileDialogRO )
-                    seqValues[nProperty] <<= m_bUseSystemFileDialog;
-                break;
-            }
-
             case PROPERTYHANDLE_SYMBOLSTYLE :
             {
                 if ( !m_bIsSymbolsStyleRO ) {
@@ -644,7 +604,6 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
         PROPERTYNAME_PLUGINSENABLED,
         PROPERTYNAME_SYMBOLSET,
         PROPERTYNAME_TOOLBOXSTYLE,
-        PROPERTYNAME_USESYSTEMFILEDIALOG,
         PROPERTYNAME_ICONTHEME,
         PROPERTYNAME_SHOWLINKWARNINGDIALOG,
         PROPERTYNAME_DISABLEUICUSTOMIZATION,
@@ -682,21 +641,6 @@ SvtMiscOptions::~SvtMiscOptions()
     m_pImpl.reset();
 }
 
-bool SvtMiscOptions::UseSystemFileDialog() const
-{
-    return m_pImpl->UseSystemFileDialog();
-}
-
-void SvtMiscOptions::SetUseSystemFileDialog( bool bEnable )
-{
-    m_pImpl->SetUseSystemFileDialog( bEnable );
-}
-
-bool SvtMiscOptions::IsUseSystemFileDialogReadOnly() const
-{
-    return m_pImpl->IsUseSystemFileDialogReadOnly();
-}
-
 bool SvtMiscOptions::IsPluginsEnabled() const
 {
     return m_pImpl->IsPluginsEnabled();
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index 076f59a8d346..dbb69d601462 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -21,8 +21,8 @@
 
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 
-#include <svtools/miscopt.hxx>
 #include <svl/pickerhistoryaccess.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <vcl/svapp.hxx>
 
@@ -57,7 +57,7 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance (
         return xResult;
 
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
-    if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
+    if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get())
     {
         xResult.set( Application::createFilePicker( context ) );
 
@@ -125,7 +125,7 @@ Reference< css::uno::XInterface > FolderPicker_CreateInstance (
         return xResult;
 
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
-    if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
+    if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get())
     {
         xResult.set( Application::createFolderPicker( context ) );
         if (!xResult.is())


More information about the Libreoffice-commits mailing list