diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-09 19:28:40 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-10 22:10:37 +0200 |
commit | 50ed0fd8a51c465589da21b1414e2c2e239e986a (patch) | |
tree | 6c3efb26763f2c0d9ad5f5c2cb85b742edef68e2 /sw | |
parent | c6a3f51a89449f61ad20a1787c0a3cb41fa91466 (diff) |
Resolves: tdf#132626 entry_insert_text works on the newly typed region
but in this case we want to work on the whole entry string to see
if it forms a legal result
Change-Id: I818c7d6b8efc53d00a7ea68b2e1e0ad386ed0b20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93879
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/frmdlg/cption.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/inc/cption.hxx | 1 |
2 files changed, 7 insertions, 9 deletions
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index b9520dd71af3..6f4f8208b7ee 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -94,12 +94,6 @@ OUString TextFilterAutoConvert::filter(const OUString &rText) return rText; } -IMPL_LINK(SwCaptionDialog, TextFilterHdl, OUString&, rTest, bool) -{ - rTest = m_aTextFilter.filter(rTest); - return true; -} - SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV) : SfxDialogController(pParent, "modules/swriter/ui/insertcaption.ui", "InsertCaptionDialog") , m_sNone(SwResId(SW_STR_NONE)) @@ -123,8 +117,6 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV) , m_xOptionButton(m_xBuilder->weld_button("options")) , m_xPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreview)) { - m_xCategoryBox->connect_entry_insert_text(LINK(this, SwCaptionDialog, TextFilterHdl)); - //#i61007# order of captions ApplyCaptionOrder(); SwWrtShell &rSh = rView.GetWrtShell(); @@ -363,6 +355,13 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyEntryHdl, weld::Entry&, void) IMPL_LINK_NOARG(SwCaptionDialog, ModifyComboHdl, weld::ComboBox&, void) { + OUString sText = m_xCategoryBox->get_active_text(); + OUString sAllowedText = m_aTextFilter.filter(sText); + if (sText != sAllowedText) + { + m_xCategoryBox->set_entry_text(sAllowedText); + m_xCategoryBox->select_entry_region(sAllowedText.getLength(), sAllowedText.getLength()); + } ModifyHdl(); } diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index cc992240cccd..16fa1f063da9 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -64,7 +64,6 @@ class SwCaptionDialog : public SfxDialogController DECL_LINK(ModifyComboHdl, weld::ComboBox&, void); DECL_LINK(OptionHdl, weld::Button&, void); DECL_LINK(CaptionHdl, weld::Button&, void); - DECL_LINK(TextFilterHdl, OUString&, bool); void Apply(); |