diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-12-13 09:09:52 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-12-17 13:58:56 +0100 |
commit | 43a63b725208bfa378355011ea56cb936afa4411 (patch) | |
tree | f0d388cfb59c37e98ae8e2533d18ec649a5287ac /sfx2 | |
parent | 397195cd43249851bb89d0a2ba82ffdf975b7317 (diff) |
Allow setting some MediaDescriptor properties during runtime
Change-Id: Id6bb554c0e165c6d1f9c28c48fdbcd7156f42316
Reviewed-on: https://gerrit.libreoffice.org/65256
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 76be8c85d969..216bc94a8340 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/ucb/ContentCreationException.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/InvalidStateException.hpp> #include <comphelper/enumhelper.hxx> #include <cppuhelper/implbase.hxx> @@ -1037,6 +1038,35 @@ Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() return m_pData->m_seqArguments; } +void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs) +{ + SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); + if (!pMedium) + { + throw util::InvalidStateException( + "Medium could not be retrieved, unable to execute setArgs"); + } + + for (int i = 0; i < aArgs.getLength(); i++) + { + OUString sValue; + aArgs[i].Value >>= sValue; + + if (aArgs[i].Name == "SuggestedSaveAsName") + { + pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASNAME, sValue)); + } + else if (aArgs[i].Name == "SuggestedSaveAsDir") + { + pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASDIR, sValue)); + } + else + { + throw lang::IllegalArgumentException("Setting property not supported: " + aArgs[i].Name, + comphelper::getProcessComponentContext(), 0); + } + } +} // frame::XModel |