diff options
author | Caolán McNamara <cmc@openoffice.org> | 2010-02-03 15:42:20 +0000 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2010-02-03 15:42:20 +0000 |
commit | f25d05f3219c80e51787967701a870d72b733893 (patch) | |
tree | 5766db900346488b152dd6828ca1b7e7a0c7b318 /sc/source/ui/unoobj/miscuno.cxx | |
parent | 00511b8eefe78bdf357bd3b491cb1ded56e571e9 (diff) | |
parent | 25b005cbda460837f063ddf996c1ec72d4f4865b (diff) |
cmcfixes71: merge with DEV300 m71
Diffstat (limited to 'sc/source/ui/unoobj/miscuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/miscuno.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/miscuno.cxx b/sc/source/ui/unoobj/miscuno.cxx index 3d41da907016..ee2a64bd8c78 100644 --- a/sc/source/ui/unoobj/miscuno.cxx +++ b/sc/source/ui/unoobj/miscuno.cxx @@ -39,6 +39,9 @@ #include "unoguard.hxx" using namespace com::sun::star; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::rtl::OUString; //------------------------------------------------------------------------ @@ -137,6 +140,26 @@ sal_Int32 ScUnoHelpFunctions::GetEnumProperty( const uno::Reference<beans::XProp return nRet; } +// static +OUString ScUnoHelpFunctions::GetStringProperty( + const Reference<beans::XPropertySet>& xProp, const OUString& rName, const OUString& rDefault ) +{ + OUString aRet = rDefault; + if (!xProp.is()) + return aRet; + + try + { + Any any = xProp->getPropertyValue(rName); + any >>= aRet; + } + catch (const uno::Exception&) + { + } + + return aRet; +} + // static sal_Bool ScUnoHelpFunctions::GetBoolFromAny( const uno::Any& aAny ) { @@ -180,6 +203,20 @@ void ScUnoHelpFunctions::SetBoolInAny( uno::Any& rAny, sal_Bool bValue ) rAny.setValue( &bValue, getBooleanCppuType() ); } +// static +void ScUnoHelpFunctions::SetOptionalPropertyValue( + Reference<beans::XPropertySet>& rPropSet, const sal_Char* pPropName, const Any& rVal ) +{ + try + { + rPropSet->setPropertyValue(OUString::createFromAscii(pPropName), rVal); + } + catch (const beans::UnknownPropertyException&) + { + // ignored - not supported. + } +} + //------------------------------------------------------------------------ ScIndexEnumeration::ScIndexEnumeration(const uno::Reference<container::XIndexAccess>& rInd, |