[Libreoffice-commits] core.git: 2 commits - cui/source include/svl svl/Library_svl.mk svl/source svx/source
Kohei Yoshida
kohei.yoshida at collabora.com
Sat Nov 22 14:28:57 PST 2014
cui/source/options/optgdlg.cxx | 1
include/svl/currencytable.hxx | 40 +++++++++++
include/svl/zforlist.hxx | 110 ++++++++-----------------------
svl/Library_svl.mk | 1
svl/source/numbers/currencytable.cxx | 52 ++++++++++++++
svl/source/numbers/zforlist.cxx | 124 ++++++++++++++++++++++++++++++++---
svx/source/items/numfmtsh.cxx | 1
7 files changed, 240 insertions(+), 89 deletions(-)
New commits:
commit d69bda6300f2a2035d1754d8a33e4bba56a47607
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Nov 22 17:22:08 2014 -0500
Make NfCurrencyTable a separate header & forward-declare it in zforlist.hxx.
Change-Id: I17b52c277ab6ec8b15e88729feee0a269b75087d
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 29e1387..e68743d 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <svl/zforlist.hxx>
+#include <svl/currencytable.hxx>
#include <svtools/grfmgr.hxx>
#include <svl/flagitem.hxx>
#include <sfx2/dispatch.hxx>
diff --git a/include/svl/currencytable.hxx b/include/svl/currencytable.hxx
new file mode 100644
index 0000000..940a584
--- /dev/null
+++ b/include/svl/currencytable.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_SVL_CURRENCYTABLE_HXX
+#define INCLUDED_SVL_CURRENCYTABLE_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/zforlist.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SVL_DLLPUBLIC NfCurrencyTable
+{
+ typedef boost::ptr_vector<NfCurrencyEntry> DataType;
+ DataType maData;
+public:
+ typedef DataType::iterator iterator;
+ typedef DataType::const_iterator const_iterator;
+
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ NfCurrencyEntry& operator[] ( size_t i );
+ const NfCurrencyEntry& operator[] ( size_t i ) const;
+
+ size_t size() const;
+
+ void insert( iterator it, NfCurrencyEntry* p );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index babaeda80..7607af7 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -34,7 +34,6 @@
#include <map>
#include <set>
-#include <boost/ptr_container/ptr_vector.hpp>
class Date;
class Color;
@@ -300,11 +299,10 @@ public:
static inline sal_Unicode GetEuroSymbol() { return sal_Unicode(0x20AC); }
};
-typedef boost::ptr_vector<NfCurrencyEntry> NfCurrencyTable;
-
typedef std::vector< OUString > NfWSStringsDtor;
class SvNumberFormatterRegistry_Impl;
+class NfCurrencyTable;
class SVL_DLLPUBLIC SvNumberFormatter
{
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index b75b32a..3641385 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -127,6 +127,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/notify/isethint \
svl/source/notify/listener \
svl/source/notify/lstner \
+ svl/source/numbers/currencytable \
svl/source/numbers/numfmuno \
svl/source/numbers/numuno \
svl/source/numbers/supservs \
diff --git a/svl/source/numbers/currencytable.cxx b/svl/source/numbers/currencytable.cxx
new file mode 100644
index 0000000..ee65e8f
--- /dev/null
+++ b/svl/source/numbers/currencytable.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <svl/currencytable.hxx>
+
+NfCurrencyTable::iterator NfCurrencyTable::begin()
+{
+ return maData.begin();
+}
+
+NfCurrencyTable::iterator NfCurrencyTable::end()
+{
+ return maData.end();
+}
+
+NfCurrencyTable::const_iterator NfCurrencyTable::begin() const
+{
+ return maData.begin();
+}
+
+NfCurrencyTable::const_iterator NfCurrencyTable::end() const
+{
+ return maData.end();
+}
+
+NfCurrencyEntry& NfCurrencyTable::operator[] ( size_t i )
+{
+ return maData[i];
+}
+
+const NfCurrencyEntry& NfCurrencyTable::operator[] ( size_t i ) const
+{
+ return maData[i];
+}
+
+size_t NfCurrencyTable::size() const
+{
+ return maData.size();
+}
+
+void NfCurrencyTable::insert( iterator it, NfCurrencyEntry* p )
+{
+ maData.insert(it, p);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 51fe328..9b8e562 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <svl/zforlist.hxx>
+#include <svl/currencytable.hxx>
+
#include <comphelper/string.hxx>
#include <tools/debug.hxx>
#include <unotools/charclass.hxx>
@@ -31,7 +34,6 @@
#include <osl/mutex.hxx>
-#include <svl/zforlist.hxx>
#include "zforscan.hxx"
#include "zforfind.hxx"
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 4634fac..76b00ef 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -24,6 +24,7 @@
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
+#include <svl/currencytable.hxx>
#include <svtools/langtab.hxx>
#include <vcl/svapp.hxx>
commit b5339f0d299b0fd080fa278b0223afdf4fd65eeb
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Nov 22 16:28:19 2014 -0500
Make SvNumberFormatter's methods non-inline.
This is a high-impact header, included by hundred's of source files.
Change-Id: I2b7f1c9e8ffe81ddccd1a541e3474ca302a27e90
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 9fc560c..babaeda80 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -330,7 +330,7 @@ public:
~SvNumberFormatter();
/// Set CallBack to ColorTable
- void SetColorLink( const Link& rColorTableCallBack ) { aColorLink = rColorTableCallBack; }
+ void SetColorLink( const Link& rColorTableCallBack );
/// Do the CallBack to ColorTable
Color* GetUserDefColor(sal_uInt16 nIndex);
@@ -341,11 +341,11 @@ public:
/// Change standard precision
void ChangeStandardPrec(short nPrec);
/// Set zero value suppression
- void SetNoZero(bool bNZ) { bNoZero = bNZ; }
+ void SetNoZero(bool bNZ);
/** The language with which the formatter was initialized (system setting),
NOT the current language after a ChangeIntl() */
- LanguageType GetLanguage() const { return IniLnge; }
+ LanguageType GetLanguage() const;
// Determine whether two format types are input compatible or not
bool IsCompatible(short eOldType, short eNewType);
@@ -571,7 +571,7 @@ public:
/// Return the standard decimal precision
sal_uInt16 GetStandardPrec();
/// Return whether zero suppression is switched on
- bool GetNoZero() { return bNoZero; }
+ bool GetNoZero();
/** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
but with NUMBERFORMAT_DEFINED masked out */
short GetType(sal_uInt32 nFIndex);
@@ -582,9 +582,9 @@ public:
SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
/// Whether a merge table is present or not
- inline bool HasMergeFmtTbl() const;
+ bool HasMergeFmtTbl() const;
/// Return the new format index for an old format index, if a merge table exists
- inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const;
+ sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const;
/** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
entries merge table to ::std::map with old index key and new index key.
@@ -613,8 +613,8 @@ public:
/** Set evaluation type and order of input date strings
@see NfEvalDateFormat
*/
- void SetEvalDateFormat( NfEvalDateFormat eEDF ) { eEvalDateFormat = eEDF; }
- NfEvalDateFormat GetEvalDateFormat() const { return eEvalDateFormat; }
+ void SetEvalDateFormat( NfEvalDateFormat eEDF );
+ NfEvalDateFormat GetEvalDateFormat() const;
/** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
Default from VCL: 1930, 30-99 19xx, 00-29 20xx
@@ -630,12 +630,12 @@ public:
static sal_uInt16 GetYear2000Default();
sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear ) const;
- inline static sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart );
+ static sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart );
/// DEPRECATED: Return first character of the decimal separator of the current language/country
- sal_Unicode GetDecSep() const { return GetNumDecimalSep()[0]; }
+ sal_Unicode GetDecSep() const;
/// Return the decimal separator of the current language/country
- OUString GetDecimalSep() const { return GetNumDecimalSep(); }
+ OUString GetDecimalSep() const;
/// Return the decimal separator matching the locale of the given format
OUString GetFormatDecimalSep( sal_uInt32 nFormat ) const;
@@ -869,18 +869,12 @@ private:
// Obtain the format entry for a given key index.
SVL_DLLPRIVATE SvNumberformat* GetFormatEntry( sal_uInt32 nKey );
- SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry( sal_uInt32 nKey ) const
- {
- return GetEntry( nKey);
- }
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry( sal_uInt32 nKey ) const;
// used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
-#ifndef DBG_UTIL
- inline
-#endif
- static bool ImpLookupCurrencyEntryLoopBody( const NfCurrencyEntry*& pFoundEntry,
- bool& bFoundBank, const NfCurrencyEntry* pData,
- sal_uInt16 nPos, const OUString& rSymbol );
+ static bool ImpLookupCurrencyEntryLoopBody(
+ const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, const NfCurrencyEntry* pData,
+ sal_uInt16 nPos, const OUString& rSymbol );
// link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* );
@@ -903,94 +897,50 @@ public:
// new format codes are appended.
void ReplaceSystemCL( LanguageType eOldLanguage );
- inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > GetComponentContext() const
- {
- return m_xContext;
- }
+ css::uno::Reference<css::uno::XComponentContext> GetComponentContext() const;
//! The following method is not to be used from outside but must be
//! public for the InputScanner.
// return the current FormatScanner
- inline const ImpSvNumberformatScan* GetFormatScanner() const { return pFormatScanner; }
+ const ImpSvNumberformatScan* GetFormatScanner() const;
//! The following methods are not to be used from outside but must be
//! public for the InputScanner and FormatScanner.
// return current (!) Locale
- inline const LanguageTag& GetLanguageTag() const { return maLanguageTag; }
+ const LanguageTag& GetLanguageTag() const;
// return corresponding Transliteration wrapper
- inline const ::utl::TransliterationWrapper* GetTransliteration() const
- {
- return xTransliteration.get();
- }
+ const ::utl::TransliterationWrapper* GetTransliteration() const;
// return corresponding Transliteration wrapper with loadModuleByImplName()
- inline const ::utl::TransliterationWrapper* GetTransliterationForModule( const OUString& rModule,
- LanguageType eLang ) const
- {
- return xTransliteration.getForModule( rModule, eLang );
- }
+ const ::utl::TransliterationWrapper* GetTransliterationForModule(
+ const OUString& rModule, LanguageType eLang ) const;
// return the corresponding CharacterClassification wrapper
- inline const CharClass* GetCharClass() const { return pCharClass; }
+ const CharClass* GetCharClass() const;
// return the corresponding LocaleData wrapper
- inline const LocaleDataWrapper* GetLocaleData() const { return xLocaleData.get(); }
+ const LocaleDataWrapper* GetLocaleData() const;
// return the corresponding Calendar wrapper
- inline CalendarWrapper* GetCalendar() const { return xCalendar.get(); }
+ CalendarWrapper* GetCalendar() const;
// return the corresponding NativeNumberSupplier wrapper
- inline const NativeNumberWrapper* GetNatNum() const { return xNatNum.get(); }
+ const NativeNumberWrapper* GetNatNum() const;
// cached locale data items
// return the corresponding decimal separator
- inline const OUString& GetNumDecimalSep() const { return aDecimalSep; }
+ const OUString& GetNumDecimalSep() const;
// return the corresponding group (AKA thousand) separator
- inline const OUString& GetNumThousandSep() const { return aThousandSep; }
+ const OUString& GetNumThousandSep() const;
// return the corresponding date separator
- inline const OUString& GetDateSep() const { return aDateSep; }
+ const OUString& GetDateSep() const;
};
-inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
-{
- if (pMergeTable)
- {
- SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
- if (it != pMergeTable->end())
- {
- return it->second;
- }
- }
- return nOldFmt;
-}
-
-inline bool SvNumberFormatter::HasMergeFmtTbl() const
-{
- return pMergeTable && !pMergeTable->empty();
-}
-
-// static
-inline sal_uInt16 SvNumberFormatter::ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart )
-{
- if ( nYear < 100 )
- {
- if ( nYear < (nTwoDigitYearStart % 100) )
- {
- return nYear + (((nTwoDigitYearStart / 100) + 1) * 100);
- }
- else
- {
- return nYear + ((nTwoDigitYearStart / 100) * 100);
- }
- }
- return nYear;
-}
-
#endif // INCLUDED_SVL_ZFORLIST_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 21d004b..51fe328 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -312,6 +312,10 @@ SvNumberFormatterRegistry_Impl& SvNumberFormatter::GetFormatterRegistry()
return *pFormatterRegistry;
}
+void SvNumberFormatter::SetColorLink( const Link& rColorTableCallBack )
+{
+ aColorLink = rColorTableCallBack;
+}
Color* SvNumberFormatter::GetUserDefColor(sal_uInt16 nIndex)
{
@@ -343,11 +347,21 @@ void SvNumberFormatter::ChangeStandardPrec(short nPrec)
pFormatScanner->ChangeStandardPrec(nPrec);
}
+void SvNumberFormatter::SetNoZero(bool bNZ)
+{
+ bNoZero = bNZ;
+}
+
sal_uInt16 SvNumberFormatter::GetStandardPrec()
{
return pFormatScanner->GetStandardPrec();
}
+bool SvNumberFormatter::GetNoZero()
+{
+ return bNoZero;
+}
+
void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
{
sal_uInt32 nCLOffset = ImpGetCLOffset( LANGUAGE_SYSTEM );
@@ -443,6 +457,39 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, true );
}
+css::uno::Reference<css::uno::XComponentContext> SvNumberFormatter::GetComponentContext() const
+{
+ return m_xContext;
+}
+
+const ImpSvNumberformatScan* SvNumberFormatter::GetFormatScanner() const { return pFormatScanner; }
+
+const LanguageTag& SvNumberFormatter::GetLanguageTag() const { return maLanguageTag; }
+
+const ::utl::TransliterationWrapper* SvNumberFormatter::GetTransliteration() const
+{
+ return xTransliteration.get();
+}
+
+const ::utl::TransliterationWrapper* SvNumberFormatter::GetTransliterationForModule( const OUString& rModule,
+ LanguageType eLang ) const
+{
+ return xTransliteration.getForModule( rModule, eLang );
+}
+
+const CharClass* SvNumberFormatter::GetCharClass() const { return pCharClass; }
+
+const LocaleDataWrapper* SvNumberFormatter::GetLocaleData() const { return xLocaleData.get(); }
+
+CalendarWrapper* SvNumberFormatter::GetCalendar() const { return xCalendar.get(); }
+
+const NativeNumberWrapper* SvNumberFormatter::GetNatNum() const { return xNatNum.get(); }
+
+const OUString& SvNumberFormatter::GetNumDecimalSep() const { return aDecimalSep; }
+
+const OUString& SvNumberFormatter::GetNumThousandSep() const { return aThousandSep; }
+
+const OUString& SvNumberFormatter::GetDateSep() const { return aDateSep; }
bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
{
@@ -967,6 +1014,11 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
return res;
}
+LanguageType SvNumberFormatter::GetLanguage() const
+{
+ return IniLnge;
+}
+
bool SvNumberFormatter::IsCompatible(short eOldType,
short eNewType)
{
@@ -1746,6 +1798,15 @@ sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
return pFormatScanner->GetStandardPrec();
}
+sal_Unicode SvNumberFormatter::GetDecSep() const
+{
+ return GetNumDecimalSep()[0];
+}
+
+OUString SvNumberFormatter::GetDecimalSep() const
+{
+ return GetNumDecimalSep();
+}
OUString SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
{
@@ -1988,6 +2049,11 @@ SvNumberformat* SvNumberFormatter::GetFormatEntry( sal_uInt32 nKey )
return 0;
}
+const SvNumberformat* SvNumberFormatter::GetFormatEntry( sal_uInt32 nKey ) const
+{
+ return GetEntry( nKey);
+}
+
const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const
{
SvNumberFormatTable::const_iterator it = aFTable.find( nKey);
@@ -2924,6 +2990,15 @@ NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat )
return NF_INDEX_TABLE_ENTRIES; // bad luck
}
+void SvNumberFormatter::SetEvalDateFormat( NfEvalDateFormat eEDF )
+{
+ eEvalDateFormat = eEDF;
+}
+
+NfEvalDateFormat SvNumberFormatter::GetEvalDateFormat() const
+{
+ return eEvalDateFormat;
+}
void SvNumberFormatter::SetYear2000( sal_uInt16 nVal )
{
@@ -3175,14 +3250,10 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
// static
-// try to make it inline if possible since this a loop body
// true: continue; false: break loop, if pFoundEntry==NULL dupe found
-#ifndef DBG_UTIL
-inline
-#endif
- bool SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank,
- const NfCurrencyEntry* pData, sal_uInt16 nPos,
- const OUString& rSymbol )
+bool SvNumberFormatter::ImpLookupCurrencyEntryLoopBody(
+ const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, const NfCurrencyEntry* pData,
+ sal_uInt16 nPos, const OUString& rSymbol )
{
bool bFound;
if ( pData->GetSymbol() == rSymbol )
@@ -3708,6 +3779,41 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
return nDefault;
}
+sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
+{
+ if (pMergeTable)
+ {
+ SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
+ if (it != pMergeTable->end())
+ {
+ return it->second;
+ }
+ }
+ return nOldFmt;
+}
+
+bool SvNumberFormatter::HasMergeFmtTbl() const
+{
+ return pMergeTable && !pMergeTable->empty();
+}
+
+// static
+sal_uInt16 SvNumberFormatter::ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart )
+{
+ if ( nYear < 100 )
+ {
+ if ( nYear < (nTwoDigitYearStart % 100) )
+ {
+ return nYear + (((nTwoDigitYearStart / 100) + 1) * 100);
+ }
+ else
+ {
+ return nYear + ((nTwoDigitYearStart / 100) * 100);
+ }
+ }
+ return nYear;
+}
+
NfCurrencyEntry::NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, LanguageType eLang )
{
aSymbol = rLocaleData.getCurrSymbol();
More information about the Libreoffice-commits
mailing list