summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-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, 9 insertions, 13 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 8701b3c69204..a2862f7b6988 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 ).GetItemSet();
+ SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName, true ).GetItemSet();
const XclImpPalette& rPalette = GetPalette();
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index 1ce82e5dd1d8..bf2b784a994b 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -254,14 +254,9 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyle
} // namespace
-ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName )
+ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool 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 ) );
+ return lclMakeStyleSheet( rPool, rStyleName, SfxStyleFamily::Para, bForceName );
}
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 0fdb90cc26ae..7e8a07bce8c8 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -193,11 +193,12 @@ 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, return the existing style.
- */
+ @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. */
static ScStyleSheet& MakeCellStyleSheet(
ScStyleSheetPool& rPool,
- const OUString& rStyleName );
+ const OUString& rStyleName, bool bForceName );
/** 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 76245a6980a3..234d0365bdec 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);
+ *getScDocument().GetStyleSheetPool(), rStyleName, true);
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);
+ *getScDocument().GetStyleSheetPool(), rStyleName, true);
rStyleSheet.ResetParent();
SfxItemSet& rStyleItemSet =