[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - editeng/source include/editeng sw/source

Justin Luth justin_luth at sil.org
Mon Nov 7 15:57:29 UTC 2016


 editeng/source/items/frmitems.cxx |   12 ++++++++++--
 include/editeng/boxitem.hxx       |    5 +++--
 sw/source/core/doc/notxtfrm.cxx   |   16 ++++++++++++++--
 3 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit ab64ae2a828f4acd6d118abc14193c543d04b940
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Nov 5 11:11:29 2016 +0300

    tdf#90070 don't clip flys with borders
    
    regression from commit e598ab04476a32a08f18e8f0662fafa5f78f1a4a
    very aggressively forced a new frame size via compat setting
    CLIPPED_PICTURES on any fly - not just images.
    
    This only affects MS-format documents, EXCEPT that it is a document
    property, so if the file every spent any part of it's life in MS-format,
    it will always retain that compatibility setting. That explains
    why the problem was intermittent for me - and was hard to reproduce
    in a clean document, even though I'd seen it in .ODTs.
    
    bIgnoreLine (ignore the fact that there is no visible line)
    was a confusing word choice for "if there is no line,
    then return a spacing size of zero". bEvenIfNoLine=false is better.
    
    Change-Id: I50a3bdef3a67339ae517ee6319920651bc56f9be
    Reviewed-on: https://gerrit.libreoffice.org/30585
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit d034f273cb24ebe4fde20ad9089ac11cccf316d0)
    Reviewed-on: https://gerrit.libreoffice.org/30595

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 00a41e2..5c9c0ea 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2390,7 +2390,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;
@@ -2420,11 +2420,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 58ccb21..2fa7ef0 100644
--- a/include/editeng/boxitem.hxx
+++ b/include/editeng/boxitem.hxx
@@ -109,8 +109,9 @@ public:
     void SetRemoveAdjacentCellBorder( bool bSet = true ) { 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 d391bfa..8578e45 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -277,11 +277,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 );


More information about the Libreoffice-commits mailing list