[Libreoffice-commits] core.git: 3 commits - sw/source

Zolnai Tamás zolnaitamas2000 at gmail.com
Sun Aug 4 05:46:28 PDT 2013


 sw/source/core/inc/swfont.hxx     |    5 +++++
 sw/source/core/text/itrform2.cxx  |    4 +++-
 sw/source/core/text/porexp.cxx    |    1 +
 sw/source/core/txtnode/swfont.cxx |   20 ++++++++++----------
 4 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit c3ed56fdbc41326b306924c7793c01373e0b0d56
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Sat Aug 3 16:45:09 2013 +0200

    CharBrd 4.4: numbering
    
    Change-Id: I2d16662c723f7b4741b3784049692d74c1d33953

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 56b002b..fec3fdd 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -760,8 +760,8 @@ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor )
         // independent from hard attribute values
         SwFont* pFldFnt = ((SwFldPortion*)pPor)->pFnt;
         SwFontSave aSave( rInf, pFldFnt );
-        ((SwFldPortion*)pPor)->Height( pFldFnt->GetHeight( rInf.GetVsh(), *rInf.GetOut() ) );
-        ((SwFldPortion*)pPor)->SetAscent( pFldFnt->GetAscent( rInf.GetVsh(), *rInf.GetOut() ) );
+        pPor->Height( rInf.GetTxtHeight() );
+        pPor->SetAscent( rInf.GetAscent() );
     }
     // #i89179#
     // tab portion representing the list tab of a list label gets the
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index c030373..450d308 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -93,6 +93,7 @@ void SwExpandPortion::Paint( const SwTxtPaintInfo &rInf ) const
     SwTxtSlot aDiffTxt( &rInf, this, true, true );
 
     rInf.DrawBackBrush( *this );
+    rInf.DrawBorder( *this );
 
     // do we have to repaint a post it portion?
     if( rInf.OnWin() && pPortion && !pPortion->Width() )
commit 00515704d009d65e84404c0dc9bed7754df0f93e
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Sat Aug 3 14:31:59 2013 +0200

    Revert "Use SwTxtInfo height and ascent for portions"
    
    Not so easy
    
    This reverts commit 318bbbfc9bad8c0e04306faade2dec956ff89d28.

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 4c7f958..56b002b 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -758,8 +758,10 @@ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor )
     {
         // Numbering + InterNetFlds can keep an own font, then their size is
         // independent from hard attribute values
-        pPor->Height( rInf.GetTxtHeight() );
-        pPor->SetAscent( rInf.GetAscent() );
+        SwFont* pFldFnt = ((SwFldPortion*)pPor)->pFnt;
+        SwFontSave aSave( rInf, pFldFnt );
+        ((SwFldPortion*)pPor)->Height( pFldFnt->GetHeight( rInf.GetVsh(), *rInf.GetOut() ) );
+        ((SwFldPortion*)pPor)->SetAscent( pFldFnt->GetAscent( rInf.GetVsh(), *rInf.GetOut() ) );
     }
     // #i89179#
     // tab portion representing the list tab of a list label gets the
@@ -808,7 +810,7 @@ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor )
                 bChg = SeekAndChg( rInf );
         }
         if( bChg || bFirstPor || !pPor->GetAscent()
-            || !pLast->InTxtGrp() )
+            || !rInf.GetLast()->InTxtGrp() )
         {
             pPor->SetAscent( rInf.GetAscent()  );
             pPor->Height( rInf.GetTxtHeight() );
commit 44f930dafb191523d8f319dc27ee3f1060e692cd
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Sat Aug 3 14:16:51 2013 +0200

    Avoid some segmentation fault
    
    Set methods handle null pointers
    
    Change-Id: I9a66d13220d42e01aa90842ae189a5cf55fabf90

diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index a57a20f..97c78d2 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -381,6 +381,7 @@ public:
     const boost::optional<editeng::SvxBorderLine>& GetAbsLeftBorder( const bool bVertLayout ) const;
 
     bool HasBorder() const;
+    void RemoveBorders();
 };
 
 inline void SwFont::SetColor( const Color& rColor )
@@ -835,6 +836,10 @@ inline bool SwFont::HasBorder() const
     return m_aTopBorder || m_aBottomBorder || m_aLeftBorder || m_aRightBorder;
 }
 
+inline void SwFont::RemoveBorders()
+{
+    m_aTopBorder = m_aBottomBorder = m_aLeftBorder = m_aRightBorder = boost::none;
+}
 
 /*************************************************************************
  *                      class SwUnderlineFont
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index a88e47e..f816636 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -337,7 +337,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
     delete pBackColor;
     pBackColor = NULL;
 
-    m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none;
+    RemoveBorders();
 
     if( pAttrSet )
     {
@@ -520,10 +520,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
             sal_True, &pItem ))
         {
-            m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop();
-            m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom();
-            m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight();
-            m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft();
+            SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
+            SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
+            SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
+            SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
         }
         const SfxPoolItem* pTwoLinesItem = 0;
         if( SFX_ITEM_SET ==
@@ -687,13 +687,13 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
     if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
         sal_True, &pItem ))
     {
-        m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop();
-        m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom();
-        m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight();
-        m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft();
+        SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
+        SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
+        SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
+        SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
     }
     else
-        m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none;
+        RemoveBorders();
 
     const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
     if ( ! rTwoLinesItem.GetValue() )


More information about the Libreoffice-commits mailing list