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/uibase | |
parent | we can shrink the NoSpaceEdit down further (diff) | |
download | core-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/source/uibase')
-rw-r--r-- | sw/source/uibase/cctrl/actctrl.cxx | 37 | ||||
-rw-r--r-- | sw/source/uibase/inc/actctrl.hxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/inc/glossary.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/inc/instable.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/inc/swrenamexnameddlg.hxx | 11 | ||||
-rw-r--r-- | sw/source/uibase/table/tablepg.hxx | 3 |
6 files changed, 11 insertions, 70 deletions
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; |