diff options
author | Maarten Bosmans <mkbosmans@gmail.com> | 2016-09-09 21:11:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-22 07:12:49 +0000 |
commit | 9df9949cc484ea0ba109e7d41fd03b15afaedb11 (patch) | |
tree | 3357ed611a511dff871486275b13ef2fd70e116e /unotools | |
parent | 4c70a1a6666a079872b8f1966bd398e924dc1d1a (diff) |
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@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/Library_utl.mk | 1 | ||||
-rw-r--r-- | unotools/source/i18n/localedatawrapper.cxx | 12 | ||||
-rw-r--r-- | unotools/source/i18n/numberformatcodewrapper.cxx | 90 |
3 files changed, 5 insertions, 98 deletions
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index 0d4ea9f2e692..3853dbf965fb 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 8897db910ba2..a467685f38ea 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 652c757abf1d..000000000000 --- 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: */ |