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

Alex Ivan alexnivan at yahoo.com
Fri Aug 2 08:20:02 PDT 2013


 sw/inc/format.hxx               |    1 
 sw/source/core/doc/swtblfmt.cxx |  111 ++++++++++------------------------------
 2 files changed, 31 insertions(+), 81 deletions(-)

New commits:
commit 5345916a90c80923d7f5a6a621b7461c7ab63f6e
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Fri Aug 2 18:13:24 2013 +0300

    Remove default attribute values from Sw*Fmt
    
    These values, because they were being set in the Sw*Fmts from the
    hard format, were "blocking" the attributes from the table style.
    
    All atributes are not yet correctly propagated.
    
    Also, the changes are not instant. There needs to be some other
    interaction with the document before they come into effect.
    
    Change-Id: I0c9775c5e988862d67067ac3bc9869851d85945b

diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 62aeace..8c91b77 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -23,14 +23,6 @@ SwTableFmt::SwTableFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableSetRange )
     {
-        SetBreak( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
-        SetKeepWithNextPara( SvxFmtKeepItem( sal_False, RES_KEEP ) );
-        SetLayoutSplit( sal_True );
-        SetCollapsingBorders( sal_True );
-        SetRowSplit( sal_True );
-        SetRepeatHeading( 0 );
-        SetShadow( SvxShadowItem( RES_SHADOW ) );
-
         SwDoc* pDoc = GetDoc();
 
         m_pFstLineFmt.reset( pDoc->MakeTableLineFmt() );
@@ -48,14 +40,6 @@ SwTableFmt::SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableSetRange )
     {
-        SetBreak( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
-        SetKeepWithNextPara( SvxFmtKeepItem( sal_False, RES_KEEP ) );
-        SetLayoutSplit( sal_True );
-        SetCollapsingBorders( sal_True );
-        SetRowSplit( sal_True );
-        SetRepeatHeading( 0 );
-        SetShadow( SvxShadowItem( RES_SHADOW ) );
-
         SwDoc* pDoc = GetDoc();
 
         m_pFstLineFmt.reset( pDoc->MakeTableLineFmt() );
@@ -457,74 +441,12 @@ SwTableLineFmt& SwTableLineFmt::operator=( const SwTableLineFmt& rNew )
 SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
-    {
-        SetFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) );
-        SetHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE) );
-        SetWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ) );
-        SetPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ) );
-
-        SetCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) );
-        SetCJKHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE) );
-        SetCJKWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ) );
-        SetCJKPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ) );
-
-        SetCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) );
-        SetCTLHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE) );
-        SetCTLWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ) );
-        SetCTLPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ) );
-
-        SetUnderline( SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ) );
-        SetOverline( SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE ) );
-        SetCrossedOut( SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
-        SetContour( SvxContourItem( sal_False, RES_CHRATR_CONTOUR ) );
-        SetShadowed( SvxShadowedItem( sal_False, RES_CHRATR_SHADOWED ) );
-        SetColor( SvxColorItem( RES_CHRATR_COLOR ) );
-        SvxBoxItem rNew = SvxBoxItem( RES_BOX );
-        rNew.SetDistance( 55 );
-        SetBox( rNew );
-        SetBackground( SvxBrushItem( RES_BACKGROUND ) );
-        SetAdjust( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
-        SetTextOrientation( SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) );
-        SetVerticalAlignment( SwFmtVertOrient( 0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME ) );
-
-        eSysLanguage = eNumFmtLanguage = ::GetAppLanguage();
-    }
+    {}
 
 SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const String &rFmtNm,
                     SwFrmFmt *pDrvdFrm )
     : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
-    {
-        SetFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) );
-        SetHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE) );
-        SetWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ) );
-        SetPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ) );
-
-        SetCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) );
-        SetCJKHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE) );
-        SetCJKWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ) );
-        SetCJKPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ) );
-
-        SetCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) );
-        SetCTLHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE) );
-        SetCTLWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ) );
-        SetCTLPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ) );
-
-        SetUnderline( SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ) );
-        SetOverline( SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE ) );
-        SetCrossedOut( SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
-        SetContour( SvxContourItem( sal_False, RES_CHRATR_CONTOUR ) );
-        SetShadowed( SvxShadowedItem( sal_False, RES_CHRATR_SHADOWED ) );
-        SetColor( SvxColorItem( RES_CHRATR_COLOR ) );
-        SvxBoxItem rNew = SvxBoxItem( RES_BOX );
-        rNew.SetDistance( 55 );
-        SetBox( rNew );
-        SetBackground( SvxBrushItem( RES_BACKGROUND ) );
-        SetAdjust( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
-        SetTextOrientation( SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) );
-        SetVerticalAlignment( SwFmtVertOrient( 0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME ) );
-
-        eSysLanguage = eNumFmtLanguage = ::GetAppLanguage();
-    }
+    {}
 
 void SwTableBoxFmt::SetFont( const SvxFontItem& rNew )
 {
commit a6c71aa549e3b5a00f19c618624bafd9b7007334
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Fri Aug 2 18:05:09 2013 +0300

    Set coresponding parent to attribute set
    
    Changing style on a table now also changes the parent of the
    attribute set of the format of each element.
    
    Change-Id: I6bdc69bfe385932690851a18a47901e77e57bbec

diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index bf565f4..7ee6d6c 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -108,6 +108,7 @@ public:
 
     /// For querying the attribute array.
     inline const SwAttrSet& GetAttrSet() const { return aSet; }
+    inline       SwAttrSet& GetAttrSet()       { return aSet; }
 
     /** Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
        im Zugriff. */
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index c771894..62aeace 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -263,11 +263,15 @@ 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 );
 
@@ -307,9 +311,15 @@ void SwTableFmt::AssignLineParents( SwTableFmt* pSrcFmt, SwTable &rTable )
         }
 
         if( pFmt )
+        {
             pLineFmt->RegisterToFormat( *pFmt );
+            pLineFmt->GetAttrSet().SetParent( &pFmt->GetAttrSet() );
+        }
         else if( pLineFmt->GetRegisteredIn() )
+        {
             ((SwTableLineFmt*)pLineFmt->GetRegisteredIn())->Remove( pLineFmt );
+            pLineFmt->GetAttrSet().SetParent( NULL );
+        }
 
         AssignBoxParents( pFmt, *rTable.GetTabLines()[ n ] );
     }
@@ -336,10 +346,15 @@ void SwTableFmt::AssignBoxParents( SwTableLineFmt* pSrcLineFmt, SwTableLine &rLi
         }
 
         if( pFmt )
+        {
             pBoxFmt->RegisterToFormat( *pFmt );
+            pBoxFmt->GetAttrSet().SetParent( &pFmt->GetAttrSet() );
+        }
         else if( pBoxFmt->GetRegisteredIn() )
+        {
             ((SwTableBoxFmt*)pBoxFmt->GetRegisteredIn())->Remove( pBoxFmt );
-
+            pBoxFmt->GetAttrSet().SetParent( NULL );
+        }
 
         if( rLine.GetTabBoxes()[ n ]->GetTabLines().size() )
             AssignLineParents_Complex( pSrcLineFmt, pFmt, *rLine.GetTabBoxes()[ n ] );
@@ -354,9 +369,15 @@ void SwTableFmt::AssignLineParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTable
         SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rBox.GetTabLines()[ n ]->GetFrmFmt();
 
         if( pSrcLineFmt )
+        {
             pLineFmt->RegisterToFormat( *pSrcLineFmt );
+            pLineFmt->GetAttrSet().SetParent( &pSrcLineFmt->GetAttrSet() );
+        }
         else
+        {
             ((SwTableLineFmt*)pLineFmt->GetRegisteredIn())->Remove( pLineFmt );
+            pLineFmt->GetAttrSet().SetParent( NULL );
+        }
 
         AssignBoxParents_Complex( pSrcLineFmt, pSrcBoxFmt, *rBox.GetTabLines()[ n ] );
     }
@@ -370,9 +391,15 @@ void SwTableFmt::AssignBoxParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableB
         SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->GetFrmFmt();
 
         if( pSrcBoxFmt )
+        {
             pBoxFmt->RegisterToFormat( *pSrcBoxFmt );
+            pBoxFmt->GetAttrSet().SetParent( &pSrcBoxFmt->GetAttrSet() );
+        }
         else
+        {
             ((SwTableBoxFmt*)pBoxFmt->GetRegisteredIn())->Remove( pBoxFmt );
+            pBoxFmt->GetAttrSet().SetParent( NULL );
+        }
 
         if( rLine.GetTabBoxes()[ n ]->GetTabLines().size() )
             AssignLineParents_Complex( pSrcLineFmt, pSrcBoxFmt, *rLine.GetTabBoxes()[ n ] );


More information about the Libreoffice-commits mailing list