include/svtools/miscopt.hxx       |    4 --
 sc/source/ui/drawfunc/fuins1.cxx  |    4 +-
 sd/source/ui/func/fuinsert.cxx    |    4 +-
 svtools/source/config/miscopt.cxx |   63 ++------------------------------------
 svx/source/dialog/linkwarn.cxx    |   18 ++++++----
 sw/source/uibase/uiview/view2.cxx |    4 +-
 6 files changed, 21 insertions(+), 76 deletions(-)

New commits:
commit d3a9db6310204247a3bd8f23a984c5a04afbeef1
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Oct 31 18:55:36 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Nov 1 21:05:00 2020 +0100

    use officecfg for ShowLinkWarningDialog
    
    Change-Id: I92a42eb2ff48bff4e635f1a37a25c8ecb9ac1347
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105153
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
index 90e3702a2838..f2902de1a4a3 100644
--- a/include/svtools/miscopt.hxx
+++ b/include/svtools/miscopt.hxx
@@ -73,10 +73,6 @@ class SVT_DLLPUBLIC SvtMiscOptions final : public 
utl::detail::Options
         sal_Int16   GetToolboxStyle() const;
         void        SetToolboxStyle( sal_Int16 nStyle );
 
-        bool        ShowLinkWarningDialog() const;
-        void        SetShowLinkWarningDialog( bool bSet );
-        bool        IsShowLinkWarningDialogReadOnly() const;
-
         void        SetMacroRecorderMode( bool bSet );
         bool        IsMacroRecorderMode() const;
 
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 4187300e3428..d5a28f8a29ad 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -19,6 +19,7 @@
 
 #include <config_features.h>
 
+#include <officecfg/Office/Common.hxx>
 #include <sal/log.hxx>
 #include <sfx2/opengrf.hxx>
 #include <svx/svdograf.hxx>
@@ -30,7 +31,6 @@
 #include <svx/svxids.hrc>
 #include <vcl/graphicfilter.hxx>
 #include <svl/stritem.hxx>
-#include <svtools/miscopt.hxx>
 #include <avmedia/mediawindow.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
@@ -325,7 +325,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   rViewSh,
                 bool bAsLink = aDlg.IsAsLink();
 
                 // really store as link only?
-                if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() )
+                if( bAsLink && 
officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() )
                 {
                     SvxLinkWarningDialog aWarnDlg(pWin ? pWin->GetFrameWeld() 
: nullptr, aFileName);
                     if (aWarnDlg.run() != RET_OK)
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index ce0d45082b3f..cc93f6f38c37 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -22,6 +22,7 @@
 #include <fuinsert.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <editeng/outlobj.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <svx/svxdlg.hxx>
 #include <com/sun/star/embed/EmbedVerbs.hpp>
@@ -37,7 +38,6 @@
 #include <svtools/insdlg.hxx>
 #include <sfx2/request.hxx>
 #include <svl/globalnameitem.hxx>
-#include <svtools/miscopt.hxx>
 #include <svtools/embedhlp.hxx>
 #include <svx/linkwarn.hxx>
 #include <avmedia/mediawindow.hxx>
@@ -177,7 +177,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
             if(pGrafObj && bAsLink )
             {
                 // really store as link only?
-                if( SvtMiscOptions().ShowLinkWarningDialog() )
+                if( 
officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() )
                 {
                     SvxLinkWarningDialog aWarnDlg(mpWindow->GetFrameWeld(), 
aFileName);
                     if (aWarnDlg.run() != RET_OK)
diff --git a/svtools/source/config/miscopt.cxx 
b/svtools/source/config/miscopt.cxx
index fe216fe263e0..3390cba46229 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -50,16 +50,14 @@ using namespace ::com::sun::star;
 #define PROPERTYHANDLE_TOOLBOXSTYLE             1
 #define PROPERTYNAME_ICONTHEME              "SymbolStyle"
 #define PROPERTYHANDLE_SYMBOLSTYLE              2
-#define PROPERTYNAME_SHOWLINKWARNINGDIALOG  "ShowLinkWarningDialog"
-#define PROPERTYHANDLE_SHOWLINKWARNINGDIALOG    3
 #define PROPERTYNAME_DISABLEUICUSTOMIZATION "DisableUICustomization"
-#define PROPERTYHANDLE_DISABLEUICUSTOMIZATION   4
+#define PROPERTYHANDLE_DISABLEUICUSTOMIZATION   3
 #define PROPERTYNAME_MACRORECORDERMODE       "MacroRecorderMode"
-#define PROPERTYHANDLE_MACRORECORDERMODE        5
+#define PROPERTYHANDLE_MACRORECORDERMODE        4
 #define PROPERTYNAME_SIDEBARICONSIZE        "SidebarIconSize"
-#define PROPERTYHANDLE_SIDEBARICONSIZE          6
+#define PROPERTYHANDLE_SIDEBARICONSIZE          5
 #define PROPERTYNAME_NOTEBOOKBARICONSIZE    "NotebookbarIconSize"
-#define PROPERTYHANDLE_NOTEBOOKBARICONSIZE      7
+#define PROPERTYHANDLE_NOTEBOOKBARICONSIZE      6
 
 class SvtMiscOptions_Impl : public ConfigItem
 {
@@ -74,8 +72,6 @@ private:
     bool        m_bIsSymbolsStyleRO;
     sal_Int16   m_nToolboxStyle;
     bool        m_bIsToolboxStyleRO;
-    bool        m_bShowLinkWarningDialog;
-    bool        m_bIsShowLinkWarningDialogRO;
     bool        m_bDisableUICustomization;
     bool        m_bMacroRecorderMode;
     bool        m_bIconThemeWasSetAutomatically;
@@ -161,15 +157,6 @@ public:
         // translate from VCL settings
         void SetToolboxStyle( sal_Int16 nStyle );
 
-        bool ShowLinkWarningDialog() const
-        { return m_bShowLinkWarningDialog; }
-
-        void SetShowLinkWarningDialog( bool bSet )
-        {  m_bShowLinkWarningDialog = bSet; SetModified(); }
-
-        bool IsShowLinkWarningDialogReadOnly() const
-        { return m_bIsShowLinkWarningDialogRO; }
-
         void AddListenerLink( const Link<LinkParamNone*,void>& rLink );
         void RemoveListenerLink( const Link<LinkParamNone*,void>& rLink );
         void CallListeners();
@@ -206,8 +193,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
     , m_bIsSymbolsStyleRO( false )
     , m_nToolboxStyle( 1 )
     , m_bIsToolboxStyleRO( false )
-    , m_bShowLinkWarningDialog( true )
-    , m_bIsShowLinkWarningDialogRO( false )
     , m_bMacroRecorderMode( false )
     , m_bIconThemeWasSetAutomatically( false )
 {
@@ -274,16 +259,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
                 break;
             }
 
-            case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG :
-            {
-                if( !(seqValues[nProperty] >>= m_bShowLinkWarningDialog) )
-                {
-                    OSL_FAIL("Wrong type of \"Misc\\ShowLinkWarningDialog\"!" 
);
-                }
-                m_bIsShowLinkWarningDialogRO = seqRO[nProperty];
-                break;
-            }
-
             case PROPERTYHANDLE_SYMBOLSTYLE :
             {
                 OUString aIconTheme;
@@ -374,13 +349,6 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString 
>& rPropertyNames )
                                                             }
                                                         }
                                                     break;
-            case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG     :   {
-                                                            if( 
!(seqValues[nProperty] >>= m_bShowLinkWarningDialog) )
-                                                            {
-                                                                
OSL_FAIL("Wrong type of \"Misc\\ShowLinkWarningDialog\"!" );
-                                                            }
-                                                        }
-                                                    break;
             case PROPERTYHANDLE_SYMBOLSTYLE         :   {
                                                             OUString 
aIconTheme;
                                                             if 
(seqValues[nProperty] >>= aIconTheme)
@@ -538,13 +506,6 @@ void SvtMiscOptions_Impl::ImplCommit()
                 break;
             }
 
-            case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG :
-            {
-                if ( !m_bIsShowLinkWarningDialogRO )
-                    seqValues[nProperty] <<= m_bShowLinkWarningDialog;
-                break;
-            }
-
             case PROPERTYHANDLE_DISABLEUICUSTOMIZATION :
             {
                 seqValues[nProperty] <<= m_bDisableUICustomization;
@@ -571,7 +532,6 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
         PROPERTYNAME_SYMBOLSET,
         PROPERTYNAME_TOOLBOXSTYLE,
         PROPERTYNAME_ICONTHEME,
-        PROPERTYNAME_SHOWLINKWARNINGDIALOG,
         PROPERTYNAME_DISABLEUICUSTOMIZATION,
         PROPERTYNAME_MACRORECORDERMODE,
         PROPERTYNAME_SIDEBARICONSIZE,
@@ -688,21 +648,6 @@ void SvtMiscOptions::SetToolboxStyle( sal_Int16 nStyle )
     m_pImpl->SetToolboxStyle( nStyle );
 }
 
-bool SvtMiscOptions::ShowLinkWarningDialog() const
-{
-    return m_pImpl->ShowLinkWarningDialog();
-}
-
-void SvtMiscOptions::SetShowLinkWarningDialog( bool bSet )
-{
-    m_pImpl->SetShowLinkWarningDialog( bSet );
-}
-
-bool SvtMiscOptions::IsShowLinkWarningDialogReadOnly() const
-{
-    return m_pImpl->IsShowLinkWarningDialogReadOnly();
-}
-
 void SvtMiscOptions::SetMacroRecorderMode( bool bSet )
 {
     m_pImpl->SetMacroRecorderMode( bSet );
diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx
index 7df6f472ff21..852c92af1089 100644
--- a/svx/source/dialog/linkwarn.cxx
+++ b/svx/source/dialog/linkwarn.cxx
@@ -19,7 +19,7 @@
 
 #include <osl/file.hxx>
 #include <svx/linkwarn.hxx>
-#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
 
 SvxLinkWarningDialog::SvxLinkWarningDialog(weld::Widget* pParent, const 
OUString& _rFileName)
     : MessageDialogController(pParent, "svx/ui/linkwarndialog.ui", 
"LinkWarnDialog", "ask")
@@ -34,9 +34,9 @@ SvxLinkWarningDialog::SvxLinkWarningDialog(weld::Widget* 
pParent, const OUString
     m_xDialog->set_primary_text(sInfoText);
 
     // load state of "warning on" checkbox from misc options
-    SvtMiscOptions aMiscOpt;
-    m_xWarningOnBox->set_active(aMiscOpt.ShowLinkWarningDialog());
-    
m_xWarningOnBox->set_sensitive(!aMiscOpt.IsShowLinkWarningDialogReadOnly());
+    
m_xWarningOnBox->set_active(officecfg::Office::Common::Misc::ShowLinkWarningDialog::get());
+    m_xWarningOnBox->set_sensitive(
+        !officecfg::Office::Common::Misc::ShowLinkWarningDialog::isReadOnly());
 }
 
 SvxLinkWarningDialog::~SvxLinkWarningDialog()
@@ -44,10 +44,14 @@ SvxLinkWarningDialog::~SvxLinkWarningDialog()
     try
     {
         // save value of "warning off" checkbox, if necessary
-        SvtMiscOptions aMiscOpt;
         bool bChecked = m_xWarningOnBox->get_active();
-        if (aMiscOpt.ShowLinkWarningDialog() != bChecked)
-            aMiscOpt.SetShowLinkWarningDialog(bChecked);
+        if (officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() != 
bChecked)
+        {
+            std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+                comphelper::ConfigurationChanges::create());
+            
officecfg::Office::Common::Misc::ShowLinkWarningDialog::set(bChecked, xChanges);
+            xChanges->commit();
+        }
     }
     catch (...)
     {
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index b7021abc7cd7..4b83a3d00e95 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
 #include <com/sun/star/linguistic2/XDictionary.hpp>
+#include <officecfg/Office/Common.hxx>
 #include <SwCapObjType.hxx>
 #include <SwStyleNameMapper.hxx>
 #include <docary.hxx>
@@ -39,7 +40,6 @@
 #include <swundo.hxx>
 #include <svl/PasswordHelper.hxx>
 #include <svl/urihelper.hxx>
-#include <svtools/miscopt.hxx>
 #include <sfx2/passwd.hxx>
 #include <sfx2/sfxdlg.hxx>
 #include <sfx2/filedlghelper.hxx>
@@ -450,7 +450,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
             }
 
             // really store as link only?
-            if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() )
+            if( bAsLink && 
officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() )
             {
                 SvxLinkWarningDialog aWarnDlg(GetFrameWeld(), 
pFileDlg->GetPath());
                 if (aWarnDlg.run() != RET_OK)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to