sw/source/ui/frmdlg/cption.cxx  |   15 +++++++--------
 sw/source/uibase/inc/cption.hxx |    1 -
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit bc64f99a6a6a2134bd63d47dbfa23ed1d6cfd754
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat May 9 19:28:40 2020 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon May 11 09:29:27 2020 +0200

    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/+/93796
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 4320d71aa4f8..b12a89696d19 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -97,12 +97,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))
@@ -126,8 +120,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();
@@ -366,6 +358,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 58fffc2dce37..e12244ec49e9 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();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to