[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - 2 commits - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Nov 21 15:47:51 PST 2013


 sc/inc/documentimport.hxx                |    6 ++++++
 sc/source/core/data/documentimport.cxx   |    9 +++++++++
 sc/source/core/opencl/opencl_device.cxx  |    2 +-
 sc/source/filter/oox/worksheethelper.cxx |   12 ++++++++++--
 4 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 40f49fb57702df9e36ad7a78b28943468fecd0ff
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 16:46:57 2013 -0500

    Set default cell style directly, without UNO API.
    
    This also avoids unnecessary row height adjustments.
    
    Change-Id: Icfecf0a5fdf7ef18db368ebadcf9d0b8700c0b65

diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index d2aa994..222908e 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -23,6 +23,7 @@ class ScColumn;
 class ScAddress;
 class ScTokenArray;
 class ScFormulaCell;
+class ScStyleSheet;
 struct ScSetStringParam;
 struct ScTabOpParam;
 struct ScDocumentImportImpl;
@@ -50,6 +51,11 @@ public:
     void setDefaultNumericScript(sal_uInt16 nScript);
 
     /**
+     * Apply specified cell style to an entire sheet.
+     */
+    void setCellStyleToSheet(SCTAB nTab, const ScStyleSheet& rStyle);
+
+    /**
      * @param rName sheet name.
      *
      * @return 0-based sheet index, or -1 in case no sheet is found by
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 7138795..3ca06c5 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -58,6 +58,15 @@ void ScDocumentImport::setDefaultNumericScript(sal_uInt16 nScript)
     mpImpl->mnDefaultScriptNumeric = nScript;
 }
 
+void ScDocumentImport::setCellStyleToSheet(SCTAB nTab, const ScStyleSheet& rStyle)
+{
+    ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab);
+    if (!pTab)
+        return;
+
+    pTab->ApplyStyleArea(0, 0, MAXCOL, MAXROW, rStyle);
+}
+
 SCTAB ScDocumentImport::getSheetIndex(const OUString& rName) const
 {
     SCTAB nTab = -1;
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 6d0ea85..e3a4c89 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -70,6 +70,8 @@
 #include "tokenarray.hxx"
 #include "tablebuffer.hxx"
 #include "documentimport.hxx"
+#include "stlsheet.hxx"
+#include "stlpool.hxx"
 
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
@@ -938,8 +940,14 @@ void WorksheetGlobals::setRowModel( const RowModel& rModel )
 void WorksheetGlobals::initializeWorksheetImport()
 {
     // set default cell style for unused cells
-    PropertySet aPropSet( mxSheet );
-    aPropSet.setProperty( PROP_CellStyle, getStyles().getDefaultStyleName() );
+    ScDocumentImport& rDoc = getDocImport();
+
+    ScStyleSheet* pStyleSheet =
+        static_cast<ScStyleSheet*>(rDoc.getDoc().GetStyleSheetPool()->Find(
+            getStyles().getDefaultStyleName(), SFX_STYLE_FAMILY_PARA));
+
+    if (pStyleSheet)
+        rDoc.setCellStyleToSheet(getSheetIndex(), *pStyleSheet);
 
     /*  Remember the current sheet index in global data, needed by global
         objects, e.g. the chart converter. */
commit 2c37bdff1cecf9b50bbee98122488bfeb2bd5fd2
Author: Jagan Lokanatha <Jagan.Lokanatha at amd.com>
Date:   Thu Nov 21 15:14:14 2013 -0500

    Ensure that when ds_profile is NULL, NATIVE_CPU is selected.
    
    Change-Id: Iab714a296ce0f807b5badd1ff96a99f3da2b24f8

diff --git a/sc/source/core/opencl/opencl_device.cxx b/sc/source/core/opencl/opencl_device.cxx
index 3eb415b..8f9f8ff 100644
--- a/sc/source/core/opencl/opencl_device.cxx
+++ b/sc/source/core/opencl/opencl_device.cxx
@@ -447,7 +447,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
         if (!profile)
         {
             // failed to initialize profile.
-            selectedDevice.oclDeviceID = NULL;
+            selectedDevice.type = DS_DEVICE_NATIVE_CPU;
             return selectedDevice;
         }
 


More information about the Libreoffice-commits mailing list