Kaydet (Commit) 416f7578 authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Miklos Vajna

tdf#107555 Apply 'Default Style' table style to newly inserted tables

Change-Id: Iac32542bdefc32b07c63cc41cf0f693cc2ca799d
Reviewed-on: https://gerrit.libreoffice.org/44147Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 226804c8
...@@ -262,6 +262,16 @@ void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFormat& rFormat, bool bEnab ...@@ -262,6 +262,16 @@ void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFormat& rFormat, bool bEnab
m_pBtnAlignment->Check( rFormat.IsJustify() ); 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 void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) const
{ {
if( 255 != nIndex ) if( 255 != nIndex )
...@@ -274,7 +284,8 @@ void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) const ...@@ -274,7 +284,8 @@ void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) const
else else
{ {
delete rToFill; 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) ...@@ -482,12 +493,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFormatHdl, ListBox&, void)
nIndex = 255; nIndex = 255;
SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone ); SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone );
aTmp.SetFont( false ); lcl_SetProperties( &aTmp, false );
aTmp.SetJustify( false );
aTmp.SetFrame( false );
aTmp.SetBackground( false );
aTmp.SetValueFormat( false );
aTmp.SetWidthHeight( false );
if( nOldIdx != nIndex ) if( nOldIdx != nIndex )
m_pWndPreview->NotifyChange( aTmp ); m_pWndPreview->NotifyChange( aTmp );
......
...@@ -107,6 +107,10 @@ ...@@ -107,6 +107,10 @@
#include <svx/unobrushitemhelper.hxx> #include <svx/unobrushitemhelper.hxx>
#include <comphelper/scopeguard.hxx> #include <comphelper/scopeguard.hxx>
#include <SwStyleNameMapper.hxx>
#include <poolfmt.hxx>
#include <shellres.hxx>
FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END; FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
// These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH) // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH)
...@@ -2684,7 +2688,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) ...@@ -2684,7 +2688,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
{ {
// record before shell change // record before shell change
_rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) ); _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( SfxStringItem( FN_PARAM_2, aAutoName ) );
_rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) ); _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) );
_rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) ); _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) );
...@@ -2704,6 +2708,9 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) ...@@ -2704,6 +2708,9 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) ) if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
rSh.GetTableFormat()->SetName( aTableName ); rSh.GetTableFormat()->SetName( aTableName );
if( pTAFormat == nullptr )
rSh.SetTableStyle( SwStyleNameMapper::GetUIName( RES_POOLTABSTYLE_DEFAULT, OUString() ) );
rSh.EndAllAction(); rSh.EndAllAction();
rTempView.AutoCaption(TABLE_CAP); rTempView.AutoCaption(TABLE_CAP);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment