tdf#123516 Speed up insert of large tables with auto format table style

This patch replaces SwFEShell::SetTableStyle use to resolve tdf#108227
with SwTable::SetTableStyleName. The gain in insert speed is a result of
eliminating SwFEShell::SetTableStyle call to the time consuming
SwFEShell::UpdateTableStyleFormatting function which is somewhat
redundant when inserting a table.

Change-Id: Ide1e003d9709a6758e021b52fcf9e40a7b0fcba0
Reviewed-on: https://gerrit.libreoffice.org/68372
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index e78e91f..fa22a93 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -111,6 +111,7 @@

#include <SwStyleNameMapper.hxx>
#include <poolfmt.hxx>
#include <shellres.hxx>

FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;

@@ -2695,8 +2696,14 @@
                if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
                    rSh.GetTableFormat()->SetName( aTableName );

                if( pTAFormat != nullptr && aAutoName != SwStyleNameMapper::GetUIName( RES_POOLTABSTYLE_DEFAULT, OUString() ) )
                    rSh.SetTableStyle( aAutoName );
                if( pTAFormat != nullptr && !aAutoName.isEmpty()
                        && aAutoName != SwStyleNameMapper::GetUIName( RES_POOLTABSTYLE_DEFAULT, OUString() )
                        && aAutoName != SwViewShell::GetShellRes()->aStrNone )
                {
                    SwTableNode* pTableNode = const_cast<SwTableNode*>( rSh.IsCursorInTable() );
                    if ( pTableNode )
                        pTableNode->GetTable().SetTableStyleName( aAutoName );
                }

                rSh.EndAllAction();
                rTempView.AutoCaption(TABLE_CAP);