[Libreoffice-commits] core.git: sc/inc sc/source
Tamás Zolnai
tamas.zolnai at collabora.com
Wed Nov 23 03:47:27 UTC 2016
sc/inc/miscuno.hxx | 2 ++
sc/source/core/data/dpobject.cxx | 2 +-
sc/source/core/data/dpoutput.cxx | 2 +-
sc/source/ui/unoobj/dapiuno.cxx | 2 +-
sc/source/ui/unoobj/miscuno.cxx | 18 ++++++++++++++++++
5 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 5b7b2c8649596299c8f00b8b3b5056d272e25ccd
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Wed Nov 23 04:13:05 2016 +0000
GeneralFunction is not an enum anymore
Change-Id: Iaf34d31947fc1b85a42c8924561b756d92873be7
Reviewed-on: https://gerrit.libreoffice.org/31103
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx
index e453a0a..d939d77 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 3e1813c..ab220f1 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 1fd2c3f..031aa12 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 dca4479..41e3887 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 fb870d5..bb9a8ac 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 )
{
More information about the Libreoffice-commits
mailing list