summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2001-08-02 13:47:49 +0000
committerEike Rathke <er@openoffice.org>2001-08-02 13:47:49 +0000
commit519a20fa2537054eb49073c2f4046d3f372aa456 (patch)
tree305b0bbbcedc279bad1b4caa7ba1432c5d7e5c3d /sc
parent1594eac13ee650338e0625fc58e4b95fd421a0ca (diff)
#90412# performance: moved English formatter from each document to one global
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx10
-rw-r--r--sc/inc/global.hxx9
-rw-r--r--sc/source/core/data/documen2.cxx19
-rw-r--r--sc/source/core/data/global.cxx20
-rw-r--r--sc/source/core/data/poolhelp.cxx14
-rw-r--r--sc/source/core/inc/poolhelp.hxx7
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx11
7 files changed, 43 insertions, 47 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1b29d4dadbb9..ab7760e1e221 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.43 $
+ * $Revision: 1.44 $
*
- * last change: $Author: sab $ $Date: 2001-07-31 15:37:53 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:45:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -393,7 +393,6 @@ private:
LanguageType eCtlLanguage; // default language for complex text
CharSet eSrcSet; // Einlesen: Quell-Zeichensatz
- long nStandardIndexEnglishUS;
ULONG nFormulaCodeInTree; // FormelRPN im Formelbaum
USHORT nInterpretLevel; // >0 wenn im Interpreter
USHORT nMacroInterpretLevel; // >0 wenn Macro im Interpreter
@@ -1257,11 +1256,6 @@ public:
const ScMarkData* pMarkData = NULL );
SvNumberFormatter* GetFormatTable() const;
- SvNumberFormatter* GetEnglishFormatTable() const;
-
- // returns the standard english us
- // numberformat of the english number formatter
- ULONG GetStandardIndexEnglishUS();
void Sort( USHORT nTab, const ScSortParam& rSortParam, BOOL bKeepQuery );
USHORT Query( USHORT nTab, const ScQueryParam& rQueryParam, BOOL bKeepSub );
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 9bfe2380e6eb..3f73370f83af 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: global.hxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: er $ $Date: 2001-07-11 15:16:28 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:45:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -558,6 +558,8 @@ class ScGlobal
static ScUnitConverter* pUnitConverter;
+ static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
+
public:
static ::com::sun::star::lang::Locale* pLocale;
static SvtSysLocale* pSysLocale;
@@ -645,6 +647,9 @@ public:
static CharSet GetCharsetValue( const String& rCharSet );
static String GetCharsetString( CharSet eVal );
+
+ /// a "ReadOnly" formatter for UNO/XML export
+ static SvNumberFormatter* GetEnglishFormatter();
};
#endif
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 058fcffd9789..d3ee4cc30469 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documen2.cxx,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: er $ $Date: 2001-07-19 16:42:49 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:46:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -371,8 +371,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
eLinkMode(LM_UNKNOWN),
pDPCollection( NULL ),
pScriptTypeData( NULL ),
- nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
- nStandardIndexEnglishUS(-1)
+ nAsianCompression(SC_ASIANCOMPRESSION_INVALID)
{
eSrcSet = gsl_getSystemTextEncoding();
nSrcVer = SC_CURRENT_VERSION;
@@ -598,18 +597,6 @@ SvNumberFormatter* ScDocument::GetFormatTable() const
return xPoolHelper->GetFormTable();
}
-SvNumberFormatter* ScDocument::GetEnglishFormatTable() const
-{
- return xPoolHelper->GetEngFormTable();
-}
-
-ULONG ScDocument::GetStandardIndexEnglishUS()
-{
- if (nStandardIndexEnglishUS == -1)
- nStandardIndexEnglishUS = GetEnglishFormatTable()->GetStandardIndex(LANGUAGE_ENGLISH_US);
- return (ULONG)nStandardIndexEnglishUS;
-}
-
SfxItemPool* ScDocument::GetEditPool() const
{
return xPoolHelper->GetEditPool();
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index cd78a4ee2a56..7f0961a378f0 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: global.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: er $ $Date: 2001-07-11 15:22:13 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:46:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -174,6 +174,7 @@ ScFunctionList* ScGlobal::pStarCalcFunctionList = NULL;
ScFunctionMgr* ScGlobal::pStarCalcFunctionMgr = NULL;
ScUnitConverter* ScGlobal::pUnitConverter = NULL;
+SvNumberFormatter* ScGlobal::pEnglishFormatter = NULL;
double ScGlobal::nScreenPPTX = 96.0;
double ScGlobal::nScreenPPTY = 96.0;
@@ -332,6 +333,20 @@ ULONG ScGlobal::GetStandardFormat( double fNumber, SvNumberFormatter& rFormatter
return rFormatter.GetStandardFormat( nType, eLnge );
}
+
+// static
+SvNumberFormatter* ScGlobal::GetEnglishFormatter()
+{
+ if ( !pEnglishFormatter )
+ {
+ pEnglishFormatter = new SvNumberFormatter(
+ ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US );
+ pEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
+ }
+ return pEnglishFormatter;
+}
+
+
//------------------------------------------------------------------------
BOOL ScGlobal::CheckWidthInvalidate( BOOL& bNumFormatChanged,
@@ -721,6 +736,7 @@ void ScGlobal::Clear()
DELETEZ(pOutlineBitmaps);
// DELETEZ(pAnchorBitmap);
// DELETEZ(pGrayAnchorBitmap);
+ DELETEZ(pEnglishFormatter);
DELETEZ(pCaseTransliteration);
DELETEZ(pTransliteration);
DELETEZ(pCaseCollator);
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 74a370eac3cd..5e97b518749e 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: poolhelp.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: sab $ $Date: 2001-07-18 07:58:41 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:46:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,14 +87,9 @@ ScPoolHelper::ScPoolHelper( ScDocument* pSourceDoc )
pStylePool = new ScStyleSheetPool( *pDocPool, pSourceDoc );
pFormTable = new SvNumberFormatter( pSourceDoc->GetServiceManager(), ScGlobal::eLnge );
- aColorLink = LINK( pSourceDoc, ScDocument, GetUserDefinedColor );
- pFormTable->SetColorLink( &aColorLink );
+ pFormTable->SetColorLink( LINK( pSourceDoc, ScDocument, GetUserDefinedColor ) );
pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
- pEngFormTable = new SvNumberFormatter( pSourceDoc->GetServiceManager(), LANGUAGE_ENGLISH_US );
- pEngFormTable->SetColorLink( &aColorLink );
- pEngFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
-
pEditPool = EditEngine::CreatePool();
pEditPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
pEditPool->FreezeIdRanges();
@@ -110,7 +105,6 @@ ScPoolHelper::~ScPoolHelper()
delete pEnginePool;
delete pEditPool;
delete pFormTable;
- delete pEngFormTable;
delete pStylePool;
delete pDocPool;
}
@@ -119,7 +113,7 @@ void ScPoolHelper::SourceDocumentGone()
{
// reset all pointers to the source document
pStylePool->SetDocument( NULL );
- pFormTable->SetColorLink( NULL );
+ pFormTable->SetColorLink( Link() );
}
// -----------------------------------------------------------------------
diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx
index 51b37d8b22ea..9b00630d9287 100644
--- a/sc/source/core/inc/poolhelp.hxx
+++ b/sc/source/core/inc/poolhelp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: poolhelp.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sab $ $Date: 2001-07-18 07:59:42 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:47:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,11 +80,9 @@ class SfxItemPool;
class ScPoolHelper : public vos::OReference
{
private:
- Link aColorLink; // for NumberFormatter
ScDocumentPool* pDocPool;
ScStyleSheetPool* pStylePool;
SvNumberFormatter* pFormTable;
- SvNumberFormatter* pEngFormTable;
SfxItemPool* pEditPool; // EditTextObjectPool
SfxItemPool* pEnginePool; // EditEnginePool
@@ -99,7 +97,6 @@ public:
ScDocumentPool* GetDocPool() const { return pDocPool; }
ScStyleSheetPool* GetStylePool() const { return pStylePool; }
SvNumberFormatter* GetFormTable() const { return pFormTable; }
- SvNumberFormatter* GetEngFormTable() const { return pEngFormTable; }
SfxItemPool* GetEditPool() const { return pEditPool; }
SfxItemPool* GetEnginePool() const { return pEnginePool; }
};
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 7daf5e8dddc2..753cc714a876 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cellsuno.cxx,v $
*
- * $Revision: 1.51 $
+ * $Revision: 1.52 $
*
- * last change: $Author: sab $ $Date: 2001-07-26 06:17:09 $
+ * last change: $Author: er $ $Date: 2001-08-02 14:47:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -5512,11 +5512,14 @@ String ScCellObj::GetInputString_Impl(BOOL bEnglish) const // fuer getFormu
}
else
{
- SvNumberFormatter* pFormatter = bEnglish ? pDoc->GetEnglishFormatTable() :
+ SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
pDoc->GetFormatTable();
+ // Since the English formatter was constructed with
+ // LANGUAGE_ENGLISH_US the "General" format has index key 0,
+ // we don't have to query.
ULONG nNumFmt = bEnglish ?
// pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US) :
- pDoc->GetStandardIndexEnglishUS() :
+ 0 :
pDoc->GetNumberFormat( aCellPos );
if ( eType == CELLTYPE_EDIT )