sw/inc/swmodule.hxx | 2 +- sw/source/core/unocore/unotbl.cxx | 9 +++++---- sw/source/ui/dbui/dbinsdlg.cxx | 8 ++++---- sw/source/uibase/shells/basesh.cxx | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-)
New commits: commit 595b1ceed9739dc3a8f1be55eb121b8bd22332fc Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri May 30 13:17:51 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Jun 10 13:20:14 2025 +0200 only read-only access to AutoFormatTable needed for these cases. Change-Id: Ie2d7423fee72e993b05d855aa4d56c5514ba626a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186055 Tested-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index a43d6d616225..78be7d1a45f8 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -255,7 +255,7 @@ 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(); + SW_DLLPUBLIC const SwTableAutoFormatTable& GetAutoFormatTable(); void InvalidateAutoFormatTable();; // Access to SwModule diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 7b9832bf74c0..536a492d4aec 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -30,6 +30,7 @@ #include <tools/UnitConversion.hxx> #include <editeng/memberids.h> #include <float.h> +#include <swmodule.hxx> #include <swtypes.hxx> #include <cmdid.h> #include <unocoll.hxx> @@ -2448,9 +2449,9 @@ void SwXTextTable::autoFormat(const OUString& sAutoFormatName) SolarMutexGuard aGuard; SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this); SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), this); - SwTableAutoFormatTable aAutoFormatTable; - for (size_t i = aAutoFormatTable.size(); i;) - if( sAutoFormatName == aAutoFormatTable[ --i ].GetName() ) + const SwTableAutoFormatTable& rAutoFormatTable = SwModule::get()->GetAutoFormatTable(); + for (size_t i = rAutoFormatTable.size(); i;) + if( sAutoFormatName == rAutoFormatTable[ --i ].GetName() ) { SwSelBoxes aBoxes; const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes(); @@ -2460,7 +2461,7 @@ void SwXTextTable::autoFormat(const OUString& sAutoFormatName) aBoxes.insert( pBox ); } UnoActionContext aContext( pFormat->GetDoc() ); - pFormat->GetDoc()->SetTableAutoFormat( aBoxes, aAutoFormatTable[i] ); + pFormat->GetDoc()->SetTableAutoFormat( aBoxes, rAutoFormatTable[i] ); break; } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 305ba447d8ca..4af1f7fae994 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1707,11 +1707,11 @@ void SwInsertDBColAutoPilot::Load() if( !sTmp.isEmpty() ) { // then load the AutoFormat file and look for Autoformat first - SwTableAutoFormatTable aAutoFormatTable; - for( size_t nAutoFormat = aAutoFormatTable.size(); nAutoFormat; ) - if( sTmp == aAutoFormatTable[ --nAutoFormat ].GetName() ) + const SwTableAutoFormatTable& rAutoFormatTable = SwModule::get()->GetAutoFormatTable(); + for( size_t nAutoFormat = rAutoFormatTable.size(); nAutoFormat; ) + if( sTmp == rAutoFormatTable[ --nAutoFormat ].GetName() ) { - m_xTAutoFormat.reset(new SwTableAutoFormat(aAutoFormatTable[nAutoFormat])); + m_xTAutoFormat.reset(new SwTableAutoFormat(rAutoFormatTable[nAutoFormat])); break; } } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 1451dc5c8716..a411363b18ca 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -3168,12 +3168,12 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) aAutoNameIn = pAuto->GetValue(); if ( !aAutoNameIn.isEmpty() ) { - SwTableAutoFormatTable aTableTable; - for ( size_t n=0; n<aTableTable.size(); n++ ) + const SwTableAutoFormatTable& rTableTable = SwModule::get()->GetAutoFormatTable(); + for (size_t n = 0; n < rTableTable.size(); ++n) { - if ( aTableTable[n].GetName() == aAutoNameIn ) + if (rTableTable[n].GetName() == aAutoNameIn) { - pTAFormatIn.reset(new SwTableAutoFormat( aTableTable[n] )); + pTAFormatIn.reset(new SwTableAutoFormat(rTableTable[n])); break; } }