summaryrefslogtreecommitdiff
path: root/dbaccess
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 /dbaccess
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
Diffstat (limited to 'dbaccess')
-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
6 files changed, 25 insertions, 20 deletions
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!");