Kaydet (Commit) 151beeb0 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Set default cell style directly, without UNO API.

This also avoids unnecessary row height adjustments.

Change-Id: Icfecf0a5fdf7ef18db368ebadcf9d0b8700c0b65
üst 3797e61e
......@@ -23,6 +23,7 @@ class ScColumn;
class ScAddress;
class ScTokenArray;
class ScFormulaCell;
class ScStyleSheet;
struct ScSetStringParam;
struct ScTabOpParam;
struct ScDocumentImportImpl;
......@@ -49,6 +50,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.
*
......
......@@ -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;
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment