diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-01-07 12:40:48 +0600 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-01-07 18:23:09 +0100 |
commit | 3637c22b8217f2c059c32996bb5549e96eaf66e5 (patch) | |
tree | bc530aefd03cd3ce801ba9ff7004ca5ee1985039 | |
parent | b7cba4953a072c88813ecd1886cd0fdaa5790de7 (diff) |
Drop SvtFilterOptions and use officecfg instead
Change-Id: I6aa9a21d1422b8b3b6fe5dde9869dffa88be5535
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161744
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | cui/source/options/optfltr.cxx | 246 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 2 | ||||
-rw-r--r-- | include/unotools/fltrcfg.hxx | 106 | ||||
-rw-r--r-- | sc/inc/pch/precompiled_scfilt.hxx | 1 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_ooxmlexport14.mk | 4 | ||||
-rw-r--r-- | sw/CppunitTest_sw_ooxmlexport16.mk | 4 | ||||
-rw-r--r-- | sw/inc/pch/precompiled_msword.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 22 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 16 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 10 | ||||
-rw-r--r-- | unotools/Library_utl.mk | 1 | ||||
-rw-r--r-- | unotools/source/config/fltrcfg.cxx | 670 |
20 files changed, 167 insertions, 985 deletions
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index b582b065bc65..0c1c2b54306a 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -18,7 +18,6 @@ */ #include <unotools/moduleoptions.hxx> -#include <unotools/fltrcfg.hxx> #include <officecfg/Office/Common.hxx> #include <officecfg/Office/Calc.hxx> #include <officecfg/Office/Writer.hxx> @@ -109,67 +108,67 @@ OUString OfaMSFilterTabPage::GetAllStrings() bool OfaMSFilterTabPage::FillItemSet( SfxItemSet* ) { - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + auto batch = comphelper::ConfigurationChanges::create(); if( m_xWBasicCodeCB->get_state_changed_from_saved() ) - rOpt.SetLoadWordBasicCode( m_xWBasicCodeCB->get_active() ); + officecfg::Office::Writer::Filter::Import::VBA::Load::set(m_xWBasicCodeCB->get_active(), batch); if( m_xWBasicWbctblCB->get_state_changed_from_saved() ) - rOpt.SetLoadWordBasicExecutable( m_xWBasicWbctblCB->get_active() ); + officecfg::Office::Writer::Filter::Import::VBA::Executable::set(m_xWBasicWbctblCB->get_active(), batch); if( m_xWBasicStgCB->get_state_changed_from_saved() ) - rOpt.SetLoadWordBasicStorage( m_xWBasicStgCB->get_active() ); + officecfg::Office::Writer::Filter::Import::VBA::Save::set(m_xWBasicStgCB->get_active(), batch); if( m_xEBasicCodeCB->get_state_changed_from_saved()) - rOpt.SetLoadExcelBasicCode( m_xEBasicCodeCB->get_active() ); + officecfg::Office::Calc::Filter::Import::VBA::Load::set(m_xEBasicCodeCB->get_active(), batch); if( m_xEBasicExectblCB->get_state_changed_from_saved()) - rOpt.SetLoadExcelBasicExecutable( m_xEBasicExectblCB->get_active() ); + officecfg::Office::Calc::Filter::Import::VBA::Executable::set(m_xEBasicExectblCB->get_active(), batch); if( m_xEBasicStgCB->get_state_changed_from_saved()) - rOpt.SetLoadExcelBasicStorage( m_xEBasicStgCB->get_active() ); + officecfg::Office::Calc::Filter::Import::VBA::Save::set(m_xEBasicStgCB->get_active(), batch); if( m_xPBasicCodeCB->get_state_changed_from_saved()) - rOpt.SetLoadPPointBasicCode( m_xPBasicCodeCB->get_active() ); + officecfg::Office::Impress::Filter::Import::VBA::Load::set(m_xPBasicCodeCB->get_active(), batch); if( m_xPBasicStgCB->get_state_changed_from_saved()) - rOpt.SetLoadPPointBasicStorage( m_xPBasicStgCB->get_active() ); + officecfg::Office::Impress::Filter::Import::VBA::Save::set(m_xPBasicStgCB->get_active(), batch); + + batch->commit(); return false; } void OfaMSFilterTabPage::Reset( const SfxItemSet* ) { - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - - m_xWBasicCodeCB->set_active( rOpt.IsLoadWordBasicCode() ); + m_xWBasicCodeCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Load::get()); m_xWBasicCodeCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly()); m_xWBasicCodeImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly()); m_xWBasicCodeCB->save_state(); - m_xWBasicWbctblCB->set_active( rOpt.IsLoadWordBasicExecutable() ); + m_xWBasicWbctblCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Executable::get()); m_xWBasicWbctblCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly()); m_xWBasicWbctblImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly()); m_xWBasicWbctblCB->save_state(); - m_xWBasicStgCB->set_active( rOpt.IsLoadWordBasicStorage() ); + m_xWBasicStgCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Save::get()); m_xWBasicStgCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly()); m_xWBasicStgImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly()); m_xWBasicStgCB->save_state(); LoadWordBasicCheckHdl_Impl( *m_xWBasicCodeCB ); - m_xEBasicCodeCB->set_active( rOpt.IsLoadExcelBasicCode() ); + m_xEBasicCodeCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Load::get()); m_xEBasicCodeCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly()); m_xEBasicCodeImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly()); m_xEBasicCodeCB->save_state(); - m_xEBasicExectblCB->set_active( rOpt.IsLoadExcelBasicExecutable() ); + m_xEBasicExectblCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Executable::get()); m_xEBasicExectblCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly()); m_xEBasicExectblImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly()); m_xEBasicExectblCB->save_state(); - m_xEBasicStgCB->set_active( rOpt.IsLoadExcelBasicStorage() ); + m_xEBasicStgCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Save::get()); m_xEBasicStgCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly()); m_xEBasicStgImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly()); m_xEBasicStgCB->save_state(); LoadExcelBasicCheckHdl_Impl( *m_xEBasicCodeCB ); - m_xPBasicCodeCB->set_active( rOpt.IsLoadPPointBasicCode() ); + m_xPBasicCodeCB->set_active(officecfg::Office::Impress::Filter::Import::VBA::Load::get()); m_xPBasicCodeCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly()); m_xPBasicCodeImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly()); m_xPBasicCodeCB->save_state(); - m_xPBasicStgCB->set_active( rOpt.IsLoadPPointBasicStorage() ); + m_xPBasicStgCB->set_active(officecfg::Office::Impress::Filter::Import::VBA::Save::get()); m_xPBasicStgCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly()); m_xPBasicStgImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly()); m_xPBasicStgCB->save_state(); @@ -234,87 +233,97 @@ OUString OfaMSFilterTabPage2::GetAllStrings() return sAllStrings.replaceAll("_", ""); } +namespace +{ +struct Functions +{ + bool (*FnIs)(); + bool (*FnIsReadOnly)(); + void (*FnSet)(const bool& bFlag, const std::shared_ptr<comphelper::ConfigurationChanges>&); + template <class reg> static constexpr Functions fromReg() + { + return { reg::get, reg::isReadOnly, reg::set }; + } +}; +struct ChkCBoxPair +{ + MSFltrPg2_CheckBoxEntries eType; + Functions load; + Functions save; +}; +template <class regLoad, class regSave> constexpr ChkCBoxPair Pair(MSFltrPg2_CheckBoxEntries eType) +{ + return { eType, Functions::fromReg<regLoad>(), Functions::fromReg<regSave>() }; +} +template <class regLoad> constexpr ChkCBoxPair Load(MSFltrPg2_CheckBoxEntries eType) +{ + return { eType, Functions::fromReg<regLoad>(), {} }; +} +constexpr ChkCBoxPair aChkArr[] = { + Pair<officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath, + officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType>( + MSFltrPg2_CheckBoxEntries::Math), + Pair<officecfg::Office::Common::Filter::Microsoft::Import::WinWordToWriter, + officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord>( + MSFltrPg2_CheckBoxEntries::Writer), + Pair<officecfg::Office::Common::Filter::Microsoft::Import::ExcelToCalc, + officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel>( + MSFltrPg2_CheckBoxEntries::Calc), + Pair<officecfg::Office::Common::Filter::Microsoft::Import::PowerPointToImpress, + officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint>( + MSFltrPg2_CheckBoxEntries::Impress), + Load<officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes>( + MSFltrPg2_CheckBoxEntries::SmartArt), + Load<officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw>( + MSFltrPg2_CheckBoxEntries::Visio), + Load<officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw>( + MSFltrPg2_CheckBoxEntries::PDF), +}; +} + bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* ) { - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - - static struct ChkCBoxEntries{ - MSFltrPg2_CheckBoxEntries eType; - bool (SvtFilterOptions::*FnIs)() const; - void (SvtFilterOptions::*FnSet)( bool bFlag ); - } const aChkArr[] = { - { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMathType2Math, - &SvtFilterOptions::SetMathType2Math }, - { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMath2MathType, - &SvtFilterOptions::SetMath2MathType }, - { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWinWord2Writer, - &SvtFilterOptions::SetWinWord2Writer }, - { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWriter2WinWord, - &SvtFilterOptions::SetWriter2WinWord }, - { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsExcel2Calc, - &SvtFilterOptions::SetExcel2Calc }, - { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsCalc2Excel, - &SvtFilterOptions::SetCalc2Excel }, - { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsPowerPoint2Impress, - &SvtFilterOptions::SetPowerPoint2Impress }, - { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsImpress2PowerPoint, - &SvtFilterOptions::SetImpress2PowerPoint }, - { MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape, - &SvtFilterOptions::SetSmartArt2Shape }, - { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw, - &SvtFilterOptions::SetVisio2Draw }, - }; - bool bFirstCol = true; - for( const ChkCBoxEntries & rEntry : aChkArr ) + auto pBatch = comphelper::ConfigurationChanges::create(); + for (const ChkCBoxPair& rEntry : aChkArr) { // we loop through the list, alternating reading the first/second column, // each row appears twice in the list (except for smartart and later entries, which are // import only) - sal_uInt16 nCol = bFirstCol ? 0 : 1; - bFirstCol = !bFirstCol; int nEntry = GetEntry4Type(rEntry.eType); if (nEntry != -1) { - bool bCheck = m_xCheckLB->get_toggle(nEntry, nCol); - if( bCheck != (rOpt.*rEntry.FnIs)() ) - (rOpt.*rEntry.FnSet)( bCheck ); - } - if (rEntry.eType == MSFltrPg2_CheckBoxEntries::SmartArt) - { - bFirstCol = !bFirstCol; + bool bCheck = m_xCheckLB->get_toggle(nEntry, 0); + if (bCheck != (rEntry.load.FnIs)()) + (rEntry.load.FnSet)(bCheck, pBatch); + + if (rEntry.save.FnIs) + { + bCheck = m_xCheckLB->get_toggle(nEntry, 1); + if (bCheck != (rEntry.save.FnIs)()) + (rEntry.save.FnSet)(bCheck, pBatch); + } } } - int nPDFEntry = GetEntry4Type(MSFltrPg2_CheckBoxEntries::PDF); - bool bPDFCheck = m_xCheckLB->get_toggle(nPDFEntry, 0); - if (bPDFCheck != officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::get()) - { - std::shared_ptr<comphelper::ConfigurationChanges> pBatch( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::set(bPDFCheck, pBatch); - pBatch->commit(); - } if( m_xHighlightingRB->get_state_changed_from_saved() ) { - if (m_xHighlightingRB->get_active()) - rOpt.SetCharBackground2Highlighting(); - else - rOpt.SetCharBackground2Shading(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set( + m_xHighlightingRB->get_active(), pBatch); } if (m_xMSOLockFileCB->get_state_changed_from_saved()) { - rOpt.EnableMSOLockFileCreation(m_xMSOLockFileCB->get_active()); + officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::set( + m_xMSOLockFileCB->get_active(), pBatch); } + pBatch->commit(); return true; } void OfaMSFilterTabPage2::Reset( const SfxItemSet* ) { - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - m_xCheckLB->freeze(); m_xCheckLB->clear(); @@ -336,92 +345,31 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* ) InsertEntry(sChgToFromPDF, MSFltrPg2_CheckBoxEntries::PDF, false); } - static struct ChkCBoxEntries{ - MSFltrPg2_CheckBoxEntries eType; - bool (SvtFilterOptions::*FnIs)() const; - } const aChkArr[] = { - { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMathType2Math }, - { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMath2MathType }, - { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWinWord2Writer }, - { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWriter2WinWord }, - { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsExcel2Calc }, - { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsCalc2Excel }, - { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsPowerPoint2Impress }, - { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsImpress2PowerPoint }, - { MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape }, - { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw }, - { MSFltrPg2_CheckBoxEntries::PDF, nullptr }, - }; - - bool bFirstCol = true; - bool bReadOnly = false; - for( const ChkCBoxEntries & rArr : aChkArr ) + for (const ChkCBoxPair& rArr : aChkArr) { // we loop through the list, alternating reading the first/second column, // each row appears twice in the list (except for smartart and later entries, which are // import only) - sal_uInt16 nCol = bFirstCol ? 0 : 1; - bFirstCol = !bFirstCol; int nEntry = GetEntry4Type( rArr.eType ); if (nEntry != -1) { - bool bCheck = false; - if (rArr.eType != MSFltrPg2_CheckBoxEntries::PDF) - { - bCheck = (rOpt.*rArr.FnIs)(); - switch (rArr.eType) - { - case MSFltrPg2_CheckBoxEntries::Math: - if (nCol == 0) - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::isReadOnly(); - else - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType::isReadOnly(); - break; - case MSFltrPg2_CheckBoxEntries::Writer: - if (nCol == 0) - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::WinWordToWriter::isReadOnly(); - else - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord::isReadOnly(); - break; - case MSFltrPg2_CheckBoxEntries::Calc: - if (nCol == 0) - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::ExcelToCalc::isReadOnly(); - else - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel::isReadOnly(); - break; - case MSFltrPg2_CheckBoxEntries::Impress: - if (nCol == 0) - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::PowerPointToImpress::isReadOnly(); - else - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint::isReadOnly(); - break; - case MSFltrPg2_CheckBoxEntries::SmartArt: - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::isReadOnly(); - break; - case MSFltrPg2_CheckBoxEntries::Visio: - bReadOnly = officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::isReadOnly(); - break; - default: - break; - } - } - else + bool bCheck = (rArr.load.FnIs)(); + bool bReadOnly = (rArr.load.FnIsReadOnly)(); + m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0); + m_xCheckLB->set_sensitive(nEntry, !bReadOnly, 0); + + if (rArr.save.FnIs) { - bCheck = officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::get(); - bReadOnly = officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::isReadOnly(); - nCol = 0; + bCheck = (rArr.save.FnIs)(); + bReadOnly = (rArr.save.FnIsReadOnly)(); + m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 1); + m_xCheckLB->set_sensitive(nEntry, !bReadOnly, 1); } - m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, nCol); - m_xCheckLB->set_sensitive(nEntry, !bReadOnly, nCol); - } - if (rArr.eType == MSFltrPg2_CheckBoxEntries::SmartArt) - { - bFirstCol = !bFirstCol; } } m_xCheckLB->thaw(); - if (rOpt.IsCharBackground2Highlighting()) + if (officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get()) m_xHighlightingRB->set_active(true); else m_xShadingRB->set_active(true); @@ -436,7 +384,7 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* ) m_xHighlightingRB->save_state(); - m_xMSOLockFileCB->set_active(rOpt.IsMSOLockFileCreationIsEnabled()); + m_xMSOLockFileCB->set_active(officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::get()); m_xMSOLockFileCB->save_state(); m_xMSOLockFileCB->set_sensitive(!officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::isReadOnly()); m_xMSOLockFileImg->set_visible(officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::isReadOnly()); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c6ccb29424da..95ddeff36cfa 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -222,7 +222,6 @@ #include <svtools/miscopt.hxx> #include <unotools/cmdoptions.hxx> #include <unotools/compatibility.hxx> -#include <unotools/fltrcfg.hxx> #include <unotools/lingucfg.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/searchopt.hxx> @@ -7523,7 +7522,6 @@ static void preloadData() static SvtMiscOptions aSvtMiscOptions; static SvtCommandOptions aSvtCommandOptions; static SvtCompatibilityOptions aSvtCompatibilityOptions; - static SvtFilterOptions aSvtFilterOptions; static SvtLinguConfig aSvtLinguConfig; static SvtModuleOptions aSvtModuleOptions; static SvtPathOptions aSvtPathOptions; diff --git a/include/unotools/fltrcfg.hxx b/include/unotools/fltrcfg.hxx deleted file mode 100644 index bac46c03cc31..000000000000 --- a/include/unotools/fltrcfg.hxx +++ /dev/null @@ -1,106 +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_FLTRCFG_HXX -#define INCLUDED_UNOTOOLS_FLTRCFG_HXX - -#include <o3tl/deleter.hxx> -#include <unotools/unotoolsdllapi.h> -#include <unotools/configitem.hxx> -#include <memory> - -struct SvtFilterOptions_Impl; -class UNOTOOLS_DLLPUBLIC SvtFilterOptions final : public utl::ConfigItem -{ -private: - std::unique_ptr<SvtFilterOptions_Impl, o3tl::default_delete<SvtFilterOptions_Impl>> pImpl; - - virtual void ImplCommit() override; - -public: - SvtFilterOptions(); - virtual ~SvtFilterOptions() override; - - virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; - void Load(); - - void SetLoadWordBasicCode( bool bFlag ); - bool IsLoadWordBasicCode() const; - void SetLoadWordBasicExecutable( bool bFlag ); - bool IsLoadWordBasicExecutable() const; - void SetLoadWordBasicStorage( bool bFlag ); - bool IsLoadWordBasicStorage() const; - - void SetLoadExcelBasicCode( bool bFlag ); - bool IsLoadExcelBasicCode() const; - void SetLoadExcelBasicExecutable( bool bFlag ); - bool IsLoadExcelBasicExecutable() const; - void SetLoadExcelBasicStorage( bool bFlag ); - bool IsLoadExcelBasicStorage() const; - - void SetLoadPPointBasicCode( bool bFlag ); - bool IsLoadPPointBasicCode() const; - void SetLoadPPointBasicStorage( bool bFlag ); - bool IsLoadPPointBasicStorage() const; - - bool IsMathType2Math() const; - void SetMathType2Math( bool bFlag ); - bool IsMath2MathType() const; - void SetMath2MathType( bool bFlag ); - - bool IsWinWord2Writer() const; - void SetWinWord2Writer( bool bFlag ); - bool IsWriter2WinWord() const; - void SetWriter2WinWord( bool bFlag ); - - bool IsUseEnhancedFields() const; - - bool IsExcel2Calc() const; - void SetExcel2Calc( bool bFlag ); - bool IsCalc2Excel() const; - void SetCalc2Excel( bool bFlag ); - - bool IsPowerPoint2Impress() const; - void SetPowerPoint2Impress( bool bFlag ); - bool IsImpress2PowerPoint() const; - void SetImpress2PowerPoint( bool bFlag ); - - bool IsSmartArt2Shape() const; - void SetSmartArt2Shape( bool bFlag ); - - bool IsEnablePPTPreview() const; - bool IsEnableCalcPreview() const; - bool IsEnableWordPreview() const; - - bool IsCharBackground2Highlighting() const; - bool IsCharBackground2Shading() const; - void SetCharBackground2Highlighting(); - void SetCharBackground2Shading(); - - bool IsMSOLockFileCreationIsEnabled() const; - void EnableMSOLockFileCreation(bool bEnable); - - bool IsVisio2Draw() const; - void SetVisio2Draw(bool bFlag); - - static SvtFilterOptions& Get(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pch/precompiled_scfilt.hxx b/sc/inc/pch/precompiled_scfilt.hxx index c44c422833ad..16a85477d2eb 100644 --- a/sc/inc/pch/precompiled_scfilt.hxx +++ b/sc/inc/pch/precompiled_scfilt.hxx @@ -277,7 +277,6 @@ #include <unotools/charclass.hxx> #include <unotools/configitem.hxx> #include <unotools/configmgr.hxx> -#include <unotools/fltrcfg.hxx> #include <unotools/options.hxx> #include <unotools/textsearch.hxx> #include <unotools/unotoolsdllapi.h> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index b0f9a1384557..a9690468cb89 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6180,7 +6180,6 @@ include/unotools/dynamicmenuoptions.hxx include/unotools/eventcfg.hxx include/unotools/eventlisteneradapter.hxx include/unotools/extendedsecurityoptions.hxx -include/unotools/fltrcfg.hxx include/unotools/fontcfg.hxx include/unotools/fontcvt.hxx include/unotools/fontdefs.hxx diff --git a/sw/CppunitTest_sw_ooxmlexport14.mk b/sw/CppunitTest_sw_ooxmlexport14.mk index b582b317c064..5dcc2caeeb3d 100644 --- a/sw/CppunitTest_sw_ooxmlexport14.mk +++ b/sw/CppunitTest_sw_ooxmlexport14.mk @@ -11,4 +11,8 @@ $(eval $(call sw_ooxmlexport_test,14)) +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport14,\ + officecfg/registry \ +)) + # vim: set noet sw=4 ts=4: diff --git a/sw/CppunitTest_sw_ooxmlexport16.mk b/sw/CppunitTest_sw_ooxmlexport16.mk index 4e78cef57760..ba9bc2c146a3 100644 --- a/sw/CppunitTest_sw_ooxmlexport16.mk +++ b/sw/CppunitTest_sw_ooxmlexport16.mk @@ -11,4 +11,8 @@ $(eval $(call sw_ooxmlexport_test,16)) +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport16,\ + officecfg/registry \ +)) + # vim: set noet sw=4 ts=4: diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx index 0ef260ea7fae..a6385c4be84b 100644 --- a/sw/inc/pch/precompiled_msword.hxx +++ b/sw/inc/pch/precompiled_msword.hxx @@ -545,7 +545,6 @@ #include <uno/any2.h> #include <uno/data.h> #include <uno/sequence2.h> -#include <unotools/fltrcfg.hxx> #include <unotools/fontdefs.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/options.hxx> diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index a877c778d3ca..5f46f129e261 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -32,7 +32,6 @@ #include <ndtxt.hxx> #include <ndindex.hxx> #include <pam.hxx> -#include <unotools/fltrcfg.hxx> #include <xmloff/odffields.hxx> #include <IDocumentMarkAccess.hxx> #include <IMark.hxx> @@ -537,13 +536,15 @@ void Test::testCharStyleHighlight() void Test::testCharHighlight() { - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - rOpt.SetCharBackground2Shading(); + auto batch = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false, batch); + batch->commit(); testCharHighlightBody(); testCharStyleHighlight(); - rOpt.SetCharBackground2Highlighting(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true, batch); + batch->commit(); testCharHighlightBody(); testCharStyleHighlight(); @@ -628,6 +629,10 @@ void Test::testMSCharBackgroundEditing() "Office Open XML Text", }; + auto batch = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true, batch); + batch->commit(); + for (OUString const & rFilterName : aFilterNames) { createSwDoc("char_background_editing.docx"); @@ -683,9 +688,6 @@ void Test::testMSCharBackgroundEditing() xRun->setPropertyValue("CharInteropGrabBag", uno::Any(aGrabBag)); } - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - rOpt.SetCharBackground2Highlighting(); - // Export the document and import again for a check saveAndReload(rFilterName); @@ -733,9 +735,9 @@ void Test::testCharBackgroundToHighlighting() OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); - - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - rOpt.SetCharBackground2Highlighting(); + auto batch = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true, batch); + batch->commit(); // Export the document and import again for a check saveAndReload(rFilterName); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 4b0fbdd13716..a045a03407ff 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -30,8 +30,8 @@ #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <comphelper/sequenceashashmap.hxx> +#include <officecfg/Office/Common.hxx> #include <oox/drawingml/drawingmltypes.hxx> -#include <unotools/fltrcfg.hxx> #include <o3tl/string_view.hxx> using namespace com::sun::star; @@ -923,9 +923,10 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) createSwDoc("tdf135774_numberingCRProps.docx"); // This only affects when saving as w:highlight - which is not the default since 7.0. - SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - bool bWasExportToShade = rOpt.IsCharBackground2Shading(); - rOpt.SetCharBackground2Highlighting(); + bool bWasExportToShade = !officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get(); + auto batch = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true, batch); + batch->commit(); //Simulate a user editing the char background color of the paragraph 2 marker (CR) uno::Reference<beans::XPropertySet> properties(getParagraph(2), uno::UNO_QUERY); @@ -943,7 +944,7 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) for (beans::PropertyValue& rProp : asNonConstRange(aGrabBag)) { // The shading is no longer defined from import, so clear that flag. - // BackColor 0xff00ff will now attempt to export as highlight, since we set that in SvtFilterOptions. + // BackColor 0xff00ff will now attempt to export as highlight, since we set that in officecfg. if (rProp.Name == "CharShadingMarker") rProp.Value <<= false; } @@ -961,7 +962,10 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) // Visually, the "none" highlight means the bullet point should not have a character background. if (bWasExportToShade) - rOpt.SetCharBackground2Shading(); + { + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false, batch); + batch->commit(); + } } CPPUNIT_TEST_FIXTURE(Test, testTdf132766) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 727146f0b707..4128862c17db 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -27,11 +27,11 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/view/XViewCursor.hpp> #include <comphelper/sequenceashashmap.hxx> -#include <unotools/fltrcfg.hxx> #include <unoprnms.hxx> #include <o3tl/string_view.hxx> #include <comphelper/scopeguard.hxx> #include <vcl/skia/SkiaHelper.hxx> +#include <officecfg/Office/Common.hxx> class Test : public SwModelTestBase { @@ -526,16 +526,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134951_duplicates) CPPUNIT_TEST_FIXTURE(Test, testTdf135773_numberingShading) { - bool bIsExportAsShading = SvtFilterOptions::Get().IsCharBackground2Shading(); + bool bIsExportAsShading = !officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get(); + auto batch = comphelper::ConfigurationChanges::create(); + // This function is run at the end of the test - returning the filter options to normal. comphelper::ScopeGuard g( - [bIsExportAsShading] + [bIsExportAsShading, batch] { if (bIsExportAsShading) - SvtFilterOptions::Get().SetCharBackground2Shading(); + { + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false, batch); + batch->commit(); + } }); // For these test, ensure exporting CharBackground as w:highlight. - SvtFilterOptions::Get().SetCharBackground2Highlighting(); + officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true, batch); + batch->commit(); loadAndSave("tdf135774_numberingShading.docx"); // This test uses a custom setting to export CharBackground as Highlight instead of the 7.0 default of Shading. diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 0556facafe19..f85187e9fa13 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -46,7 +46,6 @@ #include <textlinebreak.hxx> #include <txtfld.hxx> #include <txtannotationfld.hxx> -#include <unotools/fltrcfg.hxx> #include <charfmt.hxx> #include <frmfmt.hxx> #include <ftnidx.hxx> @@ -81,6 +80,8 @@ #include <rdfhelper.hxx> #include <hints.hxx> +#include <officecfg/Office/Common.hxx> + #ifdef DBG_UTIL #define CHECK Check(true); #define CHECK_NOTMERGED Check(false); @@ -1906,7 +1907,7 @@ bool SwTextNode::IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich, bool b // LO can save the char background as either shading or highlight, so check which mode is currently chosen. // Shading does not affect the numbering. Highlighting does (but isn't allowed in a char style). if (nWhich == RES_CHRATR_BACKGROUND) - return bIsCharStyle || SvtFilterOptions::Get().IsCharBackground2Shading(); + return bIsCharStyle || !officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get(); return (nWhich == RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_ESCAPEMENT); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e99f31342ba2..20fa9f6892b7 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -37,7 +37,6 @@ #include <docsh.hxx> #include <drawdoc.hxx> -#include <unotools/fltrcfg.hxx> #include <sot/storage.hxx> #include <sfx2/docinf.hxx> #include <editeng/tstpitem.hxx> @@ -118,6 +117,7 @@ #include <fmtclbl.hxx> #include <iodetect.hxx> #include <fmtwrapinfluenceonobjpos.hxx> +#include <officecfg/Office/Common.hxx> using namespace css; using namespace sw::util; @@ -3434,14 +3434,13 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) if ( !m_oOLEExp ) { sal_uInt32 nSvxMSDffOLEConvFlags = 0; - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - if ( rOpt.IsMath2MathType() ) + if (officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType::get()) nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE; - if ( rOpt.IsWriter2WinWord() ) + if (officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord::get()) nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD; - if ( rOpt.IsCalc2Excel() ) + if (officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel::get()) nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL; - if ( rOpt.IsImpress2PowerPoint() ) + if (officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint::get()) nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT; m_oOLEExp.emplace( nSvxMSDffOLEConvFlags ); @@ -3778,7 +3777,7 @@ void WW8Export::PrepareStorage() if (!xDocProps.is()) return; - if ( SvtFilterOptions::Get().IsEnableWordPreview() ) + if (officecfg::Office::Common::Filter::Microsoft::Export::EnableWordPreview::get()) { std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 4949c7ffe6fd..50d2471dc93f 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -141,7 +141,7 @@ #include "fields.hxx" #include <i18nlangtag/mslangid.hxx> #include <i18nlangtag/languagetag.hxx> -#include <unotools/fltrcfg.hxx> +#include <officecfg/Office/Common.hxx> using ::editeng::SvxBorderLine; @@ -5981,7 +5981,7 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex void AttributeOutputBase::CharBackgroundBase( const SvxBrushItem& rBrush ) { - bool bConvertToShading = SvtFilterOptions::Get().IsCharBackground2Shading(); + bool bConvertToShading = !officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get(); bool bHasShadingMarker = false; // MS Word doesn't support highlight in character styles. Always export those as shading. diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a792a3c57927..2940e4d82b61 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -68,7 +68,6 @@ #include <svx/sdtcfitm.hxx> #include <svx/sdtditm.hxx> #include <svx/sdtmfitm.hxx> -#include <unotools/fltrcfg.hxx> #include <fmtfld.hxx> #include <fmturl.hxx> #include <fmtinfmt.hxx> @@ -154,6 +153,7 @@ #include <comphelper/storagehelper.hxx> #include <sfx2/DocumentMetadataAccess.hxx> #include <comphelper/diagnose_ex.hxx> +#include <officecfg/Office/Common.hxx> using namespace ::com::sun::star; using namespace sw::util; @@ -490,14 +490,13 @@ SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr, bool bSkipImages ) sal_uInt32 SwMSDffManager::GetFilterFlags() { sal_uInt32 nFlags(0); - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - if (rOpt.IsMathType2Math()) + if (officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::get()) nFlags |= OLE_MATHTYPE_2_STARMATH; - if (rOpt.IsExcel2Calc()) + if (officecfg::Office::Common::Filter::Microsoft::Import::ExcelToCalc::get()) nFlags |= OLE_EXCEL_2_STARCALC; - if (rOpt.IsPowerPoint2Impress()) + if (officecfg::Office::Common::Filter::Microsoft::Import::PowerPointToImpress::get()) nFlags |= OLE_POWERPOINT_2_STARIMPRESS; - if (rOpt.IsWinWord2Writer()) + if (officecfg::Office::Common::Filter::Microsoft::Import::WinWordToWriter::get()) nFlags |= OLE_WINWORD_2_STARWRITER; return nFlags; } @@ -1998,8 +1997,7 @@ void SwWW8ImplReader::ImportDop() xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList())); } - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - if (rOpt.IsUseEnhancedFields()) + if (officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get()) m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, m_xWDop->fProtEnabled ); if (m_xWDop->iGutterPos) diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index d0a294b14450..17370bfad8b6 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -69,10 +69,10 @@ #include "ww8par2.hxx" #include <IMark.hxx> -#include <unotools/fltrcfg.hxx> #include <rtl/character.hxx> #include <xmloff/odffields.hxx> #include <comphelper/string.hxx> +#include <officecfg/Office/Common.hxx> using namespace com::sun::star; using namespace sw::util; @@ -110,8 +110,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) text. */ - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - const bool bUseEnhFields = rOpt.IsUseEnhancedFields(); + const bool bUseEnhFields = officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get(); if (!bUseEnhFields) { @@ -192,8 +191,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr ) if (rStr[pF->nLCode-1]==0x01) ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_CHECKBOX); - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - const bool bUseEnhFields = rOpt.IsUseEnhancedFields(); + const bool bUseEnhFields = officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get(); if (!bUseEnhFields) { @@ -248,8 +246,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) if (pF->nLCode > 0 && rStr.getLength() >= pF->nLCode && rStr[pF->nLCode-1] == 0x01) ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_DROPDOWN); - const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); - bool bUseEnhFields = rOpt.IsUseEnhancedFields(); + bool bUseEnhFields = officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get(); if (!bUseEnhFields) { diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index c87c33dde0e1..1995f7b49936 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -79,9 +79,9 @@ #include "writerhelper.hxx" #include <o3tl/safeint.hxx> #include <o3tl/string_view.hxx> -#include <unotools/fltrcfg.hxx> #include <xmloff/odffields.hxx> #include <osl/diagnose.h> +#include <officecfg/Office/Common.hxx> #include <algorithm> #include <string_view> @@ -525,8 +525,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() if (!pF || !pF->EndPosIsFieldEnd(nCP)) return nRet; - const SvtFilterOptions &rOpt = SvtFilterOptions::Get(); - bool bUseEnhFields = rOpt.IsUseEnhancedFields(); + bool bUseEnhFields = officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get(); OSL_ENSURE(!m_aFieldStack.empty(), "Empty field stack"); if (!m_aFieldStack.empty()) diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 1cddf3070bfe..45047e701d56 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -19,7 +19,10 @@ #include <config_features.h> +#include <officecfg/Office/Calc.hxx> #include <officecfg/Office/Common.hxx> +#include <officecfg/Office/Impress.hxx> +#include <officecfg/Office/Writer.hxx> #include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> @@ -78,7 +81,6 @@ #include <cmdid.h> #include <strings.hrc> -#include <unotools/fltrcfg.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objface.hxx> @@ -304,7 +306,7 @@ bool SwDocShell::Save() { if (m_xDoc->ContainsMSVBasic()) { - if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) + if (officecfg::Office::Writer::Filter::Import::VBA::Save::get()) nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) ); m_xDoc->SetContainsMSVBasic( false ); } @@ -501,7 +503,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) if (m_xDoc->ContainsMSVBasic()) { - if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) + if (officecfg::Office::Writer::Filter::Import::VBA::Save::get()) nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) ); m_xDoc->SetContainsMSVBasic( false ); } @@ -606,7 +608,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if (m_xDoc->ContainsMSVBasic()) { bool bSave = pFlt->GetUserData() == "CWW8" - && SvtFilterOptions::Get().IsLoadWordBasicStorage(); + && officecfg::Office::Writer::Filter::Import::VBA::Save::get(); if ( bSave ) { diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index 14ef6e843ab6..14ba5240eaa2 100644 --- a/unotools/Library_utl.mk +++ b/unotools/Library_utl.mk @@ -70,7 +70,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\ unotools/source/config/docinfohelper \ unotools/source/config/dynamicmenuoptions \ unotools/source/config/eventcfg \ - unotools/source/config/fltrcfg \ unotools/source/config/fontcfg \ unotools/source/config/historyoptions \ unotools/source/config/itemholder1 \ diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx deleted file mode 100644 index 21a540e40409..000000000000 --- a/unotools/source/config/fltrcfg.cxx +++ /dev/null @@ -1,670 +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 <o3tl/any.hxx> -#include <o3tl/typed_flags_set.hxx> -#include <unotools/fltrcfg.hxx> -#include <tools/debug.hxx> -#include <osl/diagnose.h> - -#include <com/sun/star/uno/Sequence.hxx> - -using namespace utl; -using namespace com::sun::star::uno; - -namespace { - -enum class ConfigFlags { - NONE = 0x0000000, - WordCode = 0x0000001, - WordStorage = 0x0000002, - ExcelCode = 0x0000004, - ExcelStorage = 0x0000008, - PowerPointCode = 0x0000010, - PowerPointStorage = 0x0000020, - MathLoad = 0x0000100, - MathSave = 0x0000200, - WriterLoad = 0x0000400, - WriterSave = 0x0000800, - CalcLoad = 0x0001000, - CalcSave = 0x0002000, - ImpressLoad = 0x0004000, - ImpressSave = 0x0008000, - ExcelExecTbl = 0x0010000, - EnablePowerPointPreview = 0x0020000, - EnableExcelPreview = 0x0040000, - EnableWordPreview = 0x0080000, - UseEnhancedFields = 0x0100000, - WordWbctbl = 0x0200000, - SmartArtShapeLoad = 0x0400000, - CharBackgroundToHighlighting = 0x8000000, - CreateMSOLockFiles = 0x2000000, - VisioLoad = 0x4000000, -}; - -} - -namespace o3tl { - template<> struct typed_flags<ConfigFlags> : is_typed_flags<ConfigFlags, 0xe7fff3f> {}; -} - -namespace { - -class SvtAppFilterOptions_Impl : public utl::ConfigItem -{ -private: - bool bLoadVBA; - bool bSaveVBA; - -protected: - virtual void ImplCommit() override; - -public: - explicit SvtAppFilterOptions_Impl(const OUString& rRoot) : - utl::ConfigItem(rRoot), - bLoadVBA(false), - bSaveVBA(false) {} - virtual ~SvtAppFilterOptions_Impl() override; - virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; - void Load(); - - bool IsLoad() const {return bLoadVBA;} - void SetLoad(bool bSet) - { - if(bSet != bLoadVBA) - SetModified(); - bLoadVBA = bSet; - } - bool IsSave() const {return bSaveVBA;} - void SetSave(bool bSet) - { - if(bSet != bSaveVBA) - SetModified(); - bSaveVBA = bSet; - } -}; - -} - -SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() -{ - assert(!IsModified()); // should have been committed -} - -void SvtAppFilterOptions_Impl::ImplCommit() -{ - PutProperties( - {"Load", "Save"}, {css::uno::Any(bLoadVBA), css::uno::Any(bSaveVBA)}); -} - -void SvtAppFilterOptions_Impl::Notify( const Sequence< OUString >& ) -{ - // no listeners supported yet -} - -void SvtAppFilterOptions_Impl::Load() -{ - Sequence<Any> aValues = GetProperties({ "Load", "Save" }); - const Any* pValues = aValues.getConstArray(); - - if(pValues[0].hasValue()) - bLoadVBA = *o3tl::doAccess<bool>(pValues[0]); - if(pValues[1].hasValue()) - bSaveVBA = *o3tl::doAccess<bool>(pValues[1]); -} - -namespace { - -class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl -{ -private: - bool bLoadExecutable; - - virtual void ImplCommit() override; - -public: - explicit SvtWriterFilterOptions_Impl(const OUString& rRoot) : - SvtAppFilterOptions_Impl(rRoot), - bLoadExecutable(false) - {} - void Load(); - - bool IsLoadExecutable() const {return bLoadExecutable;} - void SetLoadExecutable(bool bSet) - { - if(bSet != bLoadExecutable) - SetModified(); - bLoadExecutable = bSet; - } -}; - -} - -void SvtWriterFilterOptions_Impl::ImplCommit() -{ - SvtAppFilterOptions_Impl::ImplCommit(); - - PutProperties({ "Executable" }, { Any(bLoadExecutable) }); -} - -void SvtWriterFilterOptions_Impl::Load() -{ - SvtAppFilterOptions_Impl::Load(); - - Sequence<OUString> aNames { "Executable" }; - - Sequence<Any> aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - if(pValues[0].hasValue()) - bLoadExecutable = *o3tl::doAccess<bool>(pValues[0]); -} - -namespace { - -class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl -{ -private: - bool bLoadExecutable; - - virtual void ImplCommit() override; - -public: - explicit SvtCalcFilterOptions_Impl(const OUString& rRoot) : - SvtAppFilterOptions_Impl(rRoot), - bLoadExecutable(false) - {} - void Load(); - - bool IsLoadExecutable() const {return bLoadExecutable;} - void SetLoadExecutable(bool bSet) - { - if(bSet != bLoadExecutable) - SetModified(); - bLoadExecutable = bSet; - } -}; - -} - -void SvtCalcFilterOptions_Impl::ImplCommit() -{ - SvtAppFilterOptions_Impl::ImplCommit(); - - PutProperties({ "Executable" }, { Any(bLoadExecutable) }); -} - -void SvtCalcFilterOptions_Impl::Load() -{ - SvtAppFilterOptions_Impl::Load(); - - Sequence<OUString> aNames { "Executable" }; - - Sequence<Any> aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - if(pValues[0].hasValue()) - bLoadExecutable = *o3tl::doAccess<bool>(pValues[0]); -} - -struct SvtFilterOptions_Impl -{ - ConfigFlags nFlags; - SvtWriterFilterOptions_Impl aWriterCfg; - SvtCalcFilterOptions_Impl aCalcCfg; - SvtAppFilterOptions_Impl aImpressCfg; - - SvtFilterOptions_Impl() : - aWriterCfg("Office.Writer/Filter/Import/VBA"), - aCalcCfg("Office.Calc/Filter/Import/VBA"), - aImpressCfg("Office.Impress/Filter/Import/VBA") - { - nFlags = ConfigFlags::WordCode | - ConfigFlags::WordStorage | - ConfigFlags::ExcelCode | - ConfigFlags::ExcelStorage | - ConfigFlags::PowerPointCode | - ConfigFlags::PowerPointStorage | - ConfigFlags::MathLoad | - ConfigFlags::MathSave | - ConfigFlags::WriterLoad | - ConfigFlags::WriterSave | - ConfigFlags::CalcLoad | - ConfigFlags::CalcSave | - ConfigFlags::ImpressLoad | - ConfigFlags::ImpressSave | - ConfigFlags::UseEnhancedFields | - ConfigFlags::SmartArtShapeLoad | - ConfigFlags::CharBackgroundToHighlighting| - ConfigFlags::CreateMSOLockFiles; - Load(); - } - - void SetFlag( ConfigFlags nFlag, bool bSet ); - bool IsFlag( ConfigFlags nFlag ) const; - void Load() - { - aWriterCfg.Load(); - aCalcCfg.Load(); - aImpressCfg.Load(); - } -}; - -void SvtFilterOptions_Impl::SetFlag( ConfigFlags nFlag, bool bSet ) -{ - switch(nFlag) - { - case ConfigFlags::WordCode: aWriterCfg.SetLoad(bSet);break; - case ConfigFlags::WordStorage: aWriterCfg.SetSave(bSet);break; - case ConfigFlags::WordWbctbl: aWriterCfg.SetLoadExecutable(bSet);break; - case ConfigFlags::ExcelCode: aCalcCfg.SetLoad(bSet);break; - case ConfigFlags::ExcelStorage: aCalcCfg.SetSave(bSet);break; - case ConfigFlags::ExcelExecTbl: aCalcCfg.SetLoadExecutable(bSet);break; - case ConfigFlags::PowerPointCode: aImpressCfg.SetLoad(bSet);break; - case ConfigFlags::PowerPointStorage: aImpressCfg.SetSave(bSet);break; - default: - if( bSet ) - nFlags |= nFlag; - else - nFlags &= ~nFlag; - } -} - -bool SvtFilterOptions_Impl::IsFlag( ConfigFlags nFlag ) const -{ - bool bRet; - switch(nFlag) - { - case ConfigFlags::WordCode : bRet = aWriterCfg.IsLoad();break; - case ConfigFlags::WordStorage : bRet = aWriterCfg.IsSave();break; - case ConfigFlags::WordWbctbl : bRet = aWriterCfg.IsLoadExecutable();break; - case ConfigFlags::ExcelCode : bRet = aCalcCfg.IsLoad();break; - case ConfigFlags::ExcelStorage : bRet = aCalcCfg.IsSave();break; - case ConfigFlags::ExcelExecTbl : bRet = aCalcCfg.IsLoadExecutable();break; - case ConfigFlags::PowerPointCode : bRet = aImpressCfg.IsLoad();break; - case ConfigFlags::PowerPointStorage : bRet = aImpressCfg.IsSave();break; - default: - bRet = bool(nFlags & nFlag ); - } - return bRet; -} - -namespace { - -const Sequence<OUString>& GetPropertyNames() -{ - static Sequence<OUString> const aNames - { - "Import/MathTypeToMath", // 0 - "Import/WinWordToWriter", // 1 - "Import/PowerPointToImpress", // 2 - "Import/ExcelToCalc", // 3 - "Export/MathToMathType", // 4 - "Export/WriterToWinWord", // 5 - "Export/ImpressToPowerPoint", // 6 - "Export/CalcToExcel", // 7 - "Export/EnablePowerPointPreview", // 8 - "Export/EnableExcelPreview", // 9 - "Export/EnableWordPreview", // 10 - "Import/ImportWWFieldsAsEnhancedFields", // 11 - "Import/SmartArtToShapes", // 12 - "Export/CharBackgroundToHighlighting", // 13 - "Import/CreateMSOLockFiles", // 14 - "Import/VisioToDraw" // 15 - }; - return aNames; -} - -} - -SvtFilterOptions::SvtFilterOptions() : - ConfigItem( "Office.Common/Filter/Microsoft" ), - pImpl(new SvtFilterOptions_Impl) -{ - EnableNotification(GetPropertyNames()); - Load(); -} - -SvtFilterOptions::~SvtFilterOptions() -{ -} - -static ConfigFlags lcl_GetFlag(sal_Int32 nProp) -{ - ConfigFlags nFlag = ConfigFlags::NONE; - switch(nProp) - { - case 0: nFlag = ConfigFlags::MathLoad; break; - case 1: nFlag = ConfigFlags::WriterLoad; break; - case 2: nFlag = ConfigFlags::ImpressLoad; break; - case 3: nFlag = ConfigFlags::CalcLoad; break; - case 4: nFlag = ConfigFlags::MathSave; break; - case 5: nFlag = ConfigFlags::WriterSave; break; - case 6: nFlag = ConfigFlags::ImpressSave; break; - case 7: nFlag = ConfigFlags::CalcSave; break; - case 8: nFlag = ConfigFlags::EnablePowerPointPreview; break; - case 9: nFlag = ConfigFlags::EnableExcelPreview; break; - case 10: nFlag = ConfigFlags::EnableWordPreview; break; - case 11: nFlag = ConfigFlags::UseEnhancedFields; break; - case 12: nFlag = ConfigFlags::SmartArtShapeLoad; break; - case 13: nFlag = ConfigFlags::CharBackgroundToHighlighting; break; - case 14: nFlag = ConfigFlags::CreateMSOLockFiles; break; - case 15: - nFlag = ConfigFlags::VisioLoad; - break; - - default: OSL_FAIL("illegal value"); - } - return nFlag; -} - -void SvtFilterOptions::Notify( const Sequence<OUString>& ) -{ - Load(); -} - -void SvtFilterOptions::ImplCommit() -{ - const Sequence<OUString>& aNames = GetPropertyNames(); - Sequence<Any> aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - ConfigFlags nFlag = lcl_GetFlag(nProp); - pValues[nProp] <<= pImpl->IsFlag(nFlag); - - } - PutProperties(aNames, aValues); -} - -void SvtFilterOptions::Load() -{ - pImpl->Load(); - const Sequence<OUString>& rNames = GetPropertyNames(); - Sequence<Any> aValues = GetProperties(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()) - { - bool bVal = *o3tl::doAccess<bool>(pValues[nProp]); - ConfigFlags nFlag = lcl_GetFlag(nProp); - pImpl->SetFlag( nFlag, bVal); - } - } - } -} - -void SvtFilterOptions::SetLoadWordBasicCode( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::WordCode, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadWordBasicCode() const -{ - return pImpl->IsFlag( ConfigFlags::WordCode ); -} - -void SvtFilterOptions::SetLoadWordBasicExecutable( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::WordWbctbl, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadWordBasicExecutable() const -{ - return pImpl->IsFlag( ConfigFlags::WordWbctbl ); -} - -void SvtFilterOptions::SetLoadWordBasicStorage( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::WordStorage, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadWordBasicStorage() const -{ - return pImpl->IsFlag( ConfigFlags::WordStorage ); -} - -void SvtFilterOptions::SetLoadExcelBasicCode( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::ExcelCode, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadExcelBasicCode() const -{ - return pImpl->IsFlag( ConfigFlags::ExcelCode ); -} - -void SvtFilterOptions::SetLoadExcelBasicExecutable( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::ExcelExecTbl, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadExcelBasicExecutable() const -{ - return pImpl->IsFlag( ConfigFlags::ExcelExecTbl ); -} - -void SvtFilterOptions::SetLoadExcelBasicStorage( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::ExcelStorage, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadExcelBasicStorage() const -{ - return pImpl->IsFlag( ConfigFlags::ExcelStorage ); -} - -void SvtFilterOptions::SetLoadPPointBasicCode( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::PowerPointCode, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadPPointBasicCode() const -{ - return pImpl->IsFlag( ConfigFlags::PowerPointCode ); -} - -void SvtFilterOptions::SetLoadPPointBasicStorage( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::PowerPointStorage, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsLoadPPointBasicStorage() const -{ - return pImpl->IsFlag( ConfigFlags::PowerPointStorage ); -} - -bool SvtFilterOptions::IsMathType2Math() const -{ - return pImpl->IsFlag( ConfigFlags::MathLoad ); -} - -void SvtFilterOptions::SetMathType2Math( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::MathLoad, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsMath2MathType() const -{ - return pImpl->IsFlag( ConfigFlags::MathSave ); -} - -void SvtFilterOptions::SetMath2MathType( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::MathSave, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsWinWord2Writer() const -{ - return pImpl->IsFlag( ConfigFlags::WriterLoad ); -} - -void SvtFilterOptions::SetWinWord2Writer( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::WriterLoad, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsWriter2WinWord() const -{ - return pImpl->IsFlag( ConfigFlags::WriterSave ); -} - -void SvtFilterOptions::SetWriter2WinWord( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::WriterSave, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsUseEnhancedFields() const -{ - return pImpl->IsFlag( ConfigFlags::UseEnhancedFields ); -} - -bool SvtFilterOptions::IsExcel2Calc() const -{ - return pImpl->IsFlag( ConfigFlags::CalcLoad ); -} - -void SvtFilterOptions::SetExcel2Calc( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::CalcLoad, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsCalc2Excel() const -{ - return pImpl->IsFlag( ConfigFlags::CalcSave ); -} - -void SvtFilterOptions::SetCalc2Excel( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::CalcSave, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsPowerPoint2Impress() const -{ - return pImpl->IsFlag( ConfigFlags::ImpressLoad ); -} - -void SvtFilterOptions::SetPowerPoint2Impress( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::ImpressLoad, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsImpress2PowerPoint() const -{ - return pImpl->IsFlag( ConfigFlags::ImpressSave ); -} - -void SvtFilterOptions::SetImpress2PowerPoint( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::ImpressSave, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsSmartArt2Shape() const -{ - return pImpl->IsFlag( ConfigFlags::SmartArtShapeLoad ); -} - -void SvtFilterOptions::SetSmartArt2Shape( bool bFlag ) -{ - pImpl->SetFlag( ConfigFlags::SmartArtShapeLoad, bFlag ); - SetModified(); -} - -bool SvtFilterOptions::IsVisio2Draw() const { return pImpl->IsFlag(ConfigFlags::VisioLoad); } - -void SvtFilterOptions::SetVisio2Draw(bool bFlag) -{ - pImpl->SetFlag(ConfigFlags::VisioLoad, bFlag); - SetModified(); -} - -SvtFilterOptions& SvtFilterOptions::Get() -{ - static SvtFilterOptions aOptions; - return aOptions; -} - -bool SvtFilterOptions::IsEnablePPTPreview() const -{ - return pImpl->IsFlag( ConfigFlags::EnablePowerPointPreview ); -} - -bool SvtFilterOptions::IsEnableCalcPreview() const -{ - return pImpl->IsFlag( ConfigFlags::EnableExcelPreview ); -} - -bool SvtFilterOptions::IsEnableWordPreview() const -{ - return pImpl->IsFlag( ConfigFlags::EnableWordPreview ); -} - -bool SvtFilterOptions::IsCharBackground2Highlighting() const -{ - return pImpl->IsFlag( ConfigFlags::CharBackgroundToHighlighting ); -} - -bool SvtFilterOptions::IsCharBackground2Shading() const -{ - return !pImpl->IsFlag( ConfigFlags::CharBackgroundToHighlighting ); -} - -void SvtFilterOptions::SetCharBackground2Highlighting() -{ - pImpl->SetFlag( ConfigFlags::CharBackgroundToHighlighting, true ); - SetModified(); -} - -void SvtFilterOptions::SetCharBackground2Shading() -{ - pImpl->SetFlag( ConfigFlags::CharBackgroundToHighlighting, false ); - SetModified(); -} - -bool SvtFilterOptions::IsMSOLockFileCreationIsEnabled() const -{ - return pImpl->IsFlag( ConfigFlags::CreateMSOLockFiles ); -} - -void SvtFilterOptions::EnableMSOLockFileCreation(bool bEnable) -{ - pImpl->SetFlag( ConfigFlags::CreateMSOLockFiles, bEnable ); - SetModified(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |