Switch the weld::Entry and weld::TextView handlers
that are called when the text changes due to user
interaction to pass a weld::TextWidget& param
instead of a weld::Entry& and weld::TextView&
one respectively.
Adjust related methods across the code base accordingly.
This unifies the behavior for both of these
weld::TextWidget subclasses and prepares for
deduplicating the logic and moving it to the
common base class in an upcoming commit.
That will also ensure they stay in sync.
(Change also motivated by the fact that their behavior was
differing before
Change-Id: I03d2a13cd84d53d806eb9e363f49c4b6be28d938
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Thu Jul 9 13:08:58 2026 +0200
tdf#130857 weld: Don't signal about programmatic TextView text change
.)
Change-Id: I5572fc88caf577fae9a23a39f1ec4f2179935a99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207936
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <vcl/dllapi.h>
|
|
#include <vcl/weld/Entry.hxx>
|
|
|
|
namespace weld
|
|
{
|
|
class VCL_DLLPUBLIC PatternFormatter final
|
|
{
|
|
public:
|
|
PatternFormatter(weld::Entry& rEntry);
|
|
~PatternFormatter();
|
|
|
|
weld::Entry& get_widget() { return m_rEntry; }
|
|
|
|
void SetMask(const OString& rEditMask, const OUString& rLiteralMask);
|
|
void SetStrictFormat(bool bStrict);
|
|
void ReformatAll();
|
|
|
|
/* PatternFormatter will set listeners to "changed", "focus-out", "focus-in"
|
|
and "key-press" of the Entry so users that want to add their own listeners
|
|
to those must set them through this formatter and not directly on that entry.
|
|
*/
|
|
void connect_changed(const Link<weld::TextWidget&, void>& rLink) { m_aModifyHdl = rLink; }
|
|
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
|
|
void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_aFocusInHdl = rLink; }
|
|
void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
|
|
|
|
SAL_DLLPRIVATE void Modify();
|
|
|
|
private:
|
|
weld::Entry& m_rEntry;
|
|
Link<weld::TextWidget&, void> m_aModifyHdl;
|
|
Link<weld::Widget&, void> m_aFocusInHdl;
|
|
Link<weld::Widget&, void> m_aFocusOutHdl;
|
|
Link<const KeyEvent&, bool> m_aKeyPressHdl;
|
|
bool m_bStrictFormat;
|
|
bool m_bSameMask;
|
|
bool m_bReformat;
|
|
bool m_bInPattKeyInput;
|
|
OString m_aEditMask;
|
|
OUString m_aLiteralMask;
|
|
|
|
SAL_DLLPRIVATE void EntryGainFocus();
|
|
SAL_DLLPRIVATE void EntryLostFocus();
|
|
DECL_DLLPRIVATE_LINK(ModifyHdl, weld::TextWidget&, void);
|
|
DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
|
|
DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
|
|
DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
|
|
};
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|