diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-19 15:29:46 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 11:33:14 +0200 |
commit | f4776bf465ee682f65d1e978b031c928d9d310a5 (patch) | |
tree | c361f3415fbb33e363f408579184ec224b18ed16 | |
parent | Updated core (diff) | |
download | core-f4776bf465ee682f65d1e978b031c928d9d310a5.tar.gz core-f4776bf465ee682f65d1e978b031c928d9d310a5.zip |
fdo#46808, fix up some NumberFormatter createInstance calls I missed
Change-Id: Ieb3ce841243797a119f1d1d40379ff2a4614168f
-rw-r--r-- | forms/source/inc/services.hxx | 1 | ||||
-rw-r--r-- | scaddins/Library_analysis.mk | 1 | ||||
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 7 | ||||
-rw-r--r-- | scaddins/source/analysis/analysis.hxx | 2 | ||||
-rw-r--r-- | scaddins/source/analysis/analysishelper.cxx | 10 | ||||
-rw-r--r-- | scaddins/source/analysis/analysishelper.hxx | 7 | ||||
-rw-r--r-- | svtools/source/table/cellvalueconversion.cxx | 7 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 28 | ||||
-rw-r--r-- | svx/source/form/filtnav.cxx | 7 | ||||
-rw-r--r-- | svx/source/form/fmsrcimp.cxx | 10 | ||||
-rw-r--r-- | svx/source/inc/fmservs.hxx | 1 |
11 files changed, 40 insertions, 41 deletions
diff --git a/forms/source/inc/services.hxx b/forms/source/inc/services.hxx index 3024b0609684..4c2ae6bc4413 100644 --- a/forms/source/inc/services.hxx +++ b/forms/source/inc/services.hxx @@ -210,7 +210,6 @@ namespace frm // ----------------------- FORMS_CONSTASCII_STRING( SRV_AWT_POINTER, "com.sun.star.awt.Pointer" ); FORMS_CONSTASCII_STRING( SRV_AWT_IMAGEPRODUCER, "com.sun.star.awt.ImageProducer" ); - FORMS_CONSTASCII_STRING( FRM_NUMBER_FORMATTER, "com.sun.star.util.NumberFormatter" ); FORMS_CONSTASCII_STRING( FRM_NUMBER_FORMATS_SUPPLIER, "com.sun.star.util.NumberFormatsSupplier" ); FORMS_CONSTASCII_STRING( SRV_SDB_ROWSET, "com.sun.star.sdb.RowSet" ); diff --git a/scaddins/Library_analysis.mk b/scaddins/Library_analysis.mk index dda698588fa0..6b351da0cdc8 100644 --- a/scaddins/Library_analysis.mk +++ b/scaddins/Library_analysis.mk @@ -37,6 +37,7 @@ $(eval $(call gb_Library_use_internal_comprehensive_api,analysis,\ )) $(eval $(call gb_Library_use_libraries,analysis,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index ca83361714e8..bf1ef36a25da 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -19,6 +19,7 @@ #include "analysis.hxx" +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> @@ -155,13 +156,13 @@ void AnalysisAddIn::InitData( void ) } -AnalysisAddIn::AnalysisAddIn( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) : +AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xContext ) : pDefLocales( NULL ), pFD( NULL ), pFactDoubles( NULL ), pCDL( NULL ), pResMgr( NULL ), - aAnyConv( xServiceFact ) + aAnyConv( xContext ) { } @@ -259,7 +260,7 @@ SEQ( STRING ) AnalysisAddIn::getSupportedServiceNames_Static() REF( uno::XInterface ) SAL_CALL AnalysisAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) { - static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new AnalysisAddIn( xServiceFact ); + static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new AnalysisAddIn( comphelper::getComponentContext(xServiceFact) ); return xInst; } diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx index 02792920568d..d89cbe251382 100644 --- a/scaddins/source/analysis/analysis.hxx +++ b/scaddins/source/analysis/analysis.hxx @@ -76,7 +76,7 @@ private: public: AnalysisAddIn( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFact ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); virtual ~AnalysisAddIn(); double FactDouble( sal_Int32 nNum ) THROWDEF_RTE_IAE; diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index b075bafe0148..08a096794c1a 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/util/XNumberFormatTypes.hpp> +#include <com/sun/star/util/NumberFormatter.hpp> #include <string.h> #include <stdio.h> @@ -2845,15 +2846,10 @@ sal_Bool ScaDate::operator<( const ScaDate& rCmp ) const //----------------------------------------------------------------------------- -ScaAnyConverter::ScaAnyConverter( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) : +ScaAnyConverter::ScaAnyConverter( const uno::Reference< uno::XComponentContext >& xContext ) : bHasValidFormat( sal_False ) { - if( xServiceFact.is() ) - { - uno::Reference< uno::XInterface > xInstance = xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" )) ); - xFormatter = uno::Reference< util::XNumberFormatter >( xInstance, uno::UNO_QUERY ); - } + xFormatter = util::NumberFormatter::create(xContext); } ScaAnyConverter::~ScaAnyConverter() diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index bbbbfc57f245..395348cc5781 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -23,8 +23,9 @@ #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/Date.hpp> -#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/XNumberFormatter2.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/sheet/XAddIn.hpp> #include <com/sun/star/sheet/addin/XAnalysis.hpp> @@ -1030,7 +1031,7 @@ inline void ScaDate::addYears( sal_Int32 nYearCount ) throw( ::com::sun::star::l class ScaAnyConverter { private: - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter2 > xFormatter; sal_Int32 nDefaultFormat; sal_Bool bHasValidFormat; @@ -1045,7 +1046,7 @@ private: public: ScaAnyConverter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFact ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); ~ScaAnyConverter(); /// Initializing with current language settings diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 677283a92001..6aef3ad95301 100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx @@ -27,7 +27,7 @@ #include "cellvalueconversion.hxx" -#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/NumberFormatter.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/Date.hpp> @@ -54,6 +54,8 @@ namespace svt /** === begin UNO using === **/ using ::com::sun::star::uno::Any; using ::com::sun::star::util::XNumberFormatter; + using ::com::sun::star::util::XNumberFormatter2; + using ::com::sun::star::util::NumberFormatter; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::beans::XPropertySet; @@ -343,8 +345,7 @@ namespace svt try { // a number formatter - Reference< XNumberFormatter > const xFormatter( - io_data.aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); + Reference< XNumberFormatter > const xFormatter( NumberFormatter::create( io_data.aContext.getUNOContext() ), UNO_QUERY_THROW ); // a supplier of number formats Sequence< Any > aInitArgs(1); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 61491ba16824..6f7c70056edf 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -44,12 +44,13 @@ #include <com/sun/star/sdbc/XResultSetUpdate.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/NumberFormatter.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <comphelper/extract.hxx> +#include <comphelper/processfactory.hxx> #include <tools/resid.hxx> #include <tools/diagnose_ex.h> #include <vcl/menu.hxx> @@ -1451,23 +1452,20 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt m_xFormatter = NULL; OStaticDataAccessTools aStaticTools; Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = aStaticTools.getNumberFormats(aStaticTools.getRowSetConnection(_xCursor), sal_True); - if (xSupplier.is() && m_xServiceFactory.is()) + if (xSupplier.is()) { - m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter >( - m_xServiceFactory->createInstance(FM_NUMBER_FORMATTER), + m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter >( + ::com::sun::star::util::NumberFormatter::create(comphelper::getComponentContext(m_xServiceFactory)), UNO_QUERY); - if (m_xFormatter.is()) - { - m_xFormatter->attachNumberFormatsSupplier(xSupplier); + m_xFormatter->attachNumberFormatsSupplier(xSupplier); - // retrieve the datebase of the Numberformatter - try - { - xSupplier->getNumberFormatSettings()->getPropertyValue(rtl::OUString("NullDate")) >>= m_aNullDate; - } - catch(Exception&) - { - } + // retrieve the datebase of the Numberformatter + try + { + xSupplier->getNumberFormatSettings()->getPropertyValue(rtl::OUString("NullDate")) >>= m_aNullDate; + } + catch(Exception&) + { } } diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 7dd1032b9555..4b2cec0b4b35 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -38,9 +38,10 @@ #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/NumberFormatter.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/property.hxx> #include <comphelper/sequence.hxx> @@ -103,6 +104,8 @@ namespace svxform using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::util::XNumberFormatter; + using ::com::sun::star::util::XNumberFormatter2; + using ::com::sun::star::util::NumberFormatter; using ::com::sun::star::sdbc::XRowSet; using ::com::sun::star::lang::Locale; using ::com::sun::star::sdb::SQLContext; @@ -895,7 +898,7 @@ sal_Bool FmFilterModel::ValidateText(FmFilterItem* pItem, UniString& rText, UniS // obtain a number formatter for this connection // TODO: shouldn't this be cached? Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats( xConnection, sal_True ); - Reference< XNumberFormatter > xFormatter( m_xORB->createInstance( FM_NUMBER_FORMATTER ), UNO_QUERY ); + Reference< XNumberFormatter > xFormatter( NumberFormatter::create( comphelper::getComponentContext(m_xORB) ), UNO_QUERY_THROW ); xFormatter->attachNumberFormatsSupplier( xFormatSupplier ); // get the field (database column) which the item is responsible for diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index f9d6a85f864a..63d04a43a343 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/i18n/CollatorOptions.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/util/NumberFormat.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/util/XNumberFormats.hpp> @@ -710,10 +710,10 @@ FmSearchEngine::FmSearchEngine(const Reference< XMultiServiceFactory >& _rxORB, { DBG_CTOR(FmSearchEngine,NULL); - m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter > (::comphelper::getProcessServiceFactory() - ->createInstance(FM_NUMBER_FORMATTER), UNO_QUERY); - if (m_xFormatter.is()) - m_xFormatter->attachNumberFormatsSupplier(m_xFormatSupplier); + m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter >( + ::com::sun::star::util::NumberFormatter::create( ::comphelper::getProcessComponentContext() ), + UNO_QUERY_THROW); + m_xFormatter->attachNumberFormatsSupplier(m_xFormatSupplier); Init(sVisibleFields); } diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx index fe1c9273bc18..61ad6dc6150b 100644 --- a/svx/source/inc/fmservs.hxx +++ b/svx/source/inc/fmservs.hxx @@ -21,7 +21,6 @@ #include <svx/svxdllapi.h> -#define FM_NUMBER_FORMATTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) #define FM_COMPONENT_EDIT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Edit" ) ) #define FM_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.TextField" ) ) #define FM_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ListBox" ) ) |