Kaydet (Commit) b08b7677 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#95682 spell dialog: add a button to open special character

Change-Id: I0d070dee9e940b93b294c6b2de180005a5c2248e
üst 8325fcb5
...@@ -221,6 +221,8 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, ...@@ -221,6 +221,8 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
get(m_pOptionsPB, "options"); get(m_pOptionsPB, "options");
get(m_pUndoPB, "undo"); get(m_pUndoPB, "undo");
get(m_pClosePB, "close"); get(m_pClosePB, "close");
get(m_pToolbar, "toolbar");
m_pSentenceED->Init(m_pToolbar);
xSpell = LinguMgr::GetSpellChecker(); xSpell = LinguMgr::GetSpellChecker();
pImpl = new SpellDialog_Impl; pImpl = new SpellDialog_Impl;
...@@ -242,8 +244,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, ...@@ -242,8 +244,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
LINK( this, SpellDialog, InitHdl ), nullptr, true ); LINK( this, SpellDialog, InitHdl ), nullptr, true );
} }
SpellDialog::~SpellDialog() SpellDialog::~SpellDialog()
{ {
disposeOnce(); disposeOnce();
...@@ -281,6 +281,7 @@ void SpellDialog::dispose() ...@@ -281,6 +281,7 @@ void SpellDialog::dispose()
m_pOptionsPB.clear(); m_pOptionsPB.clear();
m_pUndoPB.clear(); m_pUndoPB.clear();
m_pClosePB.clear(); m_pClosePB.clear();
m_pToolbar.clear();
SfxModelessDialog::dispose(); SfxModelessDialog::dispose();
} }
...@@ -317,8 +318,6 @@ void SpellDialog::Init_Impl() ...@@ -317,8 +318,6 @@ void SpellDialog::Init_Impl()
SvxGetChangeAllList()->clear(); SvxGetChangeAllList()->clear();
} }
void SpellDialog::UpdateBoxes_Impl() void SpellDialog::UpdateBoxes_Impl()
{ {
sal_Int32 i; sal_Int32 i;
...@@ -442,6 +441,7 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent ...@@ -442,6 +441,7 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
*/ */
IMPL_LINK_NOARG_TYPED( SpellDialog, InitHdl, void*, void) IMPL_LINK_NOARG_TYPED( SpellDialog, InitHdl, void*, void)
{ {
m_pToolbar->Disable();
SetUpdateMode( false ); SetUpdateMode( false );
//show or hide AutoCorrect depending on the modules abilities //show or hide AutoCorrect depending on the modules abilities
m_pAutoCorrPB->Show(rParent.HasAutoCorrection()); m_pAutoCorrPB->Show(rParent.HasAutoCorrection());
...@@ -1537,9 +1537,44 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) ...@@ -1537,9 +1537,44 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
else else
bChange = false; bChange = false;
} }
else if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS && m_xToolbar)
{
m_xToolbar->Enable();
}
else if(rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && m_xToolbar)
{
m_xToolbar->Disable();
}
return bChange || VclMultiLineEdit::PreNotify(rNEvt); return bChange || VclMultiLineEdit::PreNotify(rNEvt);
} }
void SentenceEditWindow_Impl::Init(VclPtr<ToolBox> &rToolbar)
{
m_xToolbar = rToolbar;
m_xToolbar->SetSelectHdl(LINK(this,SentenceEditWindow_Impl,ToolbarHdl));
}
IMPL_LINK_NOARG_TYPED(SentenceEditWindow_Impl, ToolbarHdl, ToolBox *, void)
{
const sal_uInt16 nCurItemId = m_xToolbar->GetCurItemId();
if (nCurItemId == m_xToolbar->GetItemId("paste"))
Paste();
else if (nCurItemId == m_xToolbar->GetItemId("insert"))
{
if (Edit::GetGetSpecialCharsFunction())
{
OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
if (!aChars.isEmpty())
ReplaceSelected(aChars);
}
}
}
void SentenceEditWindow_Impl::dispose()
{
m_xToolbar.clear();
VclMultiLineEdit::dispose();
}
bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, css::uno::Reference<css::linguistic2::XSpellChecker1> xSpell ) bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, css::uno::Reference<css::linguistic2::XSpellChecker1> xSpell )
{ {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vcl/group.hxx> #include <vcl/group.hxx>
#include <vcl/decoview.hxx> #include <vcl/decoview.hxx>
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include <vcl/toolbox.hxx>
#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Reference.hxx>
...@@ -62,6 +63,7 @@ class SentenceEditWindow_Impl : public VclMultiLineEdit ...@@ -62,6 +63,7 @@ class SentenceEditWindow_Impl : public VclMultiLineEdit
private: private:
std::set< sal_uInt16 > m_aIgnoreErrorsAt; std::set< sal_uInt16 > m_aIgnoreErrorsAt;
VclPtr<ToolBox> m_xToolbar;
sal_uInt16 m_nErrorStart; sal_uInt16 m_nErrorStart;
sal_uInt16 m_nErrorEnd; sal_uInt16 m_nErrorEnd;
bool m_bIsUndoEditMode; bool m_bIsUndoEditMode;
...@@ -71,12 +73,15 @@ private: ...@@ -71,12 +73,15 @@ private:
void CallModifyLink() {m_aModifyLink.Call(*this);} void CallModifyLink() {m_aModifyLink.Call(*this);}
inline SpellDialog* GetSpellDialog() const; inline SpellDialog* GetSpellDialog() const;
DECL_LINK_TYPED(ToolbarHdl, ToolBox*, void);
protected: protected:
virtual bool PreNotify( NotifyEvent& rNEvt ) override; virtual bool PreNotify( NotifyEvent& rNEvt ) override;
public: public:
SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits); SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits);
void Init(VclPtr<ToolBox> &rToolbar);
void SetModifyHdl(const Link<Edit&,void>& rLink) override { m_aModifyLink = rLink;} void SetModifyHdl(const Link<Edit&,void>& rLink) override { m_aModifyLink = rLink;}
void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
...@@ -96,6 +101,7 @@ public: ...@@ -96,6 +101,7 @@ public:
void ResetModified() { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;} void ResetModified() { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;}
virtual bool IsModified() const override { return GetTextEngine()->IsModified(); } virtual bool IsModified() const override { return GetTextEngine()->IsModified(); }
virtual void dispose() override;
bool IsUndoEditMode() const { return m_bIsUndoEditMode;} bool IsUndoEditMode() const { return m_bIsUndoEditMode;}
void SetUndoEditMode(bool bSet); void SetUndoEditMode(bool bSet);
...@@ -151,6 +157,7 @@ private: ...@@ -151,6 +157,7 @@ private:
VclPtr<PushButton> m_pOptionsPB; VclPtr<PushButton> m_pOptionsPB;
VclPtr<PushButton> m_pUndoPB; VclPtr<PushButton> m_pUndoPB;
VclPtr<CloseButton> m_pClosePB; VclPtr<CloseButton> m_pClosePB;
VclPtr<ToolBox> m_pToolbar;
OUString m_sResumeST; OUString m_sResumeST;
OUString m_sIgnoreOnceST; OUString m_sIgnoreOnceST;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment