diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-21 16:46:57 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-22 09:03:33 -0500 |
commit | 151beeb0b234512768080da3441ebe40a46cd861 (patch) | |
tree | d540a5acf3313a6160cca5868daadea18ba5772c /sc | |
parent | 3797e61e5eb15b9dee9c55afe95013f134ac2d5d (diff) |
Set default cell style directly, without UNO API.
This also avoids unnecessary row height adjustments.
Change-Id: Icfecf0a5fdf7ef18db368ebadcf9d0b8700c0b65
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/documentimport.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/documentimport.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 12 |
3 files changed, 25 insertions, 2 deletions
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx index d2aa99411cfc..222908e341c6 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 71387953e0ca..3ca06c544e62 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 6d0ea85cbc40..e3a4c897abe6 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. */ |