[Libreoffice-commits] core.git: cui/source include/unotools sc/source solenv/clang-format svl/source sw/source unotools/Library_utl.mk unotools/source vcl/source vcl/win

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 29 14:49:24 UTC 2020


 cui/source/options/treeopt.cxx         |   33 ++--
 include/unotools/itemholderbase.hxx    |    1 
 include/unotools/misccfg.hxx           |   56 -------
 sc/source/core/data/documen8.cxx       |   16 --
 sc/source/ui/docshell/docsh3.cxx       |    4 
 solenv/clang-format/excludelist        |    2 
 svl/source/numbers/zforlist.cxx        |    5 
 sw/source/core/doc/docfmt.cxx          |    4 
 sw/source/uibase/app/docsh.cxx         |    4 
 sw/source/uibase/uiview/viewprt.cxx    |   12 -
 unotools/Library_utl.mk                |    1 
 unotools/source/config/itemholder1.cxx |    5 
 unotools/source/config/misccfg.cxx     |  249 ---------------------------------
 vcl/source/control/field2.cxx          |    8 -
 vcl/win/window/salframe.cxx            |    5 
 15 files changed, 45 insertions(+), 360 deletions(-)

New commits:
commit 2d2497dd3cea9ad01f7ade0b2bf4129083cd5875
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 29 10:06:54 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 29 16:48:42 2020 +0200

    replace and drop MiscCfg
    
    Change-Id: I5ea9e3663fc5d30d725cf18757badb9b9802da18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99675
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 4632a8d5c60d..426e5c0e0a65 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -23,6 +23,8 @@
 #include <config_feature_desktop.h>
 #include <config_gpgme.h>
 
+#include <officecfg/Office/Common.hxx>
+
 #include <svx/dialogs.hrc>
 #include <svx/svxids.hrc>
 
@@ -93,7 +95,6 @@
 #include <tools/urlobj.hxx>
 #include <tools/diagnose_ex.h>
 #include <unotools/configmgr.hxx>
-#include <unotools/misccfg.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <unotools/optionsdlg.hxx>
 #include <unotools/viewoptions.hxx>
@@ -1018,7 +1019,6 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
             SfxGetpApp()->GetOptions(aOptSet);
             pRet->Put(aOptSet);
 
-            utl::MiscCfg    aMisc;
             SfxViewFrame* pViewFrame = SfxViewFrame::Current();
             if ( pViewFrame )
             {
@@ -1029,17 +1029,17 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
                 if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
                     pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<const SfxUInt16Item*>(pItem)->GetValue() ) );
                 else
-                    pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<sal_uInt16>(aMisc.GetYear2000()) ) );
+                    pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
             }
             else
-                pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<sal_uInt16>(aMisc.GetYear2000()) ) );
+                pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
 
 
             // miscellaneous - Tabulator
-            pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning()));
+            pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, officecfg::Office::Common::Print::Warning::NotFound::get()));
 
-            SfxPrinterChangeFlags nFlag = aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
-            nFlag  |= aMisc.IsPaperOrientationWarning()  ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
+            SfxPrinterChangeFlags nFlag = officecfg::Office::Common::Print::Warning::PaperSize::get() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
+            nFlag  |= officecfg::Office::Common::Print::Warning::PaperOrientation::get() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
             pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlag) ));
 
         }
@@ -1156,7 +1156,8 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
     {
         case SID_GENERAL_OPTIONS:
         {
-            utl::MiscCfg    aMisc;
+            std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+
             const SfxPoolItem* pItem = nullptr;
             SfxItemSet aOptSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
             aOptSet.Put(rSet);
@@ -1166,7 +1167,6 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
             SfxViewFrame *pViewFrame = SfxViewFrame::Current();
 
 //          evaluate Year2000
-
             sal_uInt16 nY2K = USHRT_MAX;
             if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
                 nY2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
@@ -1178,28 +1178,29 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
                     pDispatch->ExecuteList(SID_ATTR_YEAR2000,
                             SfxCallMode::ASYNCHRON, { pItem });
                 }
-                aMisc.SetYear2000(nY2K);
+                officecfg::Office::Common::DateFormat::TwoDigitYear::set(nY2K, batch);
             }
 
-
 //          evaluate print
-
             if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, false, &pItem))
-                aMisc.SetNotFoundWarning(static_cast<const SfxBoolItem*>(pItem)->GetValue());
+                officecfg::Office::Common::Print::Warning::NotFound::set(static_cast<const SfxBoolItem*>(pItem)->GetValue(), batch);
 
             if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, false, &pItem))
             {
                 const SfxFlagItem* pFlag = static_cast<const SfxFlagItem*>(pItem);
-                aMisc.SetPaperSizeWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) &  SfxPrinterChangeFlags::CHG_SIZE ));
-                aMisc.SetPaperOrientationWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION ));
+                bool bPaperSizeWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) &  SfxPrinterChangeFlags::CHG_SIZE);
+                officecfg::Office::Common::Print::Warning::PaperSize::set(bPaperSizeWarning, batch);
+                bool bPaperOrientationWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION);
+                officecfg::Office::Common::Print::Warning::PaperOrientation::set(bPaperOrientationWarning, batch);
             }
 
 //          evaluate help options
-
             if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() )
                 SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
             if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
                 SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
+
+            batch->commit();
         }
         break;
         case SID_LANGUAGE_OPTIONS :
diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx
index 5e5809aaf703..22bbc4efddd2 100644
--- a/include/unotools/itemholderbase.hxx
+++ b/include/unotools/itemholderbase.hxx
@@ -51,7 +51,6 @@ enum class EItem
     LinguConfig                   ,
 
     MenuOptions                   ,
-    MiscConfig                    ,   // 2
     MiscOptions                   ,
     ModuleOptions                 ,
 
diff --git a/include/unotools/misccfg.hxx b/include/unotools/misccfg.hxx
deleted file mode 100644
index ffc6b9f7aa6a..000000000000
--- a/include/unotools/misccfg.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_UNOTOOLS_MISCCFG_HXX
-#define INCLUDED_UNOTOOLS_MISCCFG_HXX
-
-#include <unotools/unotoolsdllapi.h>
-#include <unotools/options.hxx>
-#include <memory>
-
-namespace utl
-{
-class SfxMiscCfg;
-class UNOTOOLS_DLLPUBLIC MiscCfg final : public detail::Options
-{
-private:
-    std::shared_ptr<SfxMiscCfg> m_pImpl;
-
-public:
-    MiscCfg( );
-    virtual ~MiscCfg( ) override;
-
-    bool        IsNotFoundWarning()     const;
-    void        SetNotFoundWarning( bool bSet);
-
-    bool        IsPaperSizeWarning()    const;
-    void        SetPaperSizeWarning(bool bSet);
-
-    bool        IsPaperOrientationWarning()     const;
-    void        SetPaperOrientationWarning( bool bSet);
-
-                // 0 ... 99
-    sal_Int32   GetYear2000()           const;
-    void        SetYear2000( sal_Int32 nSet );
-};
-
-}
-
-#endif // _MISCCFG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 293e66552d75..312df8333f3b 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -21,6 +21,7 @@
 #include <comphelper/fileformat.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <tools/urlobj.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/frmdiritem.hxx>
@@ -35,7 +36,6 @@
 #include <svl/intitem.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
-#include <unotools/misccfg.hxx>
 #include <unotools/transliterationwrapper.hxx>
 #include <sal/log.hxx>
 
@@ -121,14 +121,13 @@ SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist)
                             SID_PRINT_SELECTEDSHEET,    SID_PRINT_SELECTEDSHEET,
                             SID_SCPRINTOPTIONS,         SID_SCPRINTOPTIONS>{} );
 
-        ::utl::MiscCfg aMisc;
         SfxPrinterChangeFlags nFlags = SfxPrinterChangeFlags::NONE;
-        if ( aMisc.IsPaperOrientationWarning() )
+        if (officecfg::Office::Common::Print::Warning::PaperOrientation::get())
             nFlags |= SfxPrinterChangeFlags::CHG_ORIENTATION;
-        if ( aMisc.IsPaperSizeWarning() )
+        if (officecfg::Office::Common::Print::Warning::PaperSize::get())
             nFlags |= SfxPrinterChangeFlags::CHG_SIZE;
         pSet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlags) ) );
-        pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning() ) );
+        pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, officecfg::Office::Common::Print::Warning::NotFound::get() ) );
 
         mpPrinter = VclPtr<SfxPrinter>::Create( std::move(pSet) );
         mpPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
@@ -165,16 +164,15 @@ void ScDocument::SetPrintOptions()
 
     if ( mpPrinter )
     {
-        ::utl::MiscCfg aMisc;
         SfxItemSet aOptSet( mpPrinter->GetOptions() );
 
         SfxPrinterChangeFlags nFlags = SfxPrinterChangeFlags::NONE;
-        if ( aMisc.IsPaperOrientationWarning() )
+        if (officecfg::Office::Common::Print::Warning::PaperOrientation::get())
             nFlags |= SfxPrinterChangeFlags::CHG_ORIENTATION;
-        if ( aMisc.IsPaperSizeWarning() )
+        if (officecfg::Office::Common::Print::Warning::PaperSize::get())
             nFlags |= SfxPrinterChangeFlags::CHG_SIZE;
         aOptSet.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlags) ) );
-        aOptSet.Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning() ) );
+        aOptSet.Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, officecfg::Office::Common::Print::Warning::NotFound::get() ) );
 
         mpPrinter->SetOptions( aOptSet );
     }
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 8d9133f98735..a3fc1cb492fe 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -25,6 +25,7 @@
 #include <editeng/flstitem.hxx>
 #include <editeng/paperinf.hxx>
 #include <editeng/sizeitem.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <sal/log.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/app.hxx>
@@ -33,7 +34,6 @@
 #include <svx/pageitem.hxx>
 #include <svx/postattr.hxx>
 #include <svx/svxids.hrc>
-#include <unotools/misccfg.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/weld.hxx>
@@ -413,7 +413,7 @@ void ScDocShell::InitOptions(bool bForLoading)      // called from InitNew and L
     aDocOpt.SetAutoSpell( bAutoSpell );
 
     // two-digit year entry from Tools->Options->General
-    aDocOpt.SetYear2000( sal::static_int_cast<sal_uInt16>( ::utl::MiscCfg().GetYear2000() ) );
+    aDocOpt.SetYear2000(officecfg::Office::Common::DateFormat::TwoDigitYear::get());
 
     if (bForLoading)
     {
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 20ac504ec710..2f21632f4c31 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -7242,7 +7242,6 @@ include/unotools/linguprops.hxx
 include/unotools/localedatawrapper.hxx
 include/unotools/localfilehelper.hxx
 include/unotools/mediadescriptor.hxx
-include/unotools/misccfg.hxx
 include/unotools/moduleoptions.hxx
 include/unotools/nativenumberwrapper.hxx
 include/unotools/options.hxx
@@ -16274,7 +16273,6 @@ unotools/source/config/historyoptions.cxx
 unotools/source/config/itemholder1.cxx
 unotools/source/config/itemholder1.hxx
 unotools/source/config/lingucfg.cxx
-unotools/source/config/misccfg.cxx
 unotools/source/config/moduleoptions.cxx
 unotools/source/config/options.cxx
 unotools/source/config/optionsdlg.cxx
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 7c1fa0da613e..d113c6b9f767 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -20,6 +20,7 @@
 #include <sal/config.h>
 
 #include <sal/log.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/currencytable.hxx>
 
@@ -37,8 +38,6 @@
 #include <com/sun/star/i18n/XNumberFormatCode.hpp>
 #include <com/sun/star/i18n/NumberFormatMapper.hpp>
 #include <comphelper/processfactory.hxx>
-#include <unotools/misccfg.hxx>
-
 
 #include <osl/mutex.hxx>
 
@@ -3488,7 +3487,7 @@ sal_uInt16 SvNumberFormatter::ExpandTwoDigitYear( sal_uInt16 nYear ) const
 sal_uInt16 SvNumberFormatter::GetYear2000Default()
 {
     if (!utl::ConfigManager::IsFuzzing())
-        return static_cast<sal_uInt16>(::utl::MiscCfg().GetYear2000());
+        return officecfg::Office::Common::DateFormat::TwoDigitYear::get();
     return 1930;
 }
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 230337e9d22a..dfab43445940 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -25,11 +25,11 @@
 #include <editeng/formatbreakitem.hxx>
 #include <editeng/rsiditem.hxx>
 #include <editeng/colritem.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svl/zforlist.hxx>
 #include <comphelper/doublecheckedinit.hxx>
 #include <comphelper/processfactory.hxx>
 #include <unotools/configmgr.hxx>
-#include <unotools/misccfg.hxx>
 #include <sal/log.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/i18n/XBreakIterator.hpp>
@@ -1726,7 +1726,7 @@ void SwDoc::EnsureNumberFormatter()
         SvNumberFormatter* pRet = new SvNumberFormatter(comphelper::getProcessComponentContext(), eLang);
         pRet->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
         if (!utl::ConfigManager::IsFuzzing())
-            pRet->SetYear2000(static_cast<sal_uInt16>(::utl::MiscCfg().GetYear2000()));
+            pRet->SetYear2000(officecfg::Office::Common::DateFormat::TwoDigitYear::get());
         return pRet;
     });
 }
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 7e0501749d87..f323d7a53e80 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -19,6 +19,7 @@
 
 #include <config_features.h>
 
+#include <officecfg/Office/Common.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/syswin.hxx>
@@ -29,7 +30,6 @@
 #include <svl/stritem.hxx>
 #include <svl/PasswordHelper.hxx>
 #include <unotools/moduleoptions.hxx>
-#include <unotools/misccfg.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
@@ -1081,7 +1081,7 @@ void SwDocShell::GetState(SfxItemSet& rSet)
                 rSet.Put( SfxUInt16Item( nWhich,
                         static_cast< sal_uInt16 >(
                         pFormatr ? pFormatr->GetYear2000()
-                              : ::utl::MiscCfg().GetYear2000() )));
+                              : officecfg::Office::Common::DateFormat::TwoDigitYear::get())) );
             }
             break;
         case SID_ATTR_CHAR_FONTLIST:
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 5232c6b6a8cf..ba259e62d9b8 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -19,6 +19,7 @@
 
 #include <libxml/xmlwriter.h>
 #include <cmdid.h>
+#include <officecfg/Office/Common.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <vcl/svapp.hxx>
@@ -27,7 +28,6 @@
 #include <sfx2/printer.hxx>
 #include <editeng/paperinf.hxx>
 #include <sfx2/dispatch.hxx>
-#include <unotools/misccfg.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/strings.hrc>
 #include <svl/eitem.hxx>
@@ -330,17 +330,17 @@ void SetAppPrintOptions( SwViewShell* pSh, bool bWeb )
                 SID_HTML_MODE, SID_HTML_MODE,
                 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER>{});
 
-        utl::MiscCfg aMisc;
-
         if(bWeb)
             aSet.Put(SfxUInt16Item(SID_HTML_MODE,
                     ::GetHtmlMode(static_cast<SwWrtShell*>(pSh)->GetView().GetDocShell())));
         aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN,
-                        aMisc.IsNotFoundWarning() ));
+                        officecfg::Office::Common::Print::Warning::NotFound::get() ));
         aSet.Put(aAddPrinterItem);
         aSet.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC,
-            static_cast<int>(aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE)   |
-            static_cast<int>(aMisc.IsPaperOrientationWarning()  ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE )));
+            static_cast<int>(officecfg::Office::Common::Print::Warning::PaperSize::get()
+                ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE)   |
+            static_cast<int>(officecfg::Office::Common::Print::Warning::PaperOrientation::get()
+                ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE )));
 
         rIDDA.getPrinter( true )->SetOptions( aSet );
     }
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index 5db591fa2ff5..4838371364f8 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -74,7 +74,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
     unotools/source/config/historyoptions \
     unotools/source/config/itemholder1 \
     unotools/source/config/lingucfg \
-    unotools/source/config/misccfg \
     unotools/source/config/moduleoptions \
     unotools/source/config/options \
     unotools/source/config/optionsdlg \
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 4bb1f23ec623..90d1690ac6ef 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -23,7 +23,6 @@
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/configuration/theDefaultProvider.hpp>
 
-#include <unotools/misccfg.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/cmdoptions.hxx>
 #include <unotools/compatibility.hxx>
@@ -163,10 +162,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
             rItem.pItem.reset( new SvtPathOptions() );
             break;
 
-        case EItem::MiscConfig :
-            rItem.pItem.reset( new ::utl::MiscCfg() );
-            break;
-
         case EItem::SecurityOptions :
             rItem.pItem.reset( new SvtSecurityOptions() );
             break;
diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
deleted file mode 100644
index 4941773afb65..000000000000
--- a/unotools/source/config/misccfg.cxx
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/config.h>
-
-#include <o3tl/any.hxx>
-#include <unotools/misccfg.hxx>
-#include <rtl/instance.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include "itemholder1.hxx"
-
-using namespace com::sun::star::uno;
-
-namespace utl
-{
-class SfxMiscCfg;
-
-static std::weak_ptr<SfxMiscCfg> g_pOptions;
-
-class SfxMiscCfg : public utl::ConfigItem
-{
-private:
-    bool            bPaperSize;     // printer warnings
-    bool            bPaperOrientation;
-    bool            bNotFound;
-    sal_Int32       nYear2000;      // two digit year representation
-
-    static css::uno::Sequence<OUString> GetPropertyNames();
-    void                    Load();
-
-    virtual void            ImplCommit() final override;
-
-public:
-    SfxMiscCfg( );
-    virtual ~SfxMiscCfg( ) override;
-
-    virtual void            Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
-
-    bool        IsNotFoundWarning()     const {return bNotFound;}
-    void        SetNotFoundWarning( bool bSet);
-
-    bool        IsPaperSizeWarning()    const {return bPaperSize;}
-    void        SetPaperSizeWarning(bool bSet);
-
-    bool        IsPaperOrientationWarning()     const {return bPaperOrientation;}
-    void        SetPaperOrientationWarning( bool bSet);
-
-                // 0 ... 99
-    sal_Int32   GetYear2000()           const { return nYear2000; }
-    void        SetYear2000( sal_Int32 nSet );
-
-};
-
-SfxMiscCfg::SfxMiscCfg() :
-    ConfigItem( "Office.Common" ),
-    bPaperSize(false),
-    bPaperOrientation (false),
-    bNotFound (false),
-    nYear2000( 1930 )
-{
-    Load();
-}
-
-SfxMiscCfg::~SfxMiscCfg()
-{
-    if ( IsModified() )
-        Commit();
-}
-
-void SfxMiscCfg::SetNotFoundWarning( bool bSet)
-{
-    if(bNotFound != bSet)
-        SetModified();
-    bNotFound = bSet;
-}
-
-void SfxMiscCfg::SetPaperSizeWarning( bool bSet)
-{
-    if(bPaperSize != bSet)
-        SetModified();
-    bPaperSize = bSet;
-}
-
-void SfxMiscCfg::SetPaperOrientationWarning( bool bSet)
-{
-    if(bPaperOrientation != bSet)
-        SetModified();
-    bPaperOrientation = bSet;
-}
-
-void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
-{
-    if(nYear2000 != nSet)
-        SetModified();
-    nYear2000 = nSet;
-}
-
-Sequence<OUString> SfxMiscCfg::GetPropertyNames()
-{
-    return
-    {
-        OUString("Print/Warning/PaperSize"),
-        OUString("Print/Warning/PaperOrientation"),
-        OUString("Print/Warning/NotFound"),
-        OUString("DateFormat/TwoDigitYear")
-    };
-}
-
-void SfxMiscCfg::Load()
-{
-    const Sequence<OUString>& rNames = GetPropertyNames();
-    Sequence<Any> aValues = GetProperties(rNames);
-    EnableNotification(rNames);
-    const Any* pValues = aValues.getConstArray();
-    DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
-    if(aValues.getLength() == rNames.getLength())
-    {
-        for(int nProp = 0; nProp < rNames.getLength(); nProp++)
-        {
-            if(pValues[nProp].hasValue())
-            {
-                switch(nProp)
-                {
-                    case  0: bPaperSize        = *o3tl::doAccess<bool>(pValues[nProp]); break;      //"Print/Warning/PaperSize",
-                    case  1: bPaperOrientation = *o3tl::doAccess<bool>(pValues[nProp]);  break;     //"Print/Warning/PaperOrientation",
-                    case  2: bNotFound         = *o3tl::doAccess<bool>(pValues[nProp]);  break;   //"Print/Warning/NotFound",
-                    case  3: pValues[nProp] >>= nYear2000;break;                                    //"DateFormat/TwoDigitYear",
-                }
-            }
-        }
-    }
-}
-
-void SfxMiscCfg::Notify( const css::uno::Sequence<OUString>& )
-{
-    Load();
-}
-
-void SfxMiscCfg::ImplCommit()
-{
-    const Sequence<OUString>& rNames = GetPropertyNames();
-    Sequence<Any> aValues(rNames.getLength());
-    Any* pValues = aValues.getArray();
-
-    for(int nProp = 0; nProp < rNames.getLength(); nProp++)
-    {
-        switch(nProp)
-        {
-            case  0: pValues[nProp] <<= bPaperSize;break;  //"Print/Warning/PaperSize",
-            case  1: pValues[nProp] <<= bPaperOrientation;break;     //"Print/Warning/PaperOrientation",
-            case  2: pValues[nProp] <<= bNotFound;break;   //"Print/Warning/NotFound",
-            case  3: pValues[nProp] <<= nYear2000;break;                 //"DateFormat/TwoDigitYear",
-        }
-    }
-    PutProperties(rNames, aValues);
-}
-
-namespace
-{
-    class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
-    {
-    };
-}
-
-MiscCfg::MiscCfg( )
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    m_pImpl = g_pOptions.lock();
-    if ( !m_pImpl )
-    {
-        m_pImpl = std::make_shared<SfxMiscCfg>();
-        g_pOptions = m_pImpl;
-        ItemHolder1::holdConfigItem(EItem::MiscConfig);
-    }
-
-    m_pImpl->AddListener(this);
-}
-
-MiscCfg::~MiscCfg( )
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    m_pImpl->RemoveListener(this);
-    m_pImpl.reset();
-}
-
-bool MiscCfg::IsNotFoundWarning()   const
-{
-    return m_pImpl->IsNotFoundWarning();
-}
-
-void MiscCfg::SetNotFoundWarning(   bool bSet)
-{
-    m_pImpl->SetNotFoundWarning( bSet );
-}
-
-bool MiscCfg::IsPaperSizeWarning()  const
-{
-    return m_pImpl->IsPaperSizeWarning();
-}
-
-void MiscCfg::SetPaperSizeWarning(bool bSet)
-{
-    m_pImpl->SetPaperSizeWarning( bSet );
-}
-
-bool MiscCfg::IsPaperOrientationWarning()   const
-{
-    return m_pImpl->IsPaperOrientationWarning();
-}
-
-void MiscCfg::SetPaperOrientationWarning(   bool bSet)
-{
-    m_pImpl->SetPaperOrientationWarning( bSet );
-}
-
-sal_Int32 MiscCfg::GetYear2000() const
-{
-    return m_pImpl->GetYear2000();
-}
-
-void MiscCfg::SetYear2000( sal_Int32 nSet )
-{
-    m_pImpl->SetYear2000( nSet );
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index a300bf50627a..511976249c8d 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -25,6 +25,7 @@
 #include <tools/diagnose_ex.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/event.hxx>
 #include <vcl/toolkit/field.hxx>
@@ -39,7 +40,6 @@
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/calendarwrapper.hxx>
 #include <unotools/charclass.hxx>
-#include <unotools/misccfg.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::comphelper;
@@ -1339,7 +1339,7 @@ bool DateFormatter::TextToDate(const OUString& rStr, Date& rDate, ExtDateFieldFo
         return false;
 
     Date aNewDate( nDay, nMonth, nYear );
-    DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() );
+    DateFormatter::ExpandCentury( aNewDate, officecfg::Office::Common::DateFormat::TwoDigitYear::get() );
     if ( aNewDate.IsValidDate() )
     {
         rDate = aNewDate;
@@ -1411,7 +1411,7 @@ OUString DateFormatter::FormatDate(const Date& rDate, ExtDateFieldFormat eExtFor
     if ( !bShowCentury )
     {
         // Check if I have to use force showing the century
-        sal_uInt16 nTwoDigitYearStart = utl::MiscCfg().GetYear2000();
+        sal_uInt16 nTwoDigitYearStart = officecfg::Office::Common::DateFormat::TwoDigitYear::get();
         sal_uInt16 nYear = rDate.GetYearUnsigned();
 
         // If year is not in double digit range
@@ -1948,7 +1948,7 @@ void DateFormatter::Reformat()
 
 void DateFormatter::ExpandCentury( Date& rDate )
 {
-    ExpandCentury( rDate, utl::MiscCfg().GetYear2000() );
+    ExpandCentury(rDate, officecfg::Office::Common::DateFormat::TwoDigitYear::get());
 }
 
 void DateFormatter::ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart )
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 55ddad83b743..dc7f50f4a0f7 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -21,7 +21,6 @@
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/Rectangle.hpp>
-#include <unotools/misccfg.hxx>
 
 #include <officecfg/Office/Common.hxx>
 
@@ -2819,7 +2818,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
                 nValue = static_cast<sal_uLong>(ImplW2I( aValueBuf ));
                 if ( (nValue > 1000) && (nValue < 10000) )
                 {
-                    utl::MiscCfg().SetYear2000( static_cast<sal_Int32>(nValue-99) );
+                    std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+                    officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch);
+                    batch->commit();
                 }
             }
         }


More information about the Libreoffice-commits mailing list