summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-08-10 17:33:22 +0300
committerTor Lillqvist <tml@collabora.com>2016-08-11 17:03:17 +0000
commit2f02999c360a4fc55cd5f59eac2beeea630adf32 (patch)
treebd0431f79de977442e40f651390cd02f41405e43
parentc324c79b087c98e024a2ae130ce3993346797fee (diff)
Revert "tdf#98837 - Fail loading a new document with read only property ..."
There was not really a good enough reason for the change, and it causes unfortunate regressions in 3rd-party code that previously worked fine. (It also caused two regressions in LO's own code, but those were already fixed.) This reverts commit 5334ff287c65f028753171c7b38da7ffbcebc1cc. (cherry picked from commit 38a3743e0c5d52f9386f74097fd512d3133fbbe3) Change-Id: Iec36345fa3663bc5d96ce3e74d334c7aa075ada2 Reviewed-on: https://gerrit.libreoffice.org/28035 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--framework/qa/complex/XTitle/CheckXTitle.java13
-rw-r--r--framework/source/loadenv/loadenv.cxx18
2 files changed, 9 insertions, 22 deletions
diff --git a/framework/qa/complex/XTitle/CheckXTitle.java b/framework/qa/complex/XTitle/CheckXTitle.java
index e798732730bd..8912470003af 100644
--- a/framework/qa/complex/XTitle/CheckXTitle.java
+++ b/framework/qa/complex/XTitle/CheckXTitle.java
@@ -217,11 +217,12 @@ public class CheckXTitle
xDisProv = null;
}
- /** @short checks loading of new document with readonly set to true
+ /** @short checks creation of new empty document with readonly set to true
- @descr loads a new document with readonly mode set to true.
- this should fail because new doc can not be opened in
- read only mode
+ @descr creation of a new document with readonly property set
+ to true. this should not fail even if as such it can
+ be seen as a slightly silly thing to do. But existing
+ 3rd-party code depends on it to work.
*/
@Test public void checkLoadingWithReadOnly()
{
@@ -239,10 +240,8 @@ public class CheckXTitle
try{
xDoc = m_xLoader.loadComponentFromURL("private:factory/swriter", "_default", 0, lArgs);
} catch (Exception e) {
- //exception is expected. do nothing
}
-
- assertNull("Loading new document with read only mode true should have failed", xDoc);
+ assertNotNull("Creating a new document read with ReadOnly property true should work (even if slightly silly)", xDoc);
}
private XMultiServiceFactory getMSF()
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index a7fcf579c609..b6f6f4c92178 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -552,25 +552,13 @@ 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))
- {
- //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;
- }
+ return E_CAN_BE_LOADED;
// 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());