diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-16 16:45:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-16 16:59:10 +0100 |
commit | b7e2a62dec5e9a01b1c83255aedf902f180e4ca0 (patch) | |
tree | e1a1475e8f3061cf333708b7616c09e8329fd0ee /sw | |
parent | missing SetForbiddenChars call (diff) | |
download | core-b7e2a62dec5e9a01b1c83255aedf902f180e4ca0.tar.gz core-b7e2a62dec5e9a01b1c83255aedf902f180e4ca0.zip |
and now we can remove SwRestrictedComboBox as well
Change-Id: I69aa440ed4ef13e60251bf1aa019208b79b317d2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.cxx | 50 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.hxx | 20 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/addressblockdialog.ui | 2 |
3 files changed, 5 insertions, 67 deletions
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 @@ </packing> </child> <child> - <object class="swuilo-SwRestrictedComboBox" id="custom"> + <object class="GtkComboBoxText" id="custom"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="has_entry">True</property> |