Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


There are two problems addressed here
firstly for the xlsx importer like the xls importer we really don't want to call UpdateAllRowHeights ( which autocalculates row heights ), currently when the api property IsAdjustHeightEnabled set to true it calls UpdateAllRowHeights. This doesn't live up to the spirit of the name of the property and also it is counter productive. ( Note: this api property was only created for the filter in the first place because of the way the uno api triggers potentially triggers UpdateAllRowHeights during import ) Secondly row heights that are specified but that are not marked as custom heights are mostly ignored this results in wrong row heights in imported documents ( and subsequent layout problems ) ( see https://bugs.freedesktop.org/attachment.cgi?id=60991 from fdo#49430 where Row 2,5,6 etc. are imported at 4.69mm without the patch compared to 5.03mm which is what is imported from https://bugs.freedesktop.org/attachment.cgi?id=60994 ( the xls version of the same document ). Additionally there are documents from attached to i#94028 & i#93609 which don't currently behave well that this patch seems to fix ( but as ever happy for a second opinion )


patch attached is a squash ( and backport ) of master:764752f5d85cb7c86ad21340dfdda4b62754790c & master:1cdfe7519a94d35f3fb47eed3331397cc11129b5

thanks,

Noel

From 9aa64f833d0a11996ac8e480a657e87c56565c74 Mon Sep 17 00:00:00 2001
From: Noel Power <noel.power@novell.com>
Date: Fri, 8 Jun 2012 11:05:57 +0100
Subject: [PATCH] better import xlsx heights

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




Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.