officecfg/registry/schema/org/openoffice/Office/Writer.xcs | 7 ++ sw/source/core/doc/tblrwcl.cxx | 15 +++++- sw/source/core/docnode/ndtbl.cxx | 32 +++++++++---- sw/source/core/undo/untbl.cxx | 8 ++- 4 files changed, 51 insertions(+), 11 deletions(-)
New commits: commit cee20c94bbbf39dbd9ae407c4d3ce225288332ed Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jul 18 18:31:19 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Jul 24 08:38:15 2024 +0200 (related tdf#126008) sw: add config to disable table autoformat ... ... automatic updates when editing the table. Office::Writer::Table::Change::ApplyTableAutoFormat Change-Id: I84667c68c9372d7594bb3a688da80495ef46168f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170702 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 27198ec7031e9ef3bbc592423e5c12e333e206ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170746 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 2bd5995a1e5d..e27b53e20bf1 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -1987,6 +1987,13 @@ </constraints> <value>2</value> </prop> + <prop oor:name="ApplyTableAutoFormat" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Determines if editing a table causes the table's AutoFormat to be applied automatically to update the formatting of the table and its contents.</desc> + <label>Apply table AutoFormat automatically when table is edited.</label> + </info> + <value>true</value> + </prop> </group> <group oor:name="Input"> <info> diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index ef4b023d4fee..adaa9279003e 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -19,6 +19,7 @@ #include <memory> #include <com/sun/star/text/HoriOrientation.hpp> +#include <officecfg/Office/Writer.hxx> #include <osl/diagnose.h> #include <svl/numformat.hxx> #include <hintids.hxx> @@ -508,7 +509,12 @@ bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, rDoc.UpdateCharts( GetFrameFormat()->GetName() ); if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(); + } + } return bRes; } @@ -630,7 +636,12 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, pDoc->UpdateCharts( GetFrameFormat()->GetName() ); if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(pTableNd); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(pTableNd); + } + } return true; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 8c9490fbf4e7..ce89049c862d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -89,6 +89,7 @@ #include <calbck.hxx> #include <fntcache.hxx> #include <frameformats.hxx> +#include <officecfg/Office/Writer.hxx> #include <o3tl/numeric.hxx> #include <o3tl/string_view.hxx> #include <svl/numformat.hxx> @@ -2120,9 +2121,6 @@ void SwDoc::DelTable(SwTableNode *const pTableNd) getIDocumentContentOperations().DeleteSection( pTableNd ); } - if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(); - getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } @@ -2194,7 +2192,12 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) if (bRet) { if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(); + } + } getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -2257,7 +2260,12 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, if (bRet) { if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(); + } + } getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -3286,8 +3294,11 @@ void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM // update table style formatting of both the tables if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) { - pFEShell->UpdateTableStyleFormatting(pTNd); - pFEShell->UpdateTableStyleFormatting(pNew); + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(pTNd); + pFEShell->UpdateTableStyleFormatting(pNew); + } } getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -3561,7 +3572,12 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool bWithPrev ) if( bRet ) { if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(); + } + } getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 52157df0cae1..569390d006c6 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -62,6 +62,7 @@ #include <calbck.hxx> #include <frameformats.hxx> #include <editeng/formatbreakitem.hxx> +#include <officecfg/Office/Writer.hxx> #include <osl/diagnose.h> #include <docsh.hxx> @@ -1784,7 +1785,12 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) // TL_CHART2: need to inform chart of probably changed cell names rDoc.UpdateCharts( pTableNd->GetTable().GetFrameFormat()->GetName() ); if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) - pFEShell->UpdateTableStyleFormatting(pTableNd); + { + if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) + { + pFEShell->UpdateTableStyleFormatting(pTableNd); + } + } if( IsDelBox() ) m_nSttNode = pTableNd->GetIndex(); ClearFEShellTabCols(rDoc, nullptr);