diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-29 09:32:55 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-03 15:55:06 +0200 |
commit | 3a36408b73d8a9be43cd9f4570537ff1d80c0114 (patch) | |
tree | f46fe36878b77836f9ef3606e162e87ab84bdcb2 /sw | |
parent | bc00717bb7a2b48885ca356fb0a966acbe72dca9 (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 'sw')
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 13 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbmgr.cxx | 10 |
2 files changed, 8 insertions, 15 deletions
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); |