[Libreoffice-commits] core.git: sd/qa svx/source

Xisco Fauli anistenis at gmail.com
Fri Jan 29 23:40:59 PST 2016


 sd/qa/unit/import-tests.cxx        |    3 +--
 svx/source/table/cell.cxx          |    2 +-
 svx/source/table/tablelayouter.cxx |   12 +++++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 13d4398820ded5914f635757865e258db2db2b57
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Thu Jan 21 20:56:31 2016 +0100

    tdf#91762: Check wether the row and the cell have text...
    
    ... in order to set the row's min height
    
    Regression from 4f2c8194f485b1527fb4f4dfe23ce804937f1f9c
    After this commit, the row's min height was set based only on
    the cells containing text in the row, but the problem appeared
    when the row didn't have any cell with text.
    Change logic to check wether there's text in the cell and in the row.
    
    Now, height in SdImportTest::testRowHeight() is 507 instead of
    508 but I can't figure it out why. However, I believe there's
    no harm in change the test from 508 to 507 as, visually speaking,
    the difference can't be distinguish.
    
    Change-Id: I0b3a14c34eaeaa8e77227860ca290fb79a0302ce
    Reviewed-on: https://gerrit.libreoffice.org/21692
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 49db223..9f4c2e3 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1093,9 +1093,8 @@ void SdImportTest::testRowHeight()
     uno::Reference< css::table::XTableRows > xRows( xTable->getRows(), uno::UNO_QUERY_THROW);
     uno::Reference< beans::XPropertySet > xRefRow( xRows->getByIndex(0), uno::UNO_QUERY_THROW );
     xRefRow->getPropertyValue( sHeight ) >>= nHeight;
-    CPPUNIT_ASSERT_EQUAL( sal_Int32(508), nHeight);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(507), nHeight);
 }
-
 void SdImportTest::testTdf93830()
 {
     // Text shape offset was ignored
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 6b70d08..b2d1604 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -718,7 +718,7 @@ sal_Int32 Cell::getMinimumHeight()
         pEditOutliner->SetMaxAutoPaperSize(aSize);
         nMinimumHeight = pEditOutliner->GetTextHeight()+1;
     }
-    else if ( hasText() )
+    else
     {
         Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
         rOutliner.SetPaperSize(aSize);
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 892b0d9..1df1378 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -688,6 +688,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
         sal_Int32 nMinHeight = 0;
 
         bool bIsEmpty = true; // check if all cells in this row are merged
+        bool bRowHasText = false;
 
         for( nCol = 0; nCol < nColCount; ++nCol )
         {
@@ -704,7 +705,16 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
                 }
                 else
                 {
-                    nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() );
+                    bool bCellHasText = xCell->hasText();
+                    if ( (!bRowHasText && !bCellHasText) || ( bRowHasText && bCellHasText ) )
+                    {
+                        nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() );
+                    }
+                    else if ( !bRowHasText && bCellHasText )
+                    {
+                        bRowHasText = true;
+                        nMinHeight = xCell->getMinimumHeight();
+                    }
                 }
             }
         }


More information about the Libreoffice-commits mailing list