summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/objmisc.cxx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-04-07 16:21:08 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-04-08 07:30:17 +0200
commit523922ee9d033fd304d2b50a72b76853ddcfbcdf (patch)
tree2c425badafc0b2dc31b57b1bc681ffabbfc1a6a1 /sfx2/source/doc/objmisc.cxx
parent5f47b3f56ac324ee02ea18d7362524380381b835 (diff)
Fix edit button still appearing in Calc
... even when editing readonly docs was disabled. Viewshell was not yet available at this point, so move the code where it belongs, into the object shell. Change-Id: I71cbaf9c912beeeb0b8177538999049f7f8b4e03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91832 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2/source/doc/objmisc.cxx')
-rw-r--r--sfx2/source/doc/objmisc.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 7bf2c77de4ef..7cc979a87e43 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -75,6 +75,8 @@
#include <comphelper/interaction.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/documentconstants.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <officecfg/Office/Common.hxx>
#include <sfx2/signaturestate.hxx>
#include <sfx2/app.hxx>
@@ -1867,4 +1869,15 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess
return mbContinueImportOnFilterExceptions == yes;
}
+bool SfxObjectShell::isEditDocLocked()
+{
+ Reference<XModel> xModel = GetModel();
+ if (!xModel.is())
+ return false;
+ if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get())
+ return true;
+ comphelper::NamedValueCollection aArgs(xModel->getArgs());
+ return aArgs.getOrDefault("LockEditDoc", false);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */