[Libreoffice-commits] core.git: Branch 'feature/table-style' - 3 commits - sw/inc sw/source
Alex Ivan
alexnivan at yahoo.com
Mon Aug 5 08:02:29 PDT 2013
sw/inc/swtblfmt.hxx | 9 +++++----
sw/source/core/doc/swtblfmt.cxx | 30 ++++++++++++++++++++----------
sw/source/core/docnode/ndtbl.cxx | 9 +++------
3 files changed, 28 insertions(+), 20 deletions(-)
New commits:
commit b17dad3335476d9631d0f504876810efd7d929e7
Author: Alex Ivan <alexnivan at yahoo.com>
Date: Mon Aug 5 14:15:04 2013 +0300
Fix column width in TextToTable
Change-Id: Ibe6321e5c79a7b1081087b0ae7d24a22ca676c4c
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 1cf3585..614800d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -729,17 +729,14 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
for( sal_uInt16 i = 0; i < nCols; ++i )
{
SwTableBox* pBox = rBoxes[ i ];
- bool bChgSz = false;
sal_uInt8 nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
if( bUseBoxFmt )
::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId );
else
{
- bChgSz = 0 == (*aBoxFmtArr2)[ nId ];
pBoxF = new SwTableBoxFmt ( *::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId ) );
- if( bChgSz )
- pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
+ pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
pBox->ChgFrmFmt( pBoxF );
}
}
commit 873220ff9607f25e1b58073e881f7881a33e8f3c
Author: Alex Ivan <alexnivan at yahoo.com>
Date: Mon Aug 5 12:19:52 2013 +0300
Fix borders on insert table
Checking borders in Insert Table dialog will no longer
prevent the borders of the table style from being correctly
displayed.
Change-Id: Ie9fd2ca19e7ba6355e2de6b9f8d7c954ca3a9c76
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 8b117c5..1cf3585 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -442,7 +442,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
std::vector<SwTableBoxFmt*> aBoxFmtArr;
SwTableBoxFmt* pBoxFmt = 0;
- if( !bDfltBorders )
+ if( !bDfltBorders || pTAFmt )
{
pBoxFmt = MakeTableBoxFmt();
pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nCols, 0 ));
@@ -460,7 +460,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
for( sal_uInt16 i = 0; i < nCols; ++i )
{
SwTableBoxFmt *pBoxF;
- if( bDfltBorders )
+ if( !pTAFmt && bDfltBorders )
{
sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
pBoxF = new SwTableBoxFmt( *::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId) );
commit 59e9d983b8fe4ccb3b752a615ab8d291602447af
Author: Alex Ivan <alexnivan at yahoo.com>
Date: Mon Aug 5 11:54:04 2013 +0300
Some cleanup of the parent assigning
Change-Id: If7b0e0a06e6ffa3a1739be1422548ff0c6460b4f
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index e61a0bb..51c279a 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -121,11 +121,12 @@ public:
sal_Bool GetRowSplit() const;
sal_uInt16 GetRepeatHeading() const;
- static void RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &table );
- static SwTableFmt* StoreTableProperties( const SwTable &table );
+ static void RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &rTable );
+ static SwTableFmt* StoreTableProperties( const SwTable &rTable );
- static void AssignLineParents( SwTableFmt* pSrcFmt, SwTable &table );
- static void AssignBoxParents( SwTableLineFmt* pSrcLineFmt, SwTableLine &line );
+ static void AssignFormatParents( SwTableFmt* pSrcFmt, SwTable &rTable );
+ static void AssignLineParents( SwTableFmt* pSrcFmt, SwTable &rTable );
+ static void AssignBoxParents( SwTableLineFmt* pSrcLineFmt, SwTableLine &rLine );
static void AssignLineParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableBoxFmt* pSrcBoxFmt, SwTableBox& rBox );
static void AssignBoxParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableBoxFmt* pSrcBoxFmt, SwTableLine& rLine );
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 8c91b77..8a798f0 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -230,9 +230,9 @@ sal_uInt16 SwTableFmt::GetRepeatHeading() const
return 0;
}
-void SwTableFmt::RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &table )
+void SwTableFmt::RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &rTable )
{
- SwTableFmt *pHardFmt = table.GetTableFmt();
+ SwTableFmt *pHardFmt = rTable.GetTableFmt();
if( !pHardFmt )
return;
@@ -247,33 +247,43 @@ void SwTableFmt::RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &table )
if( pSrcFmt )
{
pHardFmt->RegisterToFormat( *pSrcFmt );
- pHardFmt->GetAttrSet().SetParent( &pSrcFmt->GetAttrSet() );
bRowSplit = pSrcFmt->GetRowSplit();
nRepeatHeading = pSrcFmt->GetRepeatHeading();
}
else
- {
pTableStyle->Remove( pHardFmt );
- pHardFmt->GetAttrSet().SetParent( NULL );
- }
- AssignLineParents( pSrcFmt, table );
+ AssignFormatParents( pSrcFmt, rTable );
SwEditShell *pShell = pDoc->GetEditShell();
pDoc->SetRowSplit( *pShell->getShellCrsr( false ), SwFmtRowSplit( bRowSplit ) );
- table.SetRowsToRepeat( nRepeatHeading );
+ rTable.SetRowsToRepeat( nRepeatHeading );
}
-SwTableFmt* SwTableFmt::StoreTableProperties( const SwTable &table )
+SwTableFmt* SwTableFmt::StoreTableProperties( const SwTable &rTable )
{
- SwTableFmt *pHardFmt = table.GetTableFmt();
+ SwTableFmt *pHardFmt = rTable.GetTableFmt();
if( !pHardFmt )
return NULL;
return (SwTableFmt*)pHardFmt->GetRegisteredIn();
}
+void SwTableFmt::AssignFormatParents( SwTableFmt* pSrcFmt, SwTable &rTable )
+{
+ SwTableFmt *pHardFmt = rTable.GetTableFmt();
+ if( !pHardFmt )
+ return;
+
+ if( pSrcFmt )
+ pHardFmt->GetAttrSet().SetParent( &pSrcFmt->GetAttrSet() );
+ else
+ pHardFmt->GetAttrSet().SetParent( NULL );
+
+ AssignLineParents( pSrcFmt, rTable );
+}
+
void SwTableFmt::AssignLineParents( SwTableFmt* pSrcFmt, SwTable &rTable )
{
sal_uInt16 nLines = rTable.GetTabLines().size();
More information about the Libreoffice-commits
mailing list