diff options
-rw-r--r-- | editeng/source/items/frmitems.cxx | 12 | ||||
-rw-r--r-- | include/editeng/boxitem.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 16 |
3 files changed, 27 insertions, 6 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 7a51ddc069d0..ffd0caff7814 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2421,7 +2421,7 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ) } -sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine ) const +sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine ) const { SvxBorderLine* pTmp = nullptr; sal_uInt16 nDist = 0; @@ -2451,11 +2451,19 @@ sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine ) c { nDist = nDist + pTmp->GetScaledWidth(); } - else if( !bIgnoreLine ) + else if( !bEvenIfNoLine ) nDist = 0; return nDist; } +bool SvxBoxItem::HasBorder( bool bTreatPaddingAsBorder ) const +{ + return CalcLineSpace( SvxBoxItemLine::BOTTOM, bTreatPaddingAsBorder ) + || CalcLineSpace( SvxBoxItemLine::RIGHT, bTreatPaddingAsBorder ) + || CalcLineSpace( SvxBoxItemLine::TOP, bTreatPaddingAsBorder ) + || CalcLineSpace( SvxBoxItemLine::LEFT, bTreatPaddingAsBorder ); +} + // class SvxBoxInfoItem -------------------------------------------------- SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) : diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 11d055f47766..00227a4fa1d9 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -109,8 +109,9 @@ public: void SetRemoveAdjacentCellBorder( bool bSet ) { bRemoveAdjCellBorder = bSet; } // Line width plus Space plus inward distance - // bIgnoreLine = TRUE -> Also return distance, when no Line is set - sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine = false ) const; + // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set + 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 ); static bool LineToSvxLine(const css::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); static bool LineToSvxLine(const css::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 27beaa0dfb60..5ac99b8da9be 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -270,11 +270,23 @@ void SwNoTextFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec // In case the picture fly frm was clipped, render it with the origin // size instead of scaling it - if ( rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) ) + if ( pGrfNd && rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) ) { const SwFlyFreeFrame *pFly = dynamic_cast< const SwFlyFreeFrame* >( FindFlyFrame() ); if( pFly ) - aGrfArea = SwRect( Frame().Pos( ), pFly->GetUnclippedFrame( ).SSize( ) ); + { + bool bGetUnclippedFrame=true; + const SfxPoolItem* pItem; + if( pFly->GetFormat() && SfxItemState::SET == pFly->GetFormat()->GetItemState(RES_BOX, false, &pItem) ) + { + const SvxBoxItem& rBox = *static_cast<const SvxBoxItem*>(pItem); + if( rBox.HasBorder( /*bTreatPaddingAsBorder*/true) ) + bGetUnclippedFrame = false; + } + + if( bGetUnclippedFrame ) + aGrfArea = SwRect( Frame().Pos( ), pFly->GetUnclippedFrame( ).SSize( ) ); + } } aPaintArea.Intersection_( aOrigPaint ); |