summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2017-10-31 15:48:07 -0800
committerYousuf Philips <philipz85@hotmail.com>2017-12-27 15:27:50 +0100
commit203b913155812706e9be14c5fe2b8f543cc4fdc7 (patch)
treee2233e80cbc67d0bf834d4eb716ff935cebe6d08
parent023949fac0043408ac1b86dc67732666d041875e (diff)
tdf#107555 Apply 'Default Style' table style to newly inserted tables
Change-Id: Iac32542bdefc32b07c63cc41cf0f693cc2ca799d Reviewed-on: https://gerrit.libreoffice.org/44147 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 416f7578d6332b5b5a4445f26307d73925188e41) Reviewed-on: https://gerrit.libreoffice.org/46842 Reviewed-by: Yousuf Philips <philipz85@hotmail.com>
-rw-r--r--sw/source/ui/table/tautofmt.cxx20
-rw-r--r--sw/source/uibase/shells/basesh.cxx9
2 files changed, 21 insertions, 8 deletions
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index a4e9080be0ed..7c2a2d66e602 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);
}