diff options
Diffstat (limited to 'source/global.cxx')
-rw-r--r-- | source/global.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/global.cxx b/source/global.cxx index b384eea..4189724 100644 --- a/source/global.cxx +++ b/source/global.cxx @@ -1,8 +1,35 @@ #include "global.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> + +using ::com::sun::star::beans::XPropertySet; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::XInterface; +using ::rtl::OUString; + namespace dpsource { +bool PropertySetHelper::getBoolProperty(const Reference<XInterface>& rObj, const OUString& rPropName, bool bValueOnFail) +{ + do + { + Reference<XPropertySet> xPropSet(rObj, UNO_QUERY); + if (!xPropSet.is()) + break; + + Any any = xPropSet->getPropertyValue(rPropName); + sal_Bool bVal; + if (!(any >>= bVal)) + break; + return static_cast<bool>(bVal); + } + while (false); + + return bValueOnFail; +} } |