Kaydet (Commit) 5334ff28 authored tarafından Akash Jain's avatar Akash Jain Kaydeden (comit) Stephan Bergmann

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/23812Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst be3c2ff9
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment