diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-16 15:08:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-16 16:59:09 +0100 |
commit | fc2a0de9368db335f03461d76491d7fd733697e8 (patch) | |
tree | 9ee0c0304f90805afc5f281bb3b1a2cf4d68b88d /sw/source/ui | |
parent | 4e4a350dff08ef1393cd87d48e095e18bf423821 (diff) |
turn the no-space edit widgets into a editwidget feature
especially because most of them don't handle intercepting text getting *pasted*
into them right, so start with the one which does that right.
Change-Id: If6770798872ed3c72c469656ebf0d4fd76d2171d
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/table/instable.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/utlui/swrenamexnameddlg.cxx | 20 |
4 files changed, 9 insertions, 19 deletions
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 677dc2b2d2ae..db58cafe8834 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -116,7 +116,8 @@ struct GroupUserData class SwNewGlosNameDlg : public ModalDialog { Edit* m_pNewName; - NoSpaceEdit* m_pNewShort; + TextFilter m_aNoSpaceFilter; + Edit* m_pNewShort; OKButton* m_pOk; Edit* m_pOldName; Edit* m_pOldShort; @@ -142,6 +143,7 @@ SwNewGlosNameDlg::SwNewGlosNameDlg(Window* pParent, { get(m_pNewName, "newname"); get(m_pNewShort, "newsc"); + m_pNewShort->SetTextFilter(&m_aNoSpaceFilter); get(m_pOk, "ok"); get(m_pOldName, "oldname"); get(m_pOldShort, "oldsc"); @@ -185,6 +187,7 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, get(m_pNameED, "name"); get(m_pShortNameLbl, "shortnameft"); get(m_pShortNameEdit, "shortname"); + m_pShortNameEdit->SetTextFilter(&m_aNoSpaceFilter); get(m_pCategoryBox, "category"); get(m_pFileRelCB, "relfile"); get(m_pNetRelCB, "relnet"); diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 24ffa27a21b4..6cfe91602781 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -71,11 +71,13 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC SwInsTableDlg::SwInsTableDlg( SwView& rView ) : SfxModalDialog(rView.GetWindow(), "InsertTableDialog", "modules/swriter/ui/inserttable.ui") + , m_aTextFilter(" .<>") , pShell(&rView.GetWrtShell()) , pTAutoFmt(0) , nEnteredValRepeatHeaderNF(-1) { get(m_pNameEdit, "nameedit"); + m_pNameEdit->SetTextFilter(&m_aTextFilter); get(m_pColNF, "colspin"); get(m_pRowNF, "rowspin"); get(m_pHeaderCB, "headercb"); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index fa6800b3ff53..207d8f4d265e 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -63,6 +63,7 @@ using namespace ::com::sun::star; SwFormatTablePage::SwFormatTablePage(Window* pParent, const SfxItemSet& rSet) : SfxTabPage(pParent, "FormatTablePage", "modules/swriter/ui/formattablepage.ui", &rSet) + , m_aTextFilter(" .<>") , pTblData(0) , nSaveWidth(0) , nMinTableWidth(MINLAY) diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 582c3b8bb698..d32fd6eb3a65 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -56,11 +56,11 @@ SwRenameXNamedDlg::SwRenameXNamedDlg( Window* pWin, uno::Reference< container::XNameAccess > & xNA ) : ModalDialog(pWin, "RenameObjectDialog", "modules/swriter/ui/renameobjectdialog.ui") - , m_sRemoveWarning(SW_RESSTR(STR_REMOVE_WARNING)) , xNamed(xN) , xNameAccess(xNA) { get(m_pNewNameED, "entry"); + m_pNewNameED->SetTextFilter(&m_aTextFilter); get(m_pOk, "ok"); OUString sTmp(GetText()); @@ -88,26 +88,10 @@ IMPL_LINK_NOARG(SwRenameXNamedDlg, OkHdl) return 0; } -IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit) +IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, Edit*, pEdit) { OUString sTmp(pEdit->GetText()); - // prevent from pasting illegal characters - const sal_Int32 nLen = sTmp.getLength(); - OUString sMsg; - for(sal_Int32 i = 0; i < pEdit->GetForbiddenChars().getLength(); ++i) - { - const sal_Int32 nTmpLen = sTmp.getLength(); - sTmp = comphelper::string::remove(sTmp, pEdit->GetForbiddenChars()[i]); - if(sTmp.getLength() != nTmpLen) - sMsg += OUString(pEdit->GetForbiddenChars()[i]); - } - if(sTmp.getLength() != nLen) - { - pEdit->SetText(sTmp); - InfoBox(this, m_sRemoveWarning + sMsg).Execute(); - } - m_pOk->Enable(!sTmp.isEmpty() && !xNameAccess->hasByName(sTmp) && (!xSecondAccess.is() || !xSecondAccess->hasByName(sTmp)) |