diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 7d17202e1933..4a16e41b28d1 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -463,9 +463,6 @@ - diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 4b76162b5366..406c7f891edf 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -447,53 +447,6 @@ IMPL_LINK(SwSelectAddressBlockDialog, IncludeHdl_Impl, RadioButton*, pButton) return 0; } -extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwRestrictedComboBox(Window *pParent, VclBuilder::stringmap &rMap) -{ - WinBits nBits = WB_LEFT|WB_VCENTER|WB_3DLOOK; - - bool bDropdown = VclBuilder::extractDropdown(rMap); - - if (bDropdown) - nBits |= WB_DROPDOWN; - - SwRestrictedComboBox* pComboBox = new SwRestrictedComboBox(pParent, nBits); - pComboBox->EnableAutoSize(true); - return pComboBox; -} - -void SwRestrictedComboBox::KeyInput(const KeyEvent& rEvt) -{ - bool bCallParent = true; - if(rEvt.GetCharCode()) - { - OUString sKey(rEvt.GetCharCode()); - if( -1 != sForbiddenChars.indexOf(sKey)) - bCallParent = false; - } - if(bCallParent) - ComboBox::KeyInput(rEvt); -} - -void SwRestrictedComboBox::Modify() -{ - Selection aSel = GetSelection(); - OUString sTemp = GetText(); - for(sal_Int32 i = 0; i < sForbiddenChars.getLength(); ++i) - { - sTemp = comphelper::string::remove(sTemp, sForbiddenChars[i]); - } - const sal_Int32 nDiff = GetText().getLength() - sTemp.getLength(); - if(nDiff) - { - aSel.setMin(aSel.getMin() - nDiff); - aSel.setMax(aSel.getMin()); - SetText(sTemp); - SetSelection(aSel); - } - if(GetModifyHdl().IsSet()) - GetModifyHdl().Call(this); -} - #define USER_DATA_SALUTATION -1 #define USER_DATA_PUNCTUATION -2 #define USER_DATA_TEXT -3 @@ -503,13 +456,14 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType) : SfxModalDialog(pParent, "AddressBlockDialog", "modules/swriter/ui/addressblockdialog.ui") + , m_aTextFilter("<>") , m_rConfigItem(rConfig) , m_eType(eType) { get(m_pOK, "ok"); get(m_pPreviewWIN, "addrpreview"); get(m_pFieldCB, "custom"); - m_pFieldCB->SetForbiddenChars("<>"); + m_pFieldCB->SetTextFilter(&m_aTextFilter); get(m_pFieldFT, "customft"); get(m_pDownIB, "down"); get(m_pRightIB, "right"); diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 0563d5ae6899..c3d0d5698c84 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -170,23 +170,6 @@ public: void SelectCurrentItem(); }; -// Dialog is used to create custom address blocks as well as custom greeting lines -class SwRestrictedComboBox : public ComboBox -{ - OUString sForbiddenChars; - -protected: - virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE; - virtual void Modify() SAL_OVERRIDE; -public: - SwRestrictedComboBox(Window* pParent, WinBits nStyle = 0) - : ComboBox( pParent, nStyle ) - { - } - - void SetForbiddenChars(const OUString& rSet){sForbiddenChars = rSet;} - -}; class SwCustomizeAddressBlockDialog : public SfxModalDialog { friend class DDListBox; @@ -214,7 +197,8 @@ private: PushButton* m_pDownIB; FixedText* m_pFieldFT; - SwRestrictedComboBox* m_pFieldCB; + ComboBox* m_pFieldCB; + TextFilter m_aTextFilter; SwAddressPreview* m_pPreviewWIN; diff --git a/sw/uiconfig/swriter/ui/addressblockdialog.ui b/sw/uiconfig/swriter/ui/addressblockdialog.ui index a36e235f4098..0b4fd2596b91 100644 --- a/sw/uiconfig/swriter/ui/addressblockdialog.ui +++ b/sw/uiconfig/swriter/ui/addressblockdialog.ui @@ -247,7 +247,7 @@ - + False True True