Kaydet (Commit) 81974604 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Tomaž Vajngerl

editeng: do not throw from QueryValue implementation

None of the other QueryValue throw; in case of a problem they return
false without initialising the Any.

On the one hand, it would be useful to throw an exception for this
special property that has now become Write-Only, so that API users
get a better hint what is going wrong; on the other hand, it breaks
various other things like the various multi-property interfaces that
call QueryValue for multiple items (there are 3 such loops in
SwAccessibleParagraph alone).

(throw was introduced in 7a8ed362)

It turns out there is even a test for the exception on ToX.

Change-Id: Id60ff43544f7399ce869227bfd6fb933dbaea3be
Reviewed-on: https://gerrit.libreoffice.org/61719
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst d6da3418
......@@ -3309,7 +3309,8 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_GRAPHIC_URL:
{
throw uno::RuntimeException("Getting from this property is not supported");
SAL_INFO("editeng.items", "Getting GraphicURL property is not supported");
return false;
}
break;
case MID_GRAPHIC:
......
......@@ -36,6 +36,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <vcl/svapp.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/memberids.h>
#include <hints.hxx>
#include <cmdid.h>
#include <swtypes.hxx>
......@@ -886,6 +887,11 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
"Unknown property: " + rPropertyName,
static_cast< cppu::OWeakObject * >(this));
}
// TODO: is this the best approach to tell API clients about the change?
if (pEntry->nWID == RES_BACKGROUND && pEntry->nMemberId == MID_GRAPHIC_URL)
{
throw uno::RuntimeException("Getting GraphicURL property is not supported");
}
SwSectionFormat *const pSectionFormat( m_pImpl->GetSectionFormat() );
SwTOXBase* pTOXBase = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment