summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-12-03 13:56:57 +0100
committerAndras Timar <andras.timar@collabora.com>2021-03-22 22:34:03 +0100
commitaea8c002f961dbb551b793e68e2094427a909358 (patch)
tree34cb28a4f00b64952552e3f2783fcfaf7242ebd1 /sfx2
parent577596fd100ceb4b496a1f74e71660fd6344f00b (diff)
Also throw IllegalArgumentException for arguments of wrong type
Change-Id: I1b52accc3f0eec3e6232b8211bf7bcbf65ed18f8 Reviewed-on: https://gerrit.libreoffice.org/84350 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit ebd70d476c392b2c5a87295e01b8ea9c2e8de258)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx60
1 files changed, 42 insertions, 18 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index a297faad0ec8..8c5b2dd87fef 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1063,48 +1063,72 @@ void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs)
{
OUString sValue;
bool bValue;
-
+ bool ok = false;
if (rArg.Name == "SuggestedSaveAsName")
{
- rArg.Value >>= sValue;
- pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASNAME, sValue));
+ if (rArg.Value >>= sValue)
+ {
+ pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASNAME, sValue));
+ ok = true;
+ }
}
else if (rArg.Name == "SuggestedSaveAsDir")
{
- rArg.Value >>= sValue;
- pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASDIR, sValue));
+ if (rArg.Value >>= sValue)
+ {
+ pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASDIR, sValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockContentExtraction")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockExport")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EXPORT, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EXPORT, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockPrint")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_PRINT, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_PRINT, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockSave")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_SAVE, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_SAVE, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockEditDoc")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EDITDOC, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EDITDOC, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "Replaceable")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bValue));
+ ok = true;
+ }
}
- else
+ if (!ok)
{
throw lang::IllegalArgumentException("Setting property not supported: " + rArg.Name,
comphelper::getProcessComponentContext(), 0);