diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-21 11:34:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-22 12:24:23 +0200 |
commit | 9ebe58f0437bbb5714e629bd22e004ac895086d6 (patch) | |
tree | 219e09feb711636e097baa37beb13942bf8c5bce /include/svtools | |
parent | 51e5afb0042bc6a10f0cd02af5733079b42fa0f7 (diff) |
weld PatternControl
Change-Id: Ie84778c2f127a6b393edbfa08e61b135ec3bcbc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99174
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svtools')
-rw-r--r-- | include/svtools/editbrowsebox.hxx | 102 | ||||
-rw-r--r-- | include/svtools/editimplementation.hxx | 135 |
2 files changed, 18 insertions, 219 deletions
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: */ |