summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-12-21 18:44:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-07 13:29:10 +0000
commitfdf69336eb52905113e1d9e6e453ae4e655e2aba (patch)
tree9e449a5594a980762f12dd5c43a952fb2490d7f3
parenta0b05775fa9d400fb7eab382bf2e9df98ec76999 (diff)
fdo#87555 ComboBox in table should use same formatting as floating ComboBox
Same as fdo#67615 for TexFields, but for ComboBox. Same problem, same cause, same solution. ListBox seems not to have this problem :) Change-Id: I953c5452f6c313b8940fbd1048b4c901b331fc58 Reviewed-on: https://gerrit.libreoffice.org/13579 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/fmcomp/gridcell.cxx19
-rw-r--r--svx/source/inc/gridcell.hxx1
2 files changed, 4 insertions, 16 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index c7a218447045..25aa9f8bdcd1 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2407,7 +2407,6 @@ bool DbTimeField::commitControl()
DbComboBox::DbComboBox(DbGridColumn& _rColumn)
:DbCellControl(_rColumn)
- ,m_nKeyType(::com::sun::star::util::NumberFormat::UNDEFINED)
{
setAlignedController( false );
@@ -2479,9 +2478,6 @@ void DbComboBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
SetList( xModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) );
implAdjustGenericFieldSetting( xModel );
- if (m_rColumn.GetParent().getNumberFormatter().is())
- m_nKeyType = comphelper::getNumberFormatType(m_rColumn.GetParent().getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(), m_rColumn.GetKey());
-
DbCellControl::Init( rParent, xCursor );
}
@@ -2494,17 +2490,10 @@ CellControllerRef DbComboBox::CreateController() const
OUString DbComboBox::GetFormatText(const Reference< ::com::sun::star::sdb::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();
- }
- return aString;
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPS(_rxField, UNO_QUERY);
+ ::dbtools::FormattedColumnValue fmter( xFormatter, xPS );
+
+ return fmter.getFormattedValue();
}
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 5d23f1934a58..8d1ddf95be69 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -467,7 +467,6 @@ protected:
class DbComboBox : public DbCellControl
{
- sal_Int16 m_nKeyType;
public:
TYPEINFO_OVERRIDE();