sw/source/ui/table/tautofmt.cxx | 20 +++++++++++++------- sw/source/uibase/shells/basesh.cxx | 9 ++++++++- 2 files changed, 21 insertions(+), 8 deletions(-)
New commits: commit 416f7578d6332b5b5a4445f26307d73925188e41 Author: Jim Raykowski <rayk...@gmail.com> Date: Tue Oct 31 15:48:07 2017 -0800 tdf#107555 Apply 'Default Style' table style to newly inserted tables Change-Id: Iac32542bdefc32b07c63cc41cf0f693cc2ca799d Reviewed-on: https://gerrit.libreoffice.org/44147 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index e5b19273c717..bce5d4b06581 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -262,6 +262,16 @@ void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFormat& rFormat, bool bEnab m_pBtnAlignment->Check( rFormat.IsJustify() ); } +static void lcl_SetProperties( SwTableAutoFormat* pTableAutoFormat, bool bVal ) +{ + pTableAutoFormat->SetFont( bVal ); + pTableAutoFormat->SetJustify( bVal ); + pTableAutoFormat->SetFrame( bVal ); + pTableAutoFormat->SetBackground( bVal ); + pTableAutoFormat->SetValueFormat( bVal ); + pTableAutoFormat->SetWidthHeight( bVal ); +} + void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) const { if( 255 != nIndex ) @@ -274,7 +284,8 @@ void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) const else { delete rToFill; - rToFill = nullptr; + rToFill = new SwTableAutoFormat( SwViewShell::GetShellRes()->aStrNone ); + lcl_SetProperties( rToFill, false ); } } @@ -482,12 +493,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFormatHdl, ListBox&, void) nIndex = 255; SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone ); - aTmp.SetFont( false ); - aTmp.SetJustify( false ); - aTmp.SetFrame( false ); - aTmp.SetBackground( false ); - aTmp.SetValueFormat( false ); - aTmp.SetWidthHeight( false ); + lcl_SetProperties( &aTmp, false ); if( nOldIdx != nIndex ) m_pWndPreview->NotifyChange( aTmp ); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 58ee634b334b..9d907536b750 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -107,6 +107,10 @@ #include <svx/unobrushitemhelper.hxx> #include <comphelper/scopeguard.hxx> +#include <SwStyleNameMapper.hxx> +#include <poolfmt.hxx> +#include <shellres.hxx> + FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END; // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH) @@ -2684,7 +2688,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) { // record before shell change _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) ); - if ( !aAutoName.isEmpty() ) + if ( !aAutoName.isEmpty() && aAutoName != SwViewShell::GetShellRes()->aStrNone ) _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) ); _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) ); _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) ); @@ -2704,6 +2708,9 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) ) rSh.GetTableFormat()->SetName( aTableName ); + if( pTAFormat == nullptr ) + rSh.SetTableStyle( SwStyleNameMapper::GetUIName( RES_POOLTABSTYLE_DEFAULT, OUString() ) ); + rSh.EndAllAction(); rTempView.AutoCaption(TABLE_CAP); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits