From 8ebc294b5bbcbfe27db3718453fbfcf129329b90 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 6 Sep 2012 17:02:44 +0200 Subject: no conditional format changes i protected sheets, related fdo#51636 Change-Id: I228ca76c34e3e18ea4d4f2197db20222319ebbd0 --- sc/inc/globstr.hrc | 4 +++- sc/source/ui/src/globstr.src | 4 ++++ sc/source/ui/view/cellsh1.cxx | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 0694946a8311..42d8c1eb64ee 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -600,7 +600,9 @@ #define STR_COND_UNIQUE 475 #define STR_COND_DUPLICATE 476 -#define STR_COUNT 477 +#define STR_ERR_CONDFORMAT_PROTECTED 477 + +#define STR_COUNT 478 #endif diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 0b25b8c4835a..a58f5b68d292 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1895,5 +1895,9 @@ Resource RID_GLOBSTR { Text [ en-US ] = "Formula is"; }; + String STR_ERR_CONDFORMAT_PROTECTED + { + Text [ en-US ] = "Conditional Formats can not be created, deleted or changed in protected sheets!"; + }; }; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 90e3dfe4482e..c7f0ef8d2724 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2044,6 +2044,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false); ScDocument* pDoc = pData->GetDocument(); + if(pDoc->IsTabProtected(pData->GetTabNo())) + { + pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED ); + break; + } + ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo()); if(aRangeList.empty()) { @@ -2084,6 +2090,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false); ScDocument* pDoc = pData->GetDocument(); + if(pDoc->IsTabProtected(pData->GetTabNo())) + { + pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED ); + break; + } + ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo()); if(aRangeList.empty()) { -- cgit