summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/excel/xicontent.cxx2
-rw-r--r--sc/source/filter/ftools/ftools.cxx9
-rw-r--r--sc/source/filter/inc/ftools.hxx7
-rw-r--r--sc/source/filter/oox/stylesbuffer.cxx4
4 files changed, 13 insertions, 9 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index a2862f7b6988..8701b3c69204 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -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();
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index bf2b784a994b..1ce82e5dd1d8 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -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 )
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 7e8a07bce8c8..0fdb90cc26ae 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -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:
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 234d0365bdec..76245a6980a3 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -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 =