[Libreoffice-commits] core.git: chart2/source dbaccess/source include/unotools reportdesign/Library_rpt.mk reportdesign/Library_rptxml.mk reportdesign/source sc/source sd/source sfx2/source starmath/source sw/source unotools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 24 07:57:42 UTC 2021


 chart2/source/model/filter/XMLFilter.cxx                    |    4 
 dbaccess/source/core/dataaccess/databasedocument.cxx        |    3 
 include/unotools/saveopt.hxx                                |    4 
 reportdesign/Library_rpt.mk                                 |    4 
 reportdesign/Library_rptxml.mk                              |    4 
 reportdesign/source/core/api/ReportDefinition.cxx           |    3 
 reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx |    4 
 sc/source/filter/xml/xmlwrap.cxx                            |    4 
 sd/source/filter/xml/sdxmlwrp.cxx                           |    4 
 sfx2/source/appl/appcfg.cxx                                 |    9 +
 starmath/source/mathml/mathmlexport.cxx                     |    5 -
 sw/source/filter/xml/wrtxml.cxx                             |    4 
 unotools/source/config/saveopt.cxx                          |   55 +-----------
 13 files changed, 37 insertions(+), 70 deletions(-)

New commits:
commit e271fce82e16359394fdeb818c2ec25a07532a8d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 23 14:30:42 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 24 09:57:08 2021 +0200

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

diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 784882739ac0..5838647bc510 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -20,6 +20,7 @@
 #include <XMLFilter.hxx>
 #include <MediaDescriptorHelper.hxx>
 
+#include <officecfg/Office/Common.hxx>
 #include <svtools/sfxecode.hxx>
 #include <unotools/saveopt.hxx>
 #include <comphelper/genericpropertyset.hxx>
@@ -590,8 +591,7 @@ ErrCode XMLFilter::impl_Export(
         uno::Reference< beans::XPropertySet > xInfoSet =
             comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) );
 
-        SvtSaveOptions aSaveOpt;
-        bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+        bool bUsePrettyPrinting( officecfg::Office::Common::Save::Document::PrettyPrinting::get() );
         xInfoSet->setPropertyValue( "UsePrettyPrinting", uno::Any( bUsePrettyPrinting ) );
         if( ! bOasis )
             xInfoSet->setPropertyValue( "ExportTableNumberList", uno::Any( true ));
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 603a0622b2ba..b0b6e50afd54 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -26,6 +26,7 @@
 #include <sdbcoretools.hxx>
 #include <recovery/dbdocrecovery.hxx>
 
+#include <officecfg/Office/Common.hxx>
 #include <com/sun/star/document/XExporter.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
@@ -1618,7 +1619,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
     uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
 
     SvtSaveOptions aSaveOpt;
-    xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
+    xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
     if ( aSaveOpt.IsSaveRelFSys() )
     {
         OUString sBaseURI = _rMediaDescriptor.getOrDefault("BaseURI", OUString());
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index e8b6aed4e448..cfaa51389db3 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -40,7 +40,6 @@ public:
         SaveWorkingSet,
         SaveRelInet,
         SaveRelFsys,
-        DoPrettyPrinting,
         WarnAlienFormat,
         LoadDocPrinter,
         OdfDefaultVersion,
@@ -123,9 +122,6 @@ public:
     void                    SetLoadUserSettings(bool b);
     bool                IsLoadUserSettings() const;
 
-    void                    SetPrettyPrinting( bool _bEnable );
-    bool                IsPrettyPrinting( ) const;
-
     void                    SetWarnAlienFormat( bool _bEnable );
     bool                IsWarnAlienFormat( ) const;
 
diff --git a/reportdesign/Library_rpt.mk b/reportdesign/Library_rpt.mk
index fb846e09ee8a..c3f63a678881 100644
--- a/reportdesign/Library_rpt.mk
+++ b/reportdesign/Library_rpt.mk
@@ -26,6 +26,10 @@ $(eval $(call gb_Library_set_precompiled_header,rpt,reportdesign/inc/pch/precomp
 
 $(eval $(call gb_Library_use_sdk_api,rpt))
 
+$(eval $(call gb_Library_use_custom_headers,rpt,\
+    officecfg/registry \
+))
+
 $(eval $(call gb_Library_use_libraries,rpt,\
     comphelper \
     cppu \
diff --git a/reportdesign/Library_rptxml.mk b/reportdesign/Library_rptxml.mk
index dff99605f0bc..5a1707c2af4c 100644
--- a/reportdesign/Library_rptxml.mk
+++ b/reportdesign/Library_rptxml.mk
@@ -21,6 +21,10 @@ $(eval $(call gb_Library_set_precompiled_header,rptxml,reportdesign/inc/pch/prec
 
 $(eval $(call gb_Library_use_sdk_api,rptxml))
 
+$(eval $(call gb_Library_use_custom_headers,rptxml,\
+    officecfg/registry \
+))
+
 $(eval $(call gb_Library_use_libraries,rptxml,\
     comphelper \
     cppu \
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 839ec947ca36..3884d06198f9 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -22,6 +22,7 @@
 #include <vector>
 #include <string_view>
 
+#include <officecfg/Office/Common.hxx>
 #include <ReportDefinition.hxx>
 
 #include <Functions.hxx>
@@ -1318,7 +1319,7 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
     uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
 
     SvtSaveOptions aSaveOpt;
-    xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
+    xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
     if ( aSaveOpt.IsSaveRelFSys() )
     {
         const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL(),OUString()) );
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index 04409a7d2ab0..19fdbbc119a9 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "xmlExportDocumentHandler.hxx"
+#include <officecfg/Office/Common.hxx>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
 #include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
@@ -40,8 +41,7 @@ using namespace ::xmloff::token;
 
 static void lcl_exportPrettyPrinting(const uno::Reference< xml::sax::XDocumentHandler >& _xDelegatee)
 {
-    SvtSaveOptions aSaveOpt;
-    if ( aSaveOpt.IsPrettyPrinting() )
+    if ( officecfg::Office::Common::Save::Document::PrettyPrinting::get() )
     {
         _xDelegatee->ignorableWhitespace(" ");
     }
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 557099bfae1c..cb92ebab0ce5 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <officecfg/Office/Common.hxx>
 #include <vcl/errinf.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/objsh.hxx>
@@ -810,8 +811,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
             xStatusIndicator->start(ScResId(STR_SAVE_DOC), nProgressRange);
         xInfoSet->setPropertyValue("ProgressRange", uno::makeAny(nProgressRange));
 
-        SvtSaveOptions aSaveOpt;
-        bool bUsePrettyPrinting(aSaveOpt.IsPrettyPrinting());
+        bool bUsePrettyPrinting = officecfg::Office::Common::Save::Document::PrettyPrinting::get();
         xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(bUsePrettyPrinting));
 
         xInfoSet->setPropertyValue( "TargetStorage", uno::Any( xStorage ) );
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index a65c7eee6f99..31257d66e3e9 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <officecfg/Office/Common.hxx>
 #include <vcl/errinf.hxx>
 #include <sal/log.hxx>
 #include <com/sun/star/container/XChild.hpp>
@@ -785,8 +786,7 @@ bool SdXMLFilter::Export()
 
         uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aExportInfoMap ) ) );
 
-        SvtSaveOptions aSaveOpt;
-        bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+        bool bUsePrettyPrinting = officecfg::Office::Common::Save::Document::PrettyPrinting::get();
         xInfoSet->setPropertyValue( "UsePrettyPrinting", makeAny( bUsePrettyPrinting ) );
 
         const uno::Reference < embed::XStorage >& xStorage = mrMedium.GetOutputStorage();
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 01820c08adb7..d54a9bb42b6b 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -143,8 +143,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
                 case SID_ATTR_PRETTYPRINTING:
                     {
                         bRet = true;
-                        if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::DoPrettyPrinting))
-                            if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), aSaveOptions.IsPrettyPrinting())))
+                        if (!officecfg::Office::Common::Save::Document::PrettyPrinting::isReadOnly())
+                            if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ),
+                                    officecfg::Office::Common::Save::Document::PrettyPrinting::get())))
                                 bRet = false;
                     }
                     break;
@@ -433,7 +434,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
     if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), true, &pItem ) )
     {
         DBG_ASSERT( dynamic_cast< const SfxBoolItem *>( pItem ) !=  nullptr, "BoolItem expected" );
-        aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() );
+        officecfg::Office::Common::Save::Document::PrettyPrinting::set(
+            static_cast< const SfxBoolItem*> ( pItem )->GetValue(),
+            batch );
     }
 
     // WarnAlienFormat
diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx
index 450b81bc2f59..e9fc5a3de11d 100644
--- a/starmath/source/mathml/mathmlexport.cxx
+++ b/starmath/source/mathml/mathmlexport.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/task/XStatusIndicator.hpp>
 #include <com/sun/star/uno/Any.h>
 
+#include <officecfg/Office/Common.hxx>
 #include <rtl/math.hxx>
 #include <sfx2/frame.hxx>
 #include <sfx2/docfile.hxx>
@@ -143,8 +144,8 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium)
     uno::Reference<beans::XPropertySet> xInfoSet(
         comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap)));
 
-    SvtSaveOptions aSaveOpt;
-    bool bUsePrettyPrinting(bFlat || aSaveOpt.IsPrettyPrinting());
+    bool bUsePrettyPrinting
+        = bFlat || officecfg::Office::Common::Save::Document::PrettyPrinting::get();
     xInfoSet->setPropertyValue("UsePrettyPrinting", Any(bUsePrettyPrinting));
 
     // Set base URI
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index be2a21aeeefa..859140d9f950 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/frame/XModule.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 
+#include <officecfg/Office/Common.hxx>
 #include <comphelper/fileformat.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/genericpropertyset.hxx>
@@ -181,8 +182,7 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
         xInfoSet->setPropertyValue("ProgressMax", Any(static_cast < sal_Int32 >( -1 )));
     }
 
-    SvtSaveOptions aSaveOpt;
-    xInfoSet->setPropertyValue( "UsePrettyPrinting", makeAny(aSaveOpt.IsPrettyPrinting()) );
+    xInfoSet->setPropertyValue( "UsePrettyPrinting", makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get()) );
 
     uno::Reference<lang::XComponent> const xModelComp(m_pDoc->GetDocShell()->GetModel());
     uno::Reference<drawing::XDrawPageSupplier> const xDPS(xModelComp, uno::UNO_QUERY);
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 76c7e34f3673..6208ae1c78ae 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -68,7 +68,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
                                         bSaveWorkingSet,
                                         bSaveRelINet,
                                         bSaveRelFSys,
-                                        bDoPrettyPrinting,
                                         bWarnAlienFormat,
                                         bLoadDocPrinter;
 
@@ -85,7 +84,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
                                         bROSaveRelINet,
                                         bROSaveRelFSys,
                                         bROWarnAlienFormat,
-                                        bRODoPrettyPrinting,
                                         bROLoadDocPrinter,
                                         bROODFDefaultVersion;
 
@@ -106,7 +104,6 @@ public:
     bool                    IsSaveWorkingSet() const            { return bSaveWorkingSet;         }
     bool                    IsSaveRelINet() const               { return bSaveRelINet; }
     bool                    IsSaveRelFSys() const               { return bSaveRelFSys; }
-    bool                IsPrettyPrintingEnabled( ) const    { return bDoPrettyPrinting; }
     bool                IsWarnAlienFormat() const           { return bWarnAlienFormat; }
     bool                IsLoadDocPrinter() const            { return bLoadDocPrinter; }
 
@@ -123,7 +120,6 @@ public:
     void                    SetSaveWorkingSet( bool b );
     void                    SetSaveRelINet( bool b );
     void                    SetSaveRelFSys( bool b );
-    void                    EnablePrettyPrinting( bool _bDoPP );
     void                    SetWarnAlienFormat( bool _bDoPP );
     void                    SetLoadDocPrinter( bool bNew );
     void                    SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
@@ -226,15 +222,6 @@ void SvtSaveOptions_Impl::SetSaveRelFSys( bool b )
     }
 }
 
-void SvtSaveOptions_Impl::EnablePrettyPrinting( bool _bDoPP )
-{
-    if (!bRODoPrettyPrinting && bDoPrettyPrinting!=_bDoPP)
-    {
-        bDoPrettyPrinting = _bDoPP;
-        SetModified();
-    }
-}
-
 void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP )
 {
     if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP)
@@ -297,9 +284,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
         case SvtSaveOptions::EOption::SaveRelFsys :
             bReadOnly = bROSaveRelFSys;
             break;
-        case SvtSaveOptions::EOption::DoPrettyPrinting :
-            bReadOnly = bRODoPrettyPrinting;
-            break;
         case SvtSaveOptions::EOption::WarnAlienFormat :
             bReadOnly = bROWarnAlienFormat;
             break;
@@ -320,13 +304,12 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
 #define AUTOSAVE            4
 #define PROMPT              5
 #define EDITPROPERTY        6
-#define PRETTYPRINTING      7
-#define WARNALIENFORMAT     8
-#define LOADDOCPRINTER      9
-#define FILESYSTEM          10
-#define INTERNET            11
-#define SAVEWORKINGSET      12
-#define ODFDEFAULTVERSION   13
+#define WARNALIENFORMAT     7
+#define LOADDOCPRINTER      8
+#define FILESYSTEM          9
+#define INTERNET            10
+#define SAVEWORKINGSET      11
+#define ODFDEFAULTVERSION   12
 
 static Sequence< OUString > GetPropertyNames()
 {
@@ -339,7 +322,6 @@ static Sequence< OUString > GetPropertyNames()
         "Document/AutoSave",
         "Document/AutoSavePrompt",
         "Document/EditProperty",
-        "Document/PrettyPrinting",
         "Document/WarnAlienFormat",
         "Document/LoadPrinter",
         "URL/FileSystem",
@@ -369,7 +351,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     , bSaveWorkingSet( false )
     , bSaveRelINet( false )
     , bSaveRelFSys( false )
-    , bDoPrettyPrinting( false )
     , bWarnAlienFormat( true )
     , bLoadDocPrinter( true )
     , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
@@ -384,7 +365,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     , bROSaveRelINet( CFG_READONLY_DEFAULT )
     , bROSaveRelFSys( CFG_READONLY_DEFAULT )
     , bROWarnAlienFormat( CFG_READONLY_DEFAULT )
-    , bRODoPrettyPrinting( CFG_READONLY_DEFAULT )
     , bROLoadDocPrinter( CFG_READONLY_DEFAULT )
     , bROODFDefaultVersion( CFG_READONLY_DEFAULT )
 {
@@ -475,11 +455,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
                                     bROSaveRelINet = pROStates[nProp];
                                     break;
 
-                                case PRETTYPRINTING:
-                                    bDoPrettyPrinting = bTemp;
-                                    bRODoPrettyPrinting = pROStates[nProp];
-                                    break;
-
                                 case WARNALIENFORMAT:
                                     bWarnAlienFormat = bTemp;
                                     bROWarnAlienFormat = pROStates[nProp];
@@ -609,14 +584,6 @@ void SvtSaveOptions_Impl::ImplCommit()
                     ++nRealCount;
                 }
                 break;
-            case PRETTYPRINTING:
-                if (!bRODoPrettyPrinting)
-                {
-                    pValues[nRealCount] <<= bDoPrettyPrinting;
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
             case WARNALIENFORMAT:
                 if (!bROWarnAlienFormat)
                 {
@@ -854,16 +821,6 @@ bool   SvtSaveOptions::IsLoadUserSettings() const
     return pImp->pLoadOpt->IsLoadUserSettings();
 }
 
-void SvtSaveOptions::SetPrettyPrinting( bool _bEnable )
-{
-    pImp->pSaveOpt->EnablePrettyPrinting( _bEnable );
-}
-
-bool SvtSaveOptions::IsPrettyPrinting() const
-{
-    return pImp->pSaveOpt->IsPrettyPrintingEnabled();
-}
-
 void SvtSaveOptions::SetWarnAlienFormat( bool _bEnable )
 {
     pImp->pSaveOpt->SetWarnAlienFormat( _bEnable );


More information about the Libreoffice-commits mailing list