diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-12-03 13:56:57 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-01-25 13:25:25 +0100 |
commit | c8c17a07bdb4799fb5a2ec56aaf7440f237ca5c0 (patch) | |
tree | 40f7c198d5dfd00c1ca04fe75c8ef888f0f86213 /sfx2 | |
parent | ca1c9578b70adb2d22891e930fb4621649e62373 (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.cxx | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9849ac86d642..cf27e3493bf0 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); |