[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 24 20:10:25 UTC 2021


 include/unotools/saveopt.hxx       |    4 ---
 sfx2/source/appl/appcfg.cxx        |    9 ++++--
 unotools/source/config/saveopt.cxx |   48 ++-----------------------------------
 3 files changed, 9 insertions(+), 52 deletions(-)

New commits:
commit d904a21d5516ce2786f634d0bcc555c4b345e95d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 23 19:32:25 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 24 22:09:52 2021 +0200

    use officecfg to retrieve AutoSavePrompt
    
    Change-Id: I918e31064064664df7364d7c3093d3cefdb4067a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119458
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index b268d8397d59..d50b8115885c 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -35,7 +35,6 @@ public:
         UseUserData,
         Backup,
         AutoSave,
-        AutoSavePrompt,
         WarnAlienFormat,
         LoadDocPrinter,
         OdfDefaultVersion,
@@ -97,9 +96,6 @@ public:
     void                    SetAutoSave( bool b );
     bool                IsAutoSave() const;
 
-    void                    SetAutoSavePrompt( bool b );
-    bool                IsAutoSavePrompt() const;
-
     void                    SetUserAutoSave( bool b );
     bool                IsUserAutoSave() const;
 
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 00742402585c..fc4280e8df4b 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -168,8 +168,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
                 case SID_ATTR_AUTOSAVEPROMPT :
                     {
                         bRet = true;
-                        if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::AutoSavePrompt))
-                            if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt())))
+                        if (!officecfg::Office::Common::Save::Document::AutoSavePrompt::isReadOnly())
+                            if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ),
+                                    officecfg::Office::Common::Save::Document::AutoSavePrompt::get())))
                                 bRet = false;
                     }
                     break;
@@ -461,7 +462,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
     if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), true, &pItem))
     {
         DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) !=  nullptr, "BoolItem expected");
-        aSaveOptions.SetAutoSavePrompt(static_cast<const SfxBoolItem *>(pItem)->GetValue());
+        officecfg::Office::Common::Save::Document::AutoSavePrompt::set(
+            static_cast<const SfxBoolItem *>(pItem)->GetValue(),
+            batch);
     }
 
     // AutoSave-Time
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 1d3f7253952a..5bb82488695a 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -62,7 +62,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
     bool                            bUseUserData,
                                         bBackup,
                                         bAutoSave,
-                                        bAutoSavePrompt,
                                         bUserAutoSave,
                                         bWarnAlienFormat,
                                         bLoadDocPrinter;
@@ -73,7 +72,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
                                         bROUseUserData,
                                         bROBackup,
                                         bROAutoSave,
-                                        bROAutoSavePrompt,
                                         bROUserAutoSave,
                                         bROWarnAlienFormat,
                                         bROLoadDocPrinter,
@@ -90,7 +88,6 @@ public:
     bool                    IsUseUserData() const               { return bUseUserData; }
     bool                    IsBackup() const                    { return bBackup; }
     bool                    IsAutoSave() const                  { return bAutoSave; }
-    bool                    IsAutoSavePrompt() const            { return bAutoSavePrompt; }
     bool                    IsUserAutoSave() const              { return bUserAutoSave; }
     bool                IsWarnAlienFormat() const           { return bWarnAlienFormat; }
     bool                IsLoadDocPrinter() const            { return bLoadDocPrinter; }
@@ -102,7 +99,6 @@ public:
     void                    SetUseUserData( bool b );
     void                    SetBackup( bool b );
     void                    SetAutoSave( bool b );
-    void                    SetAutoSavePrompt( bool b );
     void                    SetUserAutoSave( bool b );
     void                    SetWarnAlienFormat( bool _bDoPP );
     void                    SetLoadDocPrinter( bool bNew );
@@ -151,15 +147,6 @@ void SvtSaveOptions_Impl::SetAutoSave( bool b )
     }
 }
 
-void SvtSaveOptions_Impl::SetAutoSavePrompt( bool b )
-{
-    if (!bROAutoSavePrompt && bAutoSavePrompt!=b)
-    {
-        bAutoSavePrompt = b;
-        SetModified();
-    }
-}
-
 void SvtSaveOptions_Impl::SetUserAutoSave( bool b )
 {
     if (!bROUserAutoSave && bUserAutoSave!=b)
@@ -214,9 +201,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
         case SvtSaveOptions::EOption::AutoSave :
             bReadOnly = bROAutoSave;
             break;
-        case SvtSaveOptions::EOption::AutoSavePrompt :
-            bReadOnly = bROAutoSavePrompt;
-            break;
         case SvtSaveOptions::EOption::UserAutoSave :
             bReadOnly = bROUserAutoSave;
             break;
@@ -238,10 +222,9 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
 #define USEUSERDATA         2
 #define CREATEBACKUP        3
 #define AUTOSAVE            4
-#define PROMPT              5
-#define WARNALIENFORMAT     6
-#define LOADDOCPRINTER      7
-#define ODFDEFAULTVERSION   8
+#define WARNALIENFORMAT     5
+#define LOADDOCPRINTER      6
+#define ODFDEFAULTVERSION   7
 
 static Sequence< OUString > GetPropertyNames()
 {
@@ -252,7 +235,6 @@ static Sequence< OUString > GetPropertyNames()
         "Document/UseUserData",
         "Document/CreateBackup",
         "Document/AutoSave",
-        "Document/AutoSavePrompt",
         "Document/WarnAlienFormat",
         "Document/LoadPrinter",
         "ODF/DefaultVersion"
@@ -273,7 +255,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     , bUseUserData( false )
     , bBackup( false )
     , bAutoSave( false )
-    , bAutoSavePrompt( false )
     , bUserAutoSave( false )
     , bWarnAlienFormat( true )
     , bLoadDocPrinter( true )
@@ -282,7 +263,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     , bROUseUserData( CFG_READONLY_DEFAULT )
     , bROBackup( CFG_READONLY_DEFAULT )
     , bROAutoSave( CFG_READONLY_DEFAULT )
-    , bROAutoSavePrompt( CFG_READONLY_DEFAULT )
     , bROUserAutoSave( CFG_READONLY_DEFAULT )
     , bROWarnAlienFormat( CFG_READONLY_DEFAULT )
     , bROLoadDocPrinter( CFG_READONLY_DEFAULT )
@@ -354,10 +334,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
                                     bAutoSave = bTemp;
                                     bROAutoSave = pROStates[nProp];
                                     break;
-                                case PROMPT :
-                                    bAutoSavePrompt = bTemp;
-                                    bROAutoSavePrompt = pROStates[nProp];
-                                    break;
 
                                 case WARNALIENFORMAT:
                                     bWarnAlienFormat = bTemp;
@@ -448,14 +424,6 @@ void SvtSaveOptions_Impl::ImplCommit()
                     ++nRealCount;
                 }
                 break;
-            case PROMPT :
-                if (!bROAutoSavePrompt)
-                {
-                    pValues[nRealCount] <<= bAutoSavePrompt;
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
             case WARNALIENFORMAT:
                 if (!bROWarnAlienFormat)
                 {
@@ -623,16 +591,6 @@ bool SvtSaveOptions::IsAutoSave() const
     return pImp->pSaveOpt->IsAutoSave();
 }
 
-void SvtSaveOptions::SetAutoSavePrompt( bool b )
-{
-    pImp->pSaveOpt->SetAutoSavePrompt( b );
-}
-
-bool SvtSaveOptions::IsAutoSavePrompt() const
-{
-    return pImp->pSaveOpt->IsAutoSavePrompt();
-}
-
 void SvtSaveOptions::SetUserAutoSave( bool b )
 {
     pImp->pSaveOpt->SetUserAutoSave( b );


More information about the Libreoffice-commits mailing list