summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-16 15:08:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-16 16:59:09 +0100
commitfc2a0de9368db335f03461d76491d7fd733697e8 (patch)
tree9ee0c0304f90805afc5f281bb3b1a2cf4d68b88d /sw
parentwe can shrink the NoSpaceEdit down further (diff)
downloadcore-fc2a0de9368db335f03461d76491d7fd733697e8.tar.gz
core-fc2a0de9368db335f03461d76491d7fd733697e8.zip
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')
-rw-r--r--sw/source/ui/misc/glossary.cxx5
-rw-r--r--sw/source/ui/table/instable.cxx2
-rw-r--r--sw/source/ui/table/tabledlg.cxx1
-rw-r--r--sw/source/ui/utlui/swrenamexnameddlg.cxx20
-rw-r--r--sw/source/uibase/cctrl/actctrl.cxx37
-rw-r--r--sw/source/uibase/inc/actctrl.hxx24
-rw-r--r--sw/source/uibase/inc/glossary.hxx3
-rw-r--r--sw/source/uibase/inc/instable.hxx3
-rw-r--r--sw/source/uibase/inc/swrenamexnameddlg.hxx11
-rw-r--r--sw/source/uibase/table/tablepg.hxx3
-rw-r--r--sw/uiconfig/swriter/ui/autotext.ui2
-rw-r--r--sw/uiconfig/swriter/ui/newuserindexdialog.ui2
-rw-r--r--sw/uiconfig/swriter/ui/renameautotextdialog.ui3
-rw-r--r--sw/uiconfig/swriter/ui/renameobjectdialog.ui2
14 files changed, 24 insertions, 94 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))
diff --git a/sw/source/uibase/cctrl/actctrl.cxx b/sw/source/uibase/cctrl/actctrl.cxx
index 4009eadf9f2b..c20a5b23a38e 100644
--- a/sw/source/uibase/cctrl/actctrl.cxx
+++ b/sw/source/uibase/cctrl/actctrl.cxx
@@ -48,31 +48,6 @@ bool NumEditAction::Notify( NotifyEvent& rNEvt )
return nHandled;
}
-NoSpaceEdit::NoSpaceEdit(Window* pParent)
- : Edit(pParent, WB_BORDER|WB_TABSTOP)
- , sForbiddenChars(OUString(" "))
-{
-}
-
-void NoSpaceEdit::Modify()
-{
- Selection aSel = GetSelection();
- OUString sTemp = GetText();
- for(sal_uInt16 i = 0; i < sForbiddenChars.getLength(); i++)
- {
- sTemp = comphelper::string::remove(sTemp, sForbiddenChars[i]);
- }
- sal_Int32 nDiff = GetText().getLength() - sTemp.getLength();
- if(nDiff)
- {
- aSel.setMin(aSel.getMin() - nDiff);
- aSel.setMax(aSel.getMin());
- SetText(sTemp);
- SetSelection(aSel);
- }
- Edit::Modify();
-}
-
void ReturnActionEdit::KeyInput( const KeyEvent& rEvt)
{
const KeyCode aKeyCode = rEvt.GetKeyCode();
@@ -87,18 +62,6 @@ void ReturnActionEdit::KeyInput( const KeyEvent& rEvt)
Edit::KeyInput(rEvt);
}
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeTableNameEdit(Window *pParent, VclBuilder::stringmap &rMap)
-{
- VclBuilder::ensureDefaultWidthChars(rMap);
- return new TableNameEdit(pParent);
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeNoSpaceEdit(Window *pParent, VclBuilder::stringmap &rMap)
-{
- VclBuilder::ensureDefaultWidthChars(rMap);
- return new NoSpaceEdit(pParent);
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeReturnActionEdit(Window *pParent, VclBuilder::stringmap &rMap)
{
VclBuilder::ensureDefaultWidthChars(rMap);
diff --git a/sw/source/uibase/inc/actctrl.hxx b/sw/source/uibase/inc/actctrl.hxx
index 00d71fd5baef..919a8dd16f6a 100644
--- a/sw/source/uibase/inc/actctrl.hxx
+++ b/sw/source/uibase/inc/actctrl.hxx
@@ -38,30 +38,6 @@ public:
const Link& GetActionHdl() const { return aActionLink; }
};
-// Edit that doesn't accept spaces
-class SW_DLLPUBLIC NoSpaceEdit : public Edit
-{
- OUString sForbiddenChars;
-protected:
- virtual void Modify() SAL_OVERRIDE;
-
-public:
- NoSpaceEdit( Window* pParent );
- void SetForbiddenChars(const OUString& rSet){sForbiddenChars = rSet;}
- const OUString& GetForbiddenChars(){return sForbiddenChars;}
-};
-
-// No space and no full stop
-class TableNameEdit : public NoSpaceEdit
-{
-public:
- TableNameEdit(Window* pWin)
- : NoSpaceEdit(pWin)
- {
- SetForbiddenChars(OUString(" .<>"));
- }
-};
-
// call a link when KEY_RETURN is pressed
class SW_DLLPUBLIC ReturnActionEdit : public Edit
{
diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx
index c34dee5d7d27..b565b71fb7ad 100644
--- a/sw/source/uibase/inc/glossary.hxx
+++ b/sw/source/uibase/inc/glossary.hxx
@@ -91,7 +91,8 @@ class SwGlossaryDlg : public SvxStandardDialog
CheckBox* m_pInsertTipCB;
Edit* m_pNameED;
FixedText* m_pShortNameLbl;
- NoSpaceEdit* m_pShortNameEdit;
+ TextFilter m_aNoSpaceFilter;
+ Edit* m_pShortNameEdit;
SwGlTreeListBox* m_pCategoryBox;
CheckBox* m_pFileRelCB;
CheckBox* m_pNetRelCB;
diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx
index ce47d8d30776..d61de339f2b8 100644
--- a/sw/source/uibase/inc/instable.hxx
+++ b/sw/source/uibase/inc/instable.hxx
@@ -34,7 +34,8 @@ struct SwInsertTableOptions;
class SwInsTableDlg : public SfxModalDialog
{
- TableNameEdit* m_pNameEdit;
+ Edit* m_pNameEdit;
+ TextFilter m_aTextFilter;
NumericField* m_pColNF;
NumericField* m_pRowNF;
diff --git a/sw/source/uibase/inc/swrenamexnameddlg.hxx b/sw/source/uibase/inc/swrenamexnameddlg.hxx
index 7d41baf60894..81d314449172 100644
--- a/sw/source/uibase/inc/swrenamexnameddlg.hxx
+++ b/sw/source/uibase/inc/swrenamexnameddlg.hxx
@@ -32,10 +32,9 @@
class SwRenameXNamedDlg : public ModalDialog
{
- NoSpaceEdit* m_pNewNameED;
- OKButton* m_pOk;
-
- OUString m_sRemoveWarning;
+ Edit* m_pNewNameED;
+ TextFilter m_aTextFilter;
+ OKButton* m_pOk;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess;
@@ -43,7 +42,7 @@ class SwRenameXNamedDlg : public ModalDialog
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xThirdAccess;
DECL_LINK(OkHdl, void *);
- DECL_LINK(ModifyHdl, NoSpaceEdit*);
+ DECL_LINK(ModifyHdl, Edit*);
public:
SwRenameXNamedDlg( Window* pParent,
@@ -52,7 +51,7 @@ public:
void SetForbiddenChars(const OUString& rSet)
{
- m_pNewNameED->SetForbiddenChars(rSet);
+ m_aTextFilter.SetForbiddenChars(rSet);
}
void SetAlternativeAccess(
diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx
index 7ab02588644e..f8d207af61e6 100644
--- a/sw/source/uibase/table/tablepg.hxx
+++ b/sw/source/uibase/table/tablepg.hxx
@@ -37,7 +37,8 @@ struct TColumn
class SwFormatTablePage : public SfxTabPage
{
- TableNameEdit* m_pNameED;
+ Edit* m_pNameED;
+ TextFilter m_aTextFilter;
FixedText* m_pWidthFT;
PercentField m_aWidthMF;
CheckBox* m_pRelWidthCB;
diff --git a/sw/uiconfig/swriter/ui/autotext.ui b/sw/uiconfig/swriter/ui/autotext.ui
index fab9878c1472..d6a3463dcead 100644
--- a/sw/uiconfig/swriter/ui/autotext.ui
+++ b/sw/uiconfig/swriter/ui/autotext.ui
@@ -276,7 +276,7 @@
</packing>
</child>
<child>
- <object class="swlo-NoSpaceEdit" id="shortname">
+ <object class="GtkEntry" id="shortname">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
diff --git a/sw/uiconfig/swriter/ui/newuserindexdialog.ui b/sw/uiconfig/swriter/ui/newuserindexdialog.ui
index 754ee70cea17..6eba268f9fc0 100644
--- a/sw/uiconfig/swriter/ui/newuserindexdialog.ui
+++ b/sw/uiconfig/swriter/ui/newuserindexdialog.ui
@@ -109,7 +109,7 @@
</packing>
</child>
<child>
- <object class="swlo-NoSpaceEdit" id="entry">
+ <object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
diff --git a/sw/uiconfig/swriter/ui/renameautotextdialog.ui b/sw/uiconfig/swriter/ui/renameautotextdialog.ui
index fda9dd794847..88423f44a176 100644
--- a/sw/uiconfig/swriter/ui/renameautotextdialog.ui
+++ b/sw/uiconfig/swriter/ui/renameautotextdialog.ui
@@ -201,10 +201,9 @@
</packing>
</child>
<child>
- <object class="swlo-NoSpaceEdit" id="newsc">
+ <object class="GtkEntry" id="newsc">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
<property name="width_chars">6</property>
<property name="invisible_char_set">True</property>
</object>
diff --git a/sw/uiconfig/swriter/ui/renameobjectdialog.ui b/sw/uiconfig/swriter/ui/renameobjectdialog.ui
index 8e98a39a984b..d162def49cfa 100644
--- a/sw/uiconfig/swriter/ui/renameobjectdialog.ui
+++ b/sw/uiconfig/swriter/ui/renameobjectdialog.ui
@@ -109,7 +109,7 @@
</packing>
</child>
<child>
- <object class="swlo-NoSpaceEdit" id="entry">
+ <object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>