summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-06 15:22:45 +0200
committerNoel Grandin <noel@peralex.com>2015-10-07 08:27:27 +0200
commit8b98c8b32cc2ba1693f26aef52d3825caabea606 (patch)
tree8ba3c256c8b216cc3de7bc0fede66a4282786ae4 /svtools
parent77f884064d88224342fecac033423088f8544f99 (diff)
loplugin:mergeclasses
Change-Id: I52446e517c2315516ea74a30767393ff32960799
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/table/cellvalueconversion.cxx49
1 files changed, 20 insertions, 29 deletions
diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx
index 32315c221c6c..0fa47bda9fbe 100644
--- a/svtools/source/table/cellvalueconversion.cxx
+++ b/svtools/source/table/cellvalueconversion.cxx
@@ -80,30 +80,12 @@ namespace svt
}
- //= IValueNormalization
-
- class SAL_NO_VTABLE IValueNormalization
- {
- public:
- virtual ~IValueNormalization() { }
-
- /** converts the given <code>Any</code> into a <code>double</code> value to be fed into a number formatter
- */
- virtual double convertToDouble( Any const & i_value ) const = 0;
-
- /** returns the format key to be used for formatting values
- */
- virtual ::sal_Int32 getFormatKey() const = 0;
- };
-
- typedef std::shared_ptr< IValueNormalization > PValueNormalization;
- typedef std::unordered_map< OUString, PValueNormalization, OUStringHash > NormalizerCache;
-
-
//= CellValueConversion_Data
-
+ class StandardFormatNormalizer;
struct CellValueConversion_Data
{
+ typedef std::unordered_map< OUString, std::shared_ptr< StandardFormatNormalizer >, OUStringHash > NormalizerCache;
+
Reference< XNumberFormatter > xNumberFormatter;
bool bAttemptedFormatterCreation;
NormalizerCache aNormalizers;
@@ -119,8 +101,20 @@ namespace svt
//= StandardFormatNormalizer
- class StandardFormatNormalizer : public IValueNormalization
+ class StandardFormatNormalizer
{
+ public:
+ /** converts the given <code>Any</code> into a <code>double</code> value to be fed into a number formatter
+ */
+ virtual double convertToDouble( Any const & i_value ) const = 0;
+
+ /** returns the format key to be used for formatting values
+ */
+ sal_Int32 getFormatKey() const
+ {
+ return m_nFormatKey;
+ }
+
protected:
StandardFormatNormalizer( Reference< XNumberFormatter > const & i_formatter, ::sal_Int32 const i_numberFormatType )
:m_nFormatKey( 0 )
@@ -138,10 +132,7 @@ namespace svt
}
}
- virtual ::sal_Int32 getFormatKey() const SAL_OVERRIDE
- {
- return m_nFormatKey;
- }
+ virtual ~StandardFormatNormalizer() {}
private:
::sal_Int32 m_nFormatKey;
@@ -351,9 +342,9 @@ namespace svt
bool lcl_getValueNormalizer( CellValueConversion_Data & io_data, Type const & i_valueType,
- PValueNormalization & o_formatter )
+ std::shared_ptr< StandardFormatNormalizer > & o_formatter )
{
- NormalizerCache::const_iterator pos = io_data.aNormalizers.find( i_valueType.getTypeName() );
+ CellValueConversion_Data::NormalizerCache::const_iterator pos = io_data.aNormalizers.find( i_valueType.getTypeName() );
if ( pos == io_data.aNormalizers.end() )
{
// never encountered this type before
@@ -432,7 +423,7 @@ namespace svt
{
if ( lcl_ensureNumberFormatter( *m_pData ) )
{
- PValueNormalization pNormalizer;
+ std::shared_ptr< StandardFormatNormalizer > pNormalizer;
if ( lcl_getValueNormalizer( *m_pData, i_value.getValueType(), pNormalizer ) )
{
try