diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-04 13:18:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-06 13:20:31 +0200 |
commit | 773ad75b0dbc4dac1cae704c726b5a2d67ae1146 (patch) | |
tree | b95386a6639835d7751a6b3aa7bcdfb114f026f8 /forms | |
parent | 584cd8d1c23d47becb776e382f853ffe77ce9fc2 (diff) |
fdo#46808, Adapt util::NumberFormatsSupplier UNO service to new style
Change-Id: I58436d9eea0c38d14cde2dc01aa463d5d71912e9
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/Date.cxx | 5 | ||||
-rw-r--r-- | forms/source/component/Filter.cxx | 3 | ||||
-rw-r--r-- | forms/source/component/FormattedField.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/Time.cxx | 5 | ||||
-rw-r--r-- | forms/source/inc/limitedformats.hxx | 6 | ||||
-rw-r--r-- | forms/source/inc/services.hxx | 1 | ||||
-rw-r--r-- | forms/source/misc/limitedformats.cxx | 21 |
7 files changed, 19 insertions, 24 deletions
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index 5355b1176356..bc59971729f6 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -22,6 +22,7 @@ #include <tools/date.hxx> #include <connectivity/dbconversion.hxx> #include <com/sun/star/sdbc/DataType.hpp> +#include <comphelper/processfactory.hxx> using namespace dbtools; @@ -91,7 +92,7 @@ DBG_NAME( ODateModel ) ODateModel::ODateModel(const Reference<XMultiServiceFactory>& _rxFactory) :OEditBaseModel( _rxFactory, VCL_CONTROLMODEL_DATEFIELD, FRM_SUN_CONTROL_DATEFIELD, sal_True, sal_True ) // use the old control name for compytibility reasons - ,OLimitedFormats( _rxFactory, FormComponentType::DATEFIELD ) + ,OLimitedFormats( comphelper::getComponentContext(_rxFactory), FormComponentType::DATEFIELD ) { DBG_CTOR( ODateModel, NULL ); @@ -116,7 +117,7 @@ ODateModel::ODateModel(const Reference<XMultiServiceFactory>& _rxFactory) //------------------------------------------------------------------------------ ODateModel::ODateModel( const ODateModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OEditBaseModel( _pOriginal, _rxFactory ) - ,OLimitedFormats( _rxFactory, FormComponentType::DATEFIELD ) + ,OLimitedFormats( comphelper::getComponentContext(_rxFactory), FormComponentType::DATEFIELD ) { DBG_CTOR( ODateModel, NULL ); diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 948bdcc4cff3..6d92e77df421 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -120,7 +120,8 @@ namespace frm if ( !m_xFormatter.is() ) { // we can create one from the connection, if it's an SDB connection - Reference< XNumberFormatsSupplier > xFormatSupplier = ::dbtools::getNumberFormats( m_xConnection, sal_True, maContext.getLegacyServiceFactory() ); + + Reference< XNumberFormatsSupplier > xFormatSupplier = ::dbtools::getNumberFormats( m_xConnection, sal_True, maContext.getUNOContext() ); if ( xFormatSupplier.is() ) { diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index dc33b2c8dff0..cc6e967f0855 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -654,7 +654,7 @@ Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() co Reference< XRowSet > xRowSet( xNextParentForm, UNO_QUERY ); Reference< XNumberFormatsSupplier > xSupplier; if (xRowSet.is()) - xSupplier = getNumberFormats( getConnection(xRowSet), sal_True, getContext().getLegacyServiceFactory() ); + xSupplier = getNumberFormats( getConnection(xRowSet), sal_True, getContext().getUNOContext() ); return xSupplier; } diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index 7cd51c188dcf..346f09695089 100644 --- a/forms/source/component/Time.cxx +++ b/forms/source/component/Time.cxx @@ -22,6 +22,7 @@ #include <tools/time.hxx> #include <connectivity/dbconversion.hxx> #include <com/sun/star/sdbc/DataType.hpp> +#include <comphelper/processfactory.hxx> using namespace dbtools; @@ -124,7 +125,7 @@ DBG_NAME( OTimeModel ) OTimeModel::OTimeModel(const Reference<XMultiServiceFactory>& _rxFactory) :OEditBaseModel( _rxFactory, VCL_CONTROLMODEL_TIMEFIELD, FRM_SUN_CONTROL_TIMEFIELD, sal_True, sal_True ) // use the old control name for compytibility reasons - ,OLimitedFormats(_rxFactory, FormComponentType::TIMEFIELD) + ,OLimitedFormats( comphelper::getComponentContext(_rxFactory), FormComponentType::TIMEFIELD) { DBG_CTOR( OTimeModel, NULL ); @@ -137,7 +138,7 @@ OTimeModel::OTimeModel(const Reference<XMultiServiceFactory>& _rxFactory) //------------------------------------------------------------------------------ OTimeModel::OTimeModel( const OTimeModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OEditBaseModel( _pOriginal, _rxFactory ) - ,OLimitedFormats( _rxFactory, FormComponentType::TIMEFIELD ) + ,OLimitedFormats( comphelper::getComponentContext(_rxFactory), FormComponentType::TIMEFIELD ) { DBG_CTOR( OTimeModel, NULL ); diff --git a/forms/source/inc/limitedformats.hxx b/forms/source/inc/limitedformats.hxx index 814f4920eb5c..9f22b1832bb6 100644 --- a/forms/source/inc/limitedformats.hxx +++ b/forms/source/inc/limitedformats.hxx @@ -22,7 +22,7 @@ #include <osl/mutex.hxx> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp> //......................................................................... @@ -57,7 +57,7 @@ namespace frm pass the same value here share one table.</p> */ OLimitedFormats( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const sal_Int16 _nClassId ); ~OLimitedFormats(); @@ -82,7 +82,7 @@ namespace frm getFormatsSupplier() const { return s_xStandardFormats; } private: - void acquireSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + void acquireSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); void releaseSupplier(); static void ensureTableInitialized(const sal_Int16 _nTableId); diff --git a/forms/source/inc/services.hxx b/forms/source/inc/services.hxx index 4c2ae6bc4413..c8f3ffb5a845 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_FORMATS_SUPPLIER, "com.sun.star.util.NumberFormatsSupplier" ); FORMS_CONSTASCII_STRING( SRV_SDB_ROWSET, "com.sun.star.sdb.RowSet" ); FORMS_CONSTASCII_STRING( SRV_SDB_CONNECTION, "com.sun.star.sdb.Connection" ); diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx index 82e4fe2b88ea..06bba11583b7 100644 --- a/forms/source/misc/limitedformats.cxx +++ b/forms/source/misc/limitedformats.cxx @@ -23,6 +23,7 @@ #include <comphelper/types.hxx> #include <comphelper/extract.hxx> #include <com/sun/star/form/FormComponentType.hpp> +#include <com/sun/star/util/NumberFormatsSupplier.hpp> //......................................................................... namespace frm @@ -132,12 +133,12 @@ namespace frm //= OLimitedFormats //===================================================================== //--------------------------------------------------------------------- - OLimitedFormats::OLimitedFormats(const Reference< XMultiServiceFactory >& _rxORB, const sal_Int16 _nClassId) + OLimitedFormats::OLimitedFormats(const Reference< XComponentContext >& _rxContext, const sal_Int16 _nClassId) :m_nFormatEnumPropertyHandle(-1) ,m_nTableId(_nClassId) { - OSL_ENSURE(_rxORB.is(), "OLimitedFormats::OLimitedFormats: invalid service factory!"); - acquireSupplier(_rxORB); + OSL_ENSURE(_rxContext.is(), "OLimitedFormats::OLimitedFormats: invalid service factory!"); + acquireSupplier(_rxContext); ensureTableInitialized(m_nTableId); } @@ -355,20 +356,12 @@ namespace frm } //--------------------------------------------------------------------- - void OLimitedFormats::acquireSupplier(const Reference< XMultiServiceFactory >& _rxORB) + void OLimitedFormats::acquireSupplier(const Reference< XComponentContext >& _rxContext) { ::osl::MutexGuard aGuard(s_aMutex); - if ((1 == ++s_nInstanceCount) && _rxORB.is()) + if (1 == ++s_nInstanceCount) { // create the standard formatter - - Sequence< Any > aInit(1); - aInit[0] <<= getLocale(ltEnglishUS); - - Reference< XInterface > xSupplier = _rxORB->createInstanceWithArguments(FRM_NUMBER_FORMATS_SUPPLIER, aInit); - OSL_ENSURE(xSupplier.is(), "OLimitedFormats::OLimitedFormats: could not create a formats supplier!"); - - s_xStandardFormats = Reference< XNumberFormatsSupplier >(xSupplier, UNO_QUERY); - OSL_ENSURE(s_xStandardFormats.is() || !xSupplier.is(), "OLimitedFormats::OLimitedFormats: missing an interface!"); + s_xStandardFormats = NumberFormatsSupplier::createWithLocale(_rxContext, getLocale(ltEnglishUS)); } } |