summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/ucbhelper.hxx7
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx17
2 files changed, 15 insertions, 9 deletions
diff --git a/unotools/inc/unotools/ucbhelper.hxx b/unotools/inc/unotools/ucbhelper.hxx
index 358d8e119c60..3ff576b862f3 100644
--- a/unotools/inc/unotools/ucbhelper.hxx
+++ b/unotools/inc/unotools/ucbhelper.hxx
@@ -47,6 +47,10 @@ UNOTOOLS_DLLPUBLIC bool IsDocument(rtl::OUString const & url);
UNOTOOLS_DLLPUBLIC bool IsFolder(rtl::OUString const & url);
+/// @param title must not be null
+/// @return true iff title has been set (i.e., if obtaining the "Title" property
+/// of the given content yields a non-void value without raising a
+/// non-RuntimeException; RuntimeExceptions are passed through)
UNOTOOLS_DLLPUBLIC bool GetTitle(
rtl::OUString const & url, rtl::OUString * title);
@@ -62,6 +66,9 @@ UNOTOOLS_DLLPUBLIC bool MakeFolder(
ucbhelper::Content & parent, rtl::OUString const & title,
ucbhelper::Content & result, bool exclusive = false);
+/// @return the value of the "Size" property of the given content, or zero if
+/// obtaining the property yields a void value or raises a
+/// non-RuntimeException (RuntimeExceptions are passed through)
UNOTOOLS_DLLPUBLIC sal_Int64 GetSize(rtl::OUString const & url);
UNOTOOLS_DLLPUBLIC bool IsYounger(
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index cbb9ee917cb2..09203df17cc3 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -200,11 +200,7 @@ bool utl::UCBContentHelper::GetTitle(
{
assert(title != 0);
try {
- *title = content(url).
- getPropertyValue(
- rtl::OUString("Title")).
- get<rtl::OUString>();
- return true;
+ return content(url).getPropertyValue(rtl::OUString("Title")) >>= *title;
} catch (css::uno::RuntimeException const &) {
throw;
} catch (css::ucb::CommandAbortedException const &) {
@@ -337,10 +333,13 @@ bool utl::UCBContentHelper::MakeFolder(
sal_Int64 utl::UCBContentHelper::GetSize(rtl::OUString const & url) {
try {
- return
- content(url).getPropertyValue(
- rtl::OUString("Size")).
- get<sal_Int64>();
+ sal_Int64 n = 0;
+ bool ok = (content(url).getPropertyValue(rtl::OUString("Size")) >>= n);
+ SAL_INFO_IF(
+ !ok, "unotools",
+ "UCBContentHelper::GetSize(" << url
+ << "): Size cannot be determined");
+ return n;
} catch (css::uno::RuntimeException const &) {
throw;
} catch (css::ucb::CommandAbortedException const &) {