summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/find-headers-to-move-inside-modules.py1
-rw-r--r--bin/find-mergedlib-can-be-private.classes.results1
-rwxr-xr-xbin/update_pch3
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx1
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignControl.cxx1
-rw-r--r--include/svtools/editbrowsebox.hxx102
-rw-r--r--include/svtools/editimplementation.hxx135
-rw-r--r--include/vcl/field.hxx2
-rw-r--r--include/vcl/weldutils.hxx44
-rw-r--r--solenv/clang-format/excludelist1
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx91
-rw-r--r--svx/source/fmcomp/gridcell.cxx43
-rw-r--r--sw/source/ui/index/cnttab.cxx1
-rw-r--r--vcl/source/app/weldutils.cxx33
-rw-r--r--vcl/source/control/field2.cxx372
15 files changed, 445 insertions, 386 deletions
diff --git a/bin/find-headers-to-move-inside-modules.py b/bin/find-headers-to-move-inside-modules.py
index f33922ee457d..af2ca619a461 100755
--- a/bin/find-headers-to-move-inside-modules.py
+++ b/bin/find-headers-to-move-inside-modules.py
@@ -13,7 +13,6 @@ with a.stdout as txt:
header = line[8:].strip();
if "README" in header: continue
if header == "version.hrc": continue
- if header == "svtools/editimplementation.hxx": continue
# ignore URE headers
if header.startswith("IwyuFilter_include.yaml"): continue
if header.startswith("cppu/"): continue
diff --git a/bin/find-mergedlib-can-be-private.classes.results b/bin/find-mergedlib-can-be-private.classes.results
index b75fe09fb821..a9e425512aca 100644
--- a/bin/find-mergedlib-can-be-private.classes.results
+++ b/bin/find-mergedlib-can-be-private.classes.results
@@ -386,7 +386,6 @@ svt::MultiLineEditImplementation
svt::MultiLineTextCell
svt::OStringTransferable
svt::PopupMenuControllerBase
-svt::SpinCellController
svt::TemplateFolderCache
svtools::AsynchronLink
svtools::ToolbarPopup
diff --git a/bin/update_pch b/bin/update_pch
index 7411e79acb80..4226b02ec037 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -372,8 +372,7 @@ def filter_ignore(line, module):
'LibreOfficeKit/LibreOfficeKitTypes.h', # Needs special directives
'jerror.h', # c++ unfriendly
'jpeglib.h', # c++ unfriendly
- 'boost/spirit/include/classic_core.hpp', # depends on BOOST_SPIRIT_DEBUG
- 'svtools/editimplementation.hxx' # no direct include
+ 'boost/spirit/include/classic_core.hpp' # depends on BOOST_SPIRIT_DEBUG
]
if module == 'accessibility':
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 5073a4667717..c11a52cc3a2e 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -42,6 +42,7 @@
#include "TableFieldControl.hxx"
#include <dsntypes.hxx>
#include <vcl/commandevent.hxx>
+#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
using namespace ::dbaui;
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index 2fe3e5ec906e..a969dc2c0f28 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vcl/builder.hxx>
#include <vcl/commandevent.hxx>
+#include <vcl/menu.hxx>
#include <helpids.h>
using namespace ::dbaui;
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 98da5046e73f..aa162d1bd09b 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -25,22 +25,17 @@
#include <memory>
#include <svtools/svtdllapi.h>
#include <tools/ref.hxx>
-#include <vcl/window.hxx>
#include <svtools/brwbox.hxx>
#include <svtools/brwhead.hxx>
#include <tools/lineend.hxx>
#include <vcl/InterimItemWindow.hxx>
-#include <vcl/edit.hxx>
#include <vcl/weldutils.hxx>
#include <o3tl/typed_flags_set.hxx>
class BrowserDataWin;
-class Button;
-class SpinField;
// EditBrowseBoxFlags (EBBF)
-
enum class EditBrowseBoxFlags
{
NONE = 0x0000,
@@ -170,39 +165,6 @@ namespace svt
}
};
- //= GenericEditImplementation
- template <class EDIT>
- class GenericEditImplementation : public IEditImplementation
- {
- EDIT& m_rEdit;
- public:
- GenericEditImplementation( EDIT& _rEdit );
-
- virtual Control& GetControl() override;
-
- virtual OUString GetText( LineEnd aSeparator ) const override;
- virtual void SetText( const OUString& _rStr ) override;
-
- virtual bool IsReadOnly() const override;
- virtual void SetReadOnly( bool bReadOnly ) override;
-
- virtual sal_Int32 GetMaxTextLen() const override;
- virtual void SetMaxTextLen( sal_Int32 _nMaxLen ) override;
-
- virtual Selection GetSelection() const override;
- virtual void SetSelection( const Selection& _rSelection ) override;
-
- virtual void ReplaceSelected( const OUString& _rStr ) override;
- virtual OUString GetSelected( LineEnd aSeparator ) const override;
-
- virtual bool IsValueChangedFromSaved() const override;
- virtual void SaveValue() override;
-
- virtual void Cut() override;
- virtual void Copy() override;
- virtual void Paste() override;
- };
-
class SVT_DLLPUBLIC ControlBase : public InterimItemWindow
{
public:
@@ -268,7 +230,7 @@ namespace svt
public:
EntryImplementation(EditControlBase& rEdit)
: m_rEdit(rEdit)
- , m_nMaxTextLen(EDIT_NOLIMIT)
+ , m_nMaxTextLen(0)
{
m_rEdit.connect_changed(LINK(this, EntryImplementation, ModifyHdl));
}
@@ -307,7 +269,7 @@ namespace svt
virtual void SetMaxTextLen( sal_Int32 nMaxLen ) override
{
m_nMaxTextLen = nMaxLen;
- m_rEdit.get_widget().set_max_length(nMaxLen == EDIT_NOLIMIT ? 0 : nMaxLen);
+ m_rEdit.get_widget().set_max_length(m_nMaxTextLen);
}
virtual Selection GetSelection() const override
@@ -374,9 +336,6 @@ namespace svt
}
};
- #include <svtools/editimplementation.hxx>
-
-
//= MultiLineTextCell
/** a multi line edit which can be used in a cell of an EditBrowseBox
@@ -403,28 +362,6 @@ namespace svt
virtual bool ProcessKey(const KeyEvent& rKEvt) override;
};
- //= concrete edit implementations
- typedef GenericEditImplementation< Edit > EditImplementation_Base;
- class EditImplementation final : public EditImplementation_Base
- {
- DECL_LINK(ModifyHdl, Edit&, void);
- public:
- EditImplementation( Edit& _rEdit ) : EditImplementation_Base( _rEdit )
- {
- _rEdit.SetModifyHdl(LINK(this, EditImplementation, ModifyHdl));
- }
-
- virtual bool CanUp() const override
- {
- return false;
- }
-
- virtual bool CanDown() const override
- {
- return false;
- }
- };
-
class SVT_DLLPUBLIC MultiLineEditImplementation : public IEditImplementation
{
MultiLineTextCell& m_rEdit;
@@ -434,7 +371,7 @@ namespace svt
public:
MultiLineEditImplementation(MultiLineTextCell& rEdit)
: m_rEdit(rEdit)
- , m_nMaxTextLen(EDIT_NOLIMIT)
+ , m_nMaxTextLen(0)
{
m_rEdit.connect_changed(LINK(this, MultiLineEditImplementation, ModifyHdl));
}
@@ -469,7 +406,7 @@ namespace svt
virtual void SetMaxTextLen( sal_Int32 nMaxLen ) override
{
m_nMaxTextLen = nMaxLen;
- m_rEdit.get_widget().set_max_length(nMaxLen == EDIT_NOLIMIT ? 0 : nMaxLen);
+ m_rEdit.get_widget().set_max_length(m_nMaxTextLen);
}
virtual Selection GetSelection() const override
@@ -537,7 +474,6 @@ namespace svt
bool m_bOwnImplementation; // did we create m_pEditImplementation?
public:
- EditCellController( Edit* _pEdit );
EditCellController( EditControlBase* _pEdit );
EditCellController( IEditImplementation* _pImplementation );
virtual ~EditCellController( ) override;
@@ -559,22 +495,6 @@ namespace svt
DECL_LINK(ModifyHdl, LinkParamNone*, void);
};
- //= SpinCellController
- class UNLESS_MERGELIBS(SVT_DLLPUBLIC) SpinCellController final : public CellController
- {
- public:
- SpinCellController(SpinField* pSpinField);
- const SpinField& GetSpinWindow() const;
- SpinField& GetSpinWindow();
-
- virtual bool IsValueChangedFromSaved() const override;
- virtual void SaveValue() override;
-
- private:
- virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
- DECL_LINK(ModifyHdl, Edit&, void);
- };
-
//= CheckBoxControl
class SVT_DLLPUBLIC CheckBoxControl final : public ControlBase
{
@@ -771,6 +691,20 @@ namespace svt
DECL_LINK(ImplClickHdl, weld::Button&, void);
};
+ class SVT_DLLPUBLIC PatternControl final : public EditControl
+ {
+ public:
+ PatternControl(BrowserDataWin* pParent);
+
+ weld::PatternFormatter& get_formatter() { return *m_xEntryFormatter; }
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override;
+
+ virtual void dispose() override;
+ private:
+ std::unique_ptr<weld::PatternFormatter> m_xEntryFormatter;
+ };
+
//= FormattedFieldCellController
class SVT_DLLPUBLIC FormattedFieldCellController final : public EditCellController
{
diff --git a/include/svtools/editimplementation.hxx b/include/svtools/editimplementation.hxx
deleted file mode 100644
index 81728017af52..000000000000
--- a/include/svtools/editimplementation.hxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SVTOOLS_IN_EDITBROWSEBOX_HXX
-#error "not to be included directly!"
-#endif
-
-
-template <class EDIT>
-GenericEditImplementation< EDIT >::GenericEditImplementation( EDIT& _rEdit )
- :m_rEdit( _rEdit )
-{
-}
-
-template <class EDIT>
-Control& GenericEditImplementation< EDIT >::GetControl()
-{
- return m_rEdit;
-}
-
-
-template <class EDIT>
-OUString GenericEditImplementation< EDIT >::GetText( LineEnd ) const
-{
- // ignore the line end - this base implementation does not support it
- return m_rEdit.GetText( );
-}
-
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::SetText( const OUString& _rStr )
-{
- m_rEdit.SetText( _rStr );
-}
-
-
-template <class EDIT>
-Selection GenericEditImplementation< EDIT >::GetSelection() const
-{
- return m_rEdit.GetSelection( );
-}
-
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::SetSelection( const Selection& _rSelection )
-{
- m_rEdit.SetSelection( _rSelection );
-}
-
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::SetReadOnly( bool bReadOnly )
-{
- m_rEdit.SetReadOnly( bReadOnly );
-}
-
-
-template <class EDIT>
-bool GenericEditImplementation< EDIT >::IsReadOnly() const
-{
- return m_rEdit.IsReadOnly();
-}
-
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::ReplaceSelected( const OUString& _rStr )
-{
- m_rEdit.ReplaceSelected( _rStr );
-}
-
-template <class EDIT>
-OUString GenericEditImplementation< EDIT >::GetSelected( LineEnd ) const
-{
- return m_rEdit.GetSelected( );
-}
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::SetMaxTextLen( sal_Int32 _nMaxLen )
-{
- m_rEdit.SetMaxTextLen( _nMaxLen );
-}
-
-template <class EDIT>
-sal_Int32 GenericEditImplementation< EDIT >::GetMaxTextLen() const
-{
- return m_rEdit.GetMaxTextLen( );
-}
-
-template <class EDIT>
-bool GenericEditImplementation< EDIT >::IsValueChangedFromSaved() const
-{
- return m_rEdit.IsValueChangedFromSaved();
-}
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::SaveValue()
-{
- m_rEdit.SaveValue();
-}
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::Cut()
-{
- m_rEdit.Cut();
-}
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::Copy()
-{
- m_rEdit.Copy();
-}
-
-template <class EDIT>
-void GenericEditImplementation< EDIT >::Paste()
-{
- m_rEdit.Paste();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 36a786061bdb..ac72ac78b3c4 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -96,8 +96,6 @@ private:
protected:
PatternFormatter(Edit* pEdit);
- SAL_DLLPRIVATE void ImplSetMask(const OString& rEditMask,
- const OUString& rLiteralMask);
SAL_DLLPRIVATE bool ImplIsSameMask() const { return mbSameMask; }
SAL_DLLPRIVATE bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; }
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index cc2a49d4d881..75da11f586bd 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -312,6 +312,50 @@ private:
mutable std::unique_ptr<CalendarWrapper> m_xCalendarWrapper;
};
+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::Entry&, 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; }
+
+ void Modify();
+
+private:
+ weld::Entry& m_rEntry;
+ Link<weld::Entry&, 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;
+
+ void EntryGainFocus();
+ void EntryLostFocus();
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+};
+
// get the row the iterator is on
VCL_DLLPUBLIC size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter);
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 0708c30817f7..1a1d6e3fc105 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -6573,7 +6573,6 @@ include/svtools/ctrlbox.hxx
include/svtools/ctrltool.hxx
include/svtools/dialogclosedlistener.hxx
include/svtools/editbrowsebox.hxx
-include/svtools/editimplementation.hxx
include/svtools/editsyntaxhighlighter.hxx
include/svtools/ehdl.hxx
include/svtools/embedhlp.hxx
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 3f1c0196e838..b228985547d8 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -17,10 +17,7 @@
*/
#include <svtools/editbrowsebox.hxx>
-#include <vcl/spinfld.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/xtextedt.hxx>
-#include <vcl/textview.hxx>
#include <vcl/virdev.hxx>
namespace svt
@@ -288,20 +285,6 @@ namespace svt
CallModifyHdls();
}
- IMPL_LINK_NOARG(EditImplementation, ModifyHdl, Edit&, void)
- {
- CallModifyHdls();
- }
-
- //= EditCellController
- EditCellController::EditCellController( Edit* _pEdit )
- :CellController( _pEdit )
- ,m_pEditImplementation( new EditImplementation( *_pEdit ) )
- ,m_bOwnImplementation( true )
- {
- m_pEditImplementation->SetModifyHdl( LINK(this, EditCellController, ModifyHdl) );
- }
-
EditCellController::EditCellController( IEditImplementation* _pImplementation )
:CellController( &_pImplementation->GetControl() )
,m_pEditImplementation( _pImplementation )
@@ -536,6 +519,25 @@ namespace svt
FormattedControlBase::dispose();
}
+ PatternControl::PatternControl(BrowserDataWin* pParent)
+ : EditControl(pParent)
+ {
+ m_xWidget->connect_key_press(Link<const KeyEvent&, bool>()); // 1) acknowledge we first remove the old one
+ m_xEntryFormatter.reset(new weld::PatternFormatter(*m_xWidget));
+ m_xEntryFormatter->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); // 2) and here we reattach via the formatter
+ }
+
+ void PatternControl::connect_changed(const Link<weld::Entry&, void>& rLink)
+ {
+ m_xEntryFormatter->connect_changed(rLink);
+ }
+
+ void PatternControl::dispose()
+ {
+ m_xEntryFormatter.reset();
+ EditControl::dispose();
+ }
+
EditCellController::EditCellController(EditControlBase* pEdit)
: CellController(pEdit)
, m_pEditImplementation(new EntryImplementation(*pEdit))
@@ -600,61 +602,6 @@ namespace svt
callModifyHdl();
}
- //= SpinCellController
- SpinCellController::SpinCellController(SpinField* pWin)
- :CellController(pWin)
- {
- GetSpinWindow().SetModifyHdl( LINK(this, SpinCellController, ModifyHdl) );
- }
-
- const SpinField& SpinCellController::GetSpinWindow() const
- {
- return static_cast<const SpinField &>(GetWindow());
- }
-
- SpinField& SpinCellController::GetSpinWindow()
- {
- return static_cast<SpinField &>(GetWindow());
- }
-
- void SpinCellController::SaveValue()
- {
- GetSpinWindow().SaveValue();
- }
-
- bool SpinCellController::MoveAllowed(const KeyEvent& rEvt) const
- {
- bool bResult;
- switch (rEvt.GetKeyCode().GetCode())
- {
- case KEY_END:
- case KEY_RIGHT:
- {
- Selection aSel = GetSpinWindow().GetSelection();
- bResult = !aSel && aSel.Max() == GetSpinWindow().GetText().getLength();
- } break;
- case KEY_HOME:
- case KEY_LEFT:
- {
- Selection aSel = GetSpinWindow().GetSelection();
- bResult = !aSel && aSel.Min() == 0;
- } break;
- default:
- bResult = true;
- }
- return bResult;
- }
-
- bool SpinCellController::IsValueChangedFromSaved() const
- {
- return GetSpinWindow().IsValueChangedFromSaved();
- }
-
- IMPL_LINK_NOARG(SpinCellController, ModifyHdl, Edit&, void)
- {
- callModifyHdl();
- }
-
//= FormattedFieldCellController
FormattedFieldCellController::FormattedFieldCellController( FormattedControlBase* _pFormatted )
: EditCellController(_pFormatted)
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 4005c0d2a7d1..b94f20727482 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1728,7 +1728,6 @@ DbPatternField::DbPatternField( DbGridColumn& _rColumn, const Reference<XCompone
doPropertyListening( FM_PROP_STRICTFORMAT );
}
-
void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
{
DBG_ASSERT( m_pWindow, "DbPatternField::implAdjustGenericFieldSetting: not to be called without window!" );
@@ -1746,18 +1745,21 @@ void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySe
OString aAsciiEditMask(OUStringToOString(aEditMask, RTL_TEXTENCODING_ASCII_US));
- static_cast< PatternField* >( m_pWindow.get() )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pPainter.get() )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
- static_cast< PatternField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
+ weld::PatternFormatter& rEditFormatter = static_cast<PatternControl*>(m_pWindow.get())->get_formatter();
+ rEditFormatter.SetMask(aAsciiEditMask, aLitMask);
+ rEditFormatter.SetStrictFormat(bStrict);
+
+ weld::PatternFormatter& rPaintFormatter = static_cast<PatternControl*>(m_pPainter.get())->get_formatter();
+ rPaintFormatter.SetMask(aAsciiEditMask, aLitMask);
+ rPaintFormatter.SetStrictFormat(bStrict);
}
void DbPatternField::Init(BrowserDataWin& rParent, const Reference< XRowSet >& xCursor)
{
m_rColumn.SetAlignmentFromModel(-1);
- m_pWindow = VclPtr<PatternField>::Create( &rParent, 0 );
- m_pPainter= VclPtr<PatternField>::Create( &rParent, 0 );
+ m_pWindow = VclPtr<PatternControl>::Create(&rParent);
+ m_pPainter= VclPtr<PatternControl>::Create(&rParent);
Reference< XPropertySet > xModel( m_rColumn.getModel() );
implAdjustGenericFieldSetting( xModel );
@@ -1767,17 +1769,17 @@ void DbPatternField::Init(BrowserDataWin& rParent, const Reference< XRowSet >& x
CellControllerRef DbPatternField::CreateController() const
{
- return new SpinCellController( static_cast< PatternField* >( m_pWindow.get() ) );
+ return new EditCellController(static_cast<PatternControl*>(m_pWindow.get()));
}
OUString DbPatternField::impl_formatText( const OUString& _rText )
{
- m_pPainter->SetText( _rText );
- static_cast< PatternField* >( m_pPainter.get() )->ReformatAll();
- return m_pPainter->GetText();
+ weld::PatternFormatter& rPaintFormatter = static_cast<PatternControl*>(m_pPainter.get())->get_formatter();
+ rPaintFormatter.get_widget().set_text(_rText);
+ rPaintFormatter.ReformatAll();
+ return rPaintFormatter.get_widget().get_text();
}
-
OUString DbPatternField::GetFormatText(const Reference< css::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
{
bool bIsForPaint = _rxField != m_rColumn.GetField();
@@ -1800,11 +1802,11 @@ OUString DbPatternField::GetFormatText(const Reference< css::sdb::XColumn >& _rx
return impl_formatText( sText );
}
-
void DbPatternField::UpdateFromField( const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
{
- static_cast< Edit* >( m_pWindow.get() )->SetText( GetFormatText( _rxField, _rxFormatter ) );
- static_cast< Edit* >( m_pWindow.get() )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ weld::Entry& rEntry = static_cast<PatternControl*>(m_pWindow.get())->get_widget();
+ rEntry.set_text(GetFormatText(_rxField, _rxFormatter));
+ rEntry.select_region(-1, 0);
}
void DbPatternField::updateFromModel( Reference< XPropertySet > _rxModel )
@@ -1814,14 +1816,15 @@ void DbPatternField::updateFromModel( Reference< XPropertySet > _rxModel )
OUString sText;
_rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
- static_cast< Edit* >( m_pWindow.get() )->SetText( impl_formatText( sText ) );
- static_cast< Edit* >( m_pWindow.get() )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ weld::Entry& rEntry = static_cast<PatternControl*>(m_pWindow.get())->get_widget();
+ rEntry.set_text(impl_formatText(sText));
+ rEntry.select_region(-1, 0);
}
bool DbPatternField::commitControl()
{
- OUString aText(m_pWindow->GetText());
- m_rColumn.getModel()->setPropertyValue(FM_PROP_TEXT, makeAny(aText));
+ weld::Entry& rEntry = static_cast<PatternControl*>(m_pWindow.get())->get_widget();
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_TEXT, makeAny(rEntry.get_text()));
return true;
}
@@ -2770,7 +2773,7 @@ CellControllerRef DbFilterField::CreateController() const
if (m_bFilterList)
xController = new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow.get()));
else
- xController = new EditCellController(static_cast<Edit*>(m_pWindow.get()));
+ xController = new EditCellController(static_cast<EditControlBase*>(m_pWindow.get()));
}
return xController;
}
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 3cb000eba8ec..ca8da21f9c64 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <svl/style.hxx>
#include <vcl/weld.hxx>
+#include <vcl/edit.hxx>
#include <svl/stritem.hxx>
#include <unotools/pathoptions.hxx>
#include <sfx2/viewfrm.hxx>
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index e24566675123..8b5532fccc8b 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -446,6 +446,39 @@ void DateFormatter::SetExtDateFormat(ExtDateFieldFormat eFormat)
}
DateFormatter::~DateFormatter() = default;
+
+PatternFormatter::PatternFormatter(weld::Entry& rEntry)
+ : m_rEntry(rEntry)
+ , m_bStrictFormat(false)
+ , m_bSameMask(true)
+ , m_bReformat(false)
+ , m_bInPattKeyInput(false)
+{
+ m_rEntry.connect_changed(LINK(this, PatternFormatter, ModifyHdl));
+ m_rEntry.connect_focus_in(LINK(this, PatternFormatter, FocusInHdl));
+ m_rEntry.connect_focus_out(LINK(this, PatternFormatter, FocusOutHdl));
+ m_rEntry.connect_key_press(LINK(this, PatternFormatter, KeyInputHdl));
+}
+
+IMPL_LINK_NOARG(PatternFormatter, ModifyHdl, weld::Entry&, void) { Modify(); }
+
+IMPL_LINK_NOARG(PatternFormatter, FocusOutHdl, weld::Widget&, void)
+{
+ EntryLostFocus();
+ m_aFocusOutHdl.Call(m_rEntry);
+}
+
+IMPL_LINK_NOARG(PatternFormatter, FocusInHdl, weld::Widget&, void)
+{
+ EntryGainFocus();
+ m_aFocusInHdl.Call(m_rEntry);
+}
+
+PatternFormatter::~PatternFormatter()
+{
+ m_rEntry.connect_changed(Link<weld::Entry&, void>());
+ m_rEntry.connect_focus_out(Link<weld::Widget&, void>());
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 1cbf4fcf9e92..a300bf50627a 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -361,12 +361,12 @@ static void ImplPatternMaxPos( const OUString& rStr, const OString& rEditMask,
rPos = nCursorPos;
}
-static void ImplPatternProcessStrictModify( Edit* pEdit,
- const OString& rEditMask,
- const OUString& rLiteralMask,
- bool bSameMask )
+static OUString ImplPatternProcessStrictModify(const OUString& rText,
+ const OString& rEditMask,
+ const OUString& rLiteralMask,
+ bool bSameMask)
{
- OUString aText = pEdit->GetText();
+ OUString aText(rText);
// remove leading blanks
if (bSameMask && !rEditMask.isEmpty())
@@ -387,7 +387,20 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
aText = aText.copy( i );
}
- OUString aNewText = ImplPatternReformat(aText, rEditMask, rLiteralMask, 0);
+ return ImplPatternReformat(aText, rEditMask, rLiteralMask, 0);
+}
+
+static void ImplPatternProcessStrictModify( Edit* pEdit,
+ const OString& rEditMask,
+ const OUString& rLiteralMask,
+ bool bSameMask )
+{
+ OUString aText = pEdit->GetText();
+ OUString aNewText = ImplPatternProcessStrictModify(aText,
+ rEditMask,
+ rLiteralMask,
+ bSameMask);
+
if ( aNewText != aText )
{
// adjust selection such that it remains at the end if it was there before
@@ -411,6 +424,43 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
}
}
+static void ImplPatternProcessStrictModify( weld::Entry& rEntry,
+ const OString& rEditMask,
+ const OUString& rLiteralMask,
+ bool bSameMask )
+{
+ OUString aText = rEntry.get_text();
+ OUString aNewText = ImplPatternProcessStrictModify(aText,
+ rEditMask,
+ rLiteralMask,
+ bSameMask);
+
+ if (aNewText != aText)
+ {
+ // adjust selection such that it remains at the end if it was there before
+ int nStartPos, nEndPos;
+ rEntry.get_selection_bounds(nStartPos, nEndPos);
+
+ int nMaxSel = std::max(nStartPos, nEndPos);
+ if (nMaxSel >= aText.getLength())
+ {
+ sal_Int32 nMaxPos = aNewText.getLength();
+ ImplPatternMaxPos(aNewText, rEditMask, 0, bSameMask, nMaxSel, nMaxPos);
+ if (nStartPos == nEndPos)
+ {
+ nStartPos = nMaxPos;
+ nEndPos = nMaxPos;
+ }
+ else if (nStartPos > nMaxPos)
+ nStartPos = nMaxPos;
+ else
+ nEndPos = nMaxPos;
+ }
+ rEntry.set_text(aNewText);
+ rEntry.select_region(nStartPos, nEndPos);
+ }
+}
+
static sal_Int32 ImplPatternLeftPos(const OString& rEditMask, sal_Int32 nCursorPos)
{
// search non-literal predecessor
@@ -447,7 +497,26 @@ static sal_Int32 ImplPatternRightPos( const OUString& rStr, const OString& rEdit
return nNewPos;
}
-static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
+namespace
+{
+ class IEditImplementation
+ {
+ public:
+ virtual ~IEditImplementation() {}
+
+ virtual OUString GetText() const = 0;
+ virtual void SetText(const OUString& rStr, const Selection& rSelection) = 0;
+
+ virtual Selection GetSelection() const = 0;
+ virtual void SetSelection(const Selection& rSelection) = 0;
+
+ virtual bool IsInsertMode() const = 0;
+
+ virtual void SetModified() = 0;
+ };
+}
+
+static bool ImplPatternProcessKeyInput( IEditImplementation& rEdit, const KeyEvent& rKEvt,
const OString& rEditMask,
const OUString& rLiteralMask,
bool bStrictFormat,
@@ -458,7 +527,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
return false;
sal_uInt16 nFormatFlags = 0;
- Selection aOldSel = pEdit->GetSelection();
+ Selection aOldSel = rEdit.GetSelection();
vcl::KeyCode aCode = rKEvt.GetKeyCode();
sal_Unicode cChar = rKEvt.GetCharCode();
sal_uInt16 nKeyCode = aCode.GetCode();
@@ -474,7 +543,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
Selection aSel( ImplPatternLeftPos( rEditMask, nCursorPos ) );
if ( bShift )
aSel.Min() = aOldSel.Min();
- pEdit->SetSelection( aSel );
+ rEdit.SetSelection( aSel );
return true;
}
else if ( nKeyCode == KEY_RIGHT )
@@ -484,12 +553,12 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
Selection aSel( aOldSel );
aSel.Justify();
nCursorPos = aSel.Min();
- aSel.Max() = ImplPatternRightPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos );
+ aSel.Max() = ImplPatternRightPos( rEdit.GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos );
if ( bShift )
aSel.Min() = aOldSel.Min();
else
aSel.Min() = aSel.Max();
- pEdit->SetSelection( aSel );
+ rEdit.SetSelection( aSel );
return true;
}
else if ( nKeyCode == KEY_HOME )
@@ -506,7 +575,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
Selection aSel( nNewPos );
if ( bShift )
aSel.Min() = aOldSel.Min();
- pEdit->SetSelection( aSel );
+ rEdit.SetSelection( aSel );
return true;
}
else if ( nKeyCode == KEY_END )
@@ -521,18 +590,18 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
Selection aSel( aOldSel );
aSel.Justify();
nCursorPos = static_cast<sal_Int32>(aSel.Min());
- ImplPatternMaxPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
+ ImplPatternMaxPos( rEdit.GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
aSel.Max() = nNewPos;
if ( bShift )
aSel.Min() = aOldSel.Min();
else
aSel.Min() = aSel.Max();
- pEdit->SetSelection( aSel );
+ rEdit.SetSelection( aSel );
return true;
}
else if ( (nKeyCode == KEY_BACKSPACE) || (nKeyCode == KEY_DELETE) )
{
- OUString aOldStr( pEdit->GetText() );
+ OUString aOldStr( rEdit.GetText() );
OUStringBuffer aStr( aOldStr );
Selection aSel = aOldSel;
@@ -580,13 +649,12 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
if ( bSameMask )
aStr = ImplPatternReformat( aStr.toString(), rEditMask, rLiteralMask, nFormatFlags );
rbInKeyInput = true;
- pEdit->SetText( aStr.toString(), Selection( nNewPos ) );
- pEdit->SetModifyFlag();
- pEdit->Modify();
+ rEdit.SetText( aStr.toString(), Selection( nNewPos ) );
+ rEdit.SetModified();
rbInKeyInput = false;
}
else
- pEdit->SetSelection( Selection( nNewPos ) );
+ rEdit.SetSelection( Selection( nNewPos ) );
return true;
}
@@ -633,10 +701,10 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
ImplCommaPointCharEqual( cChar, rLiteralMask[nTempPos] ) )
{
nTempPos++;
- ImplPatternMaxPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nNewPos, nTempPos );
+ ImplPatternMaxPos( rEdit.GetText(), rEditMask, nFormatFlags, bSameMask, nNewPos, nTempPos );
if ( nTempPos > nNewPos )
{
- pEdit->SetSelection( Selection( nTempPos ) );
+ rEdit.SetSelection( Selection( nTempPos ) );
return true;
}
}
@@ -653,9 +721,9 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
cChar = 0;
if ( cChar )
{
- OUStringBuffer aStr = pEdit->GetText();
+ OUStringBuffer aStr = rEdit.GetText();
bool bError = false;
- if ( bSameMask && pEdit->IsInsertMode() )
+ if ( bSameMask && rEdit.IsInsertMode() )
{
// crop spaces and literals at the end until current position
sal_Int32 n = aStr.getLength();
@@ -706,9 +774,8 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
{
rbInKeyInput = true;
Selection aNewSel( ImplPatternRightPos( aStr.toString(), rEditMask, nFormatFlags, bSameMask, nNewPos ) );
- pEdit->SetText( aStr.toString(), aNewSel );
- pEdit->SetModifyFlag();
- pEdit->Modify();
+ rEdit.SetText( aStr.toString(), aNewSel );
+ rEdit.SetModified();
rbInKeyInput = false;
}
}
@@ -716,55 +783,58 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
return true;
}
-void PatternFormatter::ImplSetMask(const OString& rEditMask, const OUString& rLiteralMask)
+namespace
{
- m_aEditMask = rEditMask;
- maLiteralMask = rLiteralMask;
- mbSameMask = true;
-
- if ( m_aEditMask.getLength() != maLiteralMask.getLength() )
+ bool ImplSetMask(OString& rEditMask, OUString& rLiteralMask)
{
- OUStringBuffer aBuf(maLiteralMask);
- if (m_aEditMask.getLength() < aBuf.getLength())
- aBuf.remove(m_aEditMask.getLength(), aBuf.getLength() - m_aEditMask.getLength());
- else
- comphelper::string::padToLength(aBuf, m_aEditMask.getLength(), ' ');
- maLiteralMask = aBuf.makeStringAndClear();
- }
+ bool bSameMask = true;
- // Strict mode allows only the input mode if only equal characters are allowed as mask and if
- // only spaces are specified which are not allowed by the mask
- sal_Int32 i = 0;
- char c = 0;
- while ( i < rEditMask.getLength() )
- {
- char cTemp = rEditMask[i];
- if ( cTemp != EDITMASK_LITERAL )
+ if (rEditMask.getLength() != rLiteralMask.getLength())
{
- if ( (cTemp == EDITMASK_ALLCHAR) ||
- (cTemp == EDITMASK_UPPERALLCHAR) ||
- (cTemp == EDITMASK_NUMSPACE) )
- {
- mbSameMask = false;
- break;
- }
- if ( i < rLiteralMask.getLength() )
+ OUStringBuffer aBuf(rLiteralMask);
+ if (rEditMask.getLength() < aBuf.getLength())
+ aBuf.remove(rEditMask.getLength(), aBuf.getLength() - rEditMask.getLength());
+ else
+ comphelper::string::padToLength(aBuf, rEditMask.getLength(), ' ');
+ rLiteralMask = aBuf.makeStringAndClear();
+ }
+
+ // Strict mode allows only the input mode if only equal characters are allowed as mask and if
+ // only spaces are specified which are not allowed by the mask
+ sal_Int32 i = 0;
+ char c = 0;
+ while ( i < rEditMask.getLength() )
+ {
+ char cTemp = rEditMask[i];
+ if ( cTemp != EDITMASK_LITERAL )
{
- if ( rLiteralMask[i] != ' ' )
+ if ( (cTemp == EDITMASK_ALLCHAR) ||
+ (cTemp == EDITMASK_UPPERALLCHAR) ||
+ (cTemp == EDITMASK_NUMSPACE) )
{
- mbSameMask = false;
+ bSameMask = false;
+ break;
+ }
+ if ( i < rLiteralMask.getLength() )
+ {
+ if ( rLiteralMask[i] != ' ' )
+ {
+ bSameMask = false;
+ break;
+ }
+ }
+ if ( !c )
+ c = cTemp;
+ if ( cTemp != c )
+ {
+ bSameMask = false;
break;
}
}
- if ( !c )
- c = cTemp;
- if ( cTemp != c )
- {
- mbSameMask = false;
- break;
- }
+ i++;
}
- i++;
+
+ return bSameMask;
}
}
@@ -782,10 +852,128 @@ PatternFormatter::~PatternFormatter()
void PatternFormatter::SetMask( const OString& rEditMask,
const OUString& rLiteralMask )
{
- ImplSetMask( rEditMask, rLiteralMask );
+ m_aEditMask = rEditMask;
+ maLiteralMask = rLiteralMask;
+ mbSameMask = ImplSetMask(m_aEditMask, maLiteralMask);
ReformatAll();
}
+namespace
+{
+ class EntryImplementation : public IEditImplementation
+ {
+ public:
+ EntryImplementation(weld::PatternFormatter& rFormatter)
+ : m_rFormatter(rFormatter)
+ , m_rEntry(rFormatter.get_widget())
+ {
+ }
+
+ virtual OUString GetText() const override
+ {
+ return m_rEntry.get_text();
+ }
+
+ virtual void SetText(const OUString& rStr, const Selection& rSelection) override
+ {
+ m_rEntry.set_text(rStr);
+ SetSelection(rSelection);
+ }
+
+ virtual Selection GetSelection() const override
+ {
+ int nStartPos, nEndPos;
+ m_rEntry.get_selection_bounds(nStartPos, nEndPos);
+ return Selection(nStartPos, nEndPos);
+ }
+
+ virtual void SetSelection(const Selection& rSelection) override
+ {
+ auto nMin = rSelection.Min();
+ auto nMax = rSelection.Max();
+ m_rEntry.select_region(nMin < 0 ? 0 : nMin, nMax == SELECTION_MAX ? -1 : nMax);
+ }
+
+ virtual bool IsInsertMode() const override
+ {
+ return !m_rEntry.get_overwrite_mode();
+ }
+
+ virtual void SetModified() override
+ {
+ m_rFormatter.Modify();
+ }
+
+ private:
+ weld::PatternFormatter& m_rFormatter;
+ weld::Entry& m_rEntry;
+ };
+}
+
+namespace weld
+{
+ void PatternFormatter::SetStrictFormat(bool bStrict)
+ {
+ if (bStrict != m_bStrictFormat)
+ {
+ m_bStrictFormat = bStrict;
+ if (m_bStrictFormat)
+ ReformatAll();
+ }
+ }
+
+ void PatternFormatter::SetMask(const OString& rEditMask,
+ const OUString& rLiteralMask)
+ {
+ m_aEditMask = rEditMask;
+ m_aLiteralMask = rLiteralMask;
+ m_bSameMask = ImplSetMask(m_aEditMask, m_aLiteralMask);
+ ReformatAll();
+ }
+
+ void PatternFormatter::ReformatAll()
+ {
+ m_rEntry.set_text(ImplPatternReformat(m_rEntry.get_text(), m_aEditMask, m_aLiteralMask, 0/*nFormatFlags*/));
+ if (!m_bSameMask && m_bStrictFormat && m_rEntry.get_editable())
+ m_rEntry.set_overwrite_mode(true);
+ }
+
+ void PatternFormatter::EntryGainFocus()
+ {
+ m_bReformat = false;
+ }
+
+ void PatternFormatter::EntryLostFocus()
+ {
+ if (m_bReformat)
+ ReformatAll();
+ }
+
+ void PatternFormatter::Modify()
+ {
+ if (!m_bInPattKeyInput)
+ {
+ if (m_bStrictFormat)
+ ImplPatternProcessStrictModify(m_rEntry, m_aEditMask, m_aLiteralMask, m_bSameMask);
+ else
+ m_bReformat = true;
+ }
+ m_aModifyHdl.Call(m_rEntry);
+ }
+
+ IMPL_LINK(PatternFormatter, KeyInputHdl, const KeyEvent&, rKEvt, bool)
+ {
+ if (m_aKeyPressHdl.Call(rKEvt))
+ return true;
+ if (rKEvt.GetKeyCode().IsMod2())
+ return false;
+ EntryImplementation aAdapt(*this);
+ return ImplPatternProcessKeyInput(aAdapt, rKEvt, m_aEditMask, m_aLiteralMask,
+ m_bStrictFormat,
+ m_bSameMask, m_bInPattKeyInput);
+ }
+}
+
void PatternFormatter::SetString( const OUString& rStr )
{
if ( GetField() )
@@ -826,11 +1014,58 @@ void PatternField::dispose()
SpinField::dispose();
}
+namespace
+{
+ class EditImplementation : public IEditImplementation
+ {
+ public:
+ EditImplementation(Edit& rEdit)
+ : m_rEdit(rEdit)
+ {
+ }
+
+ virtual OUString GetText() const override
+ {
+ return m_rEdit.GetText();
+ }
+
+ virtual void SetText(const OUString& rStr, const Selection& rSelection) override
+ {
+ m_rEdit.SetText(rStr, rSelection);
+ }
+
+ virtual Selection GetSelection() const override
+ {
+ return m_rEdit.GetSelection();
+ }
+
+ virtual void SetSelection(const Selection& rSelection) override
+ {
+ m_rEdit.SetSelection(rSelection);
+ }
+
+ virtual bool IsInsertMode() const override
+ {
+ return m_rEdit.IsInsertMode();
+ }
+
+ virtual void SetModified() override
+ {
+ m_rEdit.SetModifyFlag();
+ m_rEdit.Modify();
+ }
+
+ private:
+ Edit& m_rEdit;
+ };
+}
+
bool PatternField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
{
- if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
+ EditImplementation aAdapt(*GetField());
+ if ( ImplPatternProcessKeyInput( aAdapt, *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
IsStrictFormat(),
ImplIsSameMask(), ImplGetInPattKeyInput() ) )
return true;
@@ -882,7 +1117,8 @@ bool PatternBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
{
- if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
+ EditImplementation aAdapt(*GetField());
+ if ( ImplPatternProcessKeyInput( aAdapt, *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
IsStrictFormat(),
ImplIsSameMask(), ImplGetInPattKeyInput() ) )
return true;