summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-01-12 17:10:49 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-01-13 09:03:34 +0100
commitf3bedf92fb8d07114bc3d53d8a01928c77e479fc (patch)
tree8285b15aacaf71e7ef4f5d64adaaa3b6dd82bd6a /sw/source
parent6554d69871b0798ae38e5a406aefb5dd90f19ff0 (diff)
sw edit win: fix read-only selections while handling ExtTextInput
When typing into a protected section (or other read-only area), the code goes through SwEditWin::KeyInput(), which checks for HasReadonlySel(), and calls into sw::DocumentContentOperationsManager::InsertString() in the read-write case. When typing via ExtTextInput (e.g. Online), then SwEditWin::Command() called into sw::DocumentContentOperationsManager::InsertString() without such a check. The convention is to do a read-only check in the first Writer function called by vcl, so handle this in SwEditWin::Command(), to have exactly 1 read-only popup on typing a character. (cherry picked from commit 0c03a97fb8844ad0de1abea79b5265617a509460) Conflicts: sw/qa/extras/tiledrendering/tiledrendering.cxx Change-Id: I7d002e7d76bffeb6f16750de735c5bbf13a7bba9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109212 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index e9d794eb2e0b..facc9e95bda0 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5392,7 +5392,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
{
bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
rSh.IsCursorReadonly();
- if(!bIsDocReadOnly)
+ if (!bIsDocReadOnly && !rSh.HasReadonlySel())
{
if( m_pQuickHlpData->m_bIsDisplayed )
m_pQuickHlpData->Stop( rSh );
@@ -5426,6 +5426,14 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
}
}
}
+
+ if (rSh.HasReadonlySel())
+ {
+ // Inform the user that the request has been ignored.
+ auto xInfo = std::make_shared<weld::GenericDialogController>(
+ GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui", "InfoReadonlyDialog");
+ weld::DialogController::runAsync(xInfo, [](sal_Int32 /*nResult*/) {});
+ }
}
break;
case CommandEventId::CursorPos: