diff options
-rw-r--r-- | editeng/source/items/frmitems.cxx | 27 | ||||
-rw-r--r-- | include/editeng/boxitem.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 12 |
4 files changed, 33 insertions, 31 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ffd0caff7814..7de28e36d49d 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2420,6 +2420,33 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ) } } +sal_uInt16 SvxBoxItem::CalcLineWidth( SvxBoxItemLine nLine ) const +{ + SvxBorderLine* pTmp = nullptr; + sal_uInt16 nWidth = 0; + switch ( nLine ) + { + case SvxBoxItemLine::TOP: + pTmp = pTop; + break; + case SvxBoxItemLine::BOTTOM: + pTmp = pBottom; + break; + case SvxBoxItemLine::LEFT: + pTmp = pLeft; + break; + case SvxBoxItemLine::RIGHT: + pTmp = pRight; + break; + default: + OSL_FAIL( "wrong line" ); + } + + if( pTmp ) + nWidth = pTmp->GetScaledWidth(); + + return nWidth; +} sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine ) const { diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 00227a4fa1d9..a63d4a19dfe3 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -110,6 +110,7 @@ public: // Line width plus Space plus inward distance // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set + sal_uInt16 CalcLineWidth( SvxBoxItemLine nLine ) const; sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = false ) const; bool HasBorder( bool bTreatPaddingAsBorder = false ) const; static css::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert ); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index b20d5e229cea..35059e45b998 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1678,26 +1678,10 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj, rInnerDist.Right()+=nLineThick; rInnerDist.Bottom()+=nLineThick; - const SvxBorderLine *pLine; - if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::LEFT))) - { - rInnerDist.Left() -= (pLine->GetScaledWidth()); - } - - if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::TOP))) - { - rInnerDist.Top() -= (pLine->GetScaledWidth()); - } - - if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::RIGHT))) - { - rInnerDist.Right() -= (pLine->GetScaledWidth()); - } - - if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::BOTTOM))) - { - rInnerDist.Bottom() -= (pLine->GetScaledWidth()); - } + rInnerDist.Left() -= aBox.CalcLineWidth( SvxBoxItemLine::LEFT ); + rInnerDist.Top() -= aBox.CalcLineWidth( SvxBoxItemLine::TOP ); + rInnerDist.Right() -= aBox.CalcLineWidth( SvxBoxItemLine::RIGHT ); + rInnerDist.Bottom() -= aBox.CalcLineWidth( SvxBoxItemLine::BOTTOM ); // set distances from box's border to text contained within the box if( 0 < rInnerDist.Left() ) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 0f9f245aa315..d7375533feb6 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3231,21 +3231,11 @@ void WW8TabDesc::AdjustNewBand() // we have to mimic this in the filter by picking the larger of the // sides and using that one on one side of the line (right) SvxBoxItem aCurrentBox(sw::util::ItemGet<SvxBoxItem>(*(pBox->GetFrameFormat()), RES_BOX)); - const ::editeng::SvxBorderLine *pLeftLine = aCurrentBox.GetLine(SvxBoxItemLine::LEFT); - int nCurrentRightLineWidth = 0; - if(pLeftLine) - nCurrentRightLineWidth = pLeftLine->GetScaledWidth(); - if (i != 0) { SwTableBox* pBox2 = (*m_pTabBoxes)[i-1]; SvxBoxItem aOldBox(sw::util::ItemGet<SvxBoxItem>(*(pBox2->GetFrameFormat()), RES_BOX)); - const ::editeng::SvxBorderLine *pRightLine = aOldBox.GetLine(SvxBoxItemLine::RIGHT); - int nOldBoxRightLineWidth = 0; - if(pRightLine) - nOldBoxRightLineWidth = pRightLine->GetScaledWidth(); - - if(nOldBoxRightLineWidth>nCurrentRightLineWidth) + if( aOldBox.CalcLineWidth(SvxBoxItemLine::RIGHT) > aCurrentBox.CalcLineWidth(SvxBoxItemLine::LEFT) ) aCurrentBox.SetLine(aOldBox.GetLine(SvxBoxItemLine::RIGHT), SvxBoxItemLine::LEFT); aOldBox.SetLine(nullptr, SvxBoxItemLine::RIGHT); |