sw/inc/swmodule.hxx | 6 ++++++ sw/source/core/doc/tblafmt.cxx | 6 +++++- sw/source/uibase/app/swmodule.cxx | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
New commits: commit 905342d5100f801f95a6d560197d6d1c32452c81 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri May 30 20:06:17 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jun 6 16:51:34 2025 +0200 store default TableAutoFormatTable in SwModule throw this away if there is a TableAutoFormatTable save so the next use is updated to the current saved table. Change-Id: I647dc73495f5865f5c1b151f02f9913c23ccefc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186054 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index e89dee1ba0cb..a43d6d616225 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -71,6 +71,7 @@ namespace com::sun::star::linguistic2 { class XLanguageGuessing; } namespace com::sun::star::linguistic2 { class XLinguServiceEventListener; } namespace ooo::vba { class XSinkCaller; } class SwLinguServiceEventListener; +class SwTableAutoFormatTable; class SAL_DLLPUBLIC_RTTI SwModule final : public SfxModule, public SfxListener, public utl::ConfigurationListener { @@ -94,6 +95,8 @@ class SAL_DLLPUBLIC_RTTI SwModule final : public SfxModule, public SfxListener, std::unique_ptr<SfxErrorHandler> m_pErrorHandler; + std::unique_ptr<SwTableAutoFormatTable> m_xTableAutoFormatTable; + rtl::Reference<SwAttrPool> m_pAttrPool; // Current view is held here in order to avoid one's being forced @@ -252,6 +255,9 @@ public: SW_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); + const SwTableAutoFormatTable& GetAutoFormatTable(); + void InvalidateAutoFormatTable();; + // Access to SwModule static auto get() { return static_cast<SwModule*>(SfxApplication::GetModule(SfxToolsModule::Writer)); } }; diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 0e677c413dea..b8511e6d415a 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -39,6 +39,7 @@ #include <editsh.hxx> #include <fmtlsplt.hxx> #include <fmtrowsplt.hxx> +#include <swmodule.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/thread.h> @@ -1084,7 +1085,10 @@ bool SwTableAutoFormatTable::Impl::Save() const SvtPathOptions aPathOpt; const OUString sNm( aPathOpt.GetUserConfigPath() + "/" + AUTOTABLE_FORMAT_NAME ); SfxMedium aStream(sNm, StreamMode::STD_WRITE ); - return Save( *aStream.GetOutStream() ) && aStream.Commit(); + bool bRes = Save( *aStream.GetOutStream() ) && aStream.Commit(); + // Drop now out of date default auto format table instance + SwModule::get()->InvalidateAutoFormatTable(); + return bRes; } bool SwTableAutoFormatTable::Impl::Load( SvStream& rStream ) diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index ef814781bdd8..43d2b02bd991 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -55,6 +55,7 @@ #include <srcview.hxx> #include <glshell.hxx> #include <tabsh.hxx> +#include <tblafmt.hxx> #include <listsh.hxx> #include <grfsh.hxx> #include <mediash.hxx> @@ -398,4 +399,16 @@ void SwModule::CallAutomationApplicationEventSinks(const OUString& Method, css:: mxAutomationApplicationEventsCaller->CallSinks(Method, Arguments); } +const SwTableAutoFormatTable& SwModule::GetAutoFormatTable() +{ + if (!m_xTableAutoFormatTable) + m_xTableAutoFormatTable = std::make_unique<SwTableAutoFormatTable>(); + return *m_xTableAutoFormatTable; +} + +void SwModule::InvalidateAutoFormatTable() +{ + m_xTableAutoFormatTable.reset(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */