diff options
author | Akash Jain <akash96j@gmail.com> | 2016-04-04 22:13:47 +0530 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-04-05 07:00:56 +0000 |
commit | 5334ff287c65f028753171c7b38da7ffbcebc1cc (patch) | |
tree | 0a4afc6b0e4e11008deace66fbc1e3900563caaa /framework | |
parent | be3c2ff9233e8d4c5afe9c696cb5a60b24b25efc (diff) |
tdf#98837 - Fail loading a new document with read only property set to true
When opening a new document, via any API, (URL: "private:factory/swriter")
with read-only property set to true, Writer opens with a new document in
edit mode. But the title still has (read-only) in it. Since a document can
only open in read-only mode if it has been saved first, the loading of new
documents with read-only property set to true will now fail.
Change-Id: I370e6fb1c94b6476c2ded872d6d7c820b25db53a
Reviewed-on: https://gerrit.libreoffice.org/23812
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 5ec8f6c7a968..7e715aa7bc47 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -555,13 +555,25 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString& in a special way .-) */ + utl::MediaDescriptor stlMediaDescriptor(lMediaDescriptor); + utl::MediaDescriptor::const_iterator pIt; + // creation of new documents if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_FACTORY)) - return E_CAN_BE_LOADED; + { + //tdf#98837 - check if read only prop is set to true for a new document + //if yes then fail loading as doc needs to be saved before being opened + //in read only mode + pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_READONLY()); + if( pIt == stlMediaDescriptor.end() || + pIt->second == uno::Any(false) + ) + return E_CAN_BE_LOADED; + SAL_INFO("fwk", "LoadEnv::classifyContent(): new document can not be loaded in read only mode"); + return E_UNSUPPORTED_CONTENT; + } // using of an existing input stream - utl::MediaDescriptor stlMediaDescriptor(lMediaDescriptor); - utl::MediaDescriptor::const_iterator pIt; if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_STREAM)) { pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_INPUTSTREAM()); |