tdf#160706 speed up loading conditional formatting rule in XLS (3)
the comment when calling MakeCellStyleSheet does not match the implementation, so make the implementation match the comment. i.e. if there is an existing stylesheet with that name, just return it. Reduces load time for me from 47s to 33s Change-Id: If1bd08baf8515933b87c075d9eef04bc0a125357 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166241 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
68c04836ab
commit
e1268721d4
4 changed files with 13 additions and 9 deletions
|
@ -576,7 +576,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
|
|||
// *** create style sheet ***
|
||||
|
||||
OUString aStyleName( XclTools::GetCondFormatStyleName( GetCurrScTab(), mnFormatIndex, mnCondIndex ) );
|
||||
SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName, true ).GetItemSet();
|
||||
SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName ).GetItemSet();
|
||||
|
||||
const XclImpPalette& rPalette = GetPalette();
|
||||
|
||||
|
|
|
@ -254,9 +254,14 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyle
|
|||
|
||||
} // namespace
|
||||
|
||||
ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName )
|
||||
ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName )
|
||||
{
|
||||
return lclMakeStyleSheet( rPool, rStyleName, SfxStyleFamily::Para, bForceName );
|
||||
SfxStyleSheetBase* pOldStyleSheet = rPool.Find( rStyleName, SfxStyleFamily::Para );
|
||||
if( pOldStyleSheet )
|
||||
return static_cast< ScStyleSheet& >(*pOldStyleSheet);
|
||||
|
||||
// create new style sheet
|
||||
return static_cast< ScStyleSheet& >( rPool.Make( rStyleName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) );
|
||||
}
|
||||
|
||||
ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName )
|
||||
|
|
|
@ -193,12 +193,11 @@ public:
|
|||
// *** style sheet handling *** -----------------------------------------------
|
||||
|
||||
/** Creates and returns a cell style sheet and inserts it into the pool.
|
||||
@descr If the style sheet is already in the pool, another unused style name is used.
|
||||
@param bForceName Controls behaviour, if the style already exists:
|
||||
true = Old existing style will be renamed; false = New style gets another name. */
|
||||
@descr If the style sheet is already in the pool, return the existing style.
|
||||
*/
|
||||
static ScStyleSheet& MakeCellStyleSheet(
|
||||
ScStyleSheetPool& rPool,
|
||||
const OUString& rStyleName, bool bForceName );
|
||||
const OUString& rStyleName );
|
||||
/** Creates and returns a page style sheet and inserts it into the pool.
|
||||
@descr If the style sheet is already in the pool, another unused style name is used.
|
||||
@param bForceName Controls behaviour, if the style already exists:
|
||||
|
|
|
@ -3005,7 +3005,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
|
|||
// Create a cell style. This may overwrite an existing style if
|
||||
// one with the same name exists.
|
||||
ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
|
||||
*getScDocument().GetStyleSheetPool(), rStyleName, true);
|
||||
*getScDocument().GetStyleSheetPool(), rStyleName);
|
||||
|
||||
rStyleSheet.ResetParent();
|
||||
SfxItemSet& rStyleItemSet =
|
||||
|
@ -3033,7 +3033,7 @@ OUString StylesBuffer::createExtDxfStyle( sal_Int32 nDxfId ) const
|
|||
// Create a cell style. This may overwrite an existing style if
|
||||
// one with the same name exists.
|
||||
ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
|
||||
*getScDocument().GetStyleSheetPool(), rStyleName, true);
|
||||
*getScDocument().GetStyleSheetPool(), rStyleName);
|
||||
|
||||
rStyleSheet.ResetParent();
|
||||
SfxItemSet& rStyleItemSet =
|
||||
|
|
Loading…
Reference in a new issue