update emoji autocorrect entries from po-files
[LibreOffice.git] / unotools / source / i18n / numberformatcodewrapper.cxx
blobff27654c0fca98a1880443fe2705fa4433058829
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <sal/log.hxx>
23 #include <unotools/numberformatcodewrapper.hxx>
24 #include <com/sun/star/i18n/NumberFormatMapper.hpp>
26 using namespace ::com::sun::star;
27 using namespace ::com::sun::star::i18n;
28 using namespace ::com::sun::star::uno;
30 NumberFormatCodeWrapper::NumberFormatCodeWrapper(
31 const Reference< uno::XComponentContext > & rxContext,
32 const lang::Locale& rLocale
35 setLocale( rLocale );
36 xNFC = i18n::NumberFormatMapper::create( rxContext );
39 NumberFormatCodeWrapper::~NumberFormatCodeWrapper()
43 void NumberFormatCodeWrapper::setLocale( const ::com::sun::star::lang::Locale& rLocale )
45 aLocale = rLocale;
48 ::com::sun::star::i18n::NumberFormatCode
49 NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const
51 try
53 return xNFC->getFormatCode( formatIndex, aLocale );
55 catch ( const Exception& )
57 SAL_WARN( "unotools.i18n", "getFormatCode: Exception caught!" );
59 return ::com::sun::star::i18n::NumberFormatCode();
62 ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >
63 NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const
65 try
67 return xNFC->getAllFormatCode( formatUsage, aLocale );
69 catch ( const Exception& )
71 SAL_WARN( "unotools.i18n", "getAllFormatCode: Exception caught!" );
73 return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > (0);
76 ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >
77 NumberFormatCodeWrapper::getAllFormatCodes() const
79 try
81 return xNFC->getAllFormatCodes( aLocale );
83 catch ( const Exception& )
85 SAL_WARN( "unotools.i18n", "getAllFormatCodes: Exception caught!" );
87 return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > (0);
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */