diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-03 17:20:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-05 16:44:27 +0200 |
commit | ef371319fa5f6b076d6d2edc8f252bbb94fd77f0 (patch) | |
tree | ea3b16b17962492bc70496e53e6096cd4a5ccbf8 | |
parent | 95cfa85395f983df3ba044192b29ce0bbc5e6085 (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>
-rw-r--r-- | include/vcl/fmtfield.hxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 39 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 189 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 40 | ||||
-rw-r--r-- | vcl/source/control/fmtfield.cxx | 81 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 12 |
8 files changed, 181 insertions, 186 deletions
diff --git a/include/vcl/fmtfield.hxx b/include/vcl/fmtfield.hxx index 1d92a1b957b4..c1b8adc73c80 100644 --- a/include/vcl/fmtfield.hxx +++ b/include/vcl/fmtfield.hxx @@ -47,7 +47,7 @@ public: virtual FactoryFunction GetUITestFactory() const override; - Formatter* GetFormatter(); + Formatter& GetFormatter(); void SetFormatter(Formatter* pFormatter); protected: 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); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 151843191341..1832c3a9fe48 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -7176,17 +7176,15 @@ SVTXFormattedField::SVTXFormattedField() { } - SVTXFormattedField::~SVTXFormattedField() { } - void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow ) { VCLXSpinField::SetWindow(_pWindow); if (GetAs< FormattedField >()) - GetAs< FormattedField >()->GetFormatter()->SetAutoColor(true); + GetAs< FormattedField >()->GetFormatter().SetAutoColor(true); } void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::uno::Any& Value) @@ -7196,7 +7194,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) { - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch (nPropType) { @@ -7204,7 +7202,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u { bool bEnable( true ); if ( Value >>= bEnable ) - pFormatter->EnableNotANumber( !bEnable ); + rFormatter.EnableNotANumber( !bEnable ); } break; @@ -7276,12 +7274,12 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u { double d = 0.0; if ( Value >>= d ) - pFormatter->SetSpinSize( d ); + rFormatter.SetSpinSize( d ); else { sal_Int32 n = 0; if ( Value >>= n ) - pFormatter->SetSpinSize( n ); + rFormatter.SetSpinSize( n ); } } break; @@ -7289,14 +7287,14 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u { sal_Int32 n = 0; if ( Value >>= n ) - pFormatter->SetDecimalDigits( static_cast<sal_uInt16>(n) ); + rFormatter.SetDecimalDigits( static_cast<sal_uInt16>(n) ); } break; case BASEPROPERTY_NUMSHOWTHOUSANDSEP: { - bool b; - if ( Value >>= b ) - pFormatter->SetThousandsSep( b ); + bool b; + if ( Value >>= b ) + rFormatter.SetThousandsSep( b ); } break; @@ -7307,7 +7305,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u if (BASEPROPERTY_TEXTCOLOR == nPropType) { // after setting a new text color, think again about the AutoColor flag of the control // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com - pFormatter->SetAutoColor(!Value.hasValue()); + rFormatter.SetAutoColor(!Value.hasValue()); } } else @@ -7323,7 +7321,7 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) { - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch (nPropType) { @@ -7351,11 +7349,11 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) break; case BASEPROPERTY_VALUESTEP_DOUBLE: - aReturn <<= pFormatter->GetSpinSize(); + aReturn <<= rFormatter.GetSpinSize(); break; case BASEPROPERTY_DECIMALACCURACY: - aReturn <<= pFormatter->GetDecimalDigits(); + aReturn <<= rFormatter.GetDecimalDigits(); break; case BASEPROPERTY_FORMATSSUPPLIER: @@ -7390,11 +7388,11 @@ css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rVa if (!pField) return aReturn; - Formatter* pFieldFormatter = pField->GetFormatter(); + Formatter& rFieldFormatter = pField->GetFormatter(); switch (rValue.getValueType().getTypeClass()) { case css::uno::TypeClass_DOUBLE: - if (pFieldFormatter->TreatingAsNumber()) + if (rFieldFormatter.TreatingAsNumber()) { double d = 0.0; rValue >>= d; @@ -7402,9 +7400,9 @@ css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rVa } else { - SvNumberFormatter* pFormatter = pFieldFormatter->GetFormatter(); + SvNumberFormatter* pFormatter = rFieldFormatter.GetFormatter(); if (!pFormatter) - pFormatter = pFieldFormatter->StandardFormatter(); + pFormatter = rFieldFormatter.StandardFormatter(); // should never fail Color* pDum; @@ -7419,11 +7417,11 @@ css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rVa { OUString aStr; rValue >>= aStr; - if (pFieldFormatter->TreatingAsNumber()) + if (rFieldFormatter.TreatingAsNumber()) { - SvNumberFormatter* pFormatter = pFieldFormatter->GetFormatter(); + SvNumberFormatter* pFormatter = rFieldFormatter.GetFormatter(); if (!pFormatter) - pFormatter = pFieldFormatter->StandardFormatter(); + pFormatter = rFieldFormatter.StandardFormatter(); double dVal; sal_uInt32 nTestFormat(0); @@ -7448,7 +7446,7 @@ void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue) if (!pField) return; - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); switch (rValue.getValueType().getTypeClass()) { @@ -7456,7 +7454,7 @@ void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue) { double d = 0.0; rValue >>= d; - pFormatter->SetMinValue(d); + rFormatter.SetMinValue(d); break; } default: @@ -7466,7 +7464,7 @@ void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue) { throw css::lang::IllegalArgumentException(); } - pFormatter->ClearMinValue(); + rFormatter.ClearMinValue(); break; } } @@ -7476,30 +7474,29 @@ css::uno::Any SVTXFormattedField::GetMinValue() const VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (!pField) return css::uno::Any(); - Formatter* pFormatter = pField->GetFormatter(); - if (!pFormatter->HasMinValue()) + Formatter& rFormatter = pField->GetFormatter(); + if (!rFormatter.HasMinValue()) return css::uno::Any(); css::uno::Any aReturn; - aReturn <<= pFormatter->GetMinValue(); + aReturn <<= rFormatter.GetMinValue(); return aReturn; } - void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue) { VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (!pField) return; - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); switch (rValue.getValueType().getTypeClass()) { case css::uno::TypeClass_DOUBLE: { double d = 0.0; rValue >>= d; - pFormatter->SetMaxValue(d); + rFormatter.SetMaxValue(d); break; } default: @@ -7508,7 +7505,7 @@ void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue) { throw css::lang::IllegalArgumentException(); } - pFormatter->ClearMaxValue(); + rFormatter.ClearMaxValue(); break; } } @@ -7518,12 +7515,12 @@ css::uno::Any SVTXFormattedField::GetMaxValue() const VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (!pField) return css::uno::Any(); - Formatter* pFormatter = pField->GetFormatter(); - if (!pFormatter->HasMaxValue()) + Formatter& rFormatter = pField->GetFormatter(); + if (!rFormatter.HasMaxValue()) return css::uno::Any(); css::uno::Any aReturn; - aReturn <<= pFormatter->GetMaxValue(); + aReturn <<= rFormatter.GetMaxValue(); return aReturn; } @@ -7535,25 +7532,25 @@ void SVTXFormattedField::SetDefaultValue(const css::uno::Any& rValue) css::uno::Any aConverted = convertEffectiveValue(rValue); - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); switch (aConverted.getValueType().getTypeClass()) { case css::uno::TypeClass_DOUBLE: { double d = 0.0; aConverted >>= d; - pFormatter->SetDefaultValue(d); + rFormatter.SetDefaultValue(d); } break; case css::uno::TypeClass_STRING: { OUString aStr; aConverted >>= aStr; - pFormatter->SetDefaultText( aStr ); + rFormatter.SetDefaultText( aStr ); } break; default: - pFormatter->EnableEmptyField(true); + rFormatter.EnableEmptyField(true); // only void accepted break; } @@ -7564,15 +7561,15 @@ css::uno::Any SVTXFormattedField::GetDefaultValue() const VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (!pField) return css::uno::Any(); - Formatter* pFormatter = pField->GetFormatter(); - if (pFormatter->IsEmptyFieldEnabled()) + Formatter& rFormatter = pField->GetFormatter(); + if (rFormatter.IsEmptyFieldEnabled()) return css::uno::Any(); css::uno::Any aReturn; - if (pFormatter->TreatingAsNumber()) - aReturn <<= pFormatter->GetDefaultValue(); + if (rFormatter.TreatingAsNumber()) + aReturn <<= rFormatter.GetDefaultValue(); else - aReturn <<= pFormatter->GetDefaultText(); + aReturn <<= rFormatter.GetDefaultText(); return aReturn; } @@ -7580,7 +7577,7 @@ bool SVTXFormattedField::GetTreatAsNumber() const { VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (pField) - return pField->GetFormatter()->TreatingAsNumber(); + return pField->GetFormatter().TreatingAsNumber(); return true; } @@ -7589,7 +7586,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet) { VclPtr<FormattedField> pField = GetAs< FormattedField >(); if (pField) - pField->GetFormatter()->TreatAsNumber(bSet); + pField->GetFormatter().TreatAsNumber(bSet); } css::uno::Any SVTXFormattedField::GetValue() const @@ -7598,17 +7595,17 @@ css::uno::Any SVTXFormattedField::GetValue() const if (!pField) return css::uno::Any(); - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); css::uno::Any aReturn; - if (!pFormatter->TreatingAsNumber()) + if (!rFormatter.TreatingAsNumber()) { - OUString sText = pFormatter->GetTextValue(); + OUString sText = rFormatter.GetTextValue(); aReturn <<= sText; } else { if (!pField->GetText().isEmpty()) // empty is returned as void by default - aReturn <<= pFormatter->GetValue(); + aReturn <<= rFormatter.GetValue(); } return aReturn; @@ -7626,12 +7623,12 @@ void SVTXFormattedField::SetValue(const css::uno::Any& rValue) } else { - Formatter* pFormatter = pField->GetFormatter(); + Formatter& rFormatter = pField->GetFormatter(); if (rValue.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE ) { double d = 0.0; rValue >>= d; - pFormatter->SetValue(d); + rFormatter.SetValue(d); } else { @@ -7639,27 +7636,26 @@ void SVTXFormattedField::SetValue(const css::uno::Any& rValue) OUString sText; rValue >>= sText; - if (!pFormatter->TreatingAsNumber()) - pFormatter->SetTextFormatted(sText); + if (!rFormatter.TreatingAsNumber()) + rFormatter.SetTextFormatted(sText); else - pFormatter->SetTextValue(sText); + rFormatter.SetTextValue(sText); } } // NotifyTextListeners(); } - void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier) { VclPtr<FormattedField> pField = GetAs< FormattedField >(); - Formatter* pFormatter = pField ? pField->GetFormatter() : nullptr; SvNumberFormatsSupplierObj* pNew = nullptr; if (!xSupplier.is()) { if (pField) { - pNew = new SvNumberFormatsSupplierObj(pFormatter->StandardFormatter()); + Formatter& rFormatter = pField->GetFormatter(); + pNew = new SvNumberFormatsSupplierObj(rFormatter.StandardFormatter()); bIsStandardSupplier = true; } } @@ -7678,10 +7674,11 @@ void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util // save the actual value css::uno::Any aCurrent = GetValue(); - pFormatter->SetFormatter(m_xCurrentSupplier->GetNumberFormatter(), false); + Formatter& rFormatter = pField->GetFormatter(); + rFormatter.SetFormatter(m_xCurrentSupplier->GetNumberFormatter(), false); if (nKeyToSetDelayed != -1) { - pFormatter->SetFormatKey(nKeyToSetDelayed); + rFormatter.SetFormatKey(nKeyToSetDelayed); nKeyToSetDelayed = -1; } SetValue(aCurrent); @@ -7691,7 +7688,7 @@ void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util sal_Int32 SVTXFormattedField::getFormatKey() const { VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetFormatKey() : 0; + return pField ? pField->GetFormatter().GetFormatKey() : 0; } void SVTXFormattedField::setFormatKey(sal_Int32 nKey) @@ -7700,9 +7697,9 @@ void SVTXFormattedField::setFormatKey(sal_Int32 nKey) if (!pField) return; - Formatter* pFormatter = pField->GetFormatter(); - if (pFormatter->GetFormatter()) - pFormatter->SetFormatKey(nKey); + Formatter& rFormatter = pField->GetFormatter(); + if (rFormatter.GetFormatter()) + rFormatter.SetFormatKey(nKey); else { // probably I am in a block, in which first the key and next the formatter will be set, @@ -7786,7 +7783,7 @@ void SVTXCurrencyField::setValue( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetValue( Value ); + pField->GetFormatter().SetValue( Value ); } double SVTXCurrencyField::getValue() @@ -7794,7 +7791,7 @@ double SVTXCurrencyField::getValue() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetValue() : 0; + return pField ? pField->GetFormatter().GetValue() : 0; } void SVTXCurrencyField::setMin( double Value ) @@ -7803,7 +7800,7 @@ void SVTXCurrencyField::setMin( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetMinValue( Value ); + pField->GetFormatter().SetMinValue( Value ); } double SVTXCurrencyField::getMin() @@ -7811,7 +7808,7 @@ double SVTXCurrencyField::getMin() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetMinValue() : 0; + return pField ? pField->GetFormatter().GetMinValue() : 0; } void SVTXCurrencyField::setMax( double Value ) @@ -7820,7 +7817,7 @@ void SVTXCurrencyField::setMax( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetMaxValue( Value ); + pField->GetFormatter().SetMaxValue( Value ); } double SVTXCurrencyField::getMax() @@ -7828,7 +7825,7 @@ double SVTXCurrencyField::getMax() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetMaxValue() : 0; + return pField ? pField->GetFormatter().GetMaxValue() : 0; } void SVTXCurrencyField::setFirst( double Value ) @@ -7837,7 +7834,7 @@ void SVTXCurrencyField::setFirst( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinFirst( Value ); + pField->GetFormatter().SetSpinFirst( Value ); } double SVTXCurrencyField::getFirst() @@ -7845,7 +7842,7 @@ double SVTXCurrencyField::getFirst() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinFirst() : 0; + return pField ? pField->GetFormatter().GetSpinFirst() : 0; } void SVTXCurrencyField::setLast( double Value ) @@ -7854,7 +7851,7 @@ void SVTXCurrencyField::setLast( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinLast( Value ); + pField->GetFormatter().SetSpinLast( Value ); } double SVTXCurrencyField::getLast() @@ -7862,7 +7859,7 @@ double SVTXCurrencyField::getLast() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinLast() : 0; + return pField ? pField->GetFormatter().GetSpinLast() : 0; } void SVTXCurrencyField::setSpinSize( double Value ) @@ -7871,7 +7868,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinSize( Value ); + pField->GetFormatter().SetSpinSize( Value ); } double SVTXCurrencyField::getSpinSize() @@ -7879,7 +7876,7 @@ double SVTXCurrencyField::getSpinSize() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinSize() : 0; + return pField ? pField->GetFormatter().GetSpinSize() : 0; } void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) @@ -7888,7 +7885,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetDecimalDigits( Value ); + pField->GetFormatter().SetDecimalDigits( Value ); } sal_Int16 SVTXCurrencyField::getDecimalDigits() @@ -7896,7 +7893,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetDecimalDigits() : 0; + return pField ? pField->GetFormatter().GetDecimalDigits() : 0; } void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) @@ -7905,7 +7902,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetStrictFormat( bStrict ); + pField->GetFormatter().SetStrictFormat( bStrict ); } sal_Bool SVTXCurrencyField::isStrictFormat() @@ -7913,7 +7910,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField && pField->GetFormatter()->IsStrictFormat(); + return pField && pField->GetFormatter().IsStrictFormat(); } void SVTXCurrencyField::setProperty( const OUString& PropertyName, const css::uno::Any& Value) @@ -8022,7 +8019,7 @@ void SVTXNumericField::setValue( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetValue( Value ); + pField->GetFormatter().SetValue( Value ); } double SVTXNumericField::getValue() @@ -8030,7 +8027,7 @@ double SVTXNumericField::getValue() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetValue() : 0; + return pField ? pField->GetFormatter().GetValue() : 0; } void SVTXNumericField::setMin( double Value ) @@ -8039,7 +8036,7 @@ void SVTXNumericField::setMin( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetMinValue( Value ); + pField->GetFormatter().SetMinValue( Value ); } double SVTXNumericField::getMin() @@ -8047,7 +8044,7 @@ double SVTXNumericField::getMin() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetMinValue() : 0; + return pField ? pField->GetFormatter().GetMinValue() : 0; } void SVTXNumericField::setMax( double Value ) @@ -8056,7 +8053,7 @@ void SVTXNumericField::setMax( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetMaxValue( Value ); + pField->GetFormatter().SetMaxValue( Value ); } double SVTXNumericField::getMax() @@ -8064,7 +8061,7 @@ double SVTXNumericField::getMax() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetMaxValue() : 0; + return pField ? pField->GetFormatter().GetMaxValue() : 0; } void SVTXNumericField::setFirst( double Value ) @@ -8073,7 +8070,7 @@ void SVTXNumericField::setFirst( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinFirst( Value ); + pField->GetFormatter().SetSpinFirst( Value ); } double SVTXNumericField::getFirst() @@ -8081,7 +8078,7 @@ double SVTXNumericField::getFirst() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinFirst() : 0; + return pField ? pField->GetFormatter().GetSpinFirst() : 0; } void SVTXNumericField::setLast( double Value ) @@ -8090,7 +8087,7 @@ void SVTXNumericField::setLast( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinLast( Value ); + pField->GetFormatter().SetSpinLast( Value ); } double SVTXNumericField::getLast() @@ -8098,7 +8095,7 @@ double SVTXNumericField::getLast() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinLast() : 0; + return pField ? pField->GetFormatter().GetSpinLast() : 0; } void SVTXNumericField::setSpinSize( double Value ) @@ -8107,7 +8104,7 @@ void SVTXNumericField::setSpinSize( double Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetSpinSize( Value ); + pField->GetFormatter().SetSpinSize( Value ); } double SVTXNumericField::getSpinSize() @@ -8115,7 +8112,7 @@ double SVTXNumericField::getSpinSize() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetSpinSize() : 0; + return pField ? pField->GetFormatter().GetSpinSize() : 0; } void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) @@ -8124,7 +8121,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetDecimalDigits( Value ); + pField->GetFormatter().SetDecimalDigits( Value ); } sal_Int16 SVTXNumericField::getDecimalDigits() @@ -8132,7 +8129,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField ? pField->GetFormatter()->GetDecimalDigits() : 0; + return pField ? pField->GetFormatter().GetDecimalDigits() : 0; } void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) @@ -8141,7 +8138,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) VclPtr<FormattedField> pField = GetAs< FormattedField >(); if ( pField ) - pField->GetFormatter()->SetStrictFormat( bStrict ); + pField->GetFormatter().SetStrictFormat( bStrict ); } sal_Bool SVTXNumericField::isStrictFormat() @@ -8149,7 +8146,7 @@ sal_Bool SVTXNumericField::isStrictFormat() SolarMutexGuard aGuard; VclPtr<FormattedField> pField = GetAs< FormattedField >(); - return pField && pField->GetFormatter()->IsStrictFormat(); + return pField && pField->GetFormatter().IsStrictFormat(); } void SVTXNumericField::GetPropertyIds( std::vector< sal_uInt16 > &rIds ) diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 6eb671fa820c..3ee8f111bdff 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -618,7 +618,7 @@ class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::Spin { private: VclPtr<FormattedField> m_xButton; - Formatter* m_pFormatter; + Formatter& m_rFormatter; DECL_LINK(UpDownHdl, SpinField&, void); DECL_LINK(LoseFocusHdl, Control&, void); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index f646beb64d9a..0d86ac4871f9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5208,14 +5208,14 @@ SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc bool bTakeOwnership) : SalInstanceEntry(pButton, pBuilder, bTakeOwnership) , m_xButton(pButton) - , m_pFormatter(m_xButton->GetFormatter()) + , m_rFormatter(m_xButton->GetFormatter()) { - m_pFormatter->SetThousandsSep(false); //off by default, MetricSpinButton enables it + m_rFormatter.SetThousandsSep(false); //off by default, MetricSpinButton enables it m_xButton->SetUpHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetDownHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetLoseFocusHdl(LINK(this, SalInstanceSpinButton, LoseFocusHdl)); - m_pFormatter->SetOutputHdl(LINK(this, SalInstanceSpinButton, OutputHdl)); - m_pFormatter->SetInputHdl(LINK(this, SalInstanceSpinButton, InputHdl)); + m_rFormatter.SetOutputHdl(LINK(this, SalInstanceSpinButton, OutputHdl)); + m_rFormatter.SetInputHdl(LINK(this, SalInstanceSpinButton, InputHdl)); if (Edit* pEdit = m_xButton->GetSubEdit()) pEdit->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl)); else @@ -5224,40 +5224,40 @@ SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc int SalInstanceSpinButton::get_value() const { - return fromField(m_pFormatter->GetValue()); + return fromField(m_rFormatter.GetValue()); } void SalInstanceSpinButton::set_value(int value) { - m_pFormatter->SetValue(toField(value)); + m_rFormatter.SetValue(toField(value)); } void SalInstanceSpinButton::set_range(int min, int max) { - m_pFormatter->SetMinValue(toField(min)); - m_pFormatter->SetMaxValue(toField(max)); + m_rFormatter.SetMinValue(toField(min)); + m_rFormatter.SetMaxValue(toField(max)); } void SalInstanceSpinButton::get_range(int& min, int& max) const { - min = fromField(m_pFormatter->GetMinValue()); - max = fromField(m_pFormatter->GetMaxValue()); + min = fromField(m_rFormatter.GetMinValue()); + max = fromField(m_rFormatter.GetMaxValue()); } void SalInstanceSpinButton::set_increments(int step, int /*page*/) { - m_pFormatter->SetSpinSize(toField(step)); + m_rFormatter.SetSpinSize(toField(step)); } void SalInstanceSpinButton::get_increments(int& step, int& page) const { - step = fromField(m_pFormatter->GetSpinSize()); - page = fromField(m_pFormatter->GetSpinSize()); + step = fromField(m_rFormatter.GetSpinSize()); + page = fromField(m_rFormatter.GetSpinSize()); } void SalInstanceSpinButton::set_digits(unsigned int digits) { - m_pFormatter->SetDecimalDigits(digits); + m_rFormatter.SetDecimalDigits(digits); } // SpinButton may be comprised of multiple subwidgets, consider the lot as @@ -5270,18 +5270,18 @@ bool SalInstanceSpinButton::has_focus() const //so with hh::mm::ss, incrementing mm will not reset ss void SalInstanceSpinButton::DisableRemainderFactor() { - m_pFormatter->DisableRemainderFactor(); + m_rFormatter.DisableRemainderFactor(); } //off by default for direct SpinButtons, MetricSpinButton enables it void SalInstanceSpinButton::SetUseThousandSep() { - m_pFormatter->SetThousandsSep(true); + m_rFormatter.SetThousandsSep(true); } unsigned int SalInstanceSpinButton::get_digits() const { - return m_pFormatter->GetDecimalDigits(); + return m_rFormatter.GetDecimalDigits(); } SalInstanceSpinButton::~SalInstanceSpinButton() @@ -5290,8 +5290,8 @@ SalInstanceSpinButton::~SalInstanceSpinButton() pEdit->SetActivateHdl(Link<Edit&, bool>()); else m_xButton->SetActivateHdl(Link<Edit&, bool>()); - m_pFormatter->SetInputHdl(Link<sal_Int64*, TriState>()); - m_pFormatter->SetOutputHdl(Link<LinkParamNone*, bool>()); + m_rFormatter.SetInputHdl(Link<sal_Int64*, TriState>()); + m_rFormatter.SetOutputHdl(Link<LinkParamNone*, bool>()); m_xButton->SetLoseFocusHdl(Link<Control&, void>()); m_xButton->SetDownHdl(Link<SpinField&, void>()); m_xButton->SetUpHdl(Link<SpinField&, void>()); @@ -5357,7 +5357,7 @@ public: virtual Formatter& GetFormatter() override { - return *m_xButton->GetFormatter(); + return m_xButton->GetFormatter(); } }; diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 5f1cb134b9d4..40f3e4c0a711 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -448,7 +448,6 @@ void Formatter::ImplSetTextImpl(const OUString& rNew, Selection const * pNewSel) void Formatter::ImplSetFormatKey(sal_uLong nFormatKey) { - m_nFormatKey = nFormatKey; bool bNeedFormatter = (m_pFormatter == nullptr) && (nFormatKey != 0); if (bNeedFormatter) @@ -1020,8 +1019,8 @@ DoubleNumericField::~DoubleNumericField() = default; void DoubleNumericField::ResetConformanceTester() { // the thousands and the decimal separator are language dependent - Formatter* pFormatter = GetFormatter(); - const SvNumberformat* pFormatEntry = pFormatter->GetOrCreateFormatter()->GetEntry(pFormatter->GetFormatKey()); + Formatter& rFormatter = GetFormatter(); + const SvNumberformat* pFormatEntry = rFormatter.GetOrCreateFormatter()->GetEntry(rFormatter.GetFormatKey()); sal_Unicode cSeparatorThousand = ','; sal_Unicode cSeparatorDecimal = '.'; @@ -1153,21 +1152,21 @@ FormattedField::FormattedField(vcl::Window* pParent, WinBits nStyle) void FormattedField::SetText(const OUString& rStr) { - GetFormatter()->SetFieldText(rStr, Selection(0, 0)); + GetFormatter().SetFieldText(rStr, Selection(0, 0)); } void FormattedField::SetText(const OUString& rStr, const Selection& rNewSelection) { - GetFormatter()->SetFieldText(rStr, rNewSelection); + GetFormatter().SetFieldText(rStr, rNewSelection); SetSelection(rNewSelection); } bool FormattedField::set_property(const OString &rKey, const OUString &rValue) { if (rKey == "digits") - GetFormatter()->SetDecimalDigits(rValue.toInt32()); + GetFormatter().SetDecimalDigits(rValue.toInt32()); else if (rKey == "wrap") - GetFormatter()->SetWrapOnLimits(toBool(rValue)); + GetFormatter().SetWrapOnLimits(toBool(rValue)); else return SpinField::set_property(rKey, rValue); return true; @@ -1175,19 +1174,19 @@ bool FormattedField::set_property(const OString &rKey, const OUString &rValue) void FormattedField::Up() { - Formatter* pFormatter = GetFormatter(); - auto nScale = weld::SpinButton::Power10(pFormatter->GetDecimalDigits()); + Formatter& rFormatter = GetFormatter(); + auto nScale = weld::SpinButton::Power10(rFormatter.GetDecimalDigits()); - sal_Int64 nValue = std::round(pFormatter->GetValue() * nScale); - sal_Int64 nSpinSize = std::round(pFormatter->GetSpinSize() * nScale); - sal_Int64 nRemainder = pFormatter->GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; + sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale); + sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale); + sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; if (nValue >= 0) nValue = (nRemainder == 0) ? nValue + nSpinSize : nValue + nSpinSize - nRemainder; else nValue = (nRemainder == 0) ? nValue + nSpinSize : nValue - nRemainder; // setValue handles under- and overflows (min/max) automatically - pFormatter->SetValue(static_cast<double>(nValue) / nScale); + rFormatter.SetValue(static_cast<double>(nValue) / nScale); SetModifyFlag(); Modify(); @@ -1196,19 +1195,19 @@ void FormattedField::Up() void FormattedField::Down() { - Formatter* pFormatter = GetFormatter(); - auto nScale = weld::SpinButton::Power10(pFormatter->GetDecimalDigits()); + Formatter& rFormatter = GetFormatter(); + auto nScale = weld::SpinButton::Power10(rFormatter.GetDecimalDigits()); - sal_Int64 nValue = std::round(pFormatter->GetValue() * nScale); - sal_Int64 nSpinSize = std::round(pFormatter->GetSpinSize() * nScale); - sal_Int64 nRemainder = pFormatter->GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; + sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale); + sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale); + sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; if (nValue >= 0) nValue = (nRemainder == 0) ? nValue - nSpinSize : nValue - nRemainder; else nValue = (nRemainder == 0) ? nValue - nSpinSize : nValue - nSpinSize - nRemainder; // setValue handles under- and overflows (min/max) automatically - pFormatter->SetValue(static_cast<double>(nValue) / nScale); + rFormatter.SetValue(static_cast<double>(nValue) / nScale); SetModifyFlag(); Modify(); @@ -1217,10 +1216,10 @@ void FormattedField::Down() void FormattedField::First() { - Formatter* pFormatter = GetFormatter(); - if (pFormatter->HasMinValue()) + Formatter& rFormatter = GetFormatter(); + if (rFormatter.HasMinValue()) { - pFormatter->SetValue(pFormatter->GetMinValue()); + rFormatter.SetValue(rFormatter.GetMinValue()); SetModifyFlag(); Modify(); } @@ -1230,10 +1229,10 @@ void FormattedField::First() void FormattedField::Last() { - Formatter* pFormatter = GetFormatter(); - if (pFormatter->HasMaxValue()) + Formatter& rFormatter = GetFormatter(); + if (rFormatter.HasMaxValue()) { - pFormatter->SetValue(pFormatter->GetMaxValue()); + rFormatter.SetValue(rFormatter.GetMaxValue()); SetModifyFlag(); Modify(); } @@ -1243,13 +1242,13 @@ void FormattedField::Last() void FormattedField::Modify() { - GetFormatter()->Modify(); + GetFormatter().Modify(); } bool FormattedField::PreNotify(NotifyEvent& rNEvt) { if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) - GetFormatter()->SetLastSelection(GetSelection()); + GetFormatter().SetLastSelection(GetSelection()); return SpinField::PreNotify(rNEvt); } @@ -1266,8 +1265,8 @@ bool FormattedField::EventNotify(NotifyEvent& rNEvt) case KEY_PAGEUP: case KEY_PAGEDOWN: { - Formatter* pFormatter = GetFormatter(); - if (!nMod && pFormatter->GetOrCreateFormatter()->IsTextFormat(pFormatter->GetFormatKey())) + Formatter& rFormatter = GetFormatter(); + if (!nMod && rFormatter.GetOrCreateFormatter()->IsTextFormat(rFormatter.GetFormatKey())) { // the base class would translate this into calls to Up/Down/First/Last, // but we don't want this if we are text-formatted @@ -1283,9 +1282,9 @@ bool FormattedField::EventNotify(NotifyEvent& rNEvt) if (pCommand->GetCommand() == CommandEventId::Wheel) { const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); - Formatter* pFormatter = GetFormatter(); + Formatter& rFormatter = GetFormatter(); if ((pData->GetMode() == CommandWheelMode::SCROLL) && - pFormatter->GetOrCreateFormatter()->IsTextFormat(pFormatter->GetFormatKey())) + rFormatter.GetOrCreateFormatter()->IsTextFormat(rFormatter.GetFormatKey())) { // same as above : prevent the base class from doing Up/Down-calls // (normally I should put this test into the Up/Down methods itself, shouldn't I ?) @@ -1296,16 +1295,16 @@ bool FormattedField::EventNotify(NotifyEvent& rNEvt) } if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS) - GetFormatter()->EntryLostFocus(); + GetFormatter().EntryLostFocus(); return SpinField::EventNotify( rNEvt ); } -Formatter* FormattedField::GetFormatter() +Formatter& FormattedField::GetFormatter() { if (!m_xFormatter) m_xFormatter.reset(new FieldFormatter(*this)); - return m_xFormatter.get(); + return *m_xFormatter; } void FormattedField::SetFormatter(Formatter* pFormatter) @@ -1318,13 +1317,13 @@ void FormattedField::SetValueFromString(const OUString& rStr) { sal_Int32 nEnd; rtl_math_ConversionStatus eStatus; - Formatter* pFormatter = GetFormatter(); - double fValue = ::rtl::math::stringToDouble(rStr, '.', pFormatter->GetDecimalDigits(), &eStatus, &nEnd ); + Formatter& rFormatter = GetFormatter(); + double fValue = ::rtl::math::stringToDouble(rStr, '.', rFormatter.GetDecimalDigits(), &eStatus, &nEnd ); if (eStatus == rtl_math_ConversionStatus_Ok && nEnd == rStr.getLength()) { - pFormatter->SetValue(fValue); + rFormatter.SetValue(fValue); SetModifyFlag(); Modify(); @@ -1340,10 +1339,10 @@ void FormattedField::SetValueFromString(const OUString& rStr) void FormattedField::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { SpinField::DumpAsPropertyTree(rJsonWriter); - Formatter* pFormatter = GetFormatter(); - rJsonWriter.put("min", pFormatter->GetMinValue()); - rJsonWriter.put("max", pFormatter->GetMaxValue()); - rJsonWriter.put("value", pFormatter->GetValue()); + Formatter& rFormatter = GetFormatter(); + rJsonWriter.put("min", rFormatter.GetMinValue()); + rJsonWriter.put("max", rFormatter.GetMaxValue()); + rJsonWriter.put("value", rFormatter.GetValue()); } FactoryFunction FormattedField::GetUITestFactory() const diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index c8170a17caee..f7c3c79de9d3 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1374,7 +1374,7 @@ void FormattedFieldUIObject::execute(const OUString& rAction, StringMap FormattedFieldUIObject::get_state() { StringMap aMap = EditUIObject::get_state(); - aMap["Value"] = OUString::number(mxFormattedField->GetFormatter()->GetValue()); + aMap["Value"] = OUString::number(mxFormattedField->GetFormatter().GetValue()); return aMap; } diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 85ee2ca4f4f1..c31611e89a2b 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1951,7 +1951,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & { connectFormattedFormatterAdjustment(id, sAdjustment); VclPtrInstance<FormattedField> xField(pParent, nBits); - xField->GetFormatter()->SetMinValue(0); + xField->GetFormatter().SetMinValue(0); xWindow = xField; } } @@ -4411,11 +4411,11 @@ void VclBuilder::mungeAdjustment(FormattedField &rTarget, const Adjustment &rAdj SAL_INFO("vcl.builder", "unhandled property :" << rKey); } - Formatter* pFormatter = rTarget.GetFormatter(); - pFormatter->SetMinValue(nMinValue); - pFormatter->SetMaxValue(nMaxValue); - pFormatter->SetValue(nValue); - pFormatter->SetSpinSize(nSpinSize); + Formatter& rFormatter = rTarget.GetFormatter(); + rFormatter.SetMinValue(nMinValue); + rFormatter.SetMaxValue(nMaxValue); + rFormatter.SetValue(nValue); + rFormatter.SetSpinSize(nSpinSize); } void VclBuilder::mungeAdjustment(ScrollBar &rTarget, const Adjustment &rAdjustment) |