From 9a69d111c1f563b5a4f484154d1be36a5a92f3e6 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Fri, 29 Aug 2014 21:04:26 +0200 Subject: fdo#67615 TextField in table should use same formatting as floating TextField Change-Id: Ia6333d12f9f1ecdd5a552089f0df8703c5fce88a Reviewed-on: https://gerrit.libreoffice.org/11197 Tested-by: Norbert Thiebaud Reviewed-by: Norbert Thiebaud --- svx/Library_svxcore.mk | 1 + svx/source/fmcomp/gridcell.cxx | 18 +++--------------- svx/source/inc/gridcell.hxx | 1 - 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index b1cbc0215531..ee4322d89e37 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\ comphelper \ cppuhelper \ cppu \ + dbtools \ drawinglayer \ editeng \ fwe \ diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index cf24b3518553..0863c60b69f5 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1083,7 +1083,6 @@ DbTextField::DbTextField(DbGridColumn& _rColumn) :DbLimitedLengthField(_rColumn) ,m_pEdit( NULL ) ,m_pPainterImplementation( NULL ) - ,m_nKeyType(::com::sun::star::util::NumberFormat::TEXT) ,m_bIsSimpleEdit( true ) { } @@ -1160,9 +1159,6 @@ void DbTextField::Init( Window& rParent, const Reference< XRowSet >& xCursor) implAdjustGenericFieldSetting( xModel ); - if (m_rColumn.GetParent().getNumberFormatter().is() && m_rColumn.GetKey()) - m_nKeyType = comphelper::getNumberFormatType(m_rColumn.GetParent().getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(), m_rColumn.GetKey()); - DbLimitedLengthField::Init( rParent, xCursor ); } @@ -1184,18 +1180,10 @@ void DbTextField::PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect OUString DbTextField::GetFormatText(const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter, Color** /*ppColor*/) { - OUString aString; - if ( _rxField.is() ) - try - { - aString = getFormattedValue( _rxField, xFormatter, m_rColumn.GetParent().getNullDate(), m_rColumn.GetKey(), m_nKeyType); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + const com::sun::star::uno::Reference xPS(_rxField, UNO_QUERY); + ::dbtools::FormattedColumnValue fmter( xFormatter, xPS ); - return aString; + return fmter.getFormattedValue(); } diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 6275c3f8ee80..9e86abd2526b 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -393,7 +393,6 @@ class DbTextField : public DbLimitedLengthField { ::svt::IEditImplementation* m_pEdit; ::svt::IEditImplementation* m_pPainterImplementation; - sal_Int16 m_nKeyType; bool m_bIsSimpleEdit; protected: -- cgit v1.2.3