sw/inc/tblafmt.hxx | 4 ---- sw/qa/core/uwriter.cxx | 6 ------ sw/source/core/doc/tblafmt.cxx | 30 ++++++++++++++++++++++-------- sw/source/core/docnode/ndtbl.cxx | 3 --- sw/source/core/unocore/unotbl.cxx | 1 - sw/source/ui/dbui/dbinsdlg.cxx | 1 - sw/source/ui/table/convert.cxx | 1 - sw/source/ui/table/instable.cxx | 1 - sw/source/ui/table/tautofmt.cxx | 1 - sw/source/uibase/shells/basesh.cxx | 2 -- 10 files changed, 22 insertions(+), 28 deletions(-)
New commits: commit a1cebda1e9d15610718510cc197ca98a27537861 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri May 30 12:12:36 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat May 31 22:21:02 2025 +0200 move Load/Save bodies to SwTableAutoFormatTable::Impl Change-Id: I6f9fdfdcacc91a786857d997748069830e92d222 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186040 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 17a27eb923bc..dfb9b3af1022 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -275,10 +275,6 @@ class SW_DLLPUBLIC SwTableAutoFormatTable struct Impl; std::unique_ptr<Impl> m_pImpl; - SAL_DLLPRIVATE bool Load( SvStream& rStream ); - SAL_DLLPRIVATE bool Save( SvStream& rStream ) const; - - void Load(); public: explicit SwTableAutoFormatTable(); ~SwTableAutoFormatTable(); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 19c79cd22fa8..73314685d387 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -927,6 +927,13 @@ void SwTableAutoFormat::SetXObject(rtl::Reference<SwXTextTableStyle> const& xObj struct SwTableAutoFormatTable::Impl { std::vector<std::unique_ptr<SwTableAutoFormat>> m_AutoFormats; + + void Load(); + bool Save() const; + +private: + SAL_DLLPRIVATE bool Load(SvStream& rStream); + SAL_DLLPRIVATE bool Save(SvStream& rStream) const; }; size_t SwTableAutoFormatTable::size() const @@ -1036,10 +1043,15 @@ SwTableAutoFormatTable::SwTableAutoFormatTable() pNew->SetUserDefined(false); m_pImpl->m_AutoFormats.push_back(std::move(pNew)); - Load(); + m_pImpl->Load(); } -void SwTableAutoFormatTable::Load() +bool SwTableAutoFormatTable::Save() const +{ + return m_pImpl->Save(); +} + +void SwTableAutoFormatTable::Impl::Load() { if (comphelper::IsFuzzing()) return; @@ -1052,7 +1064,7 @@ void SwTableAutoFormatTable::Load() } } -bool SwTableAutoFormatTable::Save() const +bool SwTableAutoFormatTable::Impl::Save() const { if (comphelper::IsFuzzing()) return false; @@ -1062,7 +1074,7 @@ bool SwTableAutoFormatTable::Save() const return Save( *aStream.GetOutStream() ) && aStream.Commit(); } -bool SwTableAutoFormatTable::Load( SvStream& rStream ) +bool SwTableAutoFormatTable::Impl::Load( SvStream& rStream ) { bool bRet = ERRCODE_NONE == rStream.GetError(); if (bRet) @@ -1122,7 +1134,7 @@ bool SwTableAutoFormatTable::Load( SvStream& rStream ) bRet = pNew->Load( rStream, aVersions ); if( bRet ) { - m_pImpl->m_AutoFormats.push_back(std::move(pNew)); + m_AutoFormats.push_back(std::move(pNew)); } else { @@ -1140,7 +1152,7 @@ bool SwTableAutoFormatTable::Load( SvStream& rStream ) return bRet; } -bool SwTableAutoFormatTable::Save( SvStream& rStream ) const +bool SwTableAutoFormatTable::Impl::Save( SvStream& rStream ) const { bool bRet = ERRCODE_NONE == rStream.GetError(); if (bRet) @@ -1159,12 +1171,12 @@ bool SwTableAutoFormatTable::Save( SvStream& rStream ) const // Write this version number for all attributes SwAfVersions::Write(rStream, AUTOFORMAT_FILE_VERSION); - rStream.WriteUInt16( m_pImpl->m_AutoFormats.size() - 1 ); + rStream.WriteUInt16( m_AutoFormats.size() - 1 ); bRet = ERRCODE_NONE == rStream.GetError(); - for (size_t i = 1; bRet && i < m_pImpl->m_AutoFormats.size(); ++i) + for (size_t i = 1; bRet && i < m_AutoFormats.size(); ++i) { - SwTableAutoFormat const& rFormat = *m_pImpl->m_AutoFormats[i]; + SwTableAutoFormat const& rFormat = *m_AutoFormats[i]; bRet = rFormat.Save(rStream, AUTOFORMAT_FILE_VERSION); } } commit 375b9d26bbbdfa099004aed37b9333fcdfc54877 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri May 30 11:45:20 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat May 31 22:20:53 2025 +0200 SwTableAutoFormatTable ctor is always followed by Load so call that from the ctor Change-Id: Ic071be84cedb8b131339030d294bbf4690902ac8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186036 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 43f8248a0cfc..17a27eb923bc 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -278,6 +278,7 @@ class SW_DLLPUBLIC SwTableAutoFormatTable SAL_DLLPRIVATE bool Load( SvStream& rStream ); SAL_DLLPRIVATE bool Save( SvStream& rStream ) const; + void Load(); public: explicit SwTableAutoFormatTable(); ~SwTableAutoFormatTable(); @@ -299,7 +300,6 @@ public: /// Find table style with the provided name, return nullptr when not found. SwTableAutoFormat* FindAutoFormat(const TableStyleName& rName) const; - void Load(); bool Save() const; }; diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index dcd5b6a70091..8314aec68fc7 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1244,12 +1244,6 @@ void SwDocTest::testTableAutoFormats() //create new AutoFormatTable SwTableAutoFormatTable aLoadTAFT; - //check the style size - CPPUNIT_ASSERT_EQUAL( size_t(1), aLoadTAFT.size() ); - - //load the saved styles - aLoadTAFT.Load(); - //check the style size after load CPPUNIT_ASSERT_EQUAL( size_t(2), aLoadTAFT.size() ); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index d7e713b012d3..19c79cd22fa8 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -1035,6 +1035,8 @@ SwTableAutoFormatTable::SwTableAutoFormatTable() pNew->SetUserDefined(false); m_pImpl->m_AutoFormats.push_back(std::move(pNew)); + + Load(); } void SwTableAutoFormatTable::Load() diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index c561c7475190..316438884c4b 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -3961,10 +3961,7 @@ bool SwDoc::GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGe SwTableAutoFormatTable& SwDoc::GetTableStyles() { if (!m_pTableStyles) - { m_pTableStyles.reset(new SwTableAutoFormatTable); - m_pTableStyles->Load(); - } return *m_pTableStyles; } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 0e57d3dbf622..f59233add44e 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2452,7 +2452,6 @@ void SwXTextTable::autoFormat(const OUString& sAutoFormatName) SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this); SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), this); SwTableAutoFormatTable aAutoFormatTable; - aAutoFormatTable.Load(); for (size_t i = aAutoFormatTable.size(); i;) if( sAutoFormatName == aAutoFormatTable[ --i ].GetName() ) { diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index ea5dc8b48dab..672943a24a5a 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1709,7 +1709,6 @@ void SwInsertDBColAutoPilot::Load() { // then load the AutoFormat file and look for Autoformat first SwTableAutoFormatTable aAutoFormatTable; - aAutoFormatTable.Load(); for( size_t nAutoFormat = aAutoFormatTable.size(); nAutoFormat; ) if( sTmp == aAutoFormatTable[ --nAutoFormat ].GetName() ) { diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index 47aac327673e..7e348f88e3c4 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -117,7 +117,6 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable) , m_xWndPreview(new weld::CustomWeld(*m_xBuilder, u"preview"_ustr, m_aWndPreview)) { m_aWndPreview.DetectRTL(&rView.GetWrtShell()); - m_xTableTable->Load(); const int nWidth = m_xLbFormat->get_approximate_digit_width() * 32; const int nHeight = m_xLbFormat->get_height_rows(8); diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 9a714659d373..35e6eb41203f 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -132,7 +132,6 @@ void SwInsTableDlg::InitAutoTableFormat() m_xLbFormat->connect_selection_changed(LINK(this, SwInsTableDlg, SelFormatHdl)); m_xTableTable.reset(new SwTableAutoFormatTable); - m_xTableTable->Load(); // Add "- none -" style autoformat table. m_xLbFormat->append_text(SwViewShell::GetShellRes()->aStrNone); // Insert to listbox diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index da5ce09f3657..f0714867fb44 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -80,7 +80,6 @@ SwAutoFormatDlg::SwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pWrtShell, b , m_xWndPreview(new weld::CustomWeld(*m_xBuilder, u"preview"_ustr, m_aWndPreview)) { m_aWndPreview.DetectRTL(pWrtShell); - m_xTableTable->Load(); const int nWidth = m_xLbFormat->get_approximate_digit_width() * 32; const int nHeight = m_xLbFormat->get_height_rows(8); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 4a378a02d337..c20aa3da634d 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1171,7 +1171,6 @@ void SwBaseShell::Execute(SfxRequest &rReq) OUString sAutoFormat = static_cast< const SfxStringItem* >(pItem)->GetValue(); pAutoFormatTable.reset(new SwTableAutoFormatTable); - pAutoFormatTable->Load(); for( sal_uInt16 i = 0, nCount = pAutoFormatTable->size(); i < nCount; i++ ) { @@ -3210,7 +3209,6 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) if ( !aAutoNameIn.isEmpty() ) { SwTableAutoFormatTable aTableTable; - aTableTable.Load(); for ( size_t n=0; n<aTableTable.size(); n++ ) { if ( aTableTable[n].GetName() == aAutoNameIn )