[ooo-build-commit] .: patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Oct 1 19:33:16 PDT 2010


 patches/dev300/apply                                  |    7 
 patches/dev300/calc-perf-import-dbf-connectivity.diff |  110 --
 patches/dev300/calc-perf-import-dbf-dbaccess.diff     |  168 ---
 patches/dev300/calc-perf-import-dbf-sc.diff           |  905 ------------------
 4 files changed, 1190 deletions(-)

New commits:
commit 55b9a35b37f66f3639be830ba2b759489faf600f
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Oct 1 22:32:30 2010 -0400

    Removed calc-perf-import-dbf-*.diff; moved to git.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 9c68f6d..fc521e4 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2666,13 +2666,6 @@ always-save-option-svx.diff,       n#556125, i#5226, kohei
 speed-sfx2-dont-throw-too-much.diff, i#107512, jholesov
 
 [ CalcRowLimit ]
-
-# Improve import performance of dbf files by ~80%.
-calc-perf-import-dbf-connectivity.diff, n#558505, kohei
-calc-perf-import-dbf-dbaccess.diff,     n#558505, kohei
-calc-perf-import-dbf-sc.diff,           n#558505, kohei
-
-[ CalcRowLimit ]
 # Speed up row height data import from ods documents.
 calc-perf-ods-import-cellstyles.diff, n#582693, kohei
 calc-perf-xls-import-cellstyles.diff, n#582693, kohei
diff --git a/patches/dev300/calc-perf-import-dbf-connectivity.diff b/patches/dev300/calc-perf-import-dbf-connectivity.diff
deleted file mode 100644
index f8ce5fc..0000000
--- a/patches/dev300/calc-perf-import-dbf-connectivity.diff
+++ /dev/null
@@ -1,110 +0,0 @@
----
- connectivity/source/drivers/dbase/DTable.cxx |   56 ++++++++++++++++---------
- 1 files changed, 36 insertions(+), 20 deletions(-)
-
-diff --git connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/dbase/DTable.cxx
-index 2982f48..7224cfc 100644
---- connectivity/source/drivers/dbase/DTable.cxx
-+++ connectivity/source/drivers/dbase/DTable.cxx
-@@ -885,17 +885,23 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
- 
-         if (nType == DataType::CHAR || nType == DataType::VARCHAR)
-         {
--            char cLast = pData[nLen];
--            pData[nLen] = 0;
--            String aStr(pData,(xub_StrLen)nLen,m_eEncoding);
--            aStr.EraseTrailingChars();
--
--            if ( aStr.Len() )
--                *(_rRow->get())[i] = ::rtl::OUString(aStr);
--            else// keine StringLaenge, dann NULL
-+            sal_Int32 nLastPos = -1;
-+            for (sal_Int32 k = 0; k < nLen; ++k)
-+            {
-+                if (pData[k] != ' ')
-+                    // Record last non-empty position.
-+                    nLastPos = k;
-+            }
-+            if (nLastPos < 0)
-+            {
-+                // Empty string.  Skip it.
-                 (_rRow->get())[i]->setNull();
--                
--            pData[nLen] = cLast;
-+            }
-+            else
-+            {
-+                // Commit the string.  Use intern() to ref-count it.
-+                *(_rRow->get())[i] = ::rtl::OUString::intern(pData, static_cast<sal_Int32>(nLastPos+1), m_eEncoding);
-+            }
-         } // if (nType == DataType::CHAR || nType == DataType::VARCHAR)
-         else if ( DataType::TIMESTAMP == nType )
-         {
-@@ -941,36 +947,46 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
-         }
-         else
-         {
-+            sal_Int32 nPos1 = -1, nPos2 = -1;
-             // Falls Nul-Zeichen im String enthalten sind, in Blanks umwandeln!
-             for (sal_Int32 k = 0; k < nLen; k++)
-             {
-                 if (pData[k] == '\0')
-                     pData[k] = ' ';
--            }
- 
--            String aStr(pData, (xub_StrLen)nLen,m_eEncoding);		// Spaces am Anfang und am Ende entfernen:
--            aStr.EraseLeadingChars();
--            aStr.EraseTrailingChars();
-+                if (pData[k] != ' ')
-+                {
-+                    if (nPos1 < 0)
-+                        // first non-empty char position.
-+                        nPos1 = k;
- 
--            if (!aStr.Len())
-+                    // last non-empty char position.
-+                    nPos2 = k;
-+                }
-+            }
-+
-+            if (nPos1 < 0)
-             {
-+                // Empty string.  Skip it.
-                 nByteOffset += nLen;
-                 (_rRow->get())[i]->setNull();	// keine Werte -> fertig
-                 continue;
-             }
- 
-+            ::rtl::OUString aStr = ::rtl::OUString::intern(pData+nPos1, nPos2-nPos1+1, m_eEncoding);
-+
-             switch (nType)
-             {
-                 case DataType::DATE:
-                 {
--                    if (aStr.Len() != nLen)
-+                    if (aStr.getLength() != nLen)
-                     {
-                         (_rRow->get())[i]->setNull();
-                         break;
-                     }
--                    const sal_uInt16  nYear   = (sal_uInt16)aStr.Copy( 0, 4 ).ToInt32();
--                    const sal_uInt16  nMonth  = (sal_uInt16)aStr.Copy( 4, 2 ).ToInt32();
--                    const sal_uInt16  nDay    = (sal_uInt16)aStr.Copy( 6, 2 ).ToInt32();
-+                    const sal_uInt16  nYear   = (sal_uInt16)aStr.copy( 0, 4 ).toInt32();
-+                    const sal_uInt16  nMonth  = (sal_uInt16)aStr.copy( 4, 2 ).toInt32();
-+                    const sal_uInt16  nDay    = (sal_uInt16)aStr.copy( 6, 2 ).toInt32();
- 
-                     const ::com::sun::star::util::Date aDate(nDay,nMonth,nYear);
-                     *(_rRow->get())[i] = aDate;
-@@ -998,7 +1014,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
-                 case DataType::BINARY:
-                 case DataType::LONGVARCHAR:
-                 {
--                    const long nBlockNo = aStr.ToInt32();	// Blocknummer lesen
-+                    const long nBlockNo = aStr.toInt32();	// Blocknummer lesen
-                     if (nBlockNo > 0 && m_pMemoStream) // Daten aus Memo-Datei lesen, nur wenn
-                     {
-                         if ( !ReadMemo(nBlockNo, (_rRow->get())[i]->get()) )
--- 
-1.7.0.1
-
diff --git a/patches/dev300/calc-perf-import-dbf-dbaccess.diff b/patches/dev300/calc-perf-import-dbf-dbaccess.diff
deleted file mode 100644
index 534b63b..0000000
--- a/patches/dev300/calc-perf-import-dbf-dbaccess.diff
+++ /dev/null
@@ -1,168 +0,0 @@
----
- dbaccess/source/core/api/RowSet.cxx     |   17 +++++++++++++++++
- dbaccess/source/core/api/RowSet.hxx     |    2 ++
- dbaccess/source/core/api/RowSetBase.cxx |    9 +++++++++
- dbaccess/source/core/api/RowSetBase.hxx |    3 +++
- dbaccess/source/inc/stringconstants.hrc |    2 ++
- dbaccess/source/inc/stringconstants.inc |    1 +
- 6 files changed, 34 insertions(+), 0 deletions(-)
-
-diff --git dbaccess/source/core/api/RowSet.cxx dbaccess/source/core/api/RowSet.cxx
-index 20483cf..c7fdc64 100644
---- dbaccess/source/core/api/RowSet.cxx
-+++ dbaccess/source/core/api/RowSet.cxx
-@@ -40,6 +40,7 @@
- #include "core_resource.hrc"
- #include "core_resource.hxx"
- #include "tablecontainer.hxx"
-+#include "dbastrings.hrc"
- 
- /** === begin UNO includes === **/
- #include <com/sun/star/beans/PropertyAttribute.hpp>
-@@ -170,6 +171,7 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory
-     ,m_bNew(sal_False)
-     ,m_bCanUpdateInsertedRows(sal_True)
-     ,m_bOwnConnection(sal_False)
-+    ,m_bPropChangeNotifyEnabled(sal_True)
- {
-     m_nResultSetType = ResultSetType::SCROLL_SENSITIVE;
-     m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE;
-@@ -222,6 +224,9 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory
-     registerProperty(PROPERTY_UPDATE_CATALOGNAME,	PROPERTY_ID_UPDATE_CATALOGNAME,		PropertyAttribute::BOUND,		&m_aUpdateCatalogName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-     registerProperty(PROPERTY_UPDATE_SCHEMANAME,	PROPERTY_ID_UPDATE_SCHEMANAME,		PropertyAttribute::BOUND,		&m_aUpdateSchemaName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-     registerProperty(PROPERTY_UPDATE_TABLENAME,		PROPERTY_ID_UPDATE_TABLENAME,		PropertyAttribute::BOUND,		&m_aUpdateTableName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-+
-+    // ???
-+    registerProperty(PROPERTY_CHANGE_NOTIFICATION_ENABLED, PROPERTY_ID_PROPCHANGE_NOTIFY, PropertyAttribute::BOUND,     &m_bPropChangeNotifyEnabled, ::getBooleanCppuType());
- }
- 
- ORowSet::~ORowSet()
-@@ -373,6 +378,9 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const
-         case PROPERTY_ID_TYPEMAP:
-             ::cppu::extractInterface(m_xTypeMap,m_aTypeMap);
-             break;
-+        case PROPERTY_ID_PROPCHANGE_NOTIFY:
-+            m_bPropChangeNotifyEnabled = ::cppu::any2bool(rValue);
-+            break;
-         default:
-             break;
-     };
-@@ -413,6 +421,9 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-             case PROPERTY_ID_TYPEMAP:
-                 rValue <<= m_xTypeMap;
-                 break;
-+            case PROPERTY_ID_PROPCHANGE_NOTIFY:
-+                rValue <<= m_bPropChangeNotifyEnabled;
-+                break;
-             default:
-                 ORowSetBase::getFastPropertyValue(rValue,nHandle);
-         }
-@@ -2730,6 +2741,12 @@ sal_Bool ORowSet::isNew( )
- }
- 
- // -----------------------------------------------------------------------------
-+sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const
-+{
-+    return m_bPropChangeNotifyEnabled;
-+}
-+
-+// -----------------------------------------------------------------------------
- void ORowSet::checkUpdateIterator()
- {
-     if(!m_bModified && !m_bNew)
-diff --git dbaccess/source/core/api/RowSet.hxx dbaccess/source/core/api/RowSet.hxx
-index fdd0ecb..cb2e2ba 100644
---- dbaccess/source/core/api/RowSet.hxx
-+++ dbaccess/source/core/api/RowSet.hxx
-@@ -145,6 +145,7 @@ namespace dbaccess
-         sal_Bool					m_bNew ;
-         sal_Bool					m_bCanUpdateInsertedRows;
-         sal_Bool					m_bOwnConnection;
-+        sal_Bool                    m_bPropChangeNotifyEnabled;
- 
-     private:
-         /** builds m_aActiveCommand from our settings
-@@ -248,6 +249,7 @@ namespace dbaccess
-         virtual sal_Bool	isModification( );
-         virtual sal_Bool	isModified( );
-         virtual sal_Bool	isNew( );
-+        virtual sal_Bool    isPropertyChangeNotificationEnabled() const;
- 
-         virtual ~ORowSet();
- 
-diff --git dbaccess/source/core/api/RowSetBase.cxx dbaccess/source/core/api/RowSetBase.cxx
-index e19dd83..57c844f 100644
---- dbaccess/source/core/api/RowSetBase.cxx
-+++ dbaccess/source/core/api/RowSetBase.cxx
-@@ -1272,6 +1272,9 @@ void SAL_CALL ORowSetBase::clearWarnings(  ) throw(SQLException, RuntimeExceptio
- // -------------------------------------------------------------------------
- void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow)
- {
-+    if (!isPropertyChangeNotificationEnabled())
-+        return;
-+
-     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen at sun.com", "ORowSetBase::firePropertyChange" );
-     DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL));
-     OSL_ENSURE(m_pColumns,"Columns can not be NULL here!");
-@@ -1326,6 +1329,12 @@ void ORowSetBase::notifyAllListeners(::osl::ResettableMutexGuard& /*_rGuard*/)
- }
- 
- // -----------------------------------------------------------------------------
-+sal_Bool ORowSetBase::isPropertyChangeNotificationEnabled() const
-+{
-+    return sal_True;
-+}
-+
-+// -----------------------------------------------------------------------------
- void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld )
- {
-     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen at sun.com", "ORowSetBase::fireProperty" );
-diff --git dbaccess/source/core/api/RowSetBase.hxx dbaccess/source/core/api/RowSetBase.hxx
-index 4140c21..8632487 100644
---- dbaccess/source/core/api/RowSetBase.hxx
-+++ dbaccess/source/core/api/RowSetBase.hxx
-@@ -190,6 +190,9 @@ namespace dbaccess
-         virtual sal_Bool	isModified( ) = 0;
-         // return <TRUE/> if and only if the current row is the insert row
-         virtual sal_Bool	isNew( ) = 0;
-+        // return <TRUE/> if the property change notification should be fired
-+        // upon property change.
-+        virtual sal_Bool    isPropertyChangeNotificationEnabled() const;
-         // notify the change of a boolean property
-         void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld );
- 
-diff --git dbaccess/source/inc/stringconstants.hrc dbaccess/source/inc/stringconstants.hrc
-index 5d7b985..6516006 100644
---- dbaccess/source/inc/stringconstants.hrc
-+++ dbaccess/source/inc/stringconstants.hrc
-@@ -183,6 +183,7 @@
- #define PROPERTY_ID_PERSISTENT_PATH         143
- #define PROPERTY_ID_CURRENT_QUERY_DESIGN    144
- #define PROPERTY_ID_SINGLESELECTQUERYCOMPOSER   145
-+#define PROPERTY_ID_PROPCHANGE_NOTIFY       146
-  
- //============================================================
- //= property names
-@@ -340,6 +341,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE);
- DECLARE_CONSTASCII_USTRING(PROPERTY_GROUP_BY);
- DECLARE_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH);
- DECLARE_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER);
-+DECLARE_CONSTASCII_USTRING(PROPERTY_CHANGE_NOTIFICATION_ENABLED);
- 
- //============================================================
- //= service names
-diff --git dbaccess/source/inc/stringconstants.inc dbaccess/source/inc/stringconstants.inc
-index f2a39b0..5eef8a6 100644
---- dbaccess/source/inc/stringconstants.inc
-+++ dbaccess/source/inc/stringconstants.inc
-@@ -183,6 +183,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE,	"HavingClause");
- IMPLEMENT_CONSTASCII_USTRING(PROPERTY_GROUP_BY,			"GroupBy");
- IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH, "EditWidth");
- IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER,"SingleSelectQueryComposer");
-+IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHANGE_NOTIFICATION_ENABLED, "PropertyChangeNotificationEnabled");
- 
- //============================================================
- //= service names
--- 
-1.7.0.1
-
diff --git a/patches/dev300/calc-perf-import-dbf-sc.diff b/patches/dev300/calc-perf-import-dbf-sc.diff
deleted file mode 100644
index cdfb5ae..0000000
--- a/patches/dev300/calc-perf-import-dbf-sc.diff
+++ /dev/null
@@ -1,905 +0,0 @@
- sc/inc/column.hxx                    |   13 ++++-
- sc/inc/dbdocutl.hxx                  |   12 ++++-
- sc/inc/dociter.hxx                   |   39 +++++++++++++
- sc/inc/docparam.hxx                  |   47 ++++++++++++++++
- sc/inc/document.hxx                  |    5 ++-
- sc/inc/table.hxx                     |    4 +-
- sc/source/core/data/column.cxx       |   14 +++++-
- sc/source/core/data/column2.cxx      |   50 +++++++++++++----
- sc/source/core/data/column3.cxx      |    2 +-
- sc/source/core/data/dbdocutl.cxx     |   18 +++++--
- sc/source/core/data/dociter.cxx      |   98 ++++++++++++++++++++++++++++++++++
- sc/source/core/data/docparam.cxx     |   39 +++++++++++++
- sc/source/core/data/document.cxx     |   10 ++--
- sc/source/core/data/makefile.mk      |    2 +
- sc/source/core/data/table1.cxx       |    4 +-
- sc/source/ui/docshell/.docsh.cxx.swp |  Bin 16384 -> 16384 bytes
- sc/source/ui/docshell/dbdocimp.cxx   |    3 +-
- sc/source/ui/docshell/docsh.cxx      |   46 ++++++++++++----
- sc/source/ui/docshell/docsh8.cxx     |   30 ++++++++++-
- sc/source/ui/docshell/impex.cxx      |    4 +-
- sc/source/ui/inc/docsh.hxx           |    4 +-
- 21 files changed, 394 insertions(+), 50 deletions(-)
-
-diff --git sc/inc/column.hxx sc/inc/column.hxx
-index 1968815..4e6dbf0 100644
---- sc/inc/column.hxx
-+++ sc/inc/column.hxx
-@@ -67,6 +67,7 @@ struct ScLineFlags;
- struct ScMergePatternState;
- class ScFlatBoolRowSegments;
- struct ScSetStringParam;
-+struct ScColWidthParam;
- 
- #define COLUMN_DELTA	4
- 
-@@ -121,8 +122,16 @@ friend class ScHorizontalCellIterator;
- friend class ScHorizontalAttrIterator;
- 
- public:
--static BOOL bDoubleAlloc;			// fuer Import: Groesse beim Allozieren verdoppeln
-+    static bool bDoubleAlloc;			// fuer Import: Groesse beim Allozieren verdoppeln
- 
-+    class DoubleAllocSwitch
-+    {
-+    public:
-+        DoubleAllocSwitch(bool bNewVal = true);
-+        ~DoubleAllocSwitch();
-+    private:
-+        bool mbOldVal;
-+    };
- public:
-                 ScColumn();
-                 ~ScColumn();
-@@ -360,7 +369,7 @@ public:
-                                     const Fraction& rZoomX, const Fraction& rZoomY,
-                                     BOOL bFormula, USHORT nOldWidth,
-                                     const ScMarkData* pMarkData,
--                                    BOOL bSimpleTextImport );
-+                                    const ScColWidthParam* pParam );
-     void		GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT* pHeight,
-                                     OutputDevice* pDev,
-                                     double nPPTX, double nPPTY,
-diff --git sc/inc/dbdocutl.hxx sc/inc/dbdocutl.hxx
-index 2ee1e37..8803622 100644
---- sc/inc/dbdocutl.hxx
-+++ sc/inc/dbdocutl.hxx
-@@ -42,10 +42,20 @@ namespace com { namespace sun { namespace star { namespace sdbc {
- class ScDatabaseDocUtil
- {
- public:
-+    /**
-+     * Detailed information on single string value.
-+     */
-+    struct StrData
-+    {
-+        bool        mbSimpleText;
-+        sal_uInt32  mnStrLength;
-+
-+        StrData();
-+    };
-     static void PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
-                         const ::com::sun::star::uno::Reference<
-                             ::com::sun::star::sdbc::XRow>& xRow, long nRowPos,
--                        long nType, BOOL bCurrency, BOOL* pSimpleFlag = NULL );
-+                        long nType, BOOL bCurrency, StrData* pStrData = NULL );
- };
- 
- #endif
-diff --git sc/inc/dociter.hxx sc/inc/dociter.hxx
-index d63a08a..a9a57e3 100644
---- sc/inc/dociter.hxx
-+++ sc/inc/dociter.hxx
-@@ -37,6 +37,8 @@
- #include <memory>
- 
- #include <set>
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
- 
- class ScDocument;
- class ScBaseCell;
-@@ -44,6 +46,7 @@ class ScPatternAttr;
- class ScAttrArray;
- class ScAttrIterator;
- class ScRange;
-+class ScFlatBoolRowSegments;
- 
- class ScDocumentIterator				// alle nichtleeren Zellen durchgehen
- {
-@@ -530,6 +533,42 @@ private:
-     ::std::set<SCROW>::const_iterator maEnd;
- };
- 
-+// ============================================================================
-+
-+class ScDocRowHeightUpdater
-+{
-+public:
-+    struct TabRanges
-+    {
-+        SCTAB mnTab;
-+        ::boost::shared_ptr<ScFlatBoolRowSegments> mpRanges;
-+
-+        TabRanges();
-+        TabRanges(SCTAB nTab);
-+    };
-+
-+    /**
-+     * Passing a NULL pointer to pTabRangesArray forces the heights of all
-+     * rows in all tables to be updated.
-+     */
-+    explicit ScDocRowHeightUpdater(
-+        ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY,
-+        const ::std::vector<TabRanges>* pTabRangesArray = NULL);
-+
-+    void update();
-+
-+private:
-+    void updateAll();
-+
-+private:
-+    ScDocument& mrDoc;
-+    OutputDevice* mpOutDev;
-+    double mfPPTX;
-+    double mfPPTY;
-+    const ::std::vector<TabRanges>* mpTabRangesArray;
-+};
-+
-+
- #endif
- 
- 
-diff --git sc/inc/docparam.hxx sc/inc/docparam.hxx
-new file mode 100644
-index 0000000..e273c01
---- /dev/null
-+++ sc/inc/docparam.hxx
-@@ -0,0 +1,47 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_DOCPARAM_HXX
-+#define SC_DOCPARAM_HXX
-+
-+#include "address.hxx"
-+
-+// Let's put here misc structures that get passed to ScDocument's methods.
-+
-+struct ScColWidthParam
-+{
-+    SCROW       mnMaxTextRow;
-+    sal_uInt32  mnMaxTextLen;
-+    bool        mbSimpleText;
-+
-+    ScColWidthParam();
-+};
-+
-+#endif
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index a30cd61..4866f4b 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -148,6 +148,8 @@ struct ScClipParam;
- struct ScClipRangeNameData;
- class ScRowBreakIterator;
- struct ScSetStringParam;
-+class ScDocRowHeightUpdater;
-+struct ScColWidthParam;
- 
- namespace com { namespace sun { namespace star {
-     namespace lang {
-@@ -251,6 +253,7 @@ friend class ScHorizontalAttrIterator;
- friend class ScDocAttrIterator;
- friend class ScAttrRectIterator;
- friend class ScDocShell;
-+friend class ScDocRowHeightUpdater;
- 
- private:
-     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
-@@ -1308,7 +1311,7 @@ public:
-                                         const Fraction& rZoomX, const Fraction& rZoomY,
-                                         BOOL bFormula,
-                                         const ScMarkData* pMarkData = NULL,
--                                        BOOL bSimpleTextImport = FALSE );
-+                                        const ScColWidthParam* pParam = NULL );
-     SC_DLLPUBLIC BOOL			SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, USHORT nExtra,
-                                         OutputDevice* pDev,
-                                         double nPPTX, double nPPTY,
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index abd0a88..709000e 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -85,6 +85,8 @@ class ScFlatUInt16RowSegments;
- class ScFlatBoolRowSegments;
- class ScFlatBoolColSegments;
- struct ScSetStringParam;
-+struct ScColWidthParam;
-+struct ScColWidthParam;
- 
- typedef std::hash_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap;
-  
-@@ -596,7 +598,7 @@ public:
-                                     double nPPTX, double nPPTY,
-                                     const Fraction& rZoomX, const Fraction& rZoomY,
-                                     BOOL bFormula, const ScMarkData* pMarkData,
--                                    BOOL bSimpleTextImport );
-+                                    const ScColWidthParam* pParam );
-     BOOL		SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT nExtra,
-                                     OutputDevice* pDev,
-                                     double nPPTX, double nPPTY,
-diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
-index 8645a15..b35d019 100644
---- sc/source/core/data/column.cxx
-+++ sc/source/core/data/column.cxx
-@@ -67,8 +67,20 @@ inline BOOL IsAmbiguousScriptNonZero( BYTE nScript )
-              nScript != 0 );
- }
- 
--// -----------------------------------------------------------------------------------------
-+// ----------------------------------------------------------------------------
- 
-+ScColumn::DoubleAllocSwitch::DoubleAllocSwitch(bool bNewVal) :
-+    mbOldVal(ScColumn::bDoubleAlloc)
-+{
-+    ScColumn::bDoubleAlloc = bNewVal;
-+}
-+
-+ScColumn::DoubleAllocSwitch::~DoubleAllocSwitch()
-+{
-+    ScColumn::bDoubleAlloc = mbOldVal;
-+}
-+
-+// ----------------------------------------------------------------------------
- 
- ScColumn::ScColumn() :
-     nCol( 0 ),
-diff --git sc/source/core/data/column2.cxx sc/source/core/data/column2.cxx
-index 77fcc57..83e25a7 100644
---- sc/source/core/data/column2.cxx
-+++ sc/source/core/data/column2.cxx
-@@ -67,6 +67,7 @@
- #include "dbcolect.hxx"
- #include "fillinfo.hxx"
- #include "segmenttree.hxx"
-+#include "docparam.hxx"
- 
- #include <math.h>
- 
-@@ -638,10 +639,10 @@ long ScColumn::GetSimpleTextNeededSize( SCSIZE nIndex, OutputDevice* pDev,
- }
- 
- USHORT ScColumn::GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY,
--                                        const Fraction& rZoomX, const Fraction& rZoomY,
--                                        BOOL bFormula, USHORT nOldWidth,
--                                        const ScMarkData* pMarkData,
--                                        BOOL bSimpleTextImport )
-+                                     const Fraction& rZoomX, const Fraction& rZoomY,
-+                                     BOOL bFormula, USHORT nOldWidth,
-+                                     const ScMarkData* pMarkData,
-+                                     const ScColWidthParam* pParam )
- {
-     if (nCount == 0)
-         return nOldWidth;
-@@ -651,7 +652,7 @@ USHORT ScColumn::GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nP
- 
-     SCSIZE nIndex;
-     ScMarkedDataIter aDataIter(this, pMarkData, TRUE);
--    if ( bSimpleTextImport )
-+    if ( pParam && pParam->mbSimpleText )
-     {	// alles eins bis auf NumberFormate
-         const ScPatternAttr* pPattern = GetPattern( 0 );
-         Font aFont;
-@@ -662,19 +663,44 @@ USHORT ScColumn::GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nP
-         long nMargin = (long) ( pMargin->GetLeftMargin() * nPPTX ) +
-                         (long) ( pMargin->GetRightMargin() * nPPTX );
- 
--        while (aDataIter.Next( nIndex ))
-+        // Try to find the row that has the longest string, and measure the width of that string.
-+        SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
-+        ULONG nFormat = pPattern->GetNumberFormat( pFormatter );
-+        String aLongStr;
-+        Color* pColor;
-+        if (pParam->mnMaxTextRow >= 0)
-         {
--            USHORT nThis = (USHORT) (GetSimpleTextNeededSize( nIndex, pDev,
--                TRUE ) + nMargin);
--            if (nThis)
-+            ScBaseCell* pCell = GetCell(pParam->mnMaxTextRow);
-+            ScCellFormat::GetString(
-+                pCell, nFormat, aLongStr, &pColor, *pFormatter, TRUE, FALSE, ftCheck );
-+        }
-+        else
-+        {
-+            xub_StrLen nLongLen = 0;
-+            while (aDataIter.Next(nIndex))
-             {
--                if (nThis>nWidth || !bFound)
-+                if (nIndex >= nCount)
-+                    // Out-of-bound reached.  No need to keep going.
-+                    break;
-+
-+                ScBaseCell* pCell = pItems[nIndex].pCell;
-+                String aValStr;
-+                ScCellFormat::GetString(
-+                    pCell, nFormat, aValStr, &pColor, *pFormatter, TRUE, FALSE, ftCheck );
-+
-+                if (aValStr.Len() > nLongLen)
-                 {
--                    nWidth = nThis;
--                    bFound = TRUE;
-+                    nLongLen = aValStr.Len();
-+                    aLongStr = aValStr;
-                 }
-             }
-         }
-+
-+        if (aLongStr.Len())
-+        {
-+            nWidth = pDev->GetTextWidth(aLongStr) + static_cast<USHORT>(nMargin);
-+            bFound = true;
-+        }
-     }
-     else
-     {
-diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
-index e691b1f..3a4d2cd 100644
---- sc/source/core/data/column3.cxx
-+++ sc/source/core/data/column3.cxx
-@@ -65,7 +65,7 @@ extern const ScFormulaCell* pLastFormulaTreeTop;	// in cellform.cxx
- using namespace formula;
- // STATIC DATA -----------------------------------------------------------
- 
--BOOL ScColumn::bDoubleAlloc = FALSE;	// fuer Import: Groesse beim Allozieren verdoppeln
-+bool ScColumn::bDoubleAlloc = FALSE;    // fuer Import: Groesse beim Allozieren verdoppeln
- 
- 
- void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
-diff --git sc/source/core/data/dbdocutl.cxx sc/source/core/data/dbdocutl.cxx
-index 233bc4e..6430e19 100644
---- sc/source/core/data/dbdocutl.cxx
-+++ sc/source/core/data/dbdocutl.cxx
-@@ -46,12 +46,19 @@ using namespace ::com::sun::star;
- 
- #define D_TIMEFACTOR              86400.0
- 
--// -----------------------------------------------------------------------
-+// ----------------------------------------------------------------------------
-+
-+ScDatabaseDocUtil::StrData::StrData() :
-+    mbSimpleText(true), mnStrLength(0)
-+{
-+}
-+
-+// ----------------------------------------------------------------------------
- 
- // static
- void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
-                                 const uno::Reference<sdbc::XRow>& xRow, long nRowPos,
--                                long nType, BOOL bCurrency, BOOL* pSimpleFlag )
-+                                long nType, BOOL bCurrency, StrData* pStrData )
- {
-     String aString;
-     double nVal = 0.0;
-@@ -185,8 +192,11 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
-         if (aString.Len())
-         {
-             pCell = ScBaseCell::CreateTextCell( aString, pDoc );
--            if ( pSimpleFlag && pCell->GetCellType() == CELLTYPE_EDIT )
--                *pSimpleFlag = FALSE;
-+            if (pStrData)
-+            {
-+                pStrData->mbSimpleText = pCell->GetCellType() != CELLTYPE_EDIT;
-+                pStrData->mnStrLength = aString.Len();
-+            }
-         }
-         else
-             pCell = NULL;
-diff --git sc/source/core/data/dociter.cxx sc/source/core/data/dociter.cxx
-index a0e9f6f..2c77d6e 100644
---- sc/source/core/data/dociter.cxx
-+++ sc/source/core/data/dociter.cxx
-@@ -43,6 +43,10 @@
- #include "patattr.hxx"
- #include "docoptio.hxx"
- #include "cellform.hxx"
-+#include "segmenttree.hxx"
-+#include "progress.hxx"
-+#include "globstr.hrc"
-+#include "tools/fract.hxx"
- 
- #include <vector>
- 
-@@ -2065,6 +2069,100 @@ const ScPatternAttr* ScDocAttrIterator::GetNext( SCCOL& rCol, SCROW& rRow1, SCRO
-     return NULL;		// is nix mehr
- }
- 
-+// ============================================================================
-+
-+ScDocRowHeightUpdater::TabRanges::TabRanges() :
-+    mnTab(0), mpRanges(new ScFlatBoolRowSegments)
-+{
-+}
-+
-+ScDocRowHeightUpdater::TabRanges::TabRanges(SCTAB nTab) :
-+    mnTab(nTab), mpRanges(new ScFlatBoolRowSegments)
-+{
-+}
-+
-+ScDocRowHeightUpdater::ScDocRowHeightUpdater(ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY, const vector<TabRanges>* pTabRangesArray) :
-+    mrDoc(rDoc), mpOutDev(pOutDev), mfPPTX(fPPTX), mfPPTY(fPPTY), mpTabRangesArray(pTabRangesArray)
-+{
-+}
-+
-+void ScDocRowHeightUpdater::update()
-+{
-+    if (!mpTabRangesArray || mpTabRangesArray->empty())
-+    {
-+        // No ranges defined.  Update all rows in all tables.
-+        updateAll();
-+        return;
-+    }
-+
-+    sal_uInt32 nCellCount = 0;
-+    vector<TabRanges>::const_iterator itr = mpTabRangesArray->begin(), itrEnd = mpTabRangesArray->end();
-+    for (; itr != itrEnd; ++itr)
-+    {
-+        ScFlatBoolRowSegments::RangeData aData;
-+        ScFlatBoolRowSegments::RangeIterator aRangeItr(*itr->mpRanges);
-+        for (bool bFound = aRangeItr.getFirst(aData); bFound; bFound = aRangeItr.getNext(aData))
-+        {
-+            if (!aData.mbValue)
-+                continue;
-+
-+            nCellCount += aData.mnRow2 - aData.mnRow1 + 1;
-+        }
-+    }
-+
-+    ScProgress aProgress(mrDoc.GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nCellCount);
-+
-+    Fraction aZoom(1, 1);
-+    itr = mpTabRangesArray->begin();
-+    sal_uInt32 nProgressStart = 0;
-+    for (; itr != itrEnd; ++itr)
-+    {
-+        SCTAB nTab = itr->mnTab;
-+        if (!ValidTab(nTab) || !mrDoc.pTab[nTab])
-+            continue;
-+
-+        ScFlatBoolRowSegments::RangeData aData;
-+        ScFlatBoolRowSegments::RangeIterator aRangeItr(*itr->mpRanges);
-+        for (bool bFound = aRangeItr.getFirst(aData); bFound; bFound = aRangeItr.getNext(aData))
-+        {
-+            if (!aData.mbValue)
-+                continue;
-+
-+            mrDoc.pTab[nTab]->SetOptimalHeight(
-+                aData.mnRow1, aData.mnRow2, 0, mpOutDev, mfPPTX, mfPPTY, aZoom, aZoom, false, &aProgress, nProgressStart);
-+
-+            nProgressStart += aData.mnRow2 - aData.mnRow1 + 1;
-+        }
-+    }
-+}
-+
-+void ScDocRowHeightUpdater::updateAll()
-+{
-+    sal_uInt32 nCellCount = 0;
-+    for (SCTAB nTab = 0; nTab <= MAXTAB; ++nTab)
-+    {
-+        if (!ValidTab(nTab) || !mrDoc.pTab[nTab])
-+            continue;
-+
-+        nCellCount += mrDoc.pTab[nTab]->GetWeightedCount();
-+    }
-+
-+    ScProgress aProgress(mrDoc.GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nCellCount);
-+
-+    Fraction aZoom(1, 1);
-+    ULONG nProgressStart = 0;
-+    for (SCTAB nTab = 0; nTab <= MAXTAB; ++nTab)
-+    {
-+        if (!ValidTab(nTab) || !mrDoc.pTab[nTab])
-+            continue;
-+
-+        mrDoc.pTab[nTab]->SetOptimalHeight(
-+            0, MAXROW, 0, mpOutDev, mfPPTX, mfPPTY, aZoom, aZoom, false, &aProgress, nProgressStart);
-+
-+        nProgressStart += mrDoc.pTab[nTab]->GetWeightedCount();
-+    }
-+}
-+
- //-------------------------------------------------------------------------------
- 
- ScAttrRectIterator::ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable,
-diff --git sc/source/core/data/docparam.cxx sc/source/core/data/docparam.cxx
-new file mode 100644
-index 0000000..bb2e073
---- /dev/null
-+++ sc/source/core/data/docparam.cxx
-@@ -0,0 +1,39 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "docparam.hxx"
-+
-+ScColWidthParam::ScColWidthParam() :
-+    mnMaxTextRow(-1), mnMaxTextLen(0), mbSimpleText(true) {}
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index cc14a95..1d6048f 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -3269,14 +3269,14 @@ ULONG ScDocument::GetRowOffset( SCROW nRow, SCTAB nTab ) const
- 
- 
- USHORT ScDocument::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
--                                        double nPPTX, double nPPTY,
--                                        const Fraction& rZoomX, const Fraction& rZoomY,
--                                        BOOL bFormula, const ScMarkData* pMarkData,
--                                        BOOL bSimpleTextImport )
-+                                       double nPPTX, double nPPTY,
-+                                       const Fraction& rZoomX, const Fraction& rZoomY,
-+                                       BOOL bFormula, const ScMarkData* pMarkData,
-+                                       const ScColWidthParam* pParam )
- {
-     if ( ValidTab(nTab) && pTab[nTab] )
-         return pTab[nTab]->GetOptimalColWidth( nCol, pDev, nPPTX, nPPTY,
--            rZoomX, rZoomY, bFormula, pMarkData, bSimpleTextImport );
-+            rZoomX, rZoomY, bFormula, pMarkData, pParam );
-     DBG_ERROR("Falsche Tabellennummer");
-     return 0;
- }
-diff --git sc/source/core/data/makefile.mk sc/source/core/data/makefile.mk
-index e46a986..6b8084c 100755
---- sc/source/core/data/makefile.mk
-+++ sc/source/core/data/makefile.mk
-@@ -70,6 +70,7 @@ SLOFILES =  \
-     $(SLO)$/documen8.obj \
-     $(SLO)$/documen9.obj \
-     $(SLO)$/document.obj \
-+    $(SLO)$/docparam.obj \
-         $(SLO)$/dpcachetable.obj \
-         $(SLO)$/dpdimsave.obj \
-     $(SLO)$/dpglobal.obj \
-@@ -121,6 +122,7 @@ EXCEPTIONSFILES= \
-     $(SLO)$/clipparam.obj \
-     $(SLO)$/column.obj \
-     $(SLO)$/column3.obj \
-+    $(SLO)$/dociter.obj \
-     $(SLO)$/documen2.obj \
-     $(SLO)$/document.obj \
-     $(SLO)$/dpdimsave.obj \
-diff --git sc/source/core/data/table1.cxx sc/source/core/data/table1.cxx
-index 84ce01c..030f0b1 100644
---- sc/source/core/data/table1.cxx
-+++ sc/source/core/data/table1.cxx
-@@ -317,10 +317,10 @@ USHORT ScTable::GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
-                                     double nPPTX, double nPPTY,
-                                     const Fraction& rZoomX, const Fraction& rZoomY,
-                                     BOOL bFormula, const ScMarkData* pMarkData,
--                                    BOOL bSimpleTextImport )
-+                                    const ScColWidthParam* pParam )
- {
-     return aCol[nCol].GetOptimalColWidth( pDev, nPPTX, nPPTY, rZoomX, rZoomY,
--        bFormula, STD_COL_WIDTH - STD_EXTRA_WIDTH, pMarkData, bSimpleTextImport );
-+        bFormula, STD_COL_WIDTH - STD_EXTRA_WIDTH, pMarkData, pParam );
- }
- 
- long ScTable::GetNeededSize( SCCOL nCol, SCROW nRow,
-diff --git sc/source/ui/docshell/dbdocimp.cxx sc/source/ui/docshell/dbdocimp.cxx
-index 60abe62..a446e17 100644
---- sc/source/ui/docshell/dbdocimp.cxx
-+++ sc/source/ui/docshell/dbdocimp.cxx
-@@ -268,7 +268,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
-     // ImportDoc - also used for Redo
-     ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
-     pImportDoc->InitUndo( pDoc, nTab, nTab );
--    ScColumn::bDoubleAlloc = TRUE;
-+    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
- 
-     //
-     //	get data from database into import document
-@@ -460,7 +460,6 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
-         DBG_ERROR("Unexpected exception in database");
-     }
- 
--    ScColumn::bDoubleAlloc = FALSE;
-     pImportDoc->DoColResize( nTab, rParam.nCol1,nEndCol, 0 );
- 
-     //
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index ef33f94..7249979 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -117,9 +117,11 @@
- #include "optsolver.hxx"
- #include "sheetdata.hxx"
- #include "tabprotection.hxx"
-+#include "docparam.hxx"
- 
- #include "docsh.hxx"
- #include "docshimp.hxx"
-+#include "sizedev.hxx"
- #include <rtl/logfile.hxx>
- 
- #include <comphelper/processfactory.hxx>
-@@ -129,9 +131,15 @@
- #include "uiitems.hxx"
- #include "cellsuno.hxx"
- 
-+
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+
- using namespace com::sun::star;
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
-+using ::boost::shared_ptr;
-+using ::std::vector;
- 
- // STATIC DATA -----------------------------------------------------------
- 
-@@ -984,12 +992,13 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
-     // ob nach dem Import optimale Spaltenbreiten gesetzt werden sollen
-     BOOL bSetColWidths = FALSE;
-     BOOL bSetSimpleTextColWidths = FALSE;
--    BOOL bSimpleColWidth[MAXCOLCOUNT];
--    memset( bSimpleColWidth, 1, (MAXCOLCOUNT) * sizeof(BOOL) );
-+    ScColWidthParam aColWidthParam[MAXCOLCOUNT];
-     ScRange aColWidthRange;
-     // ob nach dem Import optimale Zeilenhoehen gesetzt werden sollen
-     BOOL bSetRowHeights = FALSE;
- 
-+    vector<ScDocRowHeightUpdater::TabRanges> aRecalcRowRangesArray;
-+
-     aConvFilterName.Erase(); //@ #BugId 54198
- 
-     //	Alle Filter brauchen die komplette Datei am Stueck (nicht asynchron),
-@@ -1188,8 +1197,10 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
-                 sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_850 );
-             }
- 
-+            ScDocRowHeightUpdater::TabRanges aRecalcRanges(0);
-             ULONG eError = DBaseImport( rMedium.GetPhysicalName(),
--                    ScGlobal::GetCharsetValue(sItStr), bSimpleColWidth );
-+                    ScGlobal::GetCharsetValue(sItStr), aColWidthParam, *aRecalcRanges.mpRanges );
-+            aRecalcRowRangesArray.push_back(aRecalcRanges);
- 
-             if (eError != eERR_OK)
-             {
-@@ -1203,12 +1214,6 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
-             aColWidthRange.aStart.SetRow( 1 );	// Spaltenheader nicht
-             bSetColWidths = TRUE;
-             bSetSimpleTextColWidths = TRUE;
--            // Memo-Felder fuehren zu einem bSimpleColWidth[nCol]==FALSE
--            for ( SCCOL nCol=0; nCol <= MAXCOL && !bSetRowHeights; nCol++ )
--            {
--                if ( !bSimpleColWidth[nCol] )
--                    bSetRowHeights = TRUE;
--            }
-         }
-         else if (aFltName.EqualsAscii(pFilterDif))
-         {
-@@ -1422,9 +1427,12 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
-             {
-                 for ( SCCOL nCol=0; nCol <= nEndCol; nCol++ )
-                 {
-+                    if (!bSetSimpleTextColWidths)
-+                        aColWidthParam[nCol].mbSimpleText = false;
-+
-                     USHORT nWidth = aDocument.GetOptimalColWidth(
-                         nCol, nTab, &aVirtDev, nPPTX, nPPTY, aZoom, aZoom, FALSE, &aMark,
--                        (bSetSimpleTextColWidths && bSimpleColWidth[nCol]) );
-+                        &aColWidthParam[nCol] );
-                     aDocument.SetColWidth( nCol, nTab,
-                         nWidth + (USHORT)ScGlobal::nLastColWidthExtra );
-                 }
-@@ -1436,11 +1444,25 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
- //					nPPTX, nPPTY, aZoom, aZoom, FALSE );
- //			}
-         }
--        if ( bSetRowHeights )
--            UpdateAllRowHeights();		// with vdev or printer, depending on configuration
-+
-+        if (bSetRowHeights)
-+        {
-+            // Update all rows in all tables.
-+            ScSizeDeviceProvider aProv(this);
-+            ScDocRowHeightUpdater aUpdater(aDocument, aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), NULL);
-+            aUpdater.update();
-+        }
-+        else if (!aRecalcRowRangesArray.empty())
-+        {
-+            // Update only specified row ranges for better performance.
-+            ScSizeDeviceProvider aProv(this);
-+            ScDocRowHeightUpdater aUpdater(aDocument, aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), &aRecalcRowRangesArray);
-+            aUpdater.update();
-+        }
-     }
-     FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
- 
-+
-     // #73762# invalidate eventually temporary table areas
-     if ( bRet )
-         aDocument.InvalidateTableArea();
-diff --git sc/source/ui/docshell/docsh8.cxx sc/source/ui/docshell/docsh8.cxx
-index 75a0756..6397109 100644
---- sc/source/ui/docshell/docsh8.cxx
-+++ sc/source/ui/docshell/docsh8.cxx
-@@ -83,6 +83,8 @@
- #include "patattr.hxx"
- #include "scitems.hxx"
- #include "docpool.hxx"
-+#include "segmenttree.hxx"
-+#include "docparam.hxx"
- 
- #include <vector>
- 
-@@ -99,6 +101,7 @@ using ::std::vector;
- #define SC_DBPROP_ACTIVECONNECTION	"ActiveConnection"
- #define SC_DBPROP_COMMAND			"Command"
- #define SC_DBPROP_COMMANDTYPE		"CommandType"
-+#define SC_DBPROP_PROPCHANGE_NOTIFY "PropertyChangeNotificationEnabled"
- 
- #define SC_DBPROP_NAME				"Name"
- #define SC_DBPROP_TYPE				"Type"
-@@ -302,8 +305,10 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales
- }
- 
- ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
--                                BOOL bSimpleColWidth[MAXCOLCOUNT] )
-+                               ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc )
- {
-+    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
-+
-     ULONG nErr = eERR_OK;
-     long i;
- 
-@@ -349,6 +354,10 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-         xRowProp->setPropertyValue(
-                     rtl::OUString::createFromAscii(SC_DBPROP_COMMAND), aAny );
- 
-+        aAny <<= sal_False;
-+        xRowProp->setPropertyValue(
-+                    rtl::OUString::createFromAscii(SC_DBPROP_PROPCHANGE_NOTIFY), aAny );
-+
-         xRowSet->execute();
- 
-         long nColCount = 0;
-@@ -426,16 +435,33 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-         BOOL bEnd = FALSE;
-         while ( !bEnd && xRowSet->next() )
-         {
-+            bool bSimpleRow = true;
-             if ( nRow <= MAXROW )
-             {
-                 SCCOL nCol = 0;
-                 for (i=0; i<nColCount; i++)
-                 {
-+                    ScDatabaseDocUtil::StrData aStrData;
-                     ScDatabaseDocUtil::PutData( &aDocument, nCol, nRow, 0,
-                                                 xRow, i+1, pTypeArr[i], FALSE,
--                                                &bSimpleColWidth[nCol] );
-+                                                &aStrData );
-+
-+                    if (aStrData.mnStrLength > aColWidthParam[nCol].mnMaxTextLen)
-+                    {
-+                        aColWidthParam[nCol].mnMaxTextLen = aStrData.mnStrLength;
-+                        aColWidthParam[nCol].mnMaxTextRow = nRow;
-+                    }
-+
-+                    if (!aStrData.mbSimpleText)
-+                    {
-+                        bSimpleRow = false;
-+                        aColWidthParam[nCol].mbSimpleText = false;
-+                    }
-+
-                     ++nCol;
-                 }
-+                if (!bSimpleRow)
-+                    rRowHeightsRecalc.setTrue(nRow, nRow);
-                 ++nRow;
-             }
-             else		// past the end of the spreadsheet
-diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
-index 01542c2..2ed233a 100644
---- sc/source/ui/docshell/impex.cxx
-+++ sc/source/ui/docshell/impex.cxx
-@@ -1191,8 +1191,7 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
-     if ( rStrm.GetStreamCharSet() == RTL_TEXTENCODING_UNICODE )
-         rStrm.StartReadingUnicodeText();
- 
--    BOOL bOld = ScColumn::bDoubleAlloc;
--    ScColumn::bDoubleAlloc = TRUE;
-+    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
- 
-     SCCOL nStartCol = aRange.aStart.Col();
-     SCCOL nEndCol = aRange.aEnd.Col();
-@@ -1393,7 +1392,6 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
-         bDetermineRange = !bDetermineRange;     // toggle
-     } while (!bDetermineRange);
- 
--    ScColumn::bDoubleAlloc = bOld;
-     pDoc->DoColResize( nTab, nStartCol, nEndCol, 0 );
- 
-     delete pEnglishTransliteration;
-diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
-index bb17dc9..95a16ed 100644
---- sc/source/ui/inc/docsh.hxx
-+++ sc/source/ui/inc/docsh.hxx
-@@ -69,6 +69,8 @@ class ScImportOptions;
- class ScDocShellModificator;
- class ScOptSolverSave;
- class ScSheetSaveData;
-+class ScFlatBoolRowSegments;
-+struct ScColWidthParam;
- 
- namespace sfx2 { class FileDialogHelper; }
- struct DocShell_Impl;
-@@ -149,7 +151,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
-     SC_DLLPRIVATE SCTAB			GetSaveTab();
- 
-     SC_DLLPRIVATE ULONG			DBaseImport( const String& rFullFileName, CharSet eCharSet,
--                                 BOOL bSimpleColWidth[MAXCOLCOUNT] );
-+                                             ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc );
-     SC_DLLPRIVATE ULONG			DBaseExport( const String& rFullFileName, CharSet eCharSet,
-                                  BOOL& bHasMemo );
- 


More information about the ooo-build-commit mailing list