and now we can remove SwRestrictedComboBox as well

Change-Id: I69aa440ed4ef13e60251bf1aa019208b79b317d2
This commit is contained in:
Caolán McNamara
2014-06-16 16:45:46 +01:00
parent f219ec6b5e
commit b7e2a62dec
4 changed files with 5 additions and 70 deletions

View File

@@ -463,9 +463,6 @@
<glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo"
generic-name="BookmarkComboBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Restricted ComboBox" name="swuilo-SwRestrictedComboBox"
generic-name="Restricted ComboBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Category Edit" name="swuilo-FEdit"
generic-name="CategoryEdit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>

View File

@@ -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");

View File

@@ -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;

View File

@@ -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>