summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-29 09:32:55 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-03 15:55:06 +0200
commit3a36408b73d8a9be43cd9f4570537ff1d80c0114 (patch)
treef46fe36878b77836f9ef3606e162e87ab84bdcb2
parentbc00717bb7a2b48885ca356fb0a966acbe72dca9 (diff)
fdo#46808, Adapt util::NumberFormatter UNO service to new style
Create a merged XNumberFormatter2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I57f35cde0a9dbbe91c1d2c3d068cb3a97c7245e3
-rw-r--r--chart2/source/tools/RegressionCurveCalculator.cxx10
-rw-r--r--connectivity/source/commontools/formattedcolumnvalue.cxx5
-rw-r--r--connectivity/source/commontools/predicateinput.cxx11
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx7
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx5
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx9
-rw-r--r--dbaccess/source/ui/control/ColumnControlWindow.cxx8
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx7
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx9
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx7
-rw-r--r--forms/source/component/Filter.cxx6
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/util/NumberFormatter.idl21
-rw-r--r--offapi/com/sun/star/util/XNumberFormatter2.idl49
-rw-r--r--offapi/type_reference/types.rdbbin7653888 -> 7655424 bytes
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4
-rw-r--r--svl/source/numbers/numfmuno.hxx7
-rw-r--r--svx/source/form/formcontroller.cxx9
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx13
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx10
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx3
21 files changed, 122 insertions, 81 deletions
diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx
index d19276d17f76..b64b02cb55aa 100644
--- a/chart2/source/tools/RegressionCurveCalculator.cxx
+++ b/chart2/source/tools/RegressionCurveCalculator.cxx
@@ -26,6 +26,7 @@
#include <rtl/math.hxx>
#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
using namespace ::com::sun::star;
@@ -140,13 +141,8 @@ OUString SAL_CALL RegressionCurveCalculator::getFormattedRepresentation(
// create and prepare a number formatter
if( !xNumFmtSupplier.is())
return getRepresentation();
- Reference< util::XNumberFormatter > xNumFormatter;
- Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- if( xFact.is())
- xNumFormatter.set( xFact->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter"))), uno::UNO_QUERY );
- if( !xNumFormatter.is())
- return getRepresentation();
+ Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW );
+ Reference< util::XNumberFormatter > xNumFormatter( util::NumberFormatter::create(xContext), uno::UNO_QUERY_THROW );
xNumFormatter->attachNumberFormatsSupplier( xNumFmtSupplier );
return ImplGetRepresentation( xNumFormatter, nNumberFormatKey );
diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx
index ec509e78a28e..3298764be85b 100644
--- a/connectivity/source/commontools/formattedcolumnvalue.cxx
+++ b/connectivity/source/commontools/formattedcolumnvalue.cxx
@@ -22,7 +22,7 @@
#include "connectivity/dbtools.hxx"
#include "connectivity/dbconversion.hxx"
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
@@ -51,6 +51,7 @@ namespace dbtools
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::sdbc::XRowSet;
using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::util::NumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::util::Date;
using ::com::sun::star::sdbc::XConnection;
@@ -199,7 +200,7 @@ namespace dbtools
Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_True, i_rContext.getLegacyServiceFactory() ), UNO_SET_THROW );
// create a number formatter for it
- xNumberFormatter.set( i_rContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW );
+ xNumberFormatter.set( NumberFormatter::create(i_rContext.getUNOContext()), UNO_QUERY_THROW );
xNumberFormatter->attachNumberFormatsSupplier( xSupplier );
}
catch( const Exception& )
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 0fa5443a8b71..f72b1163ab36 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -23,6 +23,7 @@
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <osl/diagnose.h>
#include <connectivity/sqlnode.hxx>
#include <connectivity/PColumn.hxx>
@@ -38,8 +39,10 @@ namespace dbtools
using ::com::sun::star::sdbc::XConnection;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::util::NumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::lang::Locale;
@@ -105,16 +108,16 @@ namespace dbtools
OSL_ENSURE( m_xORB.is(), "OPredicateInputController::OPredicateInputController: need a service factory!" );
if ( m_xORB.is() )
{
- m_xFormatter = Reference< XNumberFormatter >( m_xORB->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ),
- UNO_QUERY
+ m_xFormatter = Reference< XNumberFormatter >(
+ NumberFormatter::create(comphelper::ComponentContext(m_xORB).getUNOContext()),
+ UNO_QUERY_THROW
);
}
Reference< XNumberFormatsSupplier > xNumberFormats = ::dbtools::getNumberFormats( m_xConnection, sal_True );
if ( !xNumberFormats.is() )
::comphelper::disposeComponent( m_xFormatter );
- else if ( m_xFormatter.is() )
+ else
m_xFormatter->attachNumberFormatsSupplier( xNumberFormats );
// create the locale data
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 4d9a6036a554..c874ccf8a0f0 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -36,6 +36,7 @@
#include <comphelper/types.hxx>
#include "flat/EDriver.hxx"
#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <unotools/configmgr.hxx>
#include <i18npool/mslangid.hxx>
#include "connectivity/dbconversion.hxx"
@@ -49,6 +50,7 @@ using namespace connectivity::flat;
using namespace connectivity::file;
using namespace ::cppu;
using namespace utl;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
@@ -420,7 +422,10 @@ void OFlatTable::construct()
aArg[0] <<= aAppLocale;
Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY);
- m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString("com.sun.star.util.NumberFormatter")),UNO_QUERY);
+ m_xNumberFormatter = Reference< util::XNumberFormatter >(
+ util::NumberFormatter::create(
+ comphelper::ComponentContext(m_pConnection->getDriver()->getFactory()).getUNOContext()),
+ UNO_QUERY_THROW);
m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY);
xProp->getPropertyValue(::rtl::OUString("NullDate")) >>= m_aNullDate;
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 854c7f122a4e..da159c39ff00 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -41,7 +41,7 @@
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/uno/XAggregation.hpp>
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
@@ -1755,8 +1755,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC
if ( pCondition )
{
::std::vector< ::std::vector < PropertyValue > > aFilters;
- Reference< XNumberFormatter > xFormatter;
- m_aContext.createComponent( "com.sun.star.util.NumberFormatter", xFormatter );
+ Reference< XNumberFormatter > xFormatter( NumberFormatter::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier( m_xNumberFormatsSupplier );
if (setORCriteria(pCondition, m_aAdditiveIterator, aFilters, xFormatter))
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index a3c21e902c41..348d33a4bb17 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -59,6 +59,7 @@
#include <com/sun/star/sdbcx/XRowLocate.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/XCancellable.hpp>
#include <comphelper/enumhelper.hxx>
@@ -83,6 +84,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::sdb;
@@ -775,10 +777,9 @@ void SbaXDataBrowserController::initFormatter()
if(xSupplier.is())
{
// create a new formatter
- m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter > (
- getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
- if (m_xFormatter.is())
- m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+ m_xFormatter = Reference< util::XNumberFormatter > (
+ util::NumberFormatter::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW);
+ m_xFormatter->attachNumberFormatsSupplier(xSupplier);
}
else // clear the formatter
m_xFormatter = NULL;
diff --git a/dbaccess/source/ui/control/ColumnControlWindow.cxx b/dbaccess/source/ui/control/ColumnControlWindow.cxx
index 7363d5e5b7be..d96da5c2ed0e 100644
--- a/dbaccess/source/ui/control/ColumnControlWindow.cxx
+++ b/dbaccess/source/ui/control/ColumnControlWindow.cxx
@@ -23,9 +23,12 @@
#include <connectivity/dbtools.hxx>
#include "UITools.hxx"
#include "dbu_resource.hrc"
+#include <comphelper/componentcontext.hxx>
+#include <com/sun/star/util/NumberFormatter.hpp>
using namespace ::dbaui;
+using namespace ::com::sun::star::util;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -102,9 +105,8 @@ Reference< XNumberFormatter > OColumnControlWindow::GetFormatter() const
if ( xSupplier.is() )
{
// create a new formatter
- m_xFormatter.set( m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
- if (m_xFormatter.is())
- m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+ m_xFormatter.set( NumberFormatter::create(comphelper::ComponentContext(m_xORB).getUNOContext()), UNO_QUERY_THROW);
+ m_xFormatter->attachNumberFormatsSupplier(xSupplier);
}
}
catch(Exception&)
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index d5f5accf545c..a6d48cf4bb02 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -23,7 +23,7 @@
#include "dbu_dlg.hrc"
#include "commontypes.hxx"
#include "moduledbu.hxx"
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <connectivity/dbtools.hxx>
#include "dbustrings.hrc"
@@ -81,8 +81,7 @@ DBG_NAME(OParameterDialog)
DBG_CTOR(OParameterDialog,NULL);
if (_rxORB.is())
- m_xFormatter = Reference< XNumberFormatter>(_rxORB->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
+ m_xFormatter = Reference< XNumberFormatter>( NumberFormatter::create(comphelper::ComponentContext(_rxORB).getUNOContext()), UNO_QUERY_THROW);
else {
OSL_FAIL("OParameterDialog::OParameterDialog: need a service factory!");
}
@@ -90,7 +89,7 @@ DBG_NAME(OParameterDialog)
Reference< XNumberFormatsSupplier > xNumberFormats = ::dbtools::getNumberFormats(m_xConnection, sal_True);
if (!xNumberFormats.is())
::comphelper::disposeComponent(m_xFormatter);
- else if (m_xFormatter.is())
+ else
m_xFormatter->attachNumberFormatsSupplier(xNumberFormats);
try
{
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index e2af63da73a8..6f61a4bbf7af 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -86,6 +86,7 @@
#include "dlgattr.hxx"
#include <vcl/msgbox.hxx>
#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
#include "dbu_misc.hrc"
@@ -114,6 +115,7 @@ namespace dbaui
// .........................................................................
using namespace ::dbtools;
using namespace ::comphelper;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::sdbcx;
@@ -1622,10 +1624,9 @@ Reference< XNumberFormatter > getNumberFormatter(const Reference< XConnection >&
if ( xSupplier.is() )
{
// create a new formatter
- xFormatter = Reference< ::com::sun::star::util::XNumberFormatter > (
- _rMF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
- if ( xFormatter.is() )
- xFormatter->attachNumberFormatsSupplier(xSupplier);
+ xFormatter = Reference< util::XNumberFormatter > (
+ util::NumberFormatter::create(comphelper::ComponentContext(_rMF).getUNOContext()), UNO_QUERY_THROW);
+ xFormatter->attachNumberFormatsSupplier(xSupplier);
}
}
catch(const Exception&)
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index fb86ac82443d..785b31b8859c 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -33,8 +33,10 @@
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
@@ -64,6 +66,7 @@ namespace dbaui
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::container::XChild;
using ::com::sun::star::sdbc::XDataSource;
+ using ::com::sun::star::util::NumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::util::XNumberFormatsSupplier;
using ::com::sun::star::frame::XFrame;
@@ -294,8 +297,8 @@ namespace dbaui
Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
if(xSupplier.is())
{
- m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
- ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
+ m_pImpl->m_xFormatter = Reference< XNumberFormatter >(
+ NumberFormatter::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW);
m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
}
OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index cb2ac2a50249..298bf90cae4c 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/awt/XItemList.hpp>
#include <comphelper/numbers.hxx>
@@ -131,9 +132,8 @@ namespace frm
if ( xFormatSupplier.is() )
{
- maContext.createComponent( "com.sun.star.util.NumberFormatter", m_xFormatter );
- if ( m_xFormatter.is() )
- m_xFormatter->attachNumberFormatsSupplier( xFormatSupplier );
+ m_xFormatter.set(NumberFormatter::create(maContext.getUNOContext()), UNO_QUERY_THROW );
+ m_xFormatter->attachNumberFormatsSupplier( xFormatSupplier );
}
}
if ( !m_xFormatter.is() )
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index db5c89d24304..64d1a4de6739 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -295,6 +295,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
JobManager \
+ NumberFormatter \
PathSubstitution \
TextSearch \
UriAbbreviation \
@@ -1482,7 +1483,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/util,\
NumberFormatSettings \
NumberFormats \
NumberFormatsSupplier \
- NumberFormatter \
OfficeInstallationDirectories \
PathSettings \
ReplaceDescriptor \
@@ -4061,6 +4061,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/util,\
XNumberFormats \
XNumberFormatsSupplier \
XNumberFormatter \
+ XNumberFormatter2 \
XOfficeInstallationDirectories \
XPropertyReplace \
XProtectable \
diff --git a/offapi/com/sun/star/util/NumberFormatter.idl b/offapi/com/sun/star/util/NumberFormatter.idl
index b3cd82c835cf..54c65c3c89d3 100644
--- a/offapi/com/sun/star/util/NumberFormatter.idl
+++ b/offapi/com/sun/star/util/NumberFormatter.idl
@@ -19,13 +19,10 @@
#ifndef __com_sun_star_util_NumberFormatter_idl__
#define __com_sun_star_util_NumberFormatter_idl__
-#include <com/sun/star/util/XNumberFormatter.idl>
+#include <com/sun/star/util/XNumberFormatter2.idl>
-#include <com/sun/star/util/XNumberFormatPreviewer.idl>
-
-
- module com { module sun { module star { module util {
+module com { module sun { module star { module util {
/** represents an object which can format numbers and strings.
@@ -33,19 +30,7 @@
<p>A NumberFormatter, if available, can be created by the global
service manager.</p>
*/
-published service NumberFormatter
-{
- /** is used to format or parse numbers using formats from a
- <type>NumberFormats</type> object.
- */
- interface com::sun::star::util::XNumberFormatter;
-
- /** is used to format numbers using a number format string
- that is not inserted into a <type>NumberFormats</type> object.
- */
- interface com::sun::star::util::XNumberFormatPreviewer;
-
-};
+published service NumberFormatter : XNumberFormatter2;
}; }; }; };
diff --git a/offapi/com/sun/star/util/XNumberFormatter2.idl b/offapi/com/sun/star/util/XNumberFormatter2.idl
new file mode 100644
index 000000000000..a17382177664
--- /dev/null
+++ b/offapi/com/sun/star/util/XNumberFormatter2.idl
@@ -0,0 +1,49 @@
+/* -*- 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 __com_sun_star_util_XNumberFormatter2_idl__
+#define __com_sun_star_util_XNumberFormatter2_idl__
+
+#include <com/sun/star/util/XNumberFormatter.idl>
+#include <com/sun/star/util/XNumberFormatPreviewer.idl>
+
+module com { module sun { module star { module util {
+
+/** Provides a unified interface for the NumberFormatter service to implement.
+*/
+published interface XNumberFormatter2
+{
+
+ /** is used to format or parse numbers using formats from a
+ <type>NumberFormats</type> object.
+ */
+ interface com::sun::star::util::XNumberFormatter;
+
+ /** is used to format numbers using a number format string
+ that is not inserted into a <type>NumberFormats</type> object.
+ */
+ interface com::sun::star::util::XNumberFormatPreviewer;
+
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 1969d252fda5..d36fc05331eb 100644
--- a/offapi/type_reference/types.rdb
+++ b/offapi/type_reference/types.rdb
Binary files differ
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index ea1d04cfb960..ad1074589e46 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -57,6 +57,7 @@
#include "rptui_slotid.hrc"
#include "reportformula.hxx"
+#include <comphelper/componentcontext.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/property.hxx>
@@ -69,6 +70,7 @@
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/PageStyleLayout.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
@@ -1699,7 +1701,7 @@ void OReportController::impl_initialize( )
listen(true);
setEditable( !m_aReportModel->IsReadOnly() );
- m_xFormatter.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
+ m_xFormatter.set(util::NumberFormatter::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW);
m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY));
::comphelper::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() );
diff --git a/svl/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx
index 33a50f5e0c31..1f6c4ff1964e 100644
--- a/svl/source/numbers/numfmuno.hxx
+++ b/svl/source/numbers/numfmuno.hxx
@@ -20,7 +20,7 @@
#ifndef _NUMFMUNO_HXX
#define _NUMFMUNO_HXX
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/XNumberFormatter2.hpp>
#include <com/sun/star/util/XNumberFormatPreviewer.hpp>
#include <com/sun/star/util/XNumberFormats.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
@@ -37,9 +37,8 @@ class SvNumberFormatsSupplierObj;
// SvNumberFormatterServiceObj wird global als Service angemeldet
-class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3<
- com::sun::star::util::XNumberFormatter,
- com::sun::star::util::XNumberFormatPreviewer,
+class SvNumberFormatterServiceObj : public cppu::WeakImplHelper2<
+ com::sun::star::util::XNumberFormatter2,
com::sun::star::lang::XServiceInfo>
{
private:
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 4fea777be024..d18e6bb1cc0d 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -66,7 +66,7 @@
#include <com/sun/star/form/runtime/FormFeature.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
#include <com/sun/star/sdb/XColumn.hpp>
@@ -143,6 +143,7 @@ namespace svxform
using ::com::sun::star::sdbc::XRowSet;
using ::com::sun::star::sdbc::XDatabaseMetaData;
using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::util::NumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::sdbcx::XColumnsSupplier;
using ::com::sun::star::container::XNameAccess;
@@ -845,7 +846,7 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
{
Reference< XDatabaseMetaData> xMetaData(xConnection->getMetaData());
Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats( xConnection, sal_True ) );
- Reference< XNumberFormatter> xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW );
+ Reference< XNumberFormatter> xFormatter( NumberFormatter::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Reference< XColumnsSupplier> xSupplyCols(m_xModelAsIndex, UNO_QUERY);
@@ -3165,7 +3166,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
// need to parse criteria localized
OStaticDataAccessTools aStaticTools;
Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats(xConnection, sal_True));
- Reference< XNumberFormatter> xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY );
+ Reference< XNumberFormatter> xFormatter( NumberFormatter::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Locale aAppLocale = Application::GetSettings().GetUILocale();
LocaleDataWrapper aLocaleWrapper( m_aContext.getLegacyServiceFactory(), aAppLocale );
@@ -3309,7 +3310,7 @@ void FormController::startFiltering()
// the control we have to activate after replacement
Reference< XDatabaseMetaData > xMetaData(xConnection->getMetaData());
Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats(xConnection, sal_True);
- Reference< XNumberFormatter > xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY );
+ Reference< XNumberFormatter > xFormatter( NumberFormatter::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
// structure for storing the field info
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 6acd1bc99d66..00bac12929cc 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -46,7 +46,7 @@
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <comphelper/processfactory.hxx>
@@ -108,13 +108,13 @@ namespace swui
}
using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
const char cDBFldStart = '<';
const char cDBFldEnd = '>';
@@ -1226,11 +1226,8 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
// every data set
SwDBFormatData aDBFormatData;
Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
- if( xMgr.is() )
- {
- Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.util.NumberFormatter" ));
- aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(xInstance, UNO_QUERY) ;
- }
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY_THROW) ;
Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
if(xSourceProps.is())
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index b303131cff1c..63d7c47243c3 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -37,7 +37,7 @@
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/sdb/XCompletedExecution.hpp>
#include <com/sun/star/container/XChild.hpp>
@@ -235,12 +235,8 @@ struct SwNewDBMgr_Impl
void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<XDataSource> xSource)
{
- uno::Reference<XMultiServiceFactory> xMgr = ::comphelper::getProcessServiceFactory();
- if( xMgr.is() )
- {
- uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.util.NumberFormatter" ));
- rParam.xFormatter = uno::Reference<util::XNumberFormatter>(xInstance, UNO_QUERY) ;
- }
+ uno::Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ rParam.xFormatter = uno::Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY);
if(!xSource.is())
xSource = SwNewDBMgr::getDataSourceAsParent(rParam.xConnection, rParam.sDataSource);
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index 0089d449e676..230f966fdf48 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -31,6 +31,7 @@
#include <toolkit/helper/property.hxx>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <tools/diagnose_ex.h>
@@ -251,7 +252,7 @@ namespace toolkit
if ( !m_xCachedFormatter.is() )
{
m_xCachedFormatter = Reference< XNumberFormatter >(
- ::comphelper::createProcessComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ),
+ NumberFormatter::create(::comphelper::getProcessComponentContext()),
UNO_QUERY_THROW
);
}