summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-12-23 16:17:40 -0500
committerAugust Sodora <augsod@gmail.com>2011-12-23 16:17:40 -0500
commit4586cd75646bb2396490d670d11b0b2e30fe4796 (patch)
tree257387d9b78158f41d19bce499e044fef478423d /editeng
parent4d4a67748e945d901f320d9c3af753abb3211efc (diff)
DECLARE_TABLE->std::map
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/svxacorr.hxx5
-rw-r--r--editeng/source/misc/svxacorr.cxx25
2 files changed, 13 insertions, 17 deletions
diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx
index ed0d528e9b07..aabc6442594d 100644
--- a/editeng/inc/editeng/svxacorr.hxx
+++ b/editeng/inc/editeng/svxacorr.hxx
@@ -39,13 +39,14 @@
#include <editeng/swafopt.hxx>
#include "editeng/editengdllapi.h"
+#include <map>
+
class CharClass;
class SfxPoolItem;
class SvxAutoCorrect;
class SvStringsISortDtor;
class SfxObjectShell;
class SvxAutoCorrLanguageTable_Impl;
-class SvxAutoCorrLastFileAskTable_Impl;
class SotStorageRef;
class SotStorage;
class Window;
@@ -208,7 +209,7 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
// all languages in a table
SvxAutoCorrLanguageTable_Impl* pLangTable;
- SvxAutoCorrLastFileAskTable_Impl* pLastFileTable;
+ std::map<LanguageType, long>* pLastFileTable;
CharClass* pCharClass;
bool bRunNext;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e8cd59cfe206..c2d937a69322 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -120,9 +120,6 @@ TYPEINIT0(SvxAutoCorrect)
typedef SvxAutoCorrectLanguageLists* SvxAutoCorrectLanguageListsPtr;
DECLARE_TABLE( SvxAutoCorrLanguageTable_Impl, SvxAutoCorrectLanguageListsPtr)
-DECLARE_TABLE( SvxAutoCorrLastFileAskTable_Impl, long )
-
-
inline int IsWordDelim( const sal_Unicode c )
{
return ' ' == c || '\t' == c || 0x0a == c ||
@@ -345,7 +342,7 @@ SvxAutoCorrect::SvxAutoCorrect( const String& rShareAutocorrFile,
: sShareAutoCorrFile( rShareAutocorrFile ),
sUserAutoCorrFile( rUserAutocorrFile ),
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
- pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
+ pLastFileTable( new std::map<LanguageType, long> ),
pCharClass( 0 ), bRunNext( false ),
cStartDQuote( 0 ), cEndDQuote( 0 ), cStartSQuote( 0 ), cEndSQuote( 0 )
{
@@ -362,7 +359,7 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
aSwFlags( rCpy.aSwFlags ),
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
- pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
+ pLastFileTable( new std::map<LanguageType, long> ),
pCharClass( 0 ), bRunNext( false ),
nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad)),
@@ -1618,12 +1615,11 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
SvxAutoCorrectLanguageListsPtr pLists = 0;
Time nMinTime( 0, 2 ), nAktTime( Time::SYSTEM ), nLastCheckTime( Time::EMPTY );
- sal_uLong nFndPos;
- if( TABLE_ENTRY_NOTFOUND !=
- pLastFileTable->SearchKey( sal_uLong( eLang ), &nFndPos ) &&
- ( nLastCheckTime.SetTime( pLastFileTable->GetObject( nFndPos )),
- nLastCheckTime < nAktTime ) &&
- ( nAktTime - nLastCheckTime ) < nMinTime )
+
+ std::map<LanguageType, long>::iterator nFndPos = pLastFileTable->find(eLang);
+ if(nFndPos != pLastFileTable->end() &&
+ (nLastCheckTime.SetTime(nFndPos->second), nLastCheckTime < nAktTime) &&
+ nAktTime - nLastCheckTime < nMinTime)
{
// no need to test the file, because the last check is not older then
// 2 minutes.
@@ -1633,7 +1629,7 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile,
sUserDirFile, eLang );
pLangTable->Insert( sal_uLong(eLang), pLists );
- pLastFileTable->Remove( sal_uLong( eLang ) );
+ pLastFileTable->erase(nFndPos);
}
}
else if( ( FStatHelper::IsDocument( sUserDirFile ) ||
@@ -1644,12 +1640,11 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile,
sUserDirFile, eLang );
pLangTable->Insert( sal_uLong(eLang), pLists );
- pLastFileTable->Remove( sal_uLong( eLang ) );
+ pLastFileTable->erase(nFndPos);
}
else if( !bNewFile )
{
- if( !pLastFileTable->Insert( sal_uLong( eLang ), nAktTime.GetTime() ))
- pLastFileTable->Replace( sal_uLong( eLang ), nAktTime.GetTime() );
+ pLastFileTable[eLang] = { std::make_pair(eLang, nAktTime.GetTime()) };
}
return pLists != 0;
}