summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-03 17:20:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-05 16:44:27 +0200
commitef371319fa5f6b076d6d2edc8f252bbb94fd77f0 (patch)
treeea3b16b17962492bc70496e53e6096cd4a5ccbf8 /svx
parent95cfa85395f983df3ba044192b29ce0bbc5e6085 (diff)
return a reference instead of a pointer
Change-Id: Ib8b9133991a9c36e737171ae6dfb6a87cc91e1ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97888 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/fmcomp/gridcell.cxx39
1 files changed, 19 insertions, 20 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index f3c5cb22c106..4a2a452b3ecb 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1905,16 +1905,16 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
- Formatter* pEditFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
- pEditFormatter->SetMinValue(nMin);
- pEditFormatter->SetMaxValue(nMax);
- pEditFormatter->SetSpinSize(nStep);
- pEditFormatter->SetStrictFormat(bStrict);
+ Formatter& rEditFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
+ rEditFormatter.SetMinValue(nMin);
+ rEditFormatter.SetMaxValue(nMax);
+ rEditFormatter.SetSpinSize(nStep);
+ rEditFormatter.SetStrictFormat(bStrict);
- Formatter* pPaintFormatter = static_cast<DoubleNumericField*>(m_pPainter.get())->GetFormatter();
- pPaintFormatter->SetMinValue(nMin);
- pPaintFormatter->SetMaxValue(nMax);
- pPaintFormatter->SetStrictFormat(bStrict);
+ Formatter& rPaintFormatter = static_cast<DoubleNumericField*>(m_pPainter.get())->GetFormatter();
+ rPaintFormatter.SetMinValue(nMin);
+ rPaintFormatter.SetMaxValue(nMax);
+ rPaintFormatter.SetStrictFormat(bStrict);
// give a formatter to the field and the painter;
// test first if I can get from the service behind a connection
@@ -1932,21 +1932,20 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
}
if ( nullptr == pFormatterUsed )
{ // the cursor didn't lead to success -> standard
- pFormatterUsed = pEditFormatter->StandardFormatter();
+ pFormatterUsed = rEditFormatter.StandardFormatter();
DBG_ASSERT( pFormatterUsed != nullptr, "DbNumericField::implAdjustGenericFieldSetting: no standard formatter given by the numeric field !" );
}
- pEditFormatter->SetFormatter( pFormatterUsed );
- pPaintFormatter->SetFormatter( pFormatterUsed );
+ rEditFormatter.SetFormatter( pFormatterUsed );
+ rPaintFormatter.SetFormatter( pFormatterUsed );
// and then generate a format which has the desired length after the decimal point, etc.
LanguageType aAppLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
OUString sFormatString = pFormatterUsed->GenerateFormat(0, aAppLanguage, bThousand, false, nScale);
- pEditFormatter->SetFormat( sFormatString, aAppLanguage );
- pPaintFormatter->SetFormat( sFormatString, aAppLanguage );
+ rEditFormatter.SetFormat( sFormatString, aAppLanguage );
+ rPaintFormatter.SetFormat( sFormatString, aAppLanguage );
}
-
VclPtr<SpinField> DbNumericField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
{
return VclPtr<DoubleNumericField>::Create( _pParent, _nFieldStyle );
@@ -1966,7 +1965,7 @@ namespace
double fValue = _rControl.GetValue( _rxField, _rxFormatter );
if ( !_rxField->wasNull() )
{
- _rField.GetFormatter()->SetValue( fValue );
+ _rField.GetFormatter().SetValue( fValue );
sValue = _rField.GetText();
}
}
@@ -1996,8 +1995,8 @@ void DbNumericField::updateFromModel( Reference< XPropertySet > _rxModel )
double dValue = 0;
if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
{
- Formatter* pFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
- pFormatter->SetValue(dValue);
+ Formatter& rFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
+ rFormatter.SetValue(dValue);
}
else
m_pWindow->SetText( OUString() );
@@ -2010,8 +2009,8 @@ bool DbNumericField::commitControl()
if (!aText.isEmpty()) // not empty
{
- Formatter* pFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
- double fValue = pFormatter->GetValue();
+ Formatter& rFormatter = static_cast<DoubleNumericField*>(m_pWindow.get())->GetFormatter();
+ double fValue = rFormatter.GetValue();
aVal <<= fValue;
}
m_rColumn.getModel()->setPropertyValue(FM_PROP_VALUE, aVal);