diff options
Diffstat (limited to 'extensions/source/propctrlr/standardcontrol.cxx')
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 8c33d0598711..ad978253b076 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,6 +38,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> +#include <o3tl/string_view.hxx> #include <limits> #include <memory> @@ -229,16 +230,16 @@ namespace pcr notifyModifiedValue(); } - static int ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) + static sal_Int64 ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) n *= 10; - return o3tl::saturating_cast<int>(n); + return o3tl::saturating_cast<sal_Int64>(n); } - static double ImplCalcDoubleValue( int nValue, sal_uInt16 nDigits ) + static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) @@ -313,7 +314,7 @@ namespace pcr Any SAL_CALL OHyperlinkControl::getValue() { OUString sText = m_xEntry->get_text(); - return makeAny( sText ); + return Any( sText ); } void SAL_CALL OHyperlinkControl::setValue( const Any& _value ) @@ -376,7 +377,7 @@ namespace pcr void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits ) { weld::MetricSpinButton* pControlWindow = getTypedControlWindow(); - int min, max; + sal_Int64 min, max; pControlWindow->get_range(min, max, FieldUnit::NONE); pControlWindow->set_digits(decimaldigits); pControlWindow->set_range(min, max, FieldUnit::NONE); @@ -386,8 +387,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); - if ( minValue == std::numeric_limits<int>::min() ) + sal_Int64 minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); + if ( minValue == std::numeric_limits<sal_Int64>::min() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(minValue); @@ -398,7 +399,7 @@ namespace pcr void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) { if ( !_minvalue.IsPresent ) - getTypedControlWindow()->set_min( std::numeric_limits<int>::min(), FieldUnit::NONE ); + getTypedControlWindow()->set_min( std::numeric_limits<sal_Int64>::min(), FieldUnit::NONE ); else getTypedControlWindow()->set_min( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); } @@ -407,8 +408,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); - if ( maxValue == std::numeric_limits<int>::max() ) + sal_Int64 maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); + if ( maxValue == std::numeric_limits<sal_Int64>::max() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(maxValue); @@ -419,7 +420,7 @@ namespace pcr void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) { if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->set_max( std::numeric_limits<int>::max(), FieldUnit::NONE ); + getTypedControlWindow()->set_max( std::numeric_limits<sal_Int64>::max(), FieldUnit::NONE ); else getTypedControlWindow()->set_max( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); } @@ -478,14 +479,14 @@ namespace pcr } } - int ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const + sal_Int64 ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const { - int nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); + sal_Int64 nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); nControlValue /= m_nFieldToUNOValueFactor; return nControlValue; } - double ONumericControl::impl_fieldValueToApiValue_nothrow( int nFieldValue ) const + double ONumericControl::impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const { double nApiValue = ImplCalcDoubleValue( nFieldValue, getTypedControlWindow()->get_digits() ); nApiValue *= m_nFieldToUNOValueFactor; @@ -498,7 +499,8 @@ namespace pcr if ( !getTypedControlWindow()->get_text().isEmpty() ) { double nValue = impl_fieldValueToApiValue_nothrow( getTypedControlWindow()->get_value( m_eValueUnit ) ); - aPropValue <<= nValue; + if (nValue) + aPropValue <<= nValue; } return aPropValue; } @@ -637,7 +639,7 @@ namespace pcr Any SAL_CALL OComboboxControl::getValue() { - return makeAny( getTypedControlWindow()->get_active_text() ); + return Any( getTypedControlWindow()->get_active_text() ); } Type SAL_CALL OComboboxControl::getValueType() @@ -680,7 +682,7 @@ namespace pcr namespace { - StlSyntaxSequence< OUString > lcl_convertMultiLineToList( const OUString& _rCompsedTextWithLineBreaks ) + StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks ) { sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n'); StlSyntaxSequence< OUString > aStrings( nLines ); @@ -690,7 +692,7 @@ namespace pcr sal_Int32 nIdx {0}; do { - *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx ); + *stringItem = o3tl::getToken(_rCompsedTextWithLineBreaks, 0, '\n', nIdx ); ++stringItem; } while (nIdx>0); @@ -723,9 +725,7 @@ namespace pcr { if ( strings != _rStrings.begin() ) aComposed.append( ';' ); - aComposed.append( '\"' ); - aComposed.append( *strings ); - aComposed.append( '\"' ); + aComposed.append( "\"" + *strings + "\"" ); } return aComposed.makeStringAndClear(); } |