and now we can remove SwRestrictedComboBox as well
Change-Id: I69aa440ed4ef13e60251bf1aa019208b79b317d2
This commit is contained in:
@@ -463,9 +463,6 @@
|
|||||||
<glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo"
|
<glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo"
|
||||||
generic-name="BookmarkComboBox" parent="GtkComboBox"
|
generic-name="BookmarkComboBox" parent="GtkComboBox"
|
||||||
icon-name="widget-gtk-combobox"/>
|
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"
|
<glade-widget-class title="Category Edit" name="swuilo-FEdit"
|
||||||
generic-name="CategoryEdit" parent="GtkEntry"
|
generic-name="CategoryEdit" parent="GtkEntry"
|
||||||
icon-name="widget-gtk-textentry"/>
|
icon-name="widget-gtk-textentry"/>
|
||||||
|
@@ -447,53 +447,6 @@ IMPL_LINK(SwSelectAddressBlockDialog, IncludeHdl_Impl, RadioButton*, pButton)
|
|||||||
return 0;
|
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_SALUTATION -1
|
||||||
#define USER_DATA_PUNCTUATION -2
|
#define USER_DATA_PUNCTUATION -2
|
||||||
#define USER_DATA_TEXT -3
|
#define USER_DATA_TEXT -3
|
||||||
@@ -503,13 +456,14 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog(
|
|||||||
Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType)
|
Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType)
|
||||||
: SfxModalDialog(pParent, "AddressBlockDialog",
|
: SfxModalDialog(pParent, "AddressBlockDialog",
|
||||||
"modules/swriter/ui/addressblockdialog.ui")
|
"modules/swriter/ui/addressblockdialog.ui")
|
||||||
|
, m_aTextFilter("<>")
|
||||||
, m_rConfigItem(rConfig)
|
, m_rConfigItem(rConfig)
|
||||||
, m_eType(eType)
|
, m_eType(eType)
|
||||||
{
|
{
|
||||||
get(m_pOK, "ok");
|
get(m_pOK, "ok");
|
||||||
get(m_pPreviewWIN, "addrpreview");
|
get(m_pPreviewWIN, "addrpreview");
|
||||||
get(m_pFieldCB, "custom");
|
get(m_pFieldCB, "custom");
|
||||||
m_pFieldCB->SetForbiddenChars("<>");
|
m_pFieldCB->SetTextFilter(&m_aTextFilter);
|
||||||
get(m_pFieldFT, "customft");
|
get(m_pFieldFT, "customft");
|
||||||
get(m_pDownIB, "down");
|
get(m_pDownIB, "down");
|
||||||
get(m_pRightIB, "right");
|
get(m_pRightIB, "right");
|
||||||
|
@@ -170,23 +170,6 @@ public:
|
|||||||
void SelectCurrentItem();
|
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
|
class SwCustomizeAddressBlockDialog : public SfxModalDialog
|
||||||
{
|
{
|
||||||
friend class DDListBox;
|
friend class DDListBox;
|
||||||
@@ -214,7 +197,8 @@ private:
|
|||||||
PushButton* m_pDownIB;
|
PushButton* m_pDownIB;
|
||||||
|
|
||||||
FixedText* m_pFieldFT;
|
FixedText* m_pFieldFT;
|
||||||
SwRestrictedComboBox* m_pFieldCB;
|
ComboBox* m_pFieldCB;
|
||||||
|
TextFilter m_aTextFilter;
|
||||||
|
|
||||||
SwAddressPreview* m_pPreviewWIN;
|
SwAddressPreview* m_pPreviewWIN;
|
||||||
|
|
||||||
|
@@ -247,7 +247,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="swuilo-SwRestrictedComboBox" id="custom">
|
<object class="GtkComboBoxText" id="custom">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="has_entry">True</property>
|
<property name="has_entry">True</property>
|
||||||
|
Reference in New Issue
Block a user