[Libreoffice-commits] core.git: Branch 'feature/table-style' - sw/source

2013-07-30 Thread Alex Ivan
 sw/source/core/bastyp/init.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 32ce2fc84491847d26576f3af454cb9e86cfc26a
Author: Alex Ivan alexni...@yahoo.com
Date:   Tue Jul 30 18:32:05 2013 +0300

Fix missing font attributes in AutoFormat window

The attribute range associated with the SwTableBoxFmt did not
include the necessary ids for character attributes, and as a
result, these were not stored and not used correctly.

The solution should not have any side-effects, but, to be sure
there should be further testing of other features where this
range came into use.

Change-Id: I8cb1ac881b2746ae3ec7958a958167de6f140a7f

diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 934c821..148202c 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -209,6 +209,7 @@ sal_uInt16 aTableBoxSetRange[] = {
 RES_PROTECT,RES_PROTECT,
 RES_VERT_ORIENT,RES_VERT_ORIENT,
 RES_FRAMEDIR,   RES_FRAMEDIR,
+RES_CHRATR_BEGIN,   RES_CHRATR_END-1,
 RES_BOXATR_BEGIN,   RES_BOXATR_END-1,
 RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
 0
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/table-style' - sw/source

2013-07-23 Thread Alex Ivan
 sw/source/core/docnode/ndtbl.cxx |   21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 338f4d7f21180a997fdd045669fb0c09f2e3
Author: Alex Ivan alexni...@yahoo.com
Date:   Tue Jul 23 17:00:46 2013 +0300

Fix hard format/table style separation issue

Fixed the failed unit test brought by the previous
patch which attempted to correctly separate the hard
format from the table style in table insertion and
text to table methods.

Change-Id: I5eb7ddf074c8c8aaf2b2ec58aa7a94db8792a309

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index eaa15ac..cefcef2 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -329,8 +329,8 @@ const SwTable* SwDoc::InsertTable( const 
SwInsertTableOptions rInsTblOpts,
 
 // Create the Box/Line/Table construct
 SwTableLineFmt* pLineFmt = MakeTableLineFmt();
-SwTableFmt* pTableFmt = pTAFmt ? pTAFmt-GetTableStyle()
-: MakeTblFrmFmt( aTblName, GetDfltFrmFmt() );
+SwTableFmt* pTableStyle = pTAFmt ? pTAFmt-GetTableStyle() : NULL;
+SwTableFmt* pTableFmt = MakeTblFrmFmt( aTblName, pTableStyle );
 
 /* If the node to insert the table at is a context node and has a
non-default FRAMEDIR propagate it to the table. */
@@ -350,10 +350,6 @@ const SwTable* SwDoc::InsertTable( const 
SwInsertTableOptions rInsTblOpts,
 pTableFmt-SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
 // All lines use the left-to-right Fill-Order!
 pLineFmt-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
-pTableFmt-GetFirstLineFmt()-SetFmtAttr( SwFmtFillOrder( 
ATT_LEFT_TO_RIGHT ) );
-pTableFmt-GetOddLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
) );
-pTableFmt-GetEvenLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
) );
-pTableFmt-GetLastLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
) );
 
 // Set USHRT_MAX as the Table's default SSize
 SwTwips nWidth = USHRT_MAX;
@@ -404,7 +400,7 @@ const SwTable* SwDoc::InsertTable( const 
SwInsertTableOptions rInsTblOpts,
 ::lcl_SetDfltBorders( pTableFmt );
 
 SwTable * pNdTbl = pTblNd-GetTable();
-pNdTbl-GetTableFmt()-RegisterToFormat( *pTableFmt );
+pNdTbl-RegisterToFormat( *pTableFmt );
 
 pNdTbl-SetRowsToRepeat( nRowsToRepeat );
 pNdTbl-SetTableModel( bNewModel );
@@ -603,15 +599,11 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions rInsTblOpts,
 // Create the Box/Line/Table construct
 SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
 SwTableLineFmt* pLineFmt = MakeTableLineFmt();
-SwTableFmt* pTableFmt = pTAFmt ? pTAFmt-GetTableStyle()
-: MakeTblFrmFmt( GetUniqueTblName(), GetDfltFrmFmt() );
+SwTableFmt* pTableStyle = pTAFmt ? pTAFmt-GetTableStyle() : NULL;
+SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), pTableStyle );
 
 // All Lines have a left-to-right Fill Order
 pLineFmt-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
-pTableFmt-GetFirstLineFmt()-SetFmtAttr( SwFmtFillOrder( 
ATT_LEFT_TO_RIGHT ));
-pTableFmt-GetOddLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
));
-pTableFmt-GetEvenLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
));
-pTableFmt-GetLastLineFmt()-SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT 
));
 // The Table's SSize is USHRT_MAX
 pTableFmt-SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX ));
 if( !(rInsTblOpts.mnInsMode  tabopts::SPLIT_LAYOUT) )
@@ -658,7 +650,8 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions rInsTblOpts,
 
 // Set Orientation in the Table's Fmt
 pTableFmt-SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
-pNdTbl-GetTableFmt()-RegisterToFormat( *pTableFmt );
+
+pNdTbl-RegisterToFormat( *pTableFmt );
 
 if( rInsTblOpts.mnInsMode  tabopts::DEFAULT_BORDER )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/table-style' - sw/source

2013-07-23 Thread Cédric Bosdonnat
 sw/source/ui/table/tautofmt.cxx |   63 ++--
 1 file changed, 36 insertions(+), 27 deletions(-)

New commits:
commit 09cd784b800e448e7e8ad2b0d499a01236c978ea
Author: Cédric Bosdonnat cedric.bosdonnat@free.fr
Date:   Tue Jul 23 17:53:36 2013 +0200

More protection for pCurData: NULL means default, not much to do then

Change-Id: Ied3a04a7b7be4f4f7b6174e3d6d2a6e53848afd0

diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index c0f2bc9..bdb2478 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -89,7 +89,7 @@ private:
 voidPaintCells  ();
 
 sal_uInt8GetFormatIndex( size_t nCol, size_t nRow ) const;
-const SvxBoxItem   GetBoxItem( size_t nCol, size_t nRow ) const;
+const SvxBoxItem*   GetBoxItem( size_t nCol, size_t nRow ) const;
 
 voidDrawString( size_t nCol, size_t nRow );
 voidDrawStrings();
@@ -584,21 +584,23 @@ rCTLFont.MethodName( Value );
 
 void AutoFmtPreview::MakeFonts( sal_uInt8 nIndex, Font rFont, Font rCJKFont, 
Font rCTLFont )
 {
-const SwTableBoxFmt rBoxFmt = *pCurData-GetBoxFmt( nIndex );
-
 rFont = rCJKFont = rCTLFont = GetFont();
 Size aFontSize( rFont.GetSize().Width(), 10 );
 
-lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), 
rBoxFmt.GetPosture() );
-lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), 
rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
-lcl_SetFontProperties( rCTLFont, rBoxFmt.GetCTLFont(), 
rBoxFmt.GetCTLWeight(), rBoxFmt.GetCTLPosture() );
-
-SETONALLFONTS( SetUnderline,
(FontUnderline)rBoxFmt.GetUnderline().GetValue() );
-SETONALLFONTS( SetOverline, 
(FontUnderline)rBoxFmt.GetOverline().GetValue() );
-SETONALLFONTS( SetStrikeout,
(FontStrikeout)rBoxFmt.GetCrossedOut().GetValue() );
-SETONALLFONTS( SetOutline,  rBoxFmt.GetContour().GetValue() );
-SETONALLFONTS( SetShadow,   rBoxFmt.GetShadowed().GetValue() );
-SETONALLFONTS( SetColor,rBoxFmt.GetColor().GetValue() );
+if ( pCurData )
+{
+const SwTableBoxFmt rBoxFmt = *pCurData-GetBoxFmt( nIndex );
+lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), 
rBoxFmt.GetPosture() );
+lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), 
rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
+lcl_SetFontProperties( rCTLFont, rBoxFmt.GetCTLFont(), 
rBoxFmt.GetCTLWeight(), rBoxFmt.GetCTLPosture() );
+
+SETONALLFONTS( SetUnderline,
(FontUnderline)rBoxFmt.GetUnderline().GetValue() );
+SETONALLFONTS( SetOverline, 
(FontUnderline)rBoxFmt.GetOverline().GetValue() );
+SETONALLFONTS( SetStrikeout,
(FontStrikeout)rBoxFmt.GetCrossedOut().GetValue() );
+SETONALLFONTS( SetOutline,  rBoxFmt.GetContour().GetValue() );
+SETONALLFONTS( SetShadow,   rBoxFmt.GetShadowed().GetValue() );
+SETONALLFONTS( SetColor,rBoxFmt.GetColor().GetValue() );
+}
 SETONALLFONTS( SetSize, aFontSize );
 SETONALLFONTS( SetTransparent,  sal_True );
 }
@@ -616,9 +618,12 @@ sal_uInt8 AutoFmtPreview::GetFormatIndex( size_t nCol, 
size_t nRow ) const
 return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, mbRTL ) ];
 }
 
-const SvxBoxItem AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
+const SvxBoxItem* AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
 {
-return pCurData-GetBoxFmt( GetFormatIndex( nCol, nRow ) )-GetBox();
+if ( pCurData )
+return pCurData-GetBoxFmt( GetFormatIndex( nCol, nRow ) )-GetBox();
+else
+return NULL;
 }
 
 void AutoFmtPreview::DrawString( size_t nCol, size_t nRow )
@@ -664,7 +669,7 @@ void AutoFmtPreview::DrawString( size_t nCol, size_t nRow )
 case 23:nVal = 39; nNum = 13;   goto MAKENUMSTR;
 case 24:nVal = 108; nNum = 15;  goto MAKENUMSTR;
 MAKENUMSTR:
-if( pCurData-IsValueFormat() )
+if( pCurData  pCurData-IsValueFormat() )
 {
 String sFmt; LanguageType eLng, eSys;
 pCurData-GetBoxFmt( (sal_uInt8)nNum )-GetValueFormat( sFmt, 
eLng, eSys );
@@ -693,7 +698,7 @@ MAKENUMSTR:
 
 Size theMaxStrSize( cellRect.GetWidth() - FRAME_OFFSET,
 cellRect.GetHeight() - FRAME_OFFSET );
-if( pCurData-IsFont() )
+if( pCurData  pCurData-IsFont() )
 {
 Font aFont, aCJKFont, aCTLFont;
 MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
@@ -705,7 +710,7 @@ MAKENUMSTR:
 aScriptedText.SetText( cellString, m_xBreak );
 aStrSize = aScriptedText.GetTextSize();
 
-if( pCurData-IsFont() 
+if( pCurData  pCurData-IsFont() 
 theMaxStrSize.Height()  aStrSize.Height() )
 {
 // If the string in this font does not
@@ -733,7 +738,7 @@ MAKENUMSTR: