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

Alex Ivan alexnivan at yahoo.com
Sat Jun 29 10:35:33 PDT 2013


 sw/inc/swtblfmt.hxx             |   81 ++++++++++++++--------------
 sw/source/core/doc/swtblfmt.cxx |  115 ++++++++++++++++++++++++++++------------
 sw/source/core/doc/tblafmt.cxx  |    2 
 3 files changed, 127 insertions(+), 71 deletions(-)

New commits:
commit 3e253b6cf39256135eaab39e66cf495764576702
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Sat Jun 29 20:21:07 2013 +0300

    Store/RestoreTableProperties handle components
    
    Methods now also store/apply information regarding
    the format of components.
    
    Change-Id: Id6b1b255974e593f373e43972214e451f5ba7047

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 16fc373..3f25f7a 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -75,6 +75,7 @@ protected:
     SwTableLineFmt* m_pEvnColFmt;
 
 public:
+    SwTableFmt( SwTableFmt& rNew );
     SwTableFmt& operator=( const SwTableFmt& rNew );
 
     void SetFirstLineFmt( SwTableLineFmt* pNew ) { m_pFstLineFmt = pNew; }
@@ -112,6 +113,8 @@ public:
     sal_Bool GetRowSplit() const;
     sal_uInt16 GetRepeatHeading() const;
 
+    void CopyTableFormatInfo( SwTableFmt* pTableFormat );
+
     TYPEINFO();     // Already in base class Content.
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwTableFmt)
@@ -135,6 +138,8 @@ protected:
     SwTableBoxFmt* m_pEvnBoxFmt;
 
 public:
+    SwTableLineFmt( SwTableLineFmt& rNew );
+    SwTableLineFmt& operator=( const SwTableLineFmt& rNew );
 
     void SetFirstBoxFmt( SwTableBoxFmt* pNew ) { m_pFstBoxFmt = pNew; }
     void SetLastBoxFmt( SwTableBoxFmt* pNew ) { m_pLstBoxFmt = pNew; }
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 7d0bbe3..d31b8e2 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -69,6 +69,20 @@ SwTableFmt::SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
         m_pEvnColFmt = pDoc->MakeTableLineFmt();
     }
 
+SwTableFmt::SwTableFmt( SwTableFmt& rNew )
+    : SwFrmFmt( (SwFrmFmt)rNew )
+    {
+        *m_pFstLineFmt = SwTableLineFmt( *rNew.GetFirstLineFmt() );
+        *m_pLstLineFmt = SwTableLineFmt( *rNew.GetLastLineFmt() );
+        *m_pOddLineFmt = SwTableLineFmt( *rNew.GetOddLineFmt() );
+        *m_pEvnLineFmt = SwTableLineFmt( *rNew.GetEvenLineFmt() );
+
+        *m_pFstColFmt = SwTableLineFmt( *rNew.GetFirstColFmt() );
+        *m_pLstColFmt = SwTableLineFmt( *rNew.GetLastColFmt() );
+        *m_pOddColFmt = SwTableLineFmt( *rNew.GetOddColFmt() );
+        *m_pEvnColFmt = SwTableLineFmt( *rNew.GetEvenColFmt() );
+    }
+
 SwTableFmt& SwTableFmt::operator=( const SwTableFmt& rNew )
     {
         if (&rNew == this)
@@ -152,6 +166,19 @@ sal_uInt16 SwTableFmt::GetRepeatHeading() const
     return (static_cast<const SfxUInt16Item&>( GetFmtAttr( FN_PARAM_TABLE_HEADLINE ) )).GetValue();
 }
 
+void SwTableFmt::CopyTableFormatInfo( SwTableFmt* pTableFormat )
+{
+    *m_pFstLineFmt = SwTableLineFmt ( *pTableFormat->GetFirstLineFmt() );
+    *m_pLstLineFmt = SwTableLineFmt ( *pTableFormat->GetLastLineFmt() );
+    *m_pOddLineFmt = SwTableLineFmt ( *pTableFormat->GetOddLineFmt() );
+    *m_pEvnLineFmt = SwTableLineFmt ( *pTableFormat->GetEvenLineFmt() );
+
+    *m_pFstColFmt = SwTableLineFmt ( *pTableFormat->GetFirstColFmt() );
+    *m_pLstColFmt = SwTableLineFmt ( *pTableFormat->GetLastColFmt() );
+    *m_pOddColFmt = SwTableLineFmt ( *pTableFormat->GetOddColFmt() );
+    *m_pEvnColFmt = SwTableLineFmt ( *pTableFormat->GetEvenColFmt() );
+}
+
 SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableLineSetRange )
@@ -176,6 +203,28 @@ SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const String &rFmtNm,
         m_pEvnBoxFmt = pDoc->MakeTableBoxFmt();
     }
 
+SwTableLineFmt::SwTableLineFmt( SwTableLineFmt& rNew )
+    : SwFrmFmt( (SwFrmFmt)rNew )
+    {
+        *m_pFstBoxFmt = SwTableBoxFmt( *rNew.GetFirstBoxFmt() );
+        *m_pLstBoxFmt = SwTableBoxFmt( *rNew.GetLastBoxFmt() );
+        *m_pOddBoxFmt = SwTableBoxFmt( *rNew.GetOddBoxFmt() );
+        *m_pEvnBoxFmt = SwTableBoxFmt( *rNew.GetEvenBoxFmt() );
+    }
+
+SwTableLineFmt& SwTableLineFmt::operator=( const SwTableLineFmt& rNew )
+    {
+        if (&rNew == this)
+                return *this;
+
+        m_pFstBoxFmt = rNew.m_pFstBoxFmt;
+        m_pLstBoxFmt = rNew.m_pLstBoxFmt;
+        m_pOddBoxFmt = rNew.m_pOddBoxFmt;
+        m_pEvnBoxFmt = rNew.m_pEvnBoxFmt;
+
+        return *this;
+    }
+
 SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index abbddbc..baa170a 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -850,6 +850,7 @@ void SwTableAutoFmt::RestoreTableProperties(SwTable &table) const
         return;
 
     pFormat->SetFmtAttr( m_pTableStyle->GetAttrSet() );
+    pFormat->CopyTableFormatInfo( m_pTableStyle );
 
     SwEditShell *pShell = pDoc->GetEditShell();
     pDoc->SetRowSplit(*pShell->getShellCrsr(false), SwFmtRowSplit(m_pTableStyle->GetRowSplit()));
@@ -875,6 +876,7 @@ void SwTableAutoFmt::StoreTableProperties(const SwTable &table)
     pRowSplit = 0;
 
     m_pTableStyle->SetFmtAttr( pFormat->GetAttrSet() );
+    m_pTableStyle->CopyTableFormatInfo( pFormat );
 }
 
 SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc )
commit bfdb19a6ccfae9e0c97066ab4074f3dea36244be
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Sat Jun 29 16:30:42 2013 +0300

    Fix stylistic issue
    
    Added "m_" prefix to member variables of SwTable*Fmt.
    
    Change-Id: I80c6311d91f243298d56cb9da4ab80ff606b075b

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index cbbed13..16fc373 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -64,38 +64,38 @@ protected:
     SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
                     SwFrmFmt *pDrvdFrm );
 
-    SwTableLineFmt* pFstLineFmt;
-    SwTableLineFmt* pLstLineFmt;
-    SwTableLineFmt* pOddLineFmt;
-    SwTableLineFmt* pEvnLineFmt;
+    SwTableLineFmt* m_pFstLineFmt;
+    SwTableLineFmt* m_pLstLineFmt;
+    SwTableLineFmt* m_pOddLineFmt;
+    SwTableLineFmt* m_pEvnLineFmt;
 
-    SwTableLineFmt* pFstColFmt;
-    SwTableLineFmt* pLstColFmt;
-    SwTableLineFmt* pOddColFmt;
-    SwTableLineFmt* pEvnColFmt;
+    SwTableLineFmt* m_pFstColFmt;
+    SwTableLineFmt* m_pLstColFmt;
+    SwTableLineFmt* m_pOddColFmt;
+    SwTableLineFmt* m_pEvnColFmt;
 
 public:
     SwTableFmt& operator=( const SwTableFmt& rNew );
 
-    void SetFirstLineFmt( SwTableLineFmt* pNew ) { pFstLineFmt = pNew; }
-    void SetLastLineFmt( SwTableLineFmt* pNew ) { pLstLineFmt = pNew; }
-    void SetOddLineFmt( SwTableLineFmt* pNew ) { pOddLineFmt = pNew; }
-    void SetEvenLineFmt( SwTableLineFmt* pNew ) { pEvnLineFmt = pNew; }
+    void SetFirstLineFmt( SwTableLineFmt* pNew ) { m_pFstLineFmt = pNew; }
+    void SetLastLineFmt( SwTableLineFmt* pNew ) { m_pLstLineFmt = pNew; }
+    void SetOddLineFmt( SwTableLineFmt* pNew ) { m_pOddLineFmt = pNew; }
+    void SetEvenLineFmt( SwTableLineFmt* pNew ) { m_pEvnLineFmt = pNew; }
 
-    void SetFirstColFmt( SwTableLineFmt* pNew ) { pFstColFmt = pNew; }
-    void SetLastColFmt( SwTableLineFmt* pNew ) { pLstColFmt = pNew; }
-    void SetOddColFmt( SwTableLineFmt* pNew ) { pOddColFmt = pNew; }
-    void SetEvenColFmt( SwTableLineFmt* pNew ) { pEvnColFmt = pNew; }
+    void SetFirstColFmt( SwTableLineFmt* pNew ) { m_pFstColFmt = pNew; }
+    void SetLastColFmt( SwTableLineFmt* pNew ) { m_pLstColFmt = pNew; }
+    void SetOddColFmt( SwTableLineFmt* pNew ) { m_pOddColFmt = pNew; }
+    void SetEvenColFmt( SwTableLineFmt* pNew ) { m_pEvnColFmt = pNew; }
 
-    SwTableLineFmt* GetFirstLineFmt() { return pFstLineFmt; }
-    SwTableLineFmt* GetLastLineFmt() { return pLstLineFmt; }
-    SwTableLineFmt* GetOddLineFmt() { return pOddLineFmt; }
-    SwTableLineFmt* GetEvenLineFmt() { return pEvnLineFmt; }
+    SwTableLineFmt* GetFirstLineFmt() { return m_pFstLineFmt; }
+    SwTableLineFmt* GetLastLineFmt() { return m_pLstLineFmt; }
+    SwTableLineFmt* GetOddLineFmt() { return m_pOddLineFmt; }
+    SwTableLineFmt* GetEvenLineFmt() { return m_pEvnLineFmt; }
 
-    SwTableLineFmt* GetFirstColFmt() { return pFstColFmt; }
-    SwTableLineFmt* GetLastColFmt() { return pLstColFmt; }
-    SwTableLineFmt* GetOddColFmt() { return pOddColFmt; }
-    SwTableLineFmt* GetEvenColFmt() { return pEvnColFmt; }
+    SwTableLineFmt* GetFirstColFmt() { return m_pFstColFmt; }
+    SwTableLineFmt* GetLastColFmt() { return m_pLstColFmt; }
+    SwTableLineFmt* GetOddColFmt() { return m_pOddColFmt; }
+    SwTableLineFmt* GetEvenColFmt() { return m_pEvnColFmt; }
 
     void SetBreak( const SvxFmtBreakItem& rNew );
     void SetPageDesc( const SwFmtPageDesc& rNew );
@@ -129,22 +129,22 @@ protected:
                     SwFrmFmt *pDrvdFrm );
 
     // Odd and Even Box formats will be used to handle alternating columns
-    SwTableBoxFmt* pFstBoxFmt;
-    SwTableBoxFmt* pLstBoxFmt;
-    SwTableBoxFmt* pOddBoxFmt;
-    SwTableBoxFmt* pEvnBoxFmt;
+    SwTableBoxFmt* m_pFstBoxFmt;
+    SwTableBoxFmt* m_pLstBoxFmt;
+    SwTableBoxFmt* m_pOddBoxFmt;
+    SwTableBoxFmt* m_pEvnBoxFmt;
 
 public:
 
-    void SetFirstBoxFmt( SwTableBoxFmt* pNew ) { pFstBoxFmt = pNew; }
-    void SetLastBoxFmt( SwTableBoxFmt* pNew ) { pLstBoxFmt = pNew; }
-    void SetOddBoxFmt( SwTableBoxFmt* pNew ) { pOddBoxFmt = pNew; }
-    void SetEvenBoxFmt( SwTableBoxFmt* pNew ) { pEvnBoxFmt = pNew; }
+    void SetFirstBoxFmt( SwTableBoxFmt* pNew ) { m_pFstBoxFmt = pNew; }
+    void SetLastBoxFmt( SwTableBoxFmt* pNew ) { m_pLstBoxFmt = pNew; }
+    void SetOddBoxFmt( SwTableBoxFmt* pNew ) { m_pOddBoxFmt = pNew; }
+    void SetEvenBoxFmt( SwTableBoxFmt* pNew ) { m_pEvnBoxFmt = pNew; }
 
-    SwTableBoxFmt* GetFirstBoxFmt() { return pFstBoxFmt; }
-    SwTableBoxFmt* GetLastBoxFmt() { return pLstBoxFmt; }
-    SwTableBoxFmt* GetOddBoxFmt() { return pOddBoxFmt; }
-    SwTableBoxFmt* GetEvenBoxFmt() { return pEvnBoxFmt; }
+    SwTableBoxFmt* GetFirstBoxFmt() { return m_pFstBoxFmt; }
+    SwTableBoxFmt* GetLastBoxFmt() { return m_pLstBoxFmt; }
+    SwTableBoxFmt* GetOddBoxFmt() { return m_pOddBoxFmt; }
+    SwTableBoxFmt* GetEvenBoxFmt() { return m_pEvnBoxFmt; }
 
     TYPEINFO();     // Already in base class Content.
 
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index d7b5e1c..7d0bbe3 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -33,15 +33,15 @@ SwTableFmt::SwTableFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
 
         SwDoc* pDoc = GetDoc();
 
-        pFstLineFmt = pDoc->MakeTableLineFmt();
-        pLstLineFmt = pDoc->MakeTableLineFmt();
-        pOddLineFmt = pDoc->MakeTableLineFmt();
-        pEvnLineFmt = pDoc->MakeTableLineFmt();
-
-        pFstColFmt = pDoc->MakeTableLineFmt();
-        pLstColFmt = pDoc->MakeTableLineFmt();
-        pOddColFmt = pDoc->MakeTableLineFmt();
-        pEvnColFmt = pDoc->MakeTableLineFmt();
+        m_pFstLineFmt = pDoc->MakeTableLineFmt();
+        m_pLstLineFmt = pDoc->MakeTableLineFmt();
+        m_pOddLineFmt = pDoc->MakeTableLineFmt();
+        m_pEvnLineFmt = pDoc->MakeTableLineFmt();
+
+        m_pFstColFmt = pDoc->MakeTableLineFmt();
+        m_pLstColFmt = pDoc->MakeTableLineFmt();
+        m_pOddColFmt = pDoc->MakeTableLineFmt();
+        m_pEvnColFmt = pDoc->MakeTableLineFmt();
     }
 
 SwTableFmt::SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
@@ -58,15 +58,15 @@ SwTableFmt::SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
 
         SwDoc* pDoc = GetDoc();
 
-        pFstLineFmt = pDoc->MakeTableLineFmt();
-        pLstLineFmt = pDoc->MakeTableLineFmt();
-        pOddLineFmt = pDoc->MakeTableLineFmt();
-        pEvnLineFmt = pDoc->MakeTableLineFmt();
+        m_pFstLineFmt = pDoc->MakeTableLineFmt();
+        m_pLstLineFmt = pDoc->MakeTableLineFmt();
+        m_pOddLineFmt = pDoc->MakeTableLineFmt();
+        m_pEvnLineFmt = pDoc->MakeTableLineFmt();
 
-        pFstColFmt = pDoc->MakeTableLineFmt();
-        pLstColFmt = pDoc->MakeTableLineFmt();
-        pOddColFmt = pDoc->MakeTableLineFmt();
-        pEvnColFmt = pDoc->MakeTableLineFmt();
+        m_pFstColFmt = pDoc->MakeTableLineFmt();
+        m_pLstColFmt = pDoc->MakeTableLineFmt();
+        m_pOddColFmt = pDoc->MakeTableLineFmt();
+        m_pEvnColFmt = pDoc->MakeTableLineFmt();
     }
 
 SwTableFmt& SwTableFmt::operator=( const SwTableFmt& rNew )
@@ -74,15 +74,15 @@ SwTableFmt& SwTableFmt::operator=( const SwTableFmt& rNew )
         if (&rNew == this)
             return *this;
 
-        pFstLineFmt = rNew.pFstLineFmt;
-        pLstLineFmt = rNew.pLstLineFmt;
-        pOddLineFmt = rNew.pOddLineFmt;
-        pEvnLineFmt = rNew.pEvnLineFmt;
+        m_pFstLineFmt = rNew.m_pFstLineFmt;
+        m_pLstLineFmt = rNew.m_pLstLineFmt;
+        m_pOddLineFmt = rNew.m_pOddLineFmt;
+        m_pEvnLineFmt = rNew.m_pEvnLineFmt;
 
-        pFstColFmt = rNew.pFstColFmt;
-        pLstColFmt = rNew.pLstColFmt;
-        pOddColFmt = rNew.pOddColFmt;
-        pEvnColFmt = rNew.pEvnColFmt;
+        m_pFstColFmt = rNew.m_pFstColFmt;
+        m_pLstColFmt = rNew.m_pLstColFmt;
+        m_pOddColFmt = rNew.m_pOddColFmt;
+        m_pEvnColFmt = rNew.m_pEvnColFmt;
 
         return *this;
     }
@@ -158,10 +158,10 @@ SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
     {
         SwDoc* pDoc = GetDoc();
 
-        pFstBoxFmt = pDoc->MakeTableBoxFmt();
-        pLstBoxFmt = pDoc->MakeTableBoxFmt();
-        pOddBoxFmt = pDoc->MakeTableBoxFmt();
-        pEvnBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pFstBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pLstBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pOddBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pEvnBoxFmt = pDoc->MakeTableBoxFmt();
     }
 
 SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const String &rFmtNm,
@@ -170,10 +170,10 @@ SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const String &rFmtNm,
     {
         SwDoc* pDoc = GetDoc();
 
-        pFstBoxFmt = pDoc->MakeTableBoxFmt();
-        pLstBoxFmt = pDoc->MakeTableBoxFmt();
-        pOddBoxFmt = pDoc->MakeTableBoxFmt();
-        pEvnBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pFstBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pLstBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pOddBoxFmt = pDoc->MakeTableBoxFmt();
+        m_pEvnBoxFmt = pDoc->MakeTableBoxFmt();
     }
 
 SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,


More information about the Libreoffice-commits mailing list