summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/editable.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-05-11 18:07:56 -0400
committerKohei Yoshida <libreoffice@kohei.us>2017-05-17 05:16:44 +0200
commit034be10413ed4915090678ad4f1d48596cf5e206 (patch)
tree5227cc4aae303272338e8fc25225fc48914168d0 /sc/source/ui/docshell/editable.cxx
parent296c2296f5565556eea9fab51563050f28bbcafc (diff)
tdf#43535: support additional sheet protection options.
New options are: * insert columns. * insert rows. * delete columns. * delete rows. Change-Id: I076b0d01bee0fff0623e2f1137c09938a6110939 Reviewed-on: https://gerrit.libreoffice.org/37695 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc/source/ui/docshell/editable.cxx')
-rw-r--r--sc/source/ui/docshell/editable.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/editable.cxx b/sc/source/ui/docshell/editable.cxx
index 05d4f19ebc89..2a06c82dc322 100644
--- a/sc/source/ui/docshell/editable.cxx
+++ b/sc/source/ui/docshell/editable.cxx
@@ -73,6 +73,13 @@ ScEditableTester::ScEditableTester( ScViewFunc* pView ) :
}
}
+ScEditableTester::ScEditableTester(
+ const ScDocument& rDoc, sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd, const ScMarkData& rMark ) :
+ ScEditableTester()
+{
+ TestBlockForAction(rDoc, eAction, nStart, nEnd, rMark);
+}
+
void ScEditableTester::TestBlock( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
@@ -124,6 +131,21 @@ void ScEditableTester::TestSelection( ScDocument* pDoc, const ScMarkData& rMark
}
}
+void ScEditableTester::TestBlockForAction(
+ const ScDocument& rDoc, sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd,
+ const ScMarkData& rMark )
+{
+ mbOnlyMatrix = false;
+
+ for (ScMarkData::const_iterator it = rMark.begin(), itEnd = rMark.end(); it != itEnd; ++it)
+ {
+ if (!mbIsEditable)
+ return;
+
+ mbIsEditable = rDoc.IsEditActionAllowed(eAction, *it, nStart, nEnd);
+ }
+}
+
sal_uInt16 ScEditableTester::GetMessageId() const
{
if (mbIsEditable)