[Libreoffice-commits] core.git: framework/source
Akash Jain
akash96j at gmail.com
Tue Apr 5 07:01:19 UTC 2016
framework/source/loadenv/loadenv.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 5334ff287c65f028753171c7b38da7ffbcebc1cc
Author: Akash Jain <akash96j at 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 <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at 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());
More information about the Libreoffice-commits
mailing list