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@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-07-24 09:57:08 +02:00
parent 2855f12072
commit e271fce82e
13 changed files with 37 additions and 70 deletions
+2 -2
View File
@@ -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 ));
@@ -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());
-4
View File
@@ -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;
+4
View File
@@ -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 \
+4
View File
@@ -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 \
@@ -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()) );
@@ -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(" ");
}
+2 -2
View File
@@ -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 ) );
+2 -2
View File
@@ -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();
+6 -3
View File
@@ -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
+3 -2
View File
@@ -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
+2 -2
View File
@@ -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);
+6 -49
View File
@@ -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 );