tdf#146523 Fix editable protected drop-down fields
Previously, drop-down fields from a protected section in a Writer
document could be edited by double-clicking on them. This patch adds
a check to see if the appropriate section is protected or not. This
check is done before allowing LibreOffice to open a popup window
titled "Drop-down Form Field" for editing the list of possible
values.
Also, with this patch, menu item "Form > Control Properties..." will
no longer do anything for the fields in a protected section.
Change-Id: I02a23818bd315abd61118f199c72ac28b7ed1ab4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128256
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index e0f4459..4b94dc5 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1473,7 +1473,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
}
if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN )
if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN
&& !(rWrtSh.GetCurrSection() && rWrtSh.GetCurrSection()->IsProtect()) )
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDropDownFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), pFieldBM));