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

Alex Ivan alexnivan at yahoo.com
Thu Jul 4 04:35:28 PDT 2013


 sw/inc/swtblfmt.hxx             |   26 ++-
 sw/inc/tblafmt.hxx              |  134 ------------------
 sw/source/core/bastyp/init.cxx  |    3 
 sw/source/core/doc/swtblfmt.cxx |  115 +++++++++++++++
 sw/source/core/doc/tblafmt.cxx  |  293 ++++------------------------------------
 sw/source/ui/table/tautofmt.cxx |   11 -
 6 files changed, 177 insertions(+), 405 deletions(-)

New commits:
commit 6668e83e1341112872c8e7f376534c6c76aac514
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Jul 4 14:01:17 2013 +0300

    Remove SwAutoBoxFmt class from implementation
    
    SwAutoBoxFmt class has been completely removed from the
    current implementation. All the functionality has been moved
    to SwTableBoxFmt.
    
    Change-Id: I4d4486a7819c125cf5ef6785eb4af39fff3cf145

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 98f2132..a1e59b3 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -63,124 +63,6 @@ struct SwAfVersions;
 
 class SvNumberFormatter;
 
-class SwBoxAutoFmt
-{
-    // common attributes of Calc and Writer
-    // --- from 641 on: CJK and CTL font settings
-    SvxFontItem         aFont;
-    SvxFontHeightItem   aHeight;
-    SvxWeightItem       aWeight;
-    SvxPostureItem      aPosture;
-
-    SvxFontItem         aCJKFont;
-    SvxFontHeightItem   aCJKHeight;
-    SvxWeightItem       aCJKWeight;
-    SvxPostureItem      aCJKPosture;
-
-    SvxFontItem         aCTLFont;
-    SvxFontHeightItem   aCTLHeight;
-    SvxWeightItem       aCTLWeight;
-    SvxPostureItem      aCTLPosture;
-
-    SvxUnderlineItem    aUnderline;
-    SvxOverlineItem     aOverline;
-    SvxCrossedOutItem   aCrossedOut;
-    SvxContourItem      aContour;
-    SvxShadowedItem     aShadowed;
-    SvxColorItem        aColor;
-    SvxBoxItem          aBox;
-    SvxLineItem         aTLBR;
-    SvxLineItem         aBLTR;
-    SvxBrushItem        aBackground;
-
-    // Writer specific
-    SvxAdjustItem       aAdjust;
-    SvxFrameDirectionItem m_aTextOrientation;
-    SwFmtVertOrient m_aVerticalAlignment;
-
-    // Calc specific
-    SvxHorJustifyItem   aHorJustify;
-    SvxVerJustifyItem   aVerJustify;
-    SfxBoolItem         aStacked;
-    SvxMarginItem       aMargin;
-    SfxBoolItem         aLinebreak;
-    SfxInt32Item        aRotateAngle;
-    SvxRotateModeItem   aRotateMode;
-
-    // number format
-    String              sNumFmtString;
-    LanguageType        eSysLanguage, eNumFmtLanguage;
-
-public:
-    SwBoxAutoFmt();
-    SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
-    ~SwBoxAutoFmt();
-
-    int operator==( const SwBoxAutoFmt& rCmp ) const;
-    SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );
-
-    // The get-methods.
-    const SvxFontItem       &GetFont() const        { return aFont; }
-    const SvxFontHeightItem &GetHeight() const      { return aHeight; }
-    const SvxWeightItem     &GetWeight() const      { return aWeight; }
-    const SvxPostureItem    &GetPosture() const     { return aPosture; }
-    const SvxFontItem       &GetCJKFont() const     { return aCJKFont; }
-    const SvxFontHeightItem &GetCJKHeight() const   { return aCJKHeight; }
-    const SvxWeightItem     &GetCJKWeight() const   { return aCJKWeight; }
-    const SvxPostureItem    &GetCJKPosture() const  { return aCJKPosture; }
-    const SvxFontItem       &GetCTLFont() const     { return aCTLFont; }
-    const SvxFontHeightItem &GetCTLHeight() const   { return aCTLHeight; }
-    const SvxWeightItem     &GetCTLWeight() const   { return aCTLWeight; }
-    const SvxPostureItem    &GetCTLPosture() const  { return aCTLPosture; }
-    const SvxUnderlineItem  &GetUnderline() const   { return aUnderline; }
-    const SvxOverlineItem   &GetOverline() const    { return aOverline; }
-    const SvxCrossedOutItem &GetCrossedOut() const  { return aCrossedOut; }
-    const SvxContourItem    &GetContour() const     { return aContour; }
-    const SvxShadowedItem   &GetShadowed() const    { return aShadowed; }
-    const SvxColorItem      &GetColor() const       { return aColor; }
-    const SvxAdjustItem     &GetAdjust() const      { return aAdjust; }
-    const SvxFrameDirectionItem& GetTextOrientation() const { return m_aTextOrientation; }
-    const SwFmtVertOrient& GetVerticalAlignment() const { return m_aVerticalAlignment; }
-    const SvxBoxItem        &GetBox() const         { return aBox; }
-    const SvxLineItem       &GetTLBR() const        { return aTLBR; }
-    const SvxLineItem       &GetBLTR() const        { return aBLTR; }
-    const SvxBrushItem      &GetBackground() const  { return aBackground; }
-    void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
-        { rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }
-
-    // The set-methods.
-    void SetFont( const SvxFontItem& rNew )             { aFont = rNew; }
-    void SetHeight( const SvxFontHeightItem& rNew )     { aHeight = rNew; }
-    void SetWeight( const SvxWeightItem& rNew )         { aWeight = rNew; }
-    void SetPosture( const SvxPostureItem& rNew )       { aPosture = rNew; }
-    void SetCJKFont( const SvxFontItem& rNew )          { aCJKFont = rNew; }
-    void SetCJKHeight( const SvxFontHeightItem& rNew )  { aCJKHeight = rNew; }
-    void SetCJKWeight( const SvxWeightItem& rNew )      { aCJKWeight = rNew; }
-    void SetCJKPosture( const SvxPostureItem& rNew )    { aCJKPosture = rNew; }
-    void SetCTLFont( const SvxFontItem& rNew )          { aCTLFont = rNew; }
-    void SetCTLHeight( const SvxFontHeightItem& rNew )  { aCTLHeight = rNew; }
-    void SetCTLWeight( const SvxWeightItem& rNew )      { aCTLWeight = rNew; }
-    void SetCTLPosture( const SvxPostureItem& rNew )    { aCTLPosture = rNew; }
-    void SetUnderline( const SvxUnderlineItem& rNew )   { aUnderline = rNew; }
-    void SetOverline( const SvxOverlineItem& rNew )     { aOverline = rNew; }
-    void SetCrossedOut( const SvxCrossedOutItem& rNew ) { aCrossedOut = rNew; }
-    void SetContour( const SvxContourItem& rNew )       { aContour = rNew; }
-    void SetShadowed( const SvxShadowedItem& rNew )     { aShadowed = rNew; }
-    void SetColor( const SvxColorItem& rNew )           { aColor = rNew; }
-    void SetAdjust( const SvxAdjustItem& rNew )
-        {
-            aAdjust.SetAdjust( rNew.GetAdjust() );
-            aAdjust.SetOneWord( rNew.GetOneWord() );
-            aAdjust.SetLastBlock( rNew.GetLastBlock() );
-        }
-    void SetTextOrientation(const SvxFrameDirectionItem& rNew) { m_aTextOrientation = rNew; }
-    void SetVerticalAlignment(const SwFmtVertOrient& rNew) { m_aVerticalAlignment = rNew; }
-    void SetBox( const SvxBoxItem& rNew )               { aBox = rNew; }
-    void SetBackground( const SvxBrushItem& rNew )      { aBackground = rNew; }
-    void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
-        { sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }
-};
-
 /*
 @remarks
 A table has a number of lines. These lines seem to correspond with rows, except in the case of
@@ -227,9 +109,6 @@ properties are stored per-table, and are lossless.
 */
 class SW_DLLPUBLIC SwTableAutoFmt
 {
-    friend void _FinitCore();       // To destroy dflt. pointer.
-    static SwBoxAutoFmt* pDfltBoxAutoFmt;
-
     SwTableFmt* m_pTableStyle;
     sal_uInt16 nStrResId;
 
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index e6af8f9..934c821 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -725,9 +725,6 @@ void _FinitCore()
     delete pCollator;
     delete pCaseCollator;
 
-    // destroy default TableAutoFormat
-    delete SwTableAutoFmt::pDfltBoxAutoFmt;
-
     delete SwSelPaintRects::pMapMode;
     delete SwFntObj::pPixMap;
 
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 1c72eb0..14e55b6 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -87,8 +87,6 @@ const sal_uInt16 AUTOFORMAT_ID          = AUTOFORMAT_ID_31005;
 const sal_uInt16 AUTOFORMAT_DATA_ID     = AUTOFORMAT_DATA_ID_31005;
 const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50;
 
-SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0;
-
 #define sAutoTblFmtName "autotbl.fmt"
 
 namespace
@@ -261,140 +259,6 @@ void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer )
     rStream >> nNumFmtVersion;
 }
 
-SwBoxAutoFmt::SwBoxAutoFmt()
-    : aFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) ),
-    aHeight( 240, 100, RES_CHRATR_FONTSIZE ),
-    aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ),
-    aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ),
-
-    aCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) ),
-    aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ),
-    aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ),
-    aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ),
-
-    aCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) ),
-    aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ),
-    aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ),
-    aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ),
-
-    aUnderline( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ),
-    aOverline( UNDERLINE_NONE, RES_CHRATR_OVERLINE ),
-    aCrossedOut( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ),
-    aContour( sal_False, RES_CHRATR_CONTOUR ),
-    aShadowed( sal_False, RES_CHRATR_SHADOWED ),
-    aColor( RES_CHRATR_COLOR ),
-    aBox( RES_BOX ),
-    aTLBR( 0 ),
-    aBLTR( 0 ),
-    aBackground( RES_BACKGROUND ),
-    aAdjust( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ),
-    m_aTextOrientation(FRMDIR_ENVIRONMENT, RES_FRAMEDIR),
-    m_aVerticalAlignment(0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME),
-    aHorJustify( SVX_HOR_JUSTIFY_STANDARD, 0),
-    aVerJustify( SVX_VER_JUSTIFY_STANDARD, 0),
-    aStacked( 0 ),
-    aMargin( 0 ),
-    aLinebreak( 0 ),
-    aRotateAngle( 0 ),
-
-// FIXME - add attribute IDs for the diagonal line items
-//    aTLBR( RES_... ),
-//    aBLTR( RES_... ),
-    aRotateMode( SVX_ROTATE_MODE_STANDARD, 0 )
-{
-    eSysLanguage = eNumFmtLanguage = ::GetAppLanguage();
-    aBox.SetDistance( 55 );
-}
-
-
-SwBoxAutoFmt::SwBoxAutoFmt( const SwBoxAutoFmt& rNew )
-    : aFont( rNew.aFont ),
-    aHeight( rNew.aHeight ),
-    aWeight( rNew.aWeight ),
-    aPosture( rNew.aPosture ),
-    aCJKFont( rNew.aCJKFont ),
-    aCJKHeight( rNew.aCJKHeight ),
-    aCJKWeight( rNew.aCJKWeight ),
-    aCJKPosture( rNew.aCJKPosture ),
-    aCTLFont( rNew.aCTLFont ),
-    aCTLHeight( rNew.aCTLHeight ),
-    aCTLWeight( rNew.aCTLWeight ),
-    aCTLPosture( rNew.aCTLPosture ),
-    aUnderline( rNew.aUnderline ),
-    aOverline( rNew.aOverline ),
-    aCrossedOut( rNew.aCrossedOut ),
-    aContour( rNew.aContour ),
-    aShadowed( rNew.aShadowed ),
-    aColor( rNew.aColor ),
-    aBox( rNew.aBox ),
-    aTLBR( rNew.aTLBR ),
-    aBLTR( rNew.aBLTR ),
-    aBackground( rNew.aBackground ),
-    aAdjust( rNew.aAdjust ),
-    m_aTextOrientation(rNew.m_aTextOrientation),
-    m_aVerticalAlignment(rNew.m_aVerticalAlignment),
-    aHorJustify( rNew.aHorJustify ),
-    aVerJustify( rNew.aVerJustify ),
-    aStacked( rNew.aStacked ),
-    aMargin( rNew.aMargin ),
-    aLinebreak( rNew.aLinebreak ),
-    aRotateAngle( rNew.aRotateAngle ),
-    aRotateMode( rNew.aRotateMode ),
-    sNumFmtString( rNew.sNumFmtString ),
-    eSysLanguage( rNew.eSysLanguage ),
-    eNumFmtLanguage( rNew.eNumFmtLanguage )
-{
-}
-
-
-SwBoxAutoFmt::~SwBoxAutoFmt()
-{
-}
-
-SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew )
-{
-    aFont = rNew.aFont;
-    aHeight = rNew.aHeight;
-    aWeight = rNew.aWeight;
-    aPosture = rNew.aPosture;
-    aCJKFont = rNew.aCJKFont;
-    aCJKHeight = rNew.aCJKHeight;
-    aCJKWeight = rNew.aCJKWeight;
-    aCJKPosture = rNew.aCJKPosture;
-    aCTLFont = rNew.aCTLFont;
-    aCTLHeight = rNew.aCTLHeight;
-    aCTLWeight = rNew.aCTLWeight;
-    aCTLPosture = rNew.aCTLPosture;
-    aUnderline = rNew.aUnderline;
-    aOverline = rNew.aOverline;
-    aCrossedOut = rNew.aCrossedOut;
-    aContour = rNew.aContour;
-    aShadowed = rNew.aShadowed;
-    aColor = rNew.aColor;
-    SetAdjust( rNew.aAdjust );
-    m_aTextOrientation = rNew.m_aTextOrientation;
-    m_aVerticalAlignment = rNew.m_aVerticalAlignment;
-    aBox = rNew.aBox;
-    aTLBR = rNew.aTLBR;
-    aBLTR = rNew.aBLTR;
-    aBackground = rNew.aBackground;
-
-    aHorJustify = rNew.aHorJustify;
-    aVerJustify = rNew.aVerJustify;
-    aStacked.SetValue( rNew.aStacked.GetValue() );
-    aMargin = rNew.aMargin;
-    aLinebreak.SetValue( rNew.aLinebreak.GetValue() );
-    aRotateAngle.SetValue( rNew.aRotateAngle.GetValue() );
-    aRotateMode.SetValue( rNew.aRotateMode.GetValue() );
-
-    sNumFmtString = rNew.sNumFmtString;
-    eSysLanguage = rNew.eSysLanguage;
-    eNumFmtLanguage = rNew.eNumFmtLanguage;
-
-    return *this;
-}
-
-
 #define READ( aItem, aItemType, nVers )\
     pNew = aItem.Create(rStream, nVers ); \
     aItem = *(aItemType*)pNew; \
commit 6f2572288be71068c32831824baf6d7b60217b59
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Jul 4 13:40:33 2013 +0300

    Move format info from SwTableAutoFmt to SwTableFmt
    
    Moved almost all information regarding format from SwTableAutoFmt
    into SwTableFmt. Most methods of the former now redirect to
    methods of the latter.
    
    Change-Id: Ia5621643e7bcb5d921799d71dc89d1582f77d501

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 990032f..71b32d1 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -42,6 +42,7 @@
 #include <editeng/lineitem.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <editeng/shaditem.hxx>
+#include <editsh.hxx>
 #include <fmtpdsc.hxx>
 #include <fmtlsplt.hxx>
 #include <fmtornt.hxx>
@@ -49,6 +50,7 @@
 #include <frmatr.hxx>
 #include <frmfmt.hxx>
 #include <paratr.hxx>
+#include <swtable.hxx>
 
 struct SwAfVersions;
 
@@ -91,15 +93,18 @@ public:
     void SetOddColFmt( SwTableLineFmt* pNew ) { m_pOddColFmt.reset( pNew ); }
     void SetEvenColFmt( SwTableLineFmt* pNew ) { m_pEvnColFmt.reset( pNew ); }
 
-    SwTableLineFmt* GetFirstLineFmt() { return m_pFstLineFmt.get(); }
-    SwTableLineFmt* GetLastLineFmt() { return m_pLstLineFmt.get(); }
-    SwTableLineFmt* GetOddLineFmt() { return m_pOddLineFmt.get(); }
-    SwTableLineFmt* GetEvenLineFmt() { return m_pEvnLineFmt.get(); }
+    SwTableLineFmt* GetFirstLineFmt() const { return m_pFstLineFmt.get(); }
+    SwTableLineFmt* GetLastLineFmt() const { return m_pLstLineFmt.get(); }
+    SwTableLineFmt* GetOddLineFmt() const { return m_pOddLineFmt.get(); }
+    SwTableLineFmt* GetEvenLineFmt() const { return m_pEvnLineFmt.get(); }
 
-    SwTableLineFmt* GetFirstColFmt() { return m_pFstColFmt.get(); }
-    SwTableLineFmt* GetLastColFmt() { return m_pLstColFmt.get(); }
-    SwTableLineFmt* GetOddColFmt() { return m_pOddColFmt.get(); }
-    SwTableLineFmt* GetEvenColFmt() { return m_pEvnColFmt.get(); }
+    SwTableLineFmt* GetFirstColFmt() const { return m_pFstColFmt.get(); }
+    SwTableLineFmt* GetLastColFmt() const { return m_pLstColFmt.get(); }
+    SwTableLineFmt* GetOddColFmt() const { return m_pOddColFmt.get(); }
+    SwTableLineFmt* GetEvenColFmt() const { return m_pEvnColFmt.get(); }
+
+    void SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos );
+    SwTableBoxFmt* GetBoxFmt( sal_uInt8 nPos ) const;
 
     void SetBreak( const SvxFmtBreakItem& rNew );
     void SetPageDesc( const SwFmtPageDesc& rNew );
@@ -116,7 +121,10 @@ public:
     sal_Bool GetRowSplit() const;
     sal_uInt16 GetRepeatHeading() const;
 
-    void CopyTableFormatInfo( SwTableFmt* pTableFormat );
+    void RestoreTableProperties( SwTable &table ) const;
+    void StoreTableProperties( const SwTable &table );
+
+    void CopyTableFormatInfo( const SwTableFmt* pTableFormat );
 
     TYPEINFO();     // Already in base class Content.
 
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index da2fd38..98f2132 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -56,6 +56,7 @@
 #include <fmtlsplt.hxx>
 #include <fmtrowsplt.hxx>
 #include <fmtornt.hxx>
+#include <swtblfmt.hxx>
 #include "swdllapi.h"
 
 struct SwAfVersions;
@@ -230,7 +231,6 @@ class SW_DLLPUBLIC SwTableAutoFmt
     static SwBoxAutoFmt* pDfltBoxAutoFmt;
 
     SwTableFmt* m_pTableStyle;
-    String aName;
     sal_uInt16 nStrResId;
 
     // Common flags of Calc and Writer.
@@ -246,7 +246,6 @@ class SW_DLLPUBLIC SwTableAutoFmt
 public:
     SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle );
     SwTableAutoFmt( const SwTableAutoFmt& rNew );
-    ~SwTableAutoFmt();
 
     SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
 
@@ -255,8 +254,8 @@ public:
     void SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos );
     SwTableBoxFmt* GetBoxFmt( sal_uInt8 nPos ) const;
 
-    void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
-    const String& GetName() const { return aName; }
+    void SetName( const String& rNew ) { m_pTableStyle->SetName( rNew ); nStrResId = USHRT_MAX; }
+    const String& GetName() const { return m_pTableStyle->GetName(); }
 
     enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
     void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 65bdb5f..5e348e7 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -103,6 +103,79 @@ SwTableFmt& SwTableFmt::operator=( const SwTableFmt& rNew )
         return *this;
     }
 
+void SwTableFmt::SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos )
+{
+    OSL_ENSURE( nPos < 16, "wrong area" );
+
+    sal_uInt8 nLine = nPos / 4;
+    sal_uInt8 nBox = nPos % 4;
+
+    SwTableLineFmt* pLine;
+
+    switch( nLine )
+    {
+        case 0:
+            pLine = m_pFstLineFmt.get(); break;
+        case 1:
+            pLine = m_pOddLineFmt.get(); break;
+        case 2:
+            pLine = m_pEvnLineFmt.get(); break;
+        case 3:
+            pLine = m_pLstLineFmt.get(); break;
+        // TODO Extend for columns
+    }
+
+    switch( nBox )
+    {
+        case 0:
+            pLine->SetFirstBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 1:
+            pLine->SetOddBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 2:
+            pLine->SetEvenBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 3:
+            pLine->SetLastBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+    }
+}
+
+SwTableBoxFmt* SwTableFmt::GetBoxFmt( sal_uInt8 nPos ) const
+{
+    OSL_ENSURE( nPos < 16, "wrong area" );
+
+    sal_uInt8 nLine = nPos / 4;
+    sal_uInt8 nBox = nPos % 4;
+
+    SwTableLineFmt* pLine;
+    SwTableBoxFmt* pRet;
+
+    switch( nLine )
+    {
+        case 0:
+            pLine = m_pFstLineFmt.get(); break;
+        case 1:
+            pLine = m_pOddLineFmt.get(); break;
+        case 2:
+            pLine = m_pEvnLineFmt.get(); break;
+        case 3:
+            pLine = m_pLstLineFmt.get(); break;
+        // TODO Extend for columns
+    }
+
+    switch( nBox )
+    {
+        case 0:
+            pRet = pLine->GetFirstBoxFmt(); break;
+        case 1:
+            pRet = pLine->GetOddBoxFmt(); break;
+        case 2:
+            pRet = pLine->GetEvenBoxFmt(); break;
+        case 3:
+            pRet = pLine->GetLastBoxFmt(); break;
+    }
+
+    return pRet;
+}
+
 void SwTableFmt::SetBreak( const SvxFmtBreakItem& rNew )
 {
     SetFmtAttr( rNew );
@@ -168,8 +241,48 @@ sal_uInt16 SwTableFmt::GetRepeatHeading() const
     return (static_cast<const SfxUInt16Item&>( GetFmtAttr( FN_PARAM_TABLE_HEADLINE ) )).GetValue();
 }
 
-void SwTableFmt::CopyTableFormatInfo( SwTableFmt* pTableFormat )
+void SwTableFmt::RestoreTableProperties(SwTable &table) const
+{
+    SwTableFmt *pFormat = table.GetTableFmt();
+    if (!pFormat)
+        return;
+
+    SwDoc *pDoc = pFormat->GetDoc();
+    if (!pDoc)
+        return;
+
+    pFormat->CopyTableFormatInfo( this );
+
+    SwEditShell *pShell = pDoc->GetEditShell();
+    pDoc->SetRowSplit( *pShell->getShellCrsr( false ), SwFmtRowSplit( GetRowSplit() ) );
+
+    table.SetRowsToRepeat( GetRepeatHeading() );
+}
+
+void SwTableFmt::StoreTableProperties(const SwTable &table)
 {
+    SwTableFmt *pFormat = table.GetTableFmt();
+    if (!pFormat)
+        return;
+
+    SwDoc *pDoc = pFormat->GetDoc();
+    if (!pDoc)
+        return;
+
+    SwEditShell *pShell = pDoc->GetEditShell();
+    SwFmtRowSplit *pRowSplit = 0;
+    pDoc->GetRowSplit( *pShell->getShellCrsr( false ), pRowSplit );
+    SetRowSplit( pRowSplit ? pRowSplit->GetValue() : sal_False );
+    delete pRowSplit;
+    pRowSplit = 0;
+
+    CopyTableFormatInfo( pFormat );
+}
+
+void SwTableFmt::CopyTableFormatInfo( const SwTableFmt* pTableFormat )
+{
+    SetFmtAttr( pTableFormat->GetAttrSet() );
+
     m_pFstLineFmt.reset( new SwTableLineFmt ( *pTableFormat->GetFirstLineFmt() ) );
     m_pLstLineFmt.reset( new SwTableLineFmt ( *pTableFormat->GetLastLineFmt() ) );
     m_pOddLineFmt.reset( new SwTableLineFmt ( *pTableFormat->GetOddLineFmt() ) );
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index e7084fe..1c72eb0 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -644,7 +644,6 @@ sal_Bool SwTableBoxFmt::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion
 
 SwTableAutoFmt::SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle )
     : m_pTableStyle( pTableStyle )
-    , aName( rName )
     , nStrResId( USHRT_MAX )
 {
     bInclFont = sal_True;
@@ -653,6 +652,8 @@ SwTableAutoFmt::SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle )
     bInclBackground = sal_True;
     bInclValueFormat = sal_True;
     bInclWidthHeight = sal_True;
+
+    m_pTableStyle->SetName( rName );
 }
 
 
@@ -667,7 +668,6 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
         return *this;
 
     m_pTableStyle = rNew.m_pTableStyle;
-    aName = rNew.aName;
     nStrResId = rNew.nStrResId;
     bInclFont = rNew.bInclFont;
     bInclJustify = rNew.bInclJustify;
@@ -681,76 +681,13 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
 
 void SwTableAutoFmt::SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos )
 {
-    OSL_ENSURE( nPos < 16, "wrong area" );
-
-    sal_uInt8 nLine = nPos / 4;
-    sal_uInt8 nBox = nPos % 4;
-
-    SwTableLineFmt* pLine;
-
-    switch( nLine )
-    {
-        case 0:
-            pLine = m_pTableStyle->GetFirstLineFmt(); break;
-        case 1:
-            pLine = m_pTableStyle->GetOddLineFmt(); break;
-        case 2:
-            pLine = m_pTableStyle->GetEvenLineFmt(); break;
-        case 3:
-            pLine = m_pTableStyle->GetLastLineFmt(); break;
-        // TODO Extend for columns
-    }
-
-    switch( nBox )
-    {
-        case 0:
-            pLine->SetFirstBoxFmt( new SwTableBoxFmt( rNew ) ); break;
-        case 1:
-            pLine->SetOddBoxFmt( new SwTableBoxFmt( rNew ) ); break;
-        case 2:
-            pLine->SetEvenBoxFmt( new SwTableBoxFmt( rNew ) ); break;
-        case 3:
-            pLine->SetLastBoxFmt( new SwTableBoxFmt( rNew ) ); break;
-    }
+    m_pTableStyle->SetBoxFmt( rNew, nPos );
 }
 
 
 SwTableBoxFmt* SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
 {
-    OSL_ENSURE( nPos < 16, "wrong area" );
-
-    sal_uInt8 nLine = nPos / 4;
-    sal_uInt8 nBox = nPos % 4;
-
-    SwTableLineFmt* pLine;
-    SwTableBoxFmt* pRet;
-
-    switch( nLine )
-    {
-        case 0:
-            pLine = m_pTableStyle->GetFirstLineFmt(); break;
-        case 1:
-            pLine = m_pTableStyle->GetOddLineFmt(); break;
-        case 2:
-            pLine = m_pTableStyle->GetEvenLineFmt(); break;
-        case 3:
-            pLine = m_pTableStyle->GetLastLineFmt(); break;
-        // TODO Extend for columns
-    }
-
-    switch( nBox )
-    {
-        case 0:
-            pRet = pLine->GetFirstBoxFmt();
-        case 1:
-            pRet = pLine->GetOddBoxFmt();
-        case 2:
-            pRet = pLine->GetEvenBoxFmt();
-        case 3:
-            pRet = pLine->GetLastBoxFmt();
-    }
-
-    return pRet;
+    return m_pTableStyle->GetBoxFmt( nPos );
 }
 
 
@@ -761,12 +698,7 @@ void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
 {
     OSL_ENSURE( nPos < 16, "wrong area" );
 
-    SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
-    if( !pFmt )     // if is set -> copy
-    {
-        pFmt = new SwBoxAutoFmt;
-        aBoxAutoFmt[ nPos ] = pFmt;
-    }
+    SwTableBoxFmt* pFmt = GetBoxFmt( nPos );
 
     if( UPDATE_CHAR & eFlags )
     {
@@ -823,7 +755,7 @@ void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
 void SwTableAutoFmt::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
                                  UpdateFlags eFlags, SvNumberFormatter* pNFmtr) const
 {
-    const SwBoxAutoFmt& rChg = GetBoxFmt( nPos );
+    const SwTableBoxFmt& rChg = *GetBoxFmt( nPos );
 
     if( UPDATE_CHAR & eFlags )
     {
@@ -912,42 +844,12 @@ void SwTableAutoFmt::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
 
 void SwTableAutoFmt::RestoreTableProperties(SwTable &table) const
 {
-    SwTableFmt *pFormat = table.GetTableFmt();
-    if (!pFormat)
-        return;
-
-    SwDoc *pDoc = pFormat->GetDoc();
-    if (!pDoc)
-        return;
-
-    pFormat->SetFmtAttr( m_pTableStyle->GetAttrSet() );
-    pFormat->CopyTableFormatInfo( m_pTableStyle );
-
-    SwEditShell *pShell = pDoc->GetEditShell();
-    pDoc->SetRowSplit(*pShell->getShellCrsr(false), SwFmtRowSplit(m_pTableStyle->GetRowSplit()));
-
-    table.SetRowsToRepeat(m_pTableStyle->GetRepeatHeading());
+    m_pTableStyle->RestoreTableProperties( table );
 }
 
 void SwTableAutoFmt::StoreTableProperties(const SwTable &table)
 {
-    SwTableFmt *pFormat = table.GetTableFmt();
-    if (!pFormat)
-        return;
-
-    SwDoc *pDoc = pFormat->GetDoc();
-    if (!pDoc)
-        return;
-
-    SwEditShell *pShell = pDoc->GetEditShell();
-    SwFmtRowSplit *pRowSplit = 0;
-    pDoc->GetRowSplit(*pShell->getShellCrsr(false), pRowSplit);
-    m_pTableStyle->SetRowSplit( pRowSplit ? pRowSplit->GetValue() : sal_False );
-    delete pRowSplit;
-    pRowSplit = 0;
-
-    m_pTableStyle->SetFmtAttr( pFormat->GetAttrSet() );
-    m_pTableStyle->CopyTableFormatInfo( pFormat );
+    m_pTableStyle->StoreTableProperties( table );
 }
 
 SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc )
@@ -1056,7 +958,7 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
     sal_Bool b;
     rStream << nVal;
     // --- from 680/dr25 on: store strings as UTF-8
-    write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, aName,
+    write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, GetName(),
         RTL_TEXTENCODING_UTF8 );
     rStream << nStrResId;
     rStream << ( b = bInclFont );
@@ -1314,9 +1216,8 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
         bRet = 0 == rStream.GetError();
 
         // Write this version number for all attributes
-        // TODO Remove members in SwTableAutoFmt and adapt this
-        // m_pImpl->m_AutoFormats[0].GetBoxFmt(0).SaveVersionNo(
-        //        rStream, AUTOFORMAT_FILE_VERSION);
+        m_pImpl->m_AutoFormats[0].GetBoxFmt(0)->SaveVersionNo(
+               rStream, AUTOFORMAT_FILE_VERSION);
 
         rStream << static_cast<sal_uInt16>(m_pImpl->m_AutoFormats.size() - 1);
         bRet = 0 == rStream.GetError();
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index dd1ec58..c0f2bc9 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -39,6 +39,7 @@
 #include "doc.hxx"
 #include "SwStyleNameMapper.hxx"
 #include "poolfmt.hxx"
+#include <swtblfmt.hxx>
 
 using namespace com::sun::star;
 
@@ -583,7 +584,7 @@ rCTLFont.MethodName( Value );
 
 void AutoFmtPreview::MakeFonts( sal_uInt8 nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont )
 {
-    const SwBoxAutoFmt& rBoxFmt = pCurData->GetBoxFmt( nIndex );
+    const SwTableBoxFmt& rBoxFmt = *pCurData->GetBoxFmt( nIndex );
 
     rFont = rCJKFont = rCTLFont = GetFont();
     Size aFontSize( rFont.GetSize().Width(), 10 );
@@ -617,7 +618,7 @@ sal_uInt8 AutoFmtPreview::GetFormatIndex( 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();
+    return pCurData->GetBoxFmt( GetFormatIndex( nCol, nRow ) )->GetBox();
 }
 
 void AutoFmtPreview::DrawString( size_t nCol, size_t nRow )
@@ -666,7 +667,7 @@ MAKENUMSTR:
             if( pCurData->IsValueFormat() )
             {
                 String sFmt; LanguageType eLng, eSys;
-                pCurData->GetBoxFmt( (sal_uInt8)nNum ).GetValueFormat( sFmt, eLng, eSys );
+                pCurData->GetBoxFmt( (sal_uInt8)nNum )->GetValueFormat( sFmt, eLng, eSys );
 
                 short nType;
                 bool bNew;
@@ -736,7 +737,7 @@ MAKENUMSTR:
         {
             sal_uInt16 nHorPos = (sal_uInt16)
                     ((cellRect.GetWidth()-aStrSize.Width())/2);
-            const SvxAdjustItem& rAdj = pCurData->GetBoxFmt(nFmtIndex).GetAdjust();
+            const SvxAdjustItem& rAdj = pCurData->GetBoxFmt(nFmtIndex)->GetAdjust();
             switch ( rAdj.GetAdjust() )
             {
                 case SVX_ADJUST_LEFT:
@@ -784,7 +785,7 @@ void AutoFmtPreview::DrawBackground()
     {
         for( size_t nCol = 0; nCol < 5; ++nCol )
         {
-            SvxBrushItem aBrushItem( pCurData->GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() );
+            SvxBrushItem aBrushItem( pCurData->GetBoxFmt( GetFormatIndex( nCol, nRow ) )->GetBackground() );
 
             aVD.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
             aVD.SetLineColor();
commit 8d144bb2a996c881c63597da5634fde56d5ff0c6
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Mon Jul 1 17:24:13 2013 +0300

    Remove aBoxAutoFmt member from SwTableAutoFmt
    
    Removed array of box autoformats from SwTableAutoFmt and
    adapted GetBoxFmt, SetBoxFmt, Save and Load methods.
    
    Change-Id: I9bf32f799ec386494a7fba4a520285ddb23cddaf

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index d8f3132..da2fd38 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -243,8 +243,6 @@ class SW_DLLPUBLIC SwTableAutoFmt
     // Calc specific flags.
     sal_Bool bInclWidthHeight : 1;
 
-    SwBoxAutoFmt* aBoxAutoFmt[ 16 ];
-
 public:
     SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle );
     SwTableAutoFmt( const SwTableAutoFmt& rNew );
@@ -254,8 +252,8 @@ public:
 
     SwTableFmt* GetTableStyle() { return m_pTableStyle; }
 
-    void SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos );
-    const SwBoxAutoFmt& GetBoxFmt( sal_uInt8 nPos ) const;
+    void SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos );
+    SwTableBoxFmt* GetBoxFmt( sal_uInt8 nPos ) const;
 
     void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
     const String& GetName() const { return aName; }
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 8840a20..e7084fe 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -653,15 +653,11 @@ SwTableAutoFmt::SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle )
     bInclBackground = sal_True;
     bInclValueFormat = sal_True;
     bInclWidthHeight = sal_True;
-
-    memset( aBoxAutoFmt, 0, sizeof( aBoxAutoFmt ) );
 }
 
 
 SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew )
 {
-    for( sal_uInt8 n = 0; n < 16; ++n )
-        aBoxAutoFmt[ n ] = 0;
     *this = rNew;
 }
 
@@ -670,18 +666,6 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
     if (&rNew == this)
         return *this;
 
-    for( sal_uInt8 n = 0; n < 16; ++n )
-    {
-        if( aBoxAutoFmt[ n ] )
-            delete aBoxAutoFmt[ n ];
-
-        SwBoxAutoFmt* pFmt = rNew.aBoxAutoFmt[ n ];
-        if( pFmt )      // if is set -> copy
-            aBoxAutoFmt[ n ] = new SwBoxAutoFmt( *pFmt );
-        else            // else default
-            aBoxAutoFmt[ n ] = 0;
-    }
-
     m_pTableStyle = rNew.m_pTableStyle;
     aName = rNew.aName;
     nStrResId = rNew.nStrResId;
@@ -695,44 +679,79 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
     return *this;
 }
 
-
-SwTableAutoFmt::~SwTableAutoFmt()
+void SwTableAutoFmt::SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos )
 {
-    SwBoxAutoFmt** ppFmt = aBoxAutoFmt;
-    for( sal_uInt8 n = 0; n < 16; ++n, ++ppFmt )
-        if( *ppFmt )
-            delete *ppFmt;
-}
+    OSL_ENSURE( nPos < 16, "wrong area" );
 
+    sal_uInt8 nLine = nPos / 4;
+    sal_uInt8 nBox = nPos % 4;
 
-void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos )
-{
-    OSL_ENSURE( nPos < 16, "wrong area" );
+    SwTableLineFmt* pLine;
 
-    SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
-    if( pFmt )      // if is set -> copy
-        *aBoxAutoFmt[ nPos ] = rNew;
-    else            // else set anew
-        aBoxAutoFmt[ nPos ] = new SwBoxAutoFmt( rNew );
+    switch( nLine )
+    {
+        case 0:
+            pLine = m_pTableStyle->GetFirstLineFmt(); break;
+        case 1:
+            pLine = m_pTableStyle->GetOddLineFmt(); break;
+        case 2:
+            pLine = m_pTableStyle->GetEvenLineFmt(); break;
+        case 3:
+            pLine = m_pTableStyle->GetLastLineFmt(); break;
+        // TODO Extend for columns
+    }
+
+    switch( nBox )
+    {
+        case 0:
+            pLine->SetFirstBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 1:
+            pLine->SetOddBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 2:
+            pLine->SetEvenBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+        case 3:
+            pLine->SetLastBoxFmt( new SwTableBoxFmt( rNew ) ); break;
+    }
 }
 
 
-const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
+SwTableBoxFmt* SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
 {
     OSL_ENSURE( nPos < 16, "wrong area" );
 
-    SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
-    if( pFmt )      // if is set -> copy
-        return *pFmt;
-    else            // else return the default
+    sal_uInt8 nLine = nPos / 4;
+    sal_uInt8 nBox = nPos % 4;
+
+    SwTableLineFmt* pLine;
+    SwTableBoxFmt* pRet;
+
+    switch( nLine )
     {
-        // If it doesn't exist yet:
-        if( !pDfltBoxAutoFmt )
-            pDfltBoxAutoFmt = new SwBoxAutoFmt;
-        return *pDfltBoxAutoFmt;
+        case 0:
+            pLine = m_pTableStyle->GetFirstLineFmt(); break;
+        case 1:
+            pLine = m_pTableStyle->GetOddLineFmt(); break;
+        case 2:
+            pLine = m_pTableStyle->GetEvenLineFmt(); break;
+        case 3:
+            pLine = m_pTableStyle->GetLastLineFmt(); break;
+        // TODO Extend for columns
+    }
+
+    switch( nBox )
+    {
+        case 0:
+            pRet = pLine->GetFirstBoxFmt();
+        case 1:
+            pRet = pLine->GetOddBoxFmt();
+        case 2:
+            pRet = pLine->GetEvenBoxFmt();
+        case 3:
+            pRet = pLine->GetLastBoxFmt();
     }
-}
 
+    return pRet;
+}
 
 
 void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
@@ -1011,11 +1030,11 @@ SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVe
 
         for( sal_uInt8 i = 0; bRet && i < 16; ++i )
         {
-            SwBoxAutoFmt* pFmt = new SwBoxAutoFmt;
-            // TODO Remove members in SwTableAutoFmt and adapt this
-            // bRet = pFmt->Load( rStream, rVersions, nVal );
+            SwTableBoxFmt* pFmt = pDoc->MakeTableBoxFmt();
+
+            bRet = pFmt->Load( rStream, rVersions, nVal );
             if( bRet )
-                pRet->aBoxAutoFmt[ i ] = pFmt;
+                pRet->SetBoxFmt( *pFmt, i );
             else
             {
                 delete pFmt;
@@ -1072,16 +1091,9 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
 
     for( int i = 0; bRet && i < 16; ++i )
     {
-        SwBoxAutoFmt* pFmt = aBoxAutoFmt[ i ];
-        if( !pFmt )     // if not set -> write default
-        {
-            // If it doesn't exist yet:
-            if( !pDfltBoxAutoFmt )
-                pDfltBoxAutoFmt = new SwBoxAutoFmt;
-            pFmt = pDfltBoxAutoFmt;
-        }
-        // TODO Remove members in SwTableAutoFmt and adapt this
-        // bRet = pFmt->Save( rStream, fileVersion );
+        SwTableBoxFmt* pFmt = GetBoxFmt( i );
+
+        bRet = pFmt->Save( rStream, fileVersion );
     }
     return bRet;
 }
@@ -1138,42 +1150,42 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
     SwTableFmt* pStyle = pDoc->FindTblFmtByName(sNm);
     if ( !pStyle )
         pStyle = pDoc->MakeTblFrmFmt(sNm, NULL);
-    SwTableAutoFmt* pNew = new SwTableAutoFmt( sNm, pStyle );
+    SwTableAutoFmt* pNewTableAutoFmt = new SwTableAutoFmt( sNm, pStyle );
 
-    SwBoxAutoFmt aNew;
+    SwTableBoxFmt* pNewBoxFmt = pDoc->MakeTableBoxFmt();
 
     sal_uInt8 i;
 
     Color aColor( COL_BLUE );
     SvxBrushItem aBrushItem( aColor, RES_BACKGROUND );
-    aNew.SetBackground( aBrushItem );
-    aNew.SetColor( SvxColorItem(Color( COL_WHITE ), RES_CHRATR_COLOR) );
+    pNewBoxFmt->SetBackground( aBrushItem );
+    pNewBoxFmt->SetColor( SvxColorItem(Color( COL_WHITE ), RES_CHRATR_COLOR) );
 
     for( i = 0; i < 4; ++i )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
 
     // 70% gray
     aBrushItem.SetColor( RGB_COLORDATA( 0x4d, 0x4d, 0x4d ) );
-    aNew.SetBackground( aBrushItem );
+    pNewBoxFmt->SetBackground( aBrushItem );
     for( i = 4; i <= 12; i += 4 )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
 
     // 20% gray
     aBrushItem.SetColor( RGB_COLORDATA( 0xcc, 0xcc, 0xcc ) );
-    aNew.SetBackground( aBrushItem );
+    pNewBoxFmt->SetBackground( aBrushItem );
     aColor.SetColor( COL_BLACK );
-    aNew.SetColor( SvxColorItem( aColor, RES_CHRATR_COLOR) );
+    pNewBoxFmt->SetColor( SvxColorItem( aColor, RES_CHRATR_COLOR) );
     for( i = 7; i <= 15; i += 4 )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
     for( i = 13; i <= 14; ++i )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
 
     aBrushItem.SetColor( Color( COL_WHITE ) );
-    aNew.SetBackground( aBrushItem );
+    pNewBoxFmt->SetBackground( aBrushItem );
     for( i = 5; i <= 6; ++i )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
     for( i = 9; i <= 10; ++i )
-        pNew->SetBoxFmt( aNew, i );
+        pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
 
 
     SvxBoxItem aBox( RES_BOX );
@@ -1186,10 +1198,10 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
     {
         aBox.SetLine( i <= 3 ? &aLn : 0, BOX_LINE_TOP );
         aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, BOX_LINE_RIGHT );
-        ((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox );
+        pNewTableAutoFmt->GetBoxFmt( i )->SetBox( aBox );
     }
 
-    m_pImpl->m_AutoFormats.push_back(pNew);
+    m_pImpl->m_AutoFormats.push_back(pNewTableAutoFmt);
 }
 
 sal_Bool SwTableAutoFmtTbl::Load()


More information about the Libreoffice-commits mailing list