diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-11-23 04:13:05 +0000 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-11-23 03:47:05 +0000 |
commit | 5b7b2c8649596299c8f00b8b3b5056d272e25ccd (patch) | |
tree | 35c616acb0044e504970dfec84ac58f23996522c /sc | |
parent | 7637a20a622d6799ba867bd0122841a393178545 (diff) |
GeneralFunction is not an enum anymore
Change-Id: Iaf34d31947fc1b85a42c8924561b756d92873be7
Reviewed-on: https://gerrit.libreoffice.org/31103
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/miscuno.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/dapiuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/miscuno.cxx | 18 |
5 files changed, 23 insertions, 3 deletions
diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx index e453a0a57a3e..d939d77a6759 100644 --- a/sc/inc/miscuno.hxx +++ b/sc/inc/miscuno.hxx @@ -154,6 +154,8 @@ public: AnyToInterface( const css::uno::Any& rAny ); static bool GetBoolProperty( const css::uno::Reference< css::beans::XPropertySet>& xProp, const OUString& rName, bool bDefault = false ); + static sal_Int16 GetShortProperty( const css::uno::Reference< css::beans::XPropertySet>& xProp, + const OUString& rName, sal_Int16 nDefault ); static sal_Int32 GetLongProperty( const css::uno::Reference< css::beans::XPropertySet>& xProp, const OUString& rName ); static sal_Int32 GetEnumProperty( const css::uno::Reference< css::beans::XPropertySet>& xProp, diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 3e1813c69968..ab220f18651d 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2195,7 +2195,7 @@ void lcl_FillOldFields( ScPivotFieldVector& rFields, PivotFunc nMask = PivotFunc::NONE; if ( nOrient == sheet::DataPilotFieldOrientation_DATA ) { - sal_Int16 eFunc = (sal_Int16)ScUnoHelpFunctions::GetEnumProperty( + sal_Int16 eFunc = ScUnoHelpFunctions::GetShortProperty( xDimProp, SC_UNO_DP_FUNCTION2, sheet::GeneralFunction2::NONE ); if ( eFunc == sheet::GeneralFunction2::AUTO ) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 1fd2c3f81bd9..031aa129dca8 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1588,7 +1588,7 @@ void ScDPOutput::GetDataDimensionNames( // Generate "given name" the same way as in dptabres. //TODO: Should use a stored name when available - sal_Int16 eFunc = (sal_Int16)ScUnoHelpFunctions::GetEnumProperty( + sal_Int16 eFunc = ScUnoHelpFunctions::GetShortProperty( xDimProp, SC_UNO_DP_FUNCTION2, sheet::GeneralFunction2::NONE ); rGivenName = lcl_GetDataFieldName( rSourceName, eFunc ); diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index dca44793609e..41e3887201bb 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1869,7 +1869,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa } else if ( aPropertyName == SC_UNONAME_FUNCTION2 ) { - sal_Int16 eFunction = (sal_Int16) ScUnoHelpFunctions::GetEnumFromAny( aValue ); + sal_Int16 eFunction = ScUnoHelpFunctions::GetInt16FromAny( aValue ); setFunction( eFunction ); } else if ( aPropertyName == SC_UNONAME_SUBTOTALS ) diff --git a/sc/source/ui/unoobj/miscuno.cxx b/sc/source/ui/unoobj/miscuno.cxx index fb870d5cdc8f..bb9a8ac68203 100644 --- a/sc/source/ui/unoobj/miscuno.cxx +++ b/sc/source/ui/unoobj/miscuno.cxx @@ -56,6 +56,24 @@ bool ScUnoHelpFunctions::GetBoolProperty( const uno::Reference<beans::XPropertyS return bRet; } +sal_Int16 ScUnoHelpFunctions::GetShortProperty( const css::uno::Reference< css::beans::XPropertySet>& xProp, + const OUString& rName, sal_Int16 nDefault ) +{ + sal_Int16 nRet = nDefault; + if ( xProp.is() ) + { + try + { + xProp->getPropertyValue( rName ) >>= nRet; + } + catch(uno::Exception&) + { + // keep default + } + } + return nRet; +} + sal_Int32 ScUnoHelpFunctions::GetLongProperty( const uno::Reference<beans::XPropertySet>& xProp, const OUString& rName ) { |