[PATCH] better import xlsx heights

Noel Power noel.power at novell.com
Fri Jun 8 03:05:57 PDT 2012


don't call UpdateAllRowHeights when IsAdjustHeightEnabled property is set an
d additionally set manual heights for *all* imported row heights ( same afaics x
ls import does ) - certainly this improves import ( also see documents attached
in i#94028, i#93609 )

Change-Id: I19d46753cf692bc9768512a2267e03a7a75a0f6e
---
 oox/source/xls/sheetdatabuffer.cxx |    2 --
 oox/source/xls/worksheethelper.cxx |   30 +++---------------------------
 sc/source/ui/unoobj/docuno.cxx     |    4 ----
 3 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx
index 0839b9d..5b314ac 100644
--- a/oox/source/xls/sheetdatabuffer.cxx
+++ b/oox/source/xls/sheetdatabuffer.cxx
@@ -921,8 +921,6 @@ void SheetDataBuffer::finalizeMergedRange( const CellRangeAddress& rRange )
                 Reference< XText > xText( xTopLeft, UNO_QUERY );
                 bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0);
             }
-            if( bTextWrap )
-                setManualRowHeight( rRange.StartRow );
         }
     }
     catch( Exception& )
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index e8a2972..bdf6754 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -335,8 +335,6 @@ public:
         @descr  Row default formatting is converted directly, other settings
         are cached and converted in the finalizeImport() call. */
     void                setRowModel( const RowModel& rModel );
-    /** Specifies that the passed row needs to set its height manually. */
-    void                setManualRowHeight( sal_Int32 nRow );
 
     /** Initial conversion before importing the worksheet. */
     void                initializeWorksheetImport();
@@ -394,7 +392,6 @@ private:
     RowModelRangeMap    maRowModels;        /// Ranges of rows sorted by first row index.
     HyperlinkModelList  maHyperlinks;       /// Cell ranges containing hyperlinks.
     ValidationModelList maValidations;      /// Cell ranges containing data validation settings.
-    ValueRangeSet       maManualRowHeights; /// Rows that need manual height independent from own settings.
     SheetDataBuffer     maSheetData;        /// Buffer for cell contents and cell formatting.
     CondFormatBuffer    maCondFormats;      /// Buffer for conditional formatting.
     CommentsBuffer      maComments;         /// Buffer for all cell comments in this sheet.
@@ -930,11 +927,6 @@ void WorksheetGlobals::setRowModel( const RowModel& rModel )
     lclUpdateProgressBar( mxRowProgress, maUsedArea, nRow );
 }
 
-void WorksheetGlobals::setManualRowHeight( sal_Int32 nRow )
-{
-    maManualRowHeights.insert( nRow );
-}
-
 void WorksheetGlobals::initializeWorksheetImport()
 {
     // set default cell style for unused cells
@@ -1223,20 +1215,9 @@ void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels,
     sal_Int32 nHeight = getUnitConverter().scaleToMm100( fHeight, UNIT_POINT );
     if( nHeight > 0 )
     {
-        /*  Get all rows that have custom height inside the passed row model.
-            If the model has the custom height flag set, all its rows have
-            custom height, otherwise get all rows specified in the class member
-            maManualRowHeights that are inside the passed row model. */
-        ValueRangeVector aManualRows;
-        if( rModel.mbCustomHeight )
-            aManualRows.push_back( rRowRange );
-        else
-            aManualRows = maManualRowHeights.getIntersection( rRowRange );
-        for( ValueRangeVector::const_iterator aIt = aManualRows.begin(), aEnd = aManualRows.end(); aIt != aEnd; ++aIt )
-        {
-            PropertySet aPropSet( getRows( *aIt ) );
-            aPropSet.setProperty( PROP_Height, nHeight );
-        }
+        /* always import the row height, ensures better layout */
+        PropertySet aPropSet( getRows( rRowRange ) );
+        aPropSet.setProperty( PROP_Height, nHeight );
     }
 
     // hidden rows: TODO: #108683# hide rows later?
@@ -1645,11 +1626,6 @@ void WorksheetHelper::setRowModel( const RowModel& rModel )
     mrSheetGlob.setRowModel( rModel );
 }
 
-void WorksheetHelper::setManualRowHeight( sal_Int32 nRow )
-{
-    mrSheetGlob.setManualRowHeight( nRow );
-}
-
 void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue ) const
 {
     Reference< XCell > xCell = getCell( rAddress );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b9be493..125f4a9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1689,11 +1689,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
             bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled();
             bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if( bOldAdjustHeightEnabled != bAdjustHeightEnabled )
-            {
                 pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
-                if( bAdjustHeightEnabled )
-                    pDocShell->UpdateAllRowHeights();
-            }
         }
         else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
         {
-- 
1.7.3.4




--------------020207080603020903070503--


More information about the LibreOffice mailing list