[Libreoffice-commits] core.git: connectivity/inc include/svl include/unotools svl/source svtools/inc svx/inc sw/inc unotools/Library_utl.mk unotools/source

Maarten Bosmans mkbosmans at gmail.com
Thu Sep 22 07:14:49 UTC 2016


 connectivity/inc/pch/precompiled_dbase.hxx       |    1 
 connectivity/inc/pch/precompiled_flat.hxx        |    1 
 include/svl/zforlist.hxx                         |    4 -
 include/unotools/numberformatcodewrapper.hxx     |   61 ---------------
 svl/source/numbers/zforlist.cxx                  |   37 ++++-----
 svl/source/numbers/zforscan.cxx                  |    9 +-
 svtools/inc/pch/precompiled_svt.hxx              |    1 
 svx/inc/pch/precompiled_svx.hxx                  |    1 
 sw/inc/pch/precompiled_swui.hxx                  |    1 
 unotools/Library_utl.mk                          |    1 
 unotools/source/i18n/localedatawrapper.cxx       |   12 +--
 unotools/source/i18n/numberformatcodewrapper.cxx |   90 -----------------------
 12 files changed, 28 insertions(+), 191 deletions(-)

New commits:
commit 9df9949cc484ea0ba109e7d41fd03b15afaedb11
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Fri Sep 9 21:11:13 2016 +0200

    Remove NumberFormatCodeWrapper
    
    This class only adds a level of indirection, without any useful functionality.
    
    Change-Id: I806e1b9241caf025c62c12c93aad3101daac874a
    Reviewed-on: https://gerrit.libreoffice.org/29134
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/inc/pch/precompiled_dbase.hxx b/connectivity/inc/pch/precompiled_dbase.hxx
index 544fef4..b1913e0 100644
--- a/connectivity/inc/pch/precompiled_dbase.hxx
+++ b/connectivity/inc/pch/precompiled_dbase.hxx
@@ -204,7 +204,6 @@
 #include <unotools/collatorwrapper.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/nativenumberwrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/readwritemutexguard.hxx>
 #include <unotools/sharedunocomponent.hxx>
 #include <unotools/syslocale.hxx>
diff --git a/connectivity/inc/pch/precompiled_flat.hxx b/connectivity/inc/pch/precompiled_flat.hxx
index 197cf67..73daefe 100644
--- a/connectivity/inc/pch/precompiled_flat.hxx
+++ b/connectivity/inc/pch/precompiled_flat.hxx
@@ -199,7 +199,6 @@
 #include <unotools/collatorwrapper.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/nativenumberwrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/readwritemutexguard.hxx>
 #include <unotools/syslocale.hxx>
 #include <unotools/transliterationwrapper.hxx>
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index e28b4ae..492ddc1 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -27,8 +27,8 @@
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/i18n/NumberFormatCode.hpp>
 #include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/i18n/NumberFormatMapper.hpp>
 #include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <tools/link.hxx>
 #include <svl/ondemand.hxx>
 #include <svl/nfkeytab.hxx>
@@ -829,7 +829,7 @@ private:
 
     // Generate additional formats provided by i18n
     SVL_DLLPRIVATE void ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
-                                                      NumberFormatCodeWrapper& rNumberFormatCode,
+                                                      css::uno::Reference< css::i18n::XNumberFormatCode >& rNumberFormatCode,
                                                       bool bAfterChangingSystemCL );
 
     SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat( const css::i18n::NumberFormatCode& rCode,
diff --git a/include/unotools/numberformatcodewrapper.hxx b/include/unotools/numberformatcodewrapper.hxx
deleted file mode 100644
index 08d97fc..0000000
--- a/include/unotools/numberformatcodewrapper.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
-#define INCLUDED_UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
-
-#include <com/sun/star/i18n/XNumberFormatCode.hpp>
-#include <unotools/unotoolsdllapi.h>
-
-namespace com { namespace sun { namespace star {
-    namespace uno {
-        class XComponentContext;
-    }
-}}}
-
-class UNOTOOLS_DLLPUBLIC NumberFormatCodeWrapper
-{
-    css::uno::Reference< css::i18n::XNumberFormatCode >   xNFC;
-    css::lang::Locale          aLocale;
-
-                                NumberFormatCodeWrapper( const NumberFormatCodeWrapper& ) = delete;
-            NumberFormatCodeWrapper&    operator=( const NumberFormatCodeWrapper& ) = delete;
-
-public:
-                                NumberFormatCodeWrapper(
-                                    const css::uno::Reference< css::uno::XComponentContext > & rxContext,
-                                    const css::lang::Locale& rLocale
-                                    );
-
-                                ~NumberFormatCodeWrapper();
-
-    /// set a new Locale
-            void                setLocale( const css::lang::Locale& rLocale );
-
-    // Wrapper implementations of class NumberFormatCodeMapper
-
-    css::i18n::NumberFormatCode getFormatCode( sal_Int16 nFormatIndex ) const;
-    css::uno::Sequence< css::i18n::NumberFormatCode > getAllFormatCode( sal_Int16 nFormatUsage ) const;
-    css::uno::Sequence< css::i18n::NumberFormatCode > getAllFormatCodes() const;
-
-};
-
-#endif // INCLUDED_UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index bb0e29e..08bae7e 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -30,7 +30,6 @@
 #include <unotools/configmgr.hxx>
 #include <i18nlangtag/mslangid.hxx>
 #include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/calendarwrapper.hxx>
 #include <com/sun/star/i18n/KNumberFormatUsage.hpp>
 #include <com/sun/star/i18n/KNumberFormatType.hpp>
@@ -518,9 +517,8 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
     pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset) );
 
     // append new system additional formats
-    NumberFormatCodeWrapper aNumberFormatCode( m_xContext,
-                                               GetLanguageTag().getLocale() );
-    ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, true );
+    css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
+    ImpGenerateAdditionalFormats( nCLOffset, xNFC, true );
 }
 
 const css::uno::Reference<css::uno::XComponentContext>& SvNumberFormatter::GetComponentContext() const
@@ -2232,15 +2230,14 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
         pFormatScanner->SetConvertMode(false);      // switch off for this function
     }
 
-    NumberFormatCodeWrapper aNumberFormatCode( m_xContext,
-            GetLanguageTag().getLocale() );
+    css::lang::Locale aLocale = GetLanguageTag().getLocale();
+    css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
     SvNumberformat* pNewFormat = nullptr;
     sal_Int32 nIdx;
     bool bDefault;
 
     // Number
-    uno::Sequence< i18n::NumberFormatCode > aFormatSeq =
-        aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER );
+    uno::Sequence< i18n::NumberFormatCode > aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // General
@@ -2326,7 +2323,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
     // Percent number
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::PERCENT_NUMBER );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::PERCENT_NUMBER, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // 0%
@@ -2342,7 +2339,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
     // Currency. NO default standard option! Default is determined of locale
     // data default currency and format is generated if needed.
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY, aLocale );
     if (LocaleDataWrapper::areChecksEnabled())
     {
         // though no default desired here, test for correctness of locale data
@@ -2399,7 +2396,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
     // Date
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::DATE, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // DD.MM.YY   System
@@ -2509,7 +2506,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
     // Time
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::TIME );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::TIME, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // HH:MM
@@ -2549,7 +2546,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
     // DateTime
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE_TIME );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::DATE_TIME, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // DD.MM.YY HH:MM   System
@@ -2580,7 +2577,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
     // Scientific number
-    aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER );
+    aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER, aLocale );
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
 
     // 0.00E+000
@@ -2654,7 +2651,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
     // changing SystemCL, then they are appended last after user defined.
     if ( !bNoAdditionalFormats )
     {
-        ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, false );
+        ImpGenerateAdditionalFormats( CLOffset, xNFC, false );
     }
     if (bOldConvertMode)
     {
@@ -2664,7 +2661,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
 
 
 void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
-            NumberFormatCodeWrapper& rNumberFormatCode, bool bAfterChangingSystemCL )
+            css::uno::Reference< css::i18n::XNumberFormatCode >& rNumberFormatCode,
+            bool bAfterChangingSystemCL )
 {
     using namespace ::com::sun::star;
 
@@ -2675,13 +2673,12 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
         return ;
     }
     sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
-    rNumberFormatCode.setLocale( GetLanguageTag().getLocale() );
+    css::lang::Locale aLocale = GetLanguageTag().getLocale();
     sal_Int32 j;
 
     // All currencies, this time with [$...] which was stripped in
     // ImpGenerateFormats for old "automatic" currency formats.
-    uno::Sequence< i18n::NumberFormatCode > aFormatSeq =
-        rNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY );
+    uno::Sequence< i18n::NumberFormatCode > aFormatSeq = rNumberFormatCode->getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY, aLocale );
     i18n::NumberFormatCode * pFormatArr = aFormatSeq.getArray();
     sal_Int32 nCodes = aFormatSeq.getLength();
     ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), nCodes );
@@ -2719,7 +2716,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
     // like it is done for usage groups with ImpAdjustFormatCodeDefault().
     // There is no harm though, on first invocation ImpGetDefaultFormat() will
     // use the first default encountered.
-    aFormatSeq = rNumberFormatCode.getAllFormatCodes();
+    aFormatSeq = rNumberFormatCode->getAllFormatCodes( aLocale );
     nCodes = aFormatSeq.getLength();
     if ( nCodes )
     {
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 40cc9d3..568655e 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -25,7 +25,7 @@
 #include <i18nlangtag/mslangid.hxx>
 #include <unotools/charclass.hxx>
 #include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
+#include <com/sun/star/i18n/NumberFormatCode.hpp>
 
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
@@ -201,11 +201,10 @@ void ImpSvNumberformatScan::SetDependentKeywords()
     // requested Locale, otherwise number format codes might not match
     const LanguageTag& rLoadedLocale = pLocaleData->getLoadedLanguageTag();
     LanguageType eLang = rLoadedLocale.getLanguageType( false);
-    NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetComponentContext(),
-            rLoadedLocale.getLocale() );
 
-    i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD );
-    sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code);
+    css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() );
+    i18n::NumberFormatCode aFormat = xNFC->getFormatCode( NF_NUMBER_STANDARD, rLoadedLocale.getLocale() );
+    sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code );
     sKeyword[NF_KEY_GENERAL] = pCharClass->uppercase( sNameStandardFormat );
 
     // preset new calendar keywords
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index f4d7819..f330e08 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -401,7 +401,6 @@
 #include <unotools/configmgr.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/nativenumberwrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/options.hxx>
 #include <unotools/readwritemutexguard.hxx>
 #include <unotools/streamwrap.hxx>
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index c1dff2d..fb2da67 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -405,7 +405,6 @@
 #include <unotools/fontcvt.hxx>
 #include <unotools/fontdefs.hxx>
 #include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/options.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/unotoolsdllapi.h>
diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx
index 480012e..0d13d92 100644
--- a/sw/inc/pch/precompiled_swui.hxx
+++ b/sw/inc/pch/precompiled_swui.hxx
@@ -610,7 +610,6 @@
 #include <unotools/intlwrapper.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/nativenumberwrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/options.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/syslocale.hxx>
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index 0d4ea9f..3853dbf 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -87,7 +87,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
     unotools/source/i18n/intlwrapper \
     unotools/source/i18n/localedatawrapper \
     unotools/source/i18n/nativenumberwrapper \
-    unotools/source/i18n/numberformatcodewrapper \
     unotools/source/i18n/readwritemutexguard \
     unotools/source/i18n/textsearch \
     unotools/source/i18n/transliterationwrapper \
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 8897db9..a467685 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -23,7 +23,6 @@
 
 #include <sal/log.hxx>
 #include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
 #include <unotools/calendarwrapper.hxx>
 #include <unotools/digitgroupingiterator.hxx>
 #include <tools/debug.hxx>
@@ -35,6 +34,7 @@
 #include <com/sun/star/i18n/CalendarFieldIndex.hpp>
 #include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
 #include <com/sun/star/i18n/NumberFormatIndex.hpp>
+#include <com/sun/star/i18n/NumberFormatMapper.hpp>
 
 #include <comphelper/processfactory.hxx>
 #include <rtl/instance.hxx>
@@ -750,9 +750,8 @@ void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
 
 void LocaleDataWrapper::getCurrFormatsImpl()
 {
-    NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getMyLocale() );
-    uno::Sequence< NumberFormatCode > aFormatSeq
-        = aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::CURRENCY );
+    css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
+    uno::Sequence< NumberFormatCode > aFormatSeq = xNFC->getAllFormatCode( KNumberFormatUsage::CURRENCY, getMyLocale() );
     sal_Int32 nCnt = aFormatSeq.getLength();
     if ( !nCnt )
     {   // bad luck
@@ -998,9 +997,8 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const OUString& rCode )
 
 void LocaleDataWrapper::getDateFormatsImpl()
 {
-    NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getMyLocale() );
-    uno::Sequence< NumberFormatCode > aFormatSeq
-        = aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::DATE );
+    css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
+    uno::Sequence< NumberFormatCode > aFormatSeq = xNFC->getAllFormatCode( KNumberFormatUsage::DATE, getMyLocale() );
     sal_Int32 nCnt = aFormatSeq.getLength();
     if ( !nCnt )
     {   // bad luck
diff --git a/unotools/source/i18n/numberformatcodewrapper.cxx b/unotools/source/i18n/numberformatcodewrapper.cxx
deleted file mode 100644
index 652c757..0000000
--- a/unotools/source/i18n/numberformatcodewrapper.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/config.h>
-
-#include <sal/log.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
-#include <com/sun/star/i18n/NumberFormatMapper.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::uno;
-
-NumberFormatCodeWrapper::NumberFormatCodeWrapper(
-            const Reference< uno::XComponentContext > & rxContext,
-            const lang::Locale& rLocale
-            )
-{
-    setLocale( rLocale );
-    xNFC = i18n::NumberFormatMapper::create( rxContext );
-}
-
-NumberFormatCodeWrapper::~NumberFormatCodeWrapper()
-{
-}
-
-void NumberFormatCodeWrapper::setLocale( const css::lang::Locale& rLocale )
-{
-    aLocale = rLocale;
-}
-
-css::i18n::NumberFormatCode
-NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const
-{
-    try
-    {
-        return xNFC->getFormatCode( formatIndex, aLocale );
-    }
-    catch ( const Exception& )
-    {
-        SAL_WARN( "unotools.i18n", "getFormatCode: Exception caught!" );
-    }
-    return css::i18n::NumberFormatCode();
-}
-
-css::uno::Sequence< css::i18n::NumberFormatCode >
-NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const
-{
-    try
-    {
-        return xNFC->getAllFormatCode( formatUsage, aLocale );
-    }
-    catch ( const Exception& )
-    {
-        SAL_WARN( "unotools.i18n", "getAllFormatCode: Exception caught!" );
-    }
-    return css::uno::Sequence< css::i18n::NumberFormatCode > (0);
-}
-
-css::uno::Sequence< css::i18n::NumberFormatCode >
-NumberFormatCodeWrapper::getAllFormatCodes() const
-{
-    try
-    {
-        return xNFC->getAllFormatCodes( aLocale );
-    }
-    catch ( const Exception& )
-    {
-        SAL_WARN( "unotools.i18n", "getAllFormatCodes: Exception caught!" );
-    }
-    return css::uno::Sequence< css::i18n::NumberFormatCode > (0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list