framework/source/loadenv/loadenv.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
New commits: commit 5334ff287c65f028753171c7b38da7ffbcebc1cc Author: Akash Jain <akash...@gmail.com> Date: Mon Apr 4 22:13:47 2016 +0530 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 <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 5ec8f6c..7e715aa 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()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits