[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - 6 commits - sc/source
Noel Power
noel.power at suse.com
Thu May 30 06:08:15 PDT 2013
sc/source/filter/inc/condformatbuffer.hxx | 47 ++++++++++
sc/source/filter/inc/sheetdatabuffer.hxx | 19 +++-
sc/source/filter/inc/stylesbuffer.hxx | 4
sc/source/filter/oox/condformatbuffer.cxx | 121 ++++++++++++++++++++++++++
sc/source/filter/oox/condformatcontext.cxx | 2
sc/source/filter/oox/extlstcontext.cxx | 98 ++++-----------------
sc/source/filter/oox/numberformatsbuffer.cxx | 2
sc/source/filter/oox/sheetdatabuffer.cxx | 122 +++++++++++++++++++++++----
sc/source/filter/oox/stylesbuffer.cxx | 89 ++++++++++++++++---
sc/source/filter/oox/worksheethelper.cxx | 1
10 files changed, 392 insertions(+), 113 deletions(-)
New commits:
commit 74125ebab42f4a0aca804f1c7eb5392f3b7874ef
Author: Noel Power <noel.power at suse.com>
Date: Tue May 28 11:15:31 2013 +0100
remove some methods that are no longer used after rework
Change-Id: I057ae3608d5f7ba513dcdc31b1caba1bfc45c0e8
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 3efd123..de60968 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -84,80 +84,6 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
}
}
-void ExtCfRuleContext::importDataBar( const AttributeList& rAttribs )
-{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
- pDataBar->mbGradient = rAttribs.getBool( XML_gradient, true );
-
- rtl::OUString aAxisPosition = rAttribs.getString( XML_axisPosition, "automatic" );
- if( aAxisPosition == "none" )
- pDataBar->meAxisPosition = databar::NONE;
- else if( aAxisPosition == "middle" )
- pDataBar->meAxisPosition = databar::MIDDLE;
- else
- pDataBar->meAxisPosition = databar::AUTOMATIC;
-
- pDataBar->mbNeg = !rAttribs.getBool( XML_negativeBarColorSameAsPositive, false );
-}
-
-namespace {
-
-::Color RgbToRgbComponents( sal_Int32 nRgb )
-{
- sal_Int32 ornR = (nRgb >> 16) & 0xFF;
- sal_Int32 ornG = (nRgb >> 8) & 0xFF;
- sal_Int32 ornB = nRgb & 0xFF;
-
- return ::Color(ornR, ornG, ornB);
-}
-
-}
-
-void ExtCfRuleContext::importAxisColor( const AttributeList& rAttribs )
-{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
-
- sal_Int32 nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
- ::Color aColor = RgbToRgbComponents(nColor);
- pDataBar->maAxisColor = aColor;
-}
-
-void ExtCfRuleContext::importNegativeFillColor( const AttributeList& rAttribs )
-{
- sal_Int32 nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
- ::Color aColor = RgbToRgbComponents(nColor);
- ::Color* pColor = new Color(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue());
- static_cast<ScDataBarFormatData*>(mpTarget)->mpNegativeColor.reset(pColor);
-}
-
-void ExtCfRuleContext::importCfvo( const AttributeList& rAttribs )
-{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
- ScColorScaleEntry* pEntry = NULL;
- if(mbFirstEntry)
- pEntry = pDataBar->mpLowerLimit.get();
- else
- pEntry = pDataBar->mpUpperLimit.get();
-
- rtl::OUString aColorScaleType = rAttribs.getString( XML_type, rtl::OUString() );
- if(aColorScaleType == "min")
- pEntry->SetType(COLORSCALE_MIN);
- else if (aColorScaleType == "max")
- pEntry->SetType(COLORSCALE_MAX);
- else if (aColorScaleType == "autoMin")
- pEntry->SetType(COLORSCALE_AUTO);
- else if (aColorScaleType == "autoMax")
- pEntry->SetType(COLORSCALE_AUTO);
- else if (aColorScaleType == "percentile")
- pEntry->SetType(COLORSCALE_PERCENTILE);
- else if (aColorScaleType == "percent")
- pEntry->SetType(COLORSCALE_PERCENT);
- else if (aColorScaleType == "formula")
- pEntry->SetType(COLORSCALE_FORMULA);
-
- mbFirstEntry = false;
-}
-
ExtLstLocalContext::ExtLstLocalContext( WorksheetContextBase& rFragment, void* pTarget ):
WorksheetContextBase(rFragment),
mpTarget(pTarget)
commit 2e4ba7f257dd65908ac720330c9c9e2e3b336ab5
Author: Noel Power <noel.power at suse.com>
Date: Mon May 27 14:53:49 2013 +0100
buffer ExtCfRuleContext startElement processing
ExtCfRuleContext::onStartElement processing depends on some data now buffered
until CondFormatBuffer::finalizeImport runs. We now need to wait for this
data to be available. This change buffers up the processing that used happen
in ExtCfRuleContext startElement so it is now done as part of
CondFormatBuffer::finalizeImport
Change-Id: Ifbfe12740e6c4bc9791183dba89acb79cbbb6ef6
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 9a1ca7d..c7b01ae 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -231,7 +231,47 @@ private:
bool mbReadyForFinalize;
};
+struct ExCfRuleModel
+{
+ ExCfRuleModel() : mbGradient( false ), mbNegativeBarColorSameAsPositive( false ), mnAxisColor( API_RGB_TRANSPARENT ), mnNegativeColor( API_RGB_TRANSPARENT ), mbIsLower( true ) {}
+ // DataBar
+ bool mbGradient;
+ OUString maAxisPosition;
+ bool mbNegativeBarColorSameAsPositive;
+ // AxisColor
+ sal_Int32 mnAxisColor;
+ // NegativeFillColor
+ sal_Int32 mnNegativeColor;
+ // Cfvo
+ bool mbIsLower;
+ OUString maColorScaleType;
+};
+
+class ExtCfRule
+{
+ enum RuleType
+ {
+ DATABAR,
+ NEGATIVEFILLCOLOR,
+ AXISCOLOR,
+ CFVO,
+ UNKNOWN,
+ };
+ ExCfRuleModel maModel;
+ RuleType mnRuleType;
+ void* mpTarget;
+public:
+ ExtCfRule(void* pTarget = NULL ) : mnRuleType( ExtCfRule::RuleType::UNKNOWN ), mpTarget(pTarget) {}
+ void finalizeImport();
+ void importDataBar( const AttributeList& rAttribs );
+ void importNegativeFillColor( const AttributeList& rAttribs );
+ void importAxisColor( const AttributeList& rAttribs );
+ void importCfvo( const AttributeList& rAttribs );
+ ExCfRuleModel& getModel() { return maModel; }
+};
+
typedef ::boost::shared_ptr< CondFormat > CondFormatRef;
+typedef ::boost::shared_ptr< ExtCfRule > ExtCfRuleRef;
// ============================================================================
@@ -244,6 +284,7 @@ public:
CondFormatRef importConditionalFormatting( const AttributeList& rAttribs );
/** Imports settings from the CONDFORMATTING record. */
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
+ ExtCfRuleRef createExtCfRule( void* pTarget );
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
@@ -254,7 +295,9 @@ private:
private:
typedef RefVector< CondFormat > CondFormatVec;
+ typedef RefVector< ExtCfRule > ExtCfRuleVec;
CondFormatVec maCondFormats; /// All conditional formatting in a sheet.
+ ExtCfRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
};
// ============================================================================
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 7bb671d..dfda7da 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1013,6 +1013,13 @@ void CondFormatBuffer::finalizeImport()
if ( (*it).get() )
(*it).get()->finalizeImport();
}
+ ExtCfRuleVec::iterator ext_it = maCfRules.begin();
+ ExtCfRuleVec::iterator ext_end = maCfRules.end();
+ for ( ; ext_it != ext_end; ++ext_it )
+ {
+ if ( (*ext_it).get() )
+ (*ext_it).get()->finalizeImport();
+ }
}
CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm )
@@ -1022,6 +1029,13 @@ CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm
return xCondFmt;
}
+ExtCfRuleRef CondFormatBuffer::createExtCfRule( void* pTarget )
+{
+ ExtCfRuleRef extRule( new ExtCfRule( pTarget ) );
+ maCfRules.push_back( extRule );
+ return extRule;
+}
+
sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
{
switch( nToken )
@@ -1065,7 +1079,100 @@ CondFormatRef CondFormatBuffer::createCondFormat()
maCondFormats.push_back( xCondFmt );
return xCondFmt;
}
+/*
+::Color RgbToRgbComponents( sal_Int32 nRgb )
+{
+ sal_Int32 ornR = (nRgb >> 16) & 0xFF;
+ sal_Int32 ornG = (nRgb >> 8) & 0xFF;
+ sal_Int32 ornB = nRgb & 0xFF;
+
+ return ::Color(ornR, ornG, ornB);
+}
+*/
+
+void ExtCfRule::finalizeImport()
+{
+ switch ( mnRuleType )
+ {
+ case DATABAR:
+ {
+ ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ if( maModel.maAxisPosition == "none" )
+ pDataBar->meAxisPosition = databar::NONE;
+ else if( maModel.maAxisPosition == "middle" )
+ pDataBar->meAxisPosition = databar::MIDDLE;
+ else
+ pDataBar->meAxisPosition = databar::AUTOMATIC;
+ pDataBar->mbNeg = !maModel.mbGradient;
+ break;
+ }
+ case AXISCOLOR:
+ {
+ ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ pDataBar->maAxisColor = RgbToRgbComponents(maModel.mnAxisColor);
+ break;
+ }
+ case NEGATIVEFILLCOLOR:
+ {
+ ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ pDataBar->mpNegativeColor.reset( new ::Color( RgbToRgbComponents(maModel.mnNegativeColor) ) );
+ break;
+ }
+ case CFVO:
+ {
+ ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ ScColorScaleEntry* pEntry = NULL;
+ if(maModel.mbIsLower)
+ pEntry = pDataBar->mpLowerLimit.get();
+ else
+ pEntry = pDataBar->mpUpperLimit.get();
+
+ if(maModel.maColorScaleType == "min")
+ pEntry->SetType(COLORSCALE_MIN);
+ else if (maModel.maColorScaleType == "max")
+ pEntry->SetType(COLORSCALE_MAX);
+ else if (maModel.maColorScaleType == "autoMin")
+ pEntry->SetType(COLORSCALE_AUTO);
+ else if (maModel.maColorScaleType == "autoMax")
+ pEntry->SetType(COLORSCALE_AUTO);
+ else if (maModel.maColorScaleType == "percentile")
+ pEntry->SetType(COLORSCALE_PERCENTILE);
+ else if (maModel.maColorScaleType == "percent")
+ pEntry->SetType(COLORSCALE_PERCENT);
+ else if (maModel.maColorScaleType == "formula")
+ pEntry->SetType(COLORSCALE_FORMULA);
+ break;
+ }
+ case UNKNOWN: // nothing to do
+ default:
+ break;
+ };
+}
+void ExtCfRule::importDataBar( const AttributeList& rAttribs )
+{
+ mnRuleType = DATABAR;
+ maModel.mbGradient = rAttribs.getBool( XML_gradient, true );
+ maModel.maAxisPosition = rAttribs.getString( XML_axisPosition, "automatic" );
+}
+
+void ExtCfRule::importNegativeFillColor( const AttributeList& rAttribs )
+{
+ mnRuleType = NEGATIVEFILLCOLOR;
+ maModel.mnNegativeColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
+}
+
+void ExtCfRule::importAxisColor( const AttributeList& rAttribs )
+{
+ mnRuleType = AXISCOLOR;
+ maModel.mnAxisColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
+}
+
+void ExtCfRule::importCfvo( const AttributeList& rAttribs )
+{
+ mnRuleType = CFVO;
+ maModel.maColorScaleType = rAttribs.getString( XML_type, OUString() );
+}
// ============================================================================
} // namespace xls
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 43a3859..3efd123 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -30,6 +30,7 @@
#include "worksheethelper.hxx"
#include <oox/core/contexthandler.hxx>
#include "colorscale.hxx"
+#include "condformatbuffer.hxx"
using ::oox::core::ContextHandlerRef;
@@ -53,18 +54,31 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
switch( getCurrentElement() )
{
case XLS_EXT_TOKEN( dataBar ):
- importDataBar( rAttribs );
+ {
+ ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ xRule->importDataBar( rAttribs );
break;
+ }
case XLS_EXT_TOKEN( negativeFillColor ):
- importNegativeFillColor( rAttribs );
+ {
+ ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ xRule->importNegativeFillColor( rAttribs );
break;
+ }
case XLS_EXT_TOKEN( axisColor ):
- importAxisColor( rAttribs );
+ {
+ ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ xRule->importAxisColor( rAttribs );
break;
+ }
case XLS_EXT_TOKEN( cfvo ):
- importCfvo( rAttribs );
+ {
+ ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ xRule->importCfvo( rAttribs );
+ xRule->getModel().mbIsLower = mbFirstEntry;
+ mbFirstEntry = false;
break;
-
+ }
default:
break;
}
commit faf99d003598c8d7527a635ec28514204ff5f948
Author: Noel Power <noel.power at suse.com>
Date: Mon May 27 11:30:20 2013 +0100
buffer conditional formatting finalization so it happens after styles import
Change-Id: If28059578280536141ea966d83e4540939f6e76b
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 25bae46..9a1ca7d 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -217,6 +217,7 @@ public:
/** Returns the cell ranges this conditional formatting belongs to. */
inline const ApiCellRangeList& getRanges() const { return maModel.maRanges; }
+ void setReadyForFinalize() { mbReadyForFinalize = true; }
private:
CondFormatRuleRef createRule();
void insertRule( CondFormatRuleRef xRule );
@@ -227,6 +228,7 @@ private:
CondFormatModel maModel; /// Model of this conditional formatting.
CondFormatRuleMap maRules; /// Maps formatting rules by priority.
ScConditionalFormat* mpFormat;
+ bool mbReadyForFinalize;
};
typedef ::boost::shared_ptr< CondFormat > CondFormatRef;
@@ -246,7 +248,7 @@ public:
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
static sal_Int32 convertToInternalOperator( sal_Int32 nToken );
-
+ void finalizeImport();
private:
CondFormatRef createCondFormat();
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 604b97f..7bb671d 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -922,7 +922,8 @@ CondFormatModel::CondFormatModel() :
CondFormat::CondFormat( const WorksheetHelper& rHelper ) :
WorksheetHelper( rHelper ),
- mpFormat(NULL)
+ mpFormat(NULL),
+ mbReadyForFinalize(false)
{
}
@@ -1003,6 +1004,17 @@ CondFormatRef CondFormatBuffer::importConditionalFormatting( const AttributeList
return xCondFmt;
}
+void CondFormatBuffer::finalizeImport()
+{
+ CondFormatVec::iterator it = maCondFormats.begin();
+ CondFormatVec::iterator it_end = maCondFormats.end();
+ for( ; it != it_end; ++it )
+ {
+ if ( (*it).get() )
+ (*it).get()->finalizeImport();
+ }
+}
+
CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm )
{
CondFormatRef xCondFmt = createCondFormat();
diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx
index 4337e9a..155fe3b 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -179,7 +179,7 @@ void CondFormatContext::onEndElement()
{
case XLS_TOKEN( conditionalFormatting ):
if(mxCondFmt.get())
- mxCondFmt->finalizeImport();
+ mxCondFmt->setReadyForFinalize();
break;
}
}
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index f736393..49add26 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -943,6 +943,7 @@ void WorksheetGlobals::finalizeWorksheetImport()
{
lclUpdateProgressBar( mxRowProgress, 1.0 );
maSheetData.finalizeImport();
+ getCondFormats().finalizeImport();
lclUpdateProgressBar( mxFinalProgress, 0.25 );
finalizeHyperlinkRanges();
finalizeValidationRanges();
commit 12f7468781011c9b40d8fa03004203c1f493e786
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 09:52:12 2013 +0100
reorg styles code slightly, process normal (and row ) style in own method
Change-Id: I701d12cf8f672824d7cfca1e995f02040fdd3095
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index 62f42da..84f3403 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -192,7 +192,7 @@ private:
/** Writes all cell formatting attributes to the passed cell range list. (depreciates writeXfIdRangeProperties) */
void writeXfIdRangeListProperties( sal_Int32 nXfId, sal_Int32 nNumFmtId, const ApiCellRangeList& rRanges ) const;
void applyCellMerging( const ::com::sun::star::table::CellRangeAddress& rRange );
-
+ void addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const ::com::sun::star::table::CellRangeAddress& rAddress, bool bProcessRowRange = false );
private:
/** Stores cell range address and formula token array of an array formula. */
typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula;
@@ -217,6 +217,22 @@ private:
typedef ::std::pair< sal_Int32, sal_Int32 > XfIdNumFmtKey;
typedef ::std::map< XfIdNumFmtKey, ApiCellRangeList > XfIdRangeListMap;
+ typedef ::std::pair< sal_Int32, sal_Int32 > RowRange;
+ struct RowRangeStyle
+ {
+ sal_Int32 mnStartRow;
+ sal_Int32 mnEndRow;
+ XfIdNumFmtKey mnNumFmt;
+ };
+ struct StyleRowRangeComp
+ {
+ bool operator() (const RowRangeStyle& lhs, const RowRangeStyle& rhs) const
+ {
+ return lhs.mnEndRow<rhs.mnStartRow;
+ }
+ };
+ typedef ::std::set< RowRangeStyle, StyleRowRangeComp > RowStyles;
+ typedef ::std::map< sal_Int32, RowStyles > ColStyles;
/** Stores information about a merged cell range. */
struct MergedRange
{
@@ -230,6 +246,7 @@ private:
};
typedef ::std::list< MergedRange > MergedRangeList;
+ ColStyles maStylesPerColumn; /// Stores cell styles by column ( in row ranges )
CellBlockBuffer maCellBlocks; /// Manages all open cell blocks.
ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet.
TableOperationList maTableOperations; /// All table operations in the sheet.
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 76bf25b..f0619ad 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -348,6 +348,66 @@ void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal
}
}
+void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const ::com::sun::star::table::CellRangeAddress& rAddress, bool bProcessRowRange )
+{
+ RowRangeStyle aStyleRows;
+ aStyleRows.mnNumFmt.first = nXfId;
+ aStyleRows.mnNumFmt.second = nFormatId;
+ aStyleRows.mnStartRow = rAddress.StartRow;
+ aStyleRows.mnEndRow = rAddress.EndRow;
+ for ( sal_Int32 nCol = rAddress.StartColumn; nCol <= rAddress.EndColumn; ++nCol )
+ {
+ if ( !bProcessRowRange )
+ maStylesPerColumn[ nCol ].insert( aStyleRows );
+ else
+ {
+ RowStyles& rRowStyles = maStylesPerColumn[ nCol ];
+ // If the rowrange style includes rows already
+ // allocated to a style then we need to split
+ // the range style Rows into sections ( to
+ // occupy only rows that have no style definition )
+
+ // We dont want to set any rowstyle 'rows'
+ // for rows where there is an existing 'style' )
+ std::vector< RowRangeStyle > aRangeRowsSplits;
+
+ RowStyles::iterator rows_it = rRowStyles.begin();
+ RowStyles::iterator rows_end = rRowStyles.end();
+ bool bAddRange = true;
+ for ( ; rows_it != rows_end; ++rows_it )
+ {
+ const RowRangeStyle& r = *rows_it;
+ // if row is completely within existing style, discard it
+ if ( aStyleRows.mnStartRow >= r.mnStartRow && aStyleRows.mnEndRow <= r.mnEndRow )
+ bAddRange = false;
+ else if ( aStyleRows.mnStartRow <= r.mnStartRow )
+ {
+ // not intersecting at all?, if so finish as none left
+ // to check ( row ranges are in ascending order
+ if ( aStyleRows.mnEndRow < r.mnStartRow )
+ break;
+ else if ( aStyleRows.mnEndRow <= r.mnEndRow )
+ {
+ aStyleRows.mnEndRow = r.mnStartRow - 1;
+ break;
+ }
+ if ( aStyleRows.mnStartRow < r.mnStartRow )
+ {
+ RowRangeStyle aSplit = aStyleRows;
+ aSplit.mnEndRow = r.mnStartRow - 1;
+ aRangeRowsSplits.push_back( aSplit );
+ }
+ }
+ }
+ std::vector< RowRangeStyle >::iterator splits_it = aRangeRowsSplits.begin();
+ std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end();
+ for ( ; splits_it != splits_end; ++splits_it )
+ rRowStyles.insert( *splits_it );
+ if ( bAddRange )
+ rRowStyles.insert( aStyleRows );
+ }
+ }
+}
void SheetDataBuffer::finalizeImport()
{
// insert all cells of all open cell blocks
@@ -364,49 +424,19 @@ void SheetDataBuffer::finalizeImport()
// write default formatting of remaining row range
maXfIdRowRangeList[ maXfIdRowRange.mnXfId ].push_back( maXfIdRowRange.maRowRange );
- typedef ::std::pair< sal_Int32, sal_Int32 > RowRange;
- struct RowRangeStyle
- {
- sal_Int32 mnStartRow;
- sal_Int32 mnEndRow;
- XfIdNumFmtKey mnNumFmt;
- };
- struct StyleRowRangeComp
- {
- bool operator() (const RowRangeStyle& lhs, const RowRangeStyle& rhs) const
- {
- return lhs.mnEndRow<rhs.mnStartRow;
- }
- };
-
- typedef ::std::set< RowRangeStyle, StyleRowRangeComp > RowStyles;
- typedef ::std::map< sal_Int32, RowStyles > ColStyles;
-
- ColStyles aStylesPerColumn;
- StylesBuffer& rStyles = getStyles();
-
std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList > rangeStyleListMap;
-
for( XfIdRangeListMap::const_iterator aIt = maXfIdRangeLists.begin(), aEnd = maXfIdRangeLists.end(); aIt != aEnd; ++aIt )
+ {
addIfNotInMyMap( getStyles(), rangeStyleListMap, aIt->first.first, aIt->first.second, aIt->second );
-
+ }
// gather all ranges that have the same style and apply them in bulk
for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it )
{
const ApiCellRangeList& rRanges( it->second );
for ( ApiCellRangeList::const_iterator it_range = rRanges.begin(), it_rangeend = rRanges.end(); it_range!=it_rangeend; ++it_range )
- {
- RowRangeStyle aStyleRows;
- aStyleRows.mnNumFmt.first = it->first.first;
- aStyleRows.mnNumFmt.second = it->first.second;
- aStyleRows.mnStartRow = it_range->StartRow;
- aStyleRows.mnEndRow = it_range->EndRow;
- for ( sal_Int32 nCol = it_range->StartColumn; nCol <= it_range->EndColumn; ++nCol )
- aStylesPerColumn[ nCol ].insert( aStyleRows );
- }
+ addColXfStyle( it->first.first, it->first.second, *it_range );
}
- // process row ranges for each column, don't overwrite any existing row entries for a column
for ( std::map< sal_Int32, std::vector< ValueRange > >::iterator it = maXfIdRowRangeList.begin(), it_end = maXfIdRowRangeList.end(); it != it_end; ++it )
{
ApiCellRangeList rangeList;
@@ -414,64 +444,17 @@ void SheetDataBuffer::finalizeImport()
// get all row ranges for id
for ( std::vector< ValueRange >::iterator rangeIter = it->second.begin(), rangeIter_end = it->second.end(); rangeIter != rangeIter_end; ++rangeIter )
{
- RowRangeStyle aStyleRows;
- aStyleRows.mnNumFmt.first = it->first;
- if ( aStyleRows.mnNumFmt.first == -1 ) // dud
+ if ( it->first == -1 ) // it's a dud skip it
continue;
- aStyleRows.mnNumFmt.second = -1;
- aStyleRows.mnStartRow = rangeIter->mnFirst;
- aStyleRows.mnEndRow = rangeIter->mnLast;
- for ( sal_Int32 nCol = 0; nCol <= rAddrConv.getMaxApiAddress().Column; ++nCol )
- {
- RowStyles& rRowStyles = aStylesPerColumn[ nCol ];
- // If the rowrange style includes rows already
- // allocated to a style then we need to split
- // the range style Rows into sections ( to
- // occupy only rows that have no style definition )
-
- // We dont want to set any rowstyle 'rows'
- // for rows where there is an existing 'style' )
- std::vector< RowRangeStyle > aRangeRowsSplits;
-
- RowStyles::iterator rows_it = rRowStyles.begin();
- RowStyles::iterator rows_end = rRowStyles.end();
- bool bAddRange = true;
- for ( ; rows_it != rows_end; ++rows_it )
- {
- const RowRangeStyle& r = *rows_it;
- // if row is completely within existing style, discard it
- if ( aStyleRows.mnStartRow >= r.mnStartRow && aStyleRows.mnEndRow <= r.mnEndRow )
- bAddRange = false;
- else if ( aStyleRows.mnStartRow <= r.mnStartRow )
- {
- // not intersecting at all?, if so finish as none left
- // to check ( row ranges are in ascending order
- if ( aStyleRows.mnEndRow < r.mnStartRow )
- break;
- else if ( aStyleRows.mnEndRow <= r.mnEndRow )
- {
- aStyleRows.mnEndRow = r.mnStartRow - 1;
- break;
- }
- if ( aStyleRows.mnStartRow < r.mnStartRow )
- {
- RowRangeStyle aSplit = aStyleRows;
- aSplit.mnEndRow = r.mnStartRow - 1;
- aRangeRowsSplits.push_back( aSplit );
- }
- }
- }
- std::vector< RowRangeStyle >::iterator splits_it = aRangeRowsSplits.begin();
- std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end();
- for ( ; splits_it != splits_end; ++splits_it )
- rRowStyles.insert( *splits_it );
- if ( bAddRange )
- rRowStyles.insert( aStyleRows );
- }
+ CellRangeAddress aRange( getSheetIndex(), 0, rangeIter->mnFirst, rAddrConv.getMaxApiAddress().Column, rangeIter->mnLast );
+
+ addColXfStyle( it->first, -1, aRange, true );
}
}
+
ScDocument& rDoc = getScDocument();
- for ( ColStyles::iterator col = aStylesPerColumn.begin(), col_end = aStylesPerColumn.end(); col != col_end; ++col )
+ StylesBuffer& rStyles = getStyles();
+ for ( ColStyles::iterator col = maStylesPerColumn.begin(), col_end = maStylesPerColumn.end(); col != col_end; ++col )
{
RowStyles& rRowStyles = col->second;
std::list<ScAttrEntry> aAttrs;
@@ -499,6 +482,7 @@ void SheetDataBuffer::finalizeImport()
rDoc.SetAttrEntries(nScCol, getSheetIndex(), pData, static_cast<SCSIZE>(nAttrSize));
}
+
// merge all cached merged ranges and update right/bottom cell borders
for( MergedRangeList::iterator aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt )
applyCellMerging( aIt->maRange );
commit 1fd4350cb382561438c2aeb8c567c6d92f0f784a
Author: Noel Power <noel.power at suse.com>
Date: Thu May 23 11:50:28 2013 +0100
improve cell style xls[x|m] import performance
This change reorganizes the styles by column ( and by row ranges in that column )
so we can apply ScAttrEntry entries directly via Document.SetAttrEntries(...) this is
what the binary filter does also.
Change-Id: I7c1398c1d900e0a2b6c6ec3746b982ef60e653a0
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 4b49e0d..e5fd11d 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -35,6 +35,8 @@
#include "stlsheet.hxx"
#include <editeng/svxenum.hxx>
#include <editeng/frmdir.hxx>
+#include "attarray.hxx"
+#include <list>
class ScMarkData;
namespace com { namespace sun { namespace star {
@@ -717,6 +719,8 @@ public:
inline const Protection& getProtection() const { return maProtection; }
void writeToMarkData( ::ScMarkData& rMarkData, sal_Int32 nNumFmtId );
+ void applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
+ sal_Int32 nForceScNumFmt );
/** Writes all formatting attributes to the passed property map. */
void writeToPropertyMap( PropertyMap& rPropMap ) const;
/** Writes all formatting attributes to the passed property set. */
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 4ea10d0..76bf25b 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -363,6 +363,50 @@ void SheetDataBuffer::finalizeImport()
// write default formatting of remaining row range
maXfIdRowRangeList[ maXfIdRowRange.mnXfId ].push_back( maXfIdRowRange.maRowRange );
+
+ typedef ::std::pair< sal_Int32, sal_Int32 > RowRange;
+ struct RowRangeStyle
+ {
+ sal_Int32 mnStartRow;
+ sal_Int32 mnEndRow;
+ XfIdNumFmtKey mnNumFmt;
+ };
+ struct StyleRowRangeComp
+ {
+ bool operator() (const RowRangeStyle& lhs, const RowRangeStyle& rhs) const
+ {
+ return lhs.mnEndRow<rhs.mnStartRow;
+ }
+ };
+
+ typedef ::std::set< RowRangeStyle, StyleRowRangeComp > RowStyles;
+ typedef ::std::map< sal_Int32, RowStyles > ColStyles;
+
+ ColStyles aStylesPerColumn;
+ StylesBuffer& rStyles = getStyles();
+
+ std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList > rangeStyleListMap;
+
+ for( XfIdRangeListMap::const_iterator aIt = maXfIdRangeLists.begin(), aEnd = maXfIdRangeLists.end(); aIt != aEnd; ++aIt )
+ addIfNotInMyMap( getStyles(), rangeStyleListMap, aIt->first.first, aIt->first.second, aIt->second );
+
+ // gather all ranges that have the same style and apply them in bulk
+ for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it )
+ {
+ const ApiCellRangeList& rRanges( it->second );
+ for ( ApiCellRangeList::const_iterator it_range = rRanges.begin(), it_rangeend = rRanges.end(); it_range!=it_rangeend; ++it_range )
+ {
+ RowRangeStyle aStyleRows;
+ aStyleRows.mnNumFmt.first = it->first.first;
+ aStyleRows.mnNumFmt.second = it->first.second;
+ aStyleRows.mnStartRow = it_range->StartRow;
+ aStyleRows.mnEndRow = it_range->EndRow;
+ for ( sal_Int32 nCol = it_range->StartColumn; nCol <= it_range->EndColumn; ++nCol )
+ aStylesPerColumn[ nCol ].insert( aStyleRows );
+ }
+ }
+
+ // process row ranges for each column, don't overwrite any existing row entries for a column
for ( std::map< sal_Int32, std::vector< ValueRange > >::iterator it = maXfIdRowRangeList.begin(), it_end = maXfIdRowRangeList.end(); it != it_end; ++it )
{
ApiCellRangeList rangeList;
@@ -370,27 +414,91 @@ void SheetDataBuffer::finalizeImport()
// get all row ranges for id
for ( std::vector< ValueRange >::iterator rangeIter = it->second.begin(), rangeIter_end = it->second.end(); rangeIter != rangeIter_end; ++rangeIter )
{
- CellRangeAddress aRange( getSheetIndex(), 0, rangeIter->mnFirst, rAddrConv.getMaxApiAddress().Column, rangeIter->mnLast );
- rangeList.push_back( aRange );
+ RowRangeStyle aStyleRows;
+ aStyleRows.mnNumFmt.first = it->first;
+ if ( aStyleRows.mnNumFmt.first == -1 ) // dud
+ continue;
+ aStyleRows.mnNumFmt.second = -1;
+ aStyleRows.mnStartRow = rangeIter->mnFirst;
+ aStyleRows.mnEndRow = rangeIter->mnLast;
+ for ( sal_Int32 nCol = 0; nCol <= rAddrConv.getMaxApiAddress().Column; ++nCol )
+ {
+ RowStyles& rRowStyles = aStylesPerColumn[ nCol ];
+ // If the rowrange style includes rows already
+ // allocated to a style then we need to split
+ // the range style Rows into sections ( to
+ // occupy only rows that have no style definition )
+
+ // We dont want to set any rowstyle 'rows'
+ // for rows where there is an existing 'style' )
+ std::vector< RowRangeStyle > aRangeRowsSplits;
+
+ RowStyles::iterator rows_it = rRowStyles.begin();
+ RowStyles::iterator rows_end = rRowStyles.end();
+ bool bAddRange = true;
+ for ( ; rows_it != rows_end; ++rows_it )
+ {
+ const RowRangeStyle& r = *rows_it;
+ // if row is completely within existing style, discard it
+ if ( aStyleRows.mnStartRow >= r.mnStartRow && aStyleRows.mnEndRow <= r.mnEndRow )
+ bAddRange = false;
+ else if ( aStyleRows.mnStartRow <= r.mnStartRow )
+ {
+ // not intersecting at all?, if so finish as none left
+ // to check ( row ranges are in ascending order
+ if ( aStyleRows.mnEndRow < r.mnStartRow )
+ break;
+ else if ( aStyleRows.mnEndRow <= r.mnEndRow )
+ {
+ aStyleRows.mnEndRow = r.mnStartRow - 1;
+ break;
+ }
+ if ( aStyleRows.mnStartRow < r.mnStartRow )
+ {
+ RowRangeStyle aSplit = aStyleRows;
+ aSplit.mnEndRow = r.mnStartRow - 1;
+ aRangeRowsSplits.push_back( aSplit );
+ }
+ }
+ }
+ std::vector< RowRangeStyle >::iterator splits_it = aRangeRowsSplits.begin();
+ std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end();
+ for ( ; splits_it != splits_end; ++splits_it )
+ rRowStyles.insert( *splits_it );
+ if ( bAddRange )
+ rRowStyles.insert( aStyleRows );
+ }
+ }
+ }
+ ScDocument& rDoc = getScDocument();
+ for ( ColStyles::iterator col = aStylesPerColumn.begin(), col_end = aStylesPerColumn.end(); col != col_end; ++col )
+ {
+ RowStyles& rRowStyles = col->second;
+ std::list<ScAttrEntry> aAttrs;
+ SCCOL nScCol = static_cast< SCCOL >( col->first );
+ for ( RowStyles::iterator rRows = rRowStyles.begin(), rRows_end = rRowStyles.end(); rRows != rRows_end; ++rRows )
+ {
+ Xf* pXf = rStyles.getCellXf( rRows->mnNumFmt.first ).get();
+
+ if ( pXf )
+ pXf->applyPatternToAttrList( aAttrs, rRows->mnStartRow, rRows->mnEndRow, rRows->mnNumFmt.second );
}
- ScRangeList aList;
- for ( ApiCellRangeList::const_iterator itRange = rangeList.begin(), itRange_end = rangeList.end(); itRange!=itRange_end; ++itRange )
+ if (aAttrs.empty() || aAttrs.back().nRow != MAXROW)
{
- ScRange* pRange = new ScRange();
- ScUnoConversion::FillScRange( *pRange, *itRange );
- aList.push_back( pRange );
+ ScAttrEntry aEntry;
+ aEntry.nRow = MAXROW;
+ aEntry.pPattern = rDoc.GetDefPattern();
+ aAttrs.push_back(aEntry);
}
- ScMarkData aMark;
- aMark.MarkFromRangeList( aList, false );
- getStyles().writeCellXfToMarkData( aMark, it->first, -1 );
+ size_t nAttrSize = aAttrs.size();
+ ScAttrEntry* pData = new ScAttrEntry[nAttrSize];
+ std::list<ScAttrEntry>::const_iterator itr = aAttrs.begin(), itrEnd = aAttrs.end();
+ for (size_t i = 0; itr != itrEnd; ++itr, ++i)
+ pData[i] = *itr;
+
+ rDoc.SetAttrEntries(nScCol, getSheetIndex(), pData, static_cast<SCSIZE>(nAttrSize));
}
- std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList > rangeStyleListMap;
- // gather all ranges that have the same style and apply them in bulk
- for( XfIdRangeListMap::const_iterator aIt = maXfIdRangeLists.begin(), aEnd = maXfIdRangeLists.end(); aIt != aEnd; ++aIt )
- addIfNotInMyMap( getStyles(), rangeStyleListMap, aIt->first.first, aIt->first.second, aIt->second );
- for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it )
- writeXfIdRangeListProperties( it->first.first, it->first.second, it->second );
// merge all cached merged ranges and update right/bottom cell borders
for( MergedRangeList::iterator aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt )
applyCellMerging( aIt->maRange );
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 1c9e1ec..4f2bf02 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2245,6 +2245,70 @@ FontRef Xf::getFont() const
return getStyles().getFont( maModel.mnFontId );
}
+void Xf::applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
+ sal_Int32 nNumFmtId )
+{
+ createPattern();
+ ScPatternAttr& rPat = *mpPattern;
+ ScDocument& rDoc = getScDocument();
+ if ( isCellXf() )
+ {
+ StylesBuffer& rStyles = getStyles();
+ rStyles.createCellStyle( maModel.mnStyleXfId );
+
+ mpStyleSheet = rStyles.getCellStyleSheet( maModel.mnStyleXfId );
+ if ( mpStyleSheet )
+ {
+ //rDoc.ApplySelectionStyle( static_cast<ScStyleSheet&>(*mpStyleSheet), rMarkData );
+ rPat.SetStyleSheet(mpStyleSheet, false);
+ }
+ else
+ {
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
+ if (pStylePool)
+ {
+ ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(
+ pStylePool->Find(
+ ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA));
+
+ if (pStyleSheet)
+ rPat.SetStyleSheet( pStyleSheet, false );
+ }
+ }
+ }
+ if ( nNumFmtId >= 0 )
+ {
+ ScPatternAttr aNumPat(rDoc.GetPool());
+ getStyles().writeNumFmtToItemSet( aNumPat.GetItemSet(), nNumFmtId );
+ rPat.GetItemSet().Put(aNumPat.GetItemSet());
+ }
+ if (rPat.GetStyleName())
+ {
+ // Check for a gap between the last entry and this one.
+ bool bHasGap = false;
+ if (rAttrs.empty() && nRow1 > 0)
+ // First attribute range doesn't start at row 0.
+ bHasGap = true;
+
+ if (!rAttrs.empty() && rAttrs.back().nRow + 1 < nRow1)
+ bHasGap = true;
+
+ if (bHasGap)
+ {
+ // Fill this gap with the default pattern.
+ ScAttrEntry aEntry;
+ aEntry.nRow = nRow1 - 1;
+ aEntry.pPattern = rDoc.GetDefPattern();
+ rAttrs.push_back(aEntry);
+ }
+
+ ScAttrEntry aEntry;
+ aEntry.nRow = nRow2;
+ aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(rPat));
+ rAttrs.push_back(aEntry);
+ }
+}
+
void Xf::writeToMarkData( ::ScMarkData& rMarkData, sal_Int32 nNumFmtId )
{
createPattern();
commit 4de486469a6609aaadc9065970f8f9d2d6009e1f
Author: Noel Power <noel.power at suse.com>
Date: Wed May 22 10:00:34 2013 +0100
fix for bnc#819865 itemstate in parent style incorrectly reported as set
Problem occurs because attrs set with default values are reported as set when queried
Change-Id: I89d6c3b09312fb78052d87ff20aa12c6fbe7bc98
(cherry picked from commit bf8e9b29aaebcbdd8f2f06b42ac97b8d9f8f4503)
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx
index 3c943a5..ecf6f07 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -2054,7 +2054,7 @@ void NumberFormatsBuffer::insertBuiltinFormats()
{
// do not put the current system locale for default table
Locale aLocale;
- if( (*aVIt)->mpcLocale[ 0 ] != '\0' )
+ if( (*aVIt)->mpcParent[ 0 ] != '\0' )
aLocale = aSysLocale;
for( const BuiltinFormat* pBuiltin = (*aVIt)->mpFormats; pBuiltin && (pBuiltin->mnNumFmtId >= 0); ++pBuiltin )
{
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 703fc8b..1c9e1ec 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2238,7 +2238,6 @@ void Xf::finalizeImport()
// alignment and protection
maAlignment.finalizeImport();
maProtection.finalizeImport();
- createPattern();
}
FontRef Xf::getFont() const
@@ -2335,8 +2334,12 @@ Xf::createPattern( bool bSkipPoolDefs )
StylesBuffer& rStyles = getStyles();
const Xf* pStyleXf = isCellXf() ? rStyles.getStyleXf( maModel.mnStyleXfId ).get() : 0;
- if( pStyleXf )
+ if( pStyleXf && !mpStyleSheet )
{
+ rStyles.createCellStyle( maModel.mnStyleXfId );
+ mpStyleSheet = rStyles.getCellStyleSheet( maModel.mnStyleXfId );
+ OSL_ENSURE( mpStyleSheet, "Xf::createPattern - no parentStyle created" );
+
const XfModel& rStyleData = pStyleXf->maModel;
if( !maModel.mbFontUsed )
maModel.mbFontUsed = !rStyleData.mbFontUsed || (maModel.mnFontId != rStyleData.mnFontId);
@@ -2696,8 +2699,13 @@ void CellStyle::createCellStyle()
{
// #i1624# #i1768# ignore unnamed user styles
+ bool bDefStyle = maModel.isDefaultStyle();
if( !mbCreated )
+ {
+ if ( bDefStyle && maFinalName.isEmpty() )
+ maFinalName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
mbCreated = maFinalName.isEmpty();
+ }
::ScDocument& rDoc = getScDocument();
if( !mbCreated && !mpStyleSheet )
@@ -2705,12 +2713,11 @@ void CellStyle::createCellStyle()
bool bCreatePattern = false;
Xf* pXF = getStyles().getStyleXf( maModel.mnXfId ).get();
- bool bDefStyle = maModel.isDefaultStyle();
if( bDefStyle )
{
// use existing "Default" style sheet
mpStyleSheet = static_cast< ScStyleSheet* >( static_cast< ScStyleSheetPool* >( rDoc.GetStyleSheetPool() )->Find(
- getStyles().getDefaultStyleName(), SFX_STYLE_FAMILY_PARA ) );
+ ScGlobal::GetRscString( STR_STYLENAME_STANDARD ), SFX_STYLE_FAMILY_PARA ) );
OSL_ENSURE( mpStyleSheet, "CellStyle::createStyle - Default style not found" );
bCreatePattern = true;
}
@@ -2846,16 +2853,6 @@ void CellStyleBuffer::finalizeImport()
// set final names and create user-defined and modified built-in cell styles
aCellStyles.forEachMemWithKey( &CellStyle::finalizeImport );
-
- if (mxDefStyle)
- {
- Reference<XNameAccess> xNA(getStyleFamily(false), UNO_QUERY_THROW);
- if (xNA->hasByName("Default"))
- {
- PropertySet aPropSet(xNA->getByName("Default"));
- getStyles().writeStyleXfToPropertySet(aPropSet, mxDefStyle->getModel().mnXfId);
- }
- }
}
sal_Int32 CellStyleBuffer::getDefaultXfId() const
More information about the Libreoffice-commits
mailing list