summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx628
-rw-r--r--cui/source/dialogs/SpellDialog.hrc44
-rw-r--r--cui/source/dialogs/SpellDialog.src224
-rw-r--r--cui/source/inc/SpellDialog.hxx73
-rw-r--r--cui/source/inc/helpid.hrc8
5 files changed, 292 insertions, 685 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index f5ae69edce03..5048a6720b0f 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -46,8 +46,6 @@
#include <vcl/graph.hxx>
#include <osl/file.hxx>
#include <cuires.hrc>
-#include <helpid.hrc>
-#include "SpellDialog.hrc"
#include <editeng/optitems.hxx>
#include <editeng/svxenum.hxx>
#include <svx/SpellDialogChildWindow.hxx>
@@ -180,98 +178,66 @@ sal_uInt16 SpellUndoAction_Impl::GetId()const
return m_nId;
}
-HelpFixedText::HelpFixedText( Window* pParent, const ResId& rResId ):
- FixedText( pParent, rResId )
-{
-}
-
-void HelpFixedText::Paint( const Rectangle& rRect )
-{
- Rectangle aTextRect( rRect.Left() + 6, rRect.Top(), rRect.Right() - 6, rRect.Bottom() );
- DrawText( aTextRect, GetText(), TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE );
-}
-
-long HelpFixedText::GetActualHeight( )
-{
- Rectangle rRect( GetPosPixel( ), GetSizePixel() );
- Rectangle aTextRect( rRect.Left() + 6, rRect.Top(), rRect.Right() - 6, rRect.Bottom() );
- Rectangle aBounds = GetTextRect( aTextRect, GetText(), TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE );
-
- return aBounds.getHeight();
-}
-
// class SvxSpellCheckDialog ---------------------------------------------
-SpellDialog::SpellDialog(
- SpellDialogChildWindow* pChildWindow,
- Window * pParent,
- SfxBindings* _pBindings)
- : SfxModelessDialog (_pBindings,
- pChildWindow,
- pParent,
- CUI_RES(RID_SVXDLG_SPELLCHECK)),
-
- aLanguageFT ( this, CUI_RES( FT_LANGUAGE ) ),
- aLanguageLB ( this, CUI_RES( LB_LANGUAGE ) ),
- aExplainFT ( this, CUI_RES( FT_EXPLAIN ) ),
- aExplainLink ( this, CUI_RES( LINK_EXPLAIN ) ),
- aNotInDictFT ( this, CUI_RES( FT_NOTINDICT ) ),
- aSentenceED ( this, CUI_RES( ED_NEWWORD ) ),
- aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ),
- aSuggestionLB ( this, CUI_RES( LB_SUGGESTION ) ),
-
- aIgnorePB ( this, CUI_RES( PB_IGNORE ) ),
- aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ),
- aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ),
- aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ),
- aAddToDictPB ( this, CUI_RES( PB_ADDTODICT ) ),
-
- aChangePB ( this, CUI_RES( PB_CHANGE ) ),
- aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ),
- aAutoCorrPB ( this, CUI_RES( PB_AUTOCORR ) ),
-
- aCheckGrammarCB ( this, CUI_RES( CB_CHECK_GRAMMAR ) ),
-
- aHelpPB ( this, CUI_RES( PB_HELP ) ),
- aOptionsPB ( this, CUI_RES( PB_OPTIONS ) ),
- aUndoPB ( this, CUI_RES( PB_UNDO ) ),
- aClosePB ( this, CUI_RES( PB_CLOSE ) ),
- aBackgroundGB ( this, CUI_RES( GB_BACKGROUND ) ),
-
- aResumeST ( CUI_RES(ST_RESUME )),
- aIgnoreOnceST ( aIgnorePB.GetText()),
- aNoSuggestionsST( CUI_RES(ST_NOSUGGESTIONS)),
- m_sTitleSpelling ( CUI_RES( ST_SPELLING ) ),
- m_sTitleSpellingGrammar ( CUI_RES( ST_SPELLING_AND_GRAMMAR ) ),
- aDialogUndoLink( LINK (this, SpellDialog, DialogUndoHdl)),
- bModified( false ),
- bFocusLocked( true ),
- rParent ( *pChildWindow )
-{
- FreeResource();
+SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
+ Window * pParent, SfxBindings* _pBindings)
+ : SfxModelessDialog (_pBindings, pChildWindow,
+ pParent, "SpellingDialog", "cui/ui/spellingdialog.ui")
+ , aDialogUndoLink(LINK (this, SpellDialog, DialogUndoHdl))
+ , bModified(false)
+ , bFocusLocked(true)
+ , rParent(*pChildWindow)
+{
+ m_sTitleSpellingGrammar = GetText();
+ m_sResumeST = get<FixedText>("resumeft")->GetText();
+ m_sNoSuggestionsST = get<FixedText>("nosuggestionsft")->GetText();
+ m_sTitleSpelling = get<FixedText>("alttitleft")->GetText();
+
+ get(m_pLanguageFT, "languageft");
+ get(m_pLanguageLB, "languagelb");
+ get(m_pExplainFT, "explain");
+ get(m_pExplainLink, "explainlink");
+ get(m_pNotInDictFT, "notindictft");
+ get(m_pSentenceED, "sentence");
+ Size aEdSize(LogicToPixel(Size(197, 48), MAP_APPFONT));
+ m_pSentenceED->set_width_request(aEdSize.Width());
+ m_pSentenceED->set_height_request(aEdSize.Height());
+ get(m_pSuggestionFT, "suggestionsft");
+ get(m_pSuggestionLB, "suggestionslb");
+ m_pSuggestionLB->SetDropDownLineCount(5);
+ m_pSuggestionLB->set_width_request(aEdSize.Width());
+ get(m_pIgnorePB, "ignore");
+ m_sIgnoreOnceST = m_pIgnorePB->GetText();
+ get(m_pIgnoreAllPB, "ignoreall");
+ get(m_pIgnoreRulePB, "ignorerule");
+ get(m_pAddToDictPB, "add");
+ get(m_pAddToDictMB, "addmb");
+ m_pAddToDictMB->SetHelpId(m_pAddToDictPB->GetHelpId());
+ get(m_pChangePB, "change");
+ get(m_pChangeAllPB, "changeall");
+ get(m_pAutoCorrPB, "autocorrect");
+ get(m_pCheckGrammarCB, "checkgrammar");
+ get(m_pOptionsPB, "options");
+ get(m_pUndoPB, "undo");
+ get(m_pClosePB, "close");
xSpell = LinguMgr::GetSpellChecker();
pImpl = new SpellDialog_Impl;
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
Color aCol = rSettings.GetHelpColor();
Wallpaper aWall( aCol );
- aExplainLink.SetBackground( aWall );
- aExplainFT.SetBackground( aWall );
-
- //HelpIds
- aClosePB. SetHelpId(HID_SPLDLG_BUTTON_CLOSE );
- aIgnorePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORE );
- aIgnoreAllPB. SetHelpId(HID_SPLDLG_BUTTON_IGNOREALL);
- aIgnoreRulePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE);
- aChangePB. SetHelpId(HID_SPLDLG_BUTTON_CHANGE );
- aChangeAllPB. SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL);
- aExplainLink. SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN );
+ m_pExplainLink->SetBackground( aWall );
+ m_pExplainFT->SetBackground( aWall );
+
Init_Impl();
// disable controls if service is missing
- if (!xSpell.is())
- Enable( sal_False );
+ Enable(xSpell.is());
+ //InitHdl wants to use virtual methods, so it
+ //can't be called during the ctor, so init
+ //it on next event cycle post-ctor
Application::PostUserEvent( STATIC_LINK(
this, SpellDialog, InitHdl ) );
}
@@ -287,7 +253,6 @@ SpellDialog::~SpellDialog()
linguistic::SaveDictionaries( xDicList );
}
- delete aAddToDictMB.GetPopupMenu();
delete pImpl;
}
@@ -296,33 +261,33 @@ SpellDialog::~SpellDialog()
void SpellDialog::Init_Impl()
{
// initialize handler
- aClosePB.SetClickHdl(LINK( this, SpellDialog, CancelHdl ) );
- aChangePB.SetClickHdl(LINK( this, SpellDialog, ChangeHdl ) );
- aChangeAllPB.SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) );
- aIgnorePB.SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) );
- aIgnoreAllPB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
- aIgnoreRulePB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
- aUndoPB.SetClickHdl(LINK( this, SpellDialog, UndoHdl ) );
+ m_pClosePB->SetClickHdl(LINK( this, SpellDialog, CancelHdl ) );
+ m_pChangePB->SetClickHdl(LINK( this, SpellDialog, ChangeHdl ) );
+ m_pChangeAllPB->SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) );
+ m_pIgnorePB->SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) );
+ m_pIgnoreAllPB->SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
+ m_pIgnoreRulePB->SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
+ m_pUndoPB->SetClickHdl(LINK( this, SpellDialog, UndoHdl ) );
- aAutoCorrPB.SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
- aCheckGrammarCB.SetClickHdl( LINK( this, SpellDialog, CheckGrammarHdl ));
- aOptionsPB .SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
+ m_pAutoCorrPB->SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
+ m_pCheckGrammarCB->SetClickHdl( LINK( this, SpellDialog, CheckGrammarHdl ));
+ m_pOptionsPB->SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
- aSuggestionLB.SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) );
+ m_pSuggestionLB->SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) );
- aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) );
+ m_pSentenceED->SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) );
- aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) );
- aAddToDictPB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) );
+ m_pAddToDictMB->SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) );
+ m_pAddToDictPB->SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) );
- aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
+ m_pLanguageLB->SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
- aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
+ m_pExplainLink->SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
// initialize language ListBox
- aLanguageLB.SetLanguageList( LANG_LIST_SPELL_USED, sal_False, sal_False, sal_True );
+ m_pLanguageLB->SetLanguageList( LANG_LIST_SPELL_USED, sal_False, sal_False, sal_True );
- aSentenceED.ClearModifyFlag();
+ m_pSentenceED->ClearModifyFlag();
SvxGetChangeAllList()->clear();
}
@@ -331,9 +296,9 @@ void SpellDialog::Init_Impl()
void SpellDialog::UpdateBoxes_Impl()
{
sal_Int32 i;
- aSuggestionLB.Clear();
+ m_pSuggestionLB->Clear();
- const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ const SpellErrorDescription* pSpellErrorDescription = m_pSentenceED->GetAlternatives();
LanguageType nAltLanguage = LANGUAGE_NONE;
Sequence< ::rtl::OUString > aNewWords;
@@ -343,8 +308,8 @@ void SpellDialog::UpdateBoxes_Impl()
nAltLanguage = LanguageTag( pSpellErrorDescription->aLocale ).getLanguageType();
aNewWords = pSpellErrorDescription->aSuggestions;
bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
- aExplainLink.SetURL( pSpellErrorDescription->sExplanationURL );
- aExplainFT.SetText( pSpellErrorDescription->sExplanation );
+ m_pExplainLink->SetURL( pSpellErrorDescription->sExplanationURL );
+ m_pExplainFT->SetText( pSpellErrorDescription->sExplanation );
}
if( pSpellErrorDescription && !pSpellErrorDescription->sDialogTitle.isEmpty() )
{
@@ -364,123 +329,49 @@ void SpellDialog::UpdateBoxes_Impl()
for ( i = 0; i < nSize; ++i )
{
String aTmp( pNewWords[i] );
- if ( LISTBOX_ENTRY_NOTFOUND == aSuggestionLB.GetEntryPos( aTmp ) )
+ if ( LISTBOX_ENTRY_NOTFOUND == m_pSuggestionLB->GetEntryPos( aTmp ) )
{
- aSuggestionLB.InsertEntry( aTmp );
- aSuggestionLB.SetEntryFlags(aSuggestionLB.GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE);
+ m_pSuggestionLB->InsertEntry( aTmp );
+ m_pSuggestionLB->SetEntryFlags(m_pSuggestionLB->GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE);
}
}
if(!nSize)
- aSuggestionLB.InsertEntry( aNoSuggestionsST );
- aAutoCorrPB.Enable( nSize > 0 );
+ m_pSuggestionLB->InsertEntry(m_sNoSuggestionsST);
+ m_pAutoCorrPB->Enable( nSize > 0 );
- aSuggestionFT.Enable(nSize > 0);
- aSuggestionLB.Enable(nSize > 0);
+ m_pSuggestionFT->Enable(nSize > 0);
+ m_pSuggestionLB->Enable(nSize > 0);
if( nSize )
{
- aSuggestionLB.SelectEntryPos(0);
+ m_pSuggestionLB->SelectEntryPos(0);
}
- aChangePB.Enable( nSize > 0);
- aChangeAllPB.Enable(nSize > 0);
+ m_pChangePB->Enable( nSize > 0);
+ m_pChangeAllPB->Enable(nSize > 0);
bool bShowChangeAll = !bIsGrammarError;
- aChangeAllPB.Show( bShowChangeAll );
- aExplainFT.Show( !bShowChangeAll );
- aLanguageLB.Enable( bShowChangeAll );
- aIgnoreAllPB.Show( bShowChangeAll );
-
- aAddToDictMB.Show( bShowChangeAll && nDicts > 1);
- aAddToDictPB.Show( bShowChangeAll && nDicts <= 1);
- aIgnoreRulePB.Show( !bShowChangeAll );
- aIgnoreRulePB.Enable(pSpellErrorDescription && !pSpellErrorDescription->sRuleId.isEmpty());
- aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
-
- bool bHasGrammarChecking = rParent.HasGrammarChecking();
- aCheckGrammarCB.Show( bHasGrammarChecking );
- if( !bHasGrammarChecking )
+ m_pChangeAllPB->Show( bShowChangeAll );
+ m_pExplainFT->Show( !bShowChangeAll );
+ m_pLanguageLB->Enable( bShowChangeAll );
+ m_pIgnoreAllPB->Show( bShowChangeAll );
+
+ m_pAddToDictMB->Show( bShowChangeAll && nDicts > 1);
+ m_pAddToDictPB->Show( bShowChangeAll && nDicts <= 1);
+ m_pIgnoreRulePB->Show( !bShowChangeAll );
+ m_pIgnoreRulePB->Enable(pSpellErrorDescription && !pSpellErrorDescription->sRuleId.isEmpty());
+ m_pAutoCorrPB->Show( bShowChangeAll && rParent.HasAutoCorrection() );
+
+ bool bOldShowGrammar = m_pCheckGrammarCB->IsVisible();
+ bool bOldShowExplain = m_pExplainLink->IsVisible();
+
+ m_pCheckGrammarCB->Show(rParent.HasGrammarChecking());
+ m_pExplainLink->Show(!m_pExplainLink->GetURL().isEmpty());
+ if (m_pExplainFT->GetText().Len() == 0)
{
- //resize the dialog to hide the hidden area of the CheckBox
- Size aBackSize = aBackgroundGB.GetSizePixel();
- sal_Int32 nDiff = aBackgroundGB.GetPosPixel().Y() + aBackSize.Height()
- - aCheckGrammarCB.GetPosPixel().Y();
- aBackSize.Height() -= nDiff;
- aBackgroundGB.SetSizePixel(aBackSize);
- Button* aButtons[] = { &aHelpPB, &aOptionsPB, &aUndoPB, &aClosePB, 0 };
- sal_Int32 nButton = 0;
- while( aButtons[nButton])
- {
- Point aPos = aButtons[nButton]->GetPosPixel();
- aPos.Y() -= nDiff;
- aButtons[nButton]->SetPosPixel(aPos);
- ++nButton;
- }
- Size aDlgSize = GetSizePixel();
- aDlgSize.Height() -= nDiff;
- SetSizePixel( aDlgSize );
+ m_pExplainFT->Hide();
+ m_pExplainLink->Hide();
}
- else
- {
- bool bHasExplainLink = !aExplainLink.GetURL().isEmpty();
- aExplainLink.Show( bHasExplainLink );
-
- sal_Int32 nExplainWidth = aExplainLink.GetPosPixel().X() - aExplainFT.GetPosPixel().X();
- if ( !bHasExplainLink )
- nExplainWidth += aExplainLink.GetSizePixel().Width();
- sal_Int32 nExplainHeight = aExplainFT.GetActualHeight();
- sal_Int32 nCurrentHeight = aExplainFT.GetSizePixel().Height();
- if( aExplainFT.GetText().Len() == 0 )
- {
- nExplainHeight = 0;
- aExplainFT.Hide();
- aExplainLink.Hide();
- }
- Size aCtlSize = aExplainFT.GetSizePixel();
- aCtlSize.Height() = nExplainHeight;
- aCtlSize.Width() = nExplainWidth;
- aExplainFT.SetSizePixel( aCtlSize );
-
- aCtlSize = aExplainLink.GetSizePixel();
- aCtlSize.Height() = nExplainHeight;
- aExplainLink.SetSizePixel( aCtlSize );
-
- sal_Int32 nDiff = - ( nCurrentHeight - nExplainHeight );
- if ( nDiff != 0 )
- {
- Control* aControls[] = {
- &aNotInDictFT,
- &aSentenceED,
- &aSuggestionFT,
- &aSuggestionLB,
- &aIgnorePB,
- &aIgnoreAllPB,
- &aIgnoreRulePB,
- &aAddToDictMB,
- &aAddToDictPB,
- &aChangePB,
- &aChangeAllPB,
- &aAutoCorrPB,
- &aCheckGrammarCB,
- &aHelpPB,
- &aOptionsPB,
- &aUndoPB,
- &aClosePB,
- &aBackgroundGB,
- 0
- };
- sal_Int32 nControl = 0;
- while( aControls[nControl])
- {
- Point aPos = aControls[nControl]->GetPosPixel();
- aPos.Y() += nDiff;
- aControls[nControl]->SetPosPixel(aPos);
- ++nControl;
- }
- Size aDlgSize = GetSizePixel();
- aDlgSize.Height() += nDiff;
- SetSizePixel( aDlgSize );
- Invalidate();
- }
- }
+ if (bOldShowExplain != m_pExplainLink->IsVisible() || bOldShowGrammar != m_pCheckGrammarCB->IsVisible())
+ setInitialLayoutSize();
}
// -----------------------------------------------------------------------
@@ -490,18 +381,18 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
//then GetNextSentence() has to be called followed again by MarkNextError()
//MarkNextError is not initally called if the UndoEdit mode is active
bool bNextSentence = false;
- if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) ||
- true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false )))
+ if((!m_pSentenceED->IsUndoEditMode() && m_pSentenceED->MarkNextError( bIgnoreCurrentError )) ||
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, m_pSentenceED->IsUndoEditMode()) && m_pSentenceED->MarkNextError( false )))
{
- const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ const SpellErrorDescription* pSpellErrorDescription = m_pSentenceED->GetAlternatives();
if( pSpellErrorDescription )
{
UpdateBoxes_Impl();
Control* aControls[] =
{
- &aNotInDictFT,
- &aSentenceED,
- &aLanguageFT,
+ m_pNotInDictFT,
+ m_pSentenceED,
+ m_pLanguageFT,
0
};
sal_Int32 nIdx = 0;
@@ -515,8 +406,8 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
if( bNextSentence )
{
//remove undo if a new sentence is active
- aSentenceED.ResetUndo();
- aUndoPB.Enable(sal_False);
+ m_pSentenceED->ResetUndo();
+ m_pUndoPB->Enable(sal_False);
}
}
}
@@ -527,10 +418,10 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
{
pThis->SetUpdateMode( sal_False );
//show or hide AutoCorrect depending on the modules abilities
- pThis->aAutoCorrPB.Show(pThis->rParent.HasAutoCorrection());
+ pThis->m_pAutoCorrPB->Show(pThis->rParent.HasAutoCorrection());
pThis->SpellContinue_Impl();
- pThis->aSentenceED.ResetUndo();
- pThis->aUndoPB.Enable(sal_False);
+ pThis->m_pSentenceED->ResetUndo();
+ pThis->m_pUndoPB->Enable(sal_False);
// get current language
pThis->UpdateBoxes_Impl();
@@ -539,15 +430,15 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
pThis->InitUserDicts();
pThis->LockFocusChanges(true);
- if( pThis->aChangePB.IsEnabled() )
- pThis->aChangePB.GrabFocus();
- else if( pThis->aIgnorePB.IsEnabled() )
- pThis->aIgnorePB.GrabFocus();
- else if( pThis->aClosePB.IsEnabled() )
- pThis->aClosePB.GrabFocus();
+ if( pThis->m_pChangePB->IsEnabled() )
+ pThis->m_pChangePB->GrabFocus();
+ else if( pThis->m_pIgnorePB->IsEnabled() )
+ pThis->m_pIgnorePB->GrabFocus();
+ else if( pThis->m_pClosePB->IsEnabled() )
+ pThis->m_pClosePB->GrabFocus();
pThis->LockFocusChanges(false);
//show grammar CheckBox depending on the modules abilities
- pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() );
+ pThis->m_pCheckGrammarCB->Check( pThis->rParent.IsGrammarChecking() );
pThis->SetUpdateMode( sal_True );
pThis->Show();
return 0;
@@ -557,14 +448,14 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn )
{
- if (&aOptionsPB == pBtn)
+ if (m_pOptionsPB == pBtn)
StartSpellOptDlg_Impl();
- else if(&aAutoCorrPB == pBtn)
+ else if (m_pAutoCorrPB == pBtn)
{
//get the currently selected wrong word
- String sCurrentErrorText = aSentenceED.GetErrorText();
+ String sCurrentErrorText = m_pSentenceED->GetErrorText();
//get the wrong word from the XSpellAlternative
- const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ const SpellErrorDescription* pSpellErrorDescription = m_pSentenceED->GetAlternatives();
if( pSpellErrorDescription )
{
String sWrong(pSpellErrorDescription->sErrorText);
@@ -572,10 +463,10 @@ IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn )
//the current suggestion should be used
//if it's not the 'no suggestions' entry
if(sWrong == sCurrentErrorText &&
- aSuggestionLB.IsEnabled() && aSuggestionLB.GetSelectEntryCount() > 0 &&
- aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ m_pSuggestionLB->IsEnabled() && m_pSuggestionLB->GetSelectEntryCount() > 0 &&
+ !m_sNoSuggestionsST.equals(m_pSuggestionLB->GetSelectEntry()))
{
- sCurrentErrorText = aSuggestionLB.GetSelectEntry();
+ sCurrentErrorText = m_pSuggestionLB->GetSelectEntry();
}
if(sWrong != sCurrentErrorText)
{
@@ -642,14 +533,14 @@ namespace
String SpellDialog::getReplacementString() const
{
- String sOrigString = aSentenceED.GetErrorText();
+ String sOrigString = m_pSentenceED->GetErrorText();
String sReplacement(sOrigString);
- if(aSuggestionLB.IsEnabled() &&
- aSuggestionLB.GetSelectEntryCount()>0 &&
- aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
- sReplacement = aSuggestionLB.GetSelectEntry();
+ if(m_pSuggestionLB->IsEnabled() &&
+ m_pSuggestionLB->GetSelectEntryCount()>0 &&
+ !m_sNoSuggestionsST.equals(m_pSuggestionLB->GetSelectEntry()))
+ sReplacement = m_pSuggestionLB->GetSelectEntry();
return getDotReplacementString(sOrigString, sReplacement);
}
@@ -658,21 +549,21 @@ String SpellDialog::getReplacementString() const
IMPL_LINK_NOARG(SpellDialog, ChangeHdl)
{
- if(aSentenceED.IsUndoEditMode())
+ if(m_pSentenceED->IsUndoEditMode())
{
SpellContinue_Impl();
}
else
{
- aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ m_pSentenceED->UndoActionStart( SPELLUNDO_CHANGE_GROUP );
String aString = getReplacementString();
- aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl());
+ m_pSentenceED->ChangeMarkedWord(aString, GetSelectedLang_Impl());
SpellContinue_Impl();
bModified = false;
- aSentenceED.UndoActionEnd();
+ m_pSentenceED->UndoActionEnd();
}
- if(!aChangePB.IsEnabled())
- aIgnorePB.GrabFocus();
+ if(!m_pChangePB->IsEnabled())
+ m_pIgnorePB->GrabFocus();
return 1;
}
@@ -680,12 +571,12 @@ IMPL_LINK_NOARG(SpellDialog, ChangeHdl)
IMPL_LINK_NOARG(SpellDialog, ChangeAllHdl)
{
- aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ m_pSentenceED->UndoActionStart( SPELLUNDO_CHANGE_GROUP );
String aString = getReplacementString();
LanguageType eLang = GetSelectedLang_Impl();
// add new word to ChangeAll list
- String aOldWord( aSentenceED.GetErrorText() );
+ String aOldWord( m_pSentenceED->GetErrorText() );
SvxPrepareAutoCorrect( aOldWord, aString );
Reference<XDictionary> aXDictionary( SvxGetChangeAllList(), UNO_QUERY );
sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
@@ -698,27 +589,27 @@ IMPL_LINK_NOARG(SpellDialog, ChangeAllHdl)
SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
pAction->SetDictionary(aXDictionary);
pAction->SetAddedWord(aOldWord);
- aSentenceED.AddUndoAction(pAction);
+ m_pSentenceED->AddUndoAction(pAction);
}
- aSentenceED.ChangeMarkedWord(aString, eLang);
+ m_pSentenceED->ChangeMarkedWord(aString, eLang);
SpellContinue_Impl();
bModified = false;
- aSentenceED.UndoActionEnd();
+ m_pSentenceED->UndoActionEnd();
return 1;
}
// -----------------------------------------------------------------------
IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
{
- aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ m_pSentenceED->UndoActionStart( SPELLUNDO_CHANGE_GROUP );
// add word to IgnoreAll list
Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY );
//in case the error has been changed manually it has to be restored
- aSentenceED.RestoreCurrentError();
- if( pButton == &aIgnoreRulePB )
+ m_pSentenceED->RestoreCurrentError();
+ if (pButton == m_pIgnoreRulePB)
{
- const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ const SpellErrorDescription* pSpellErrorDescription = m_pSentenceED->GetAlternatives();
try
{
if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() )
@@ -733,7 +624,7 @@ IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
}
else
{
- String sErrorText(aSentenceED.GetErrorText());
+ String sErrorText(m_pSentenceED->GetErrorText());
sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
sErrorText, sal_False,
::rtl::OUString(), LANGUAGE_NONE );
@@ -743,22 +634,22 @@ IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
pAction->SetDictionary(aXDictionary);
pAction->SetAddedWord(sErrorText);
- aSentenceED.AddUndoAction(pAction);
+ m_pSentenceED->AddUndoAction(pAction);
}
}
SpellContinue_Impl();
bModified = false;
- aSentenceED.UndoActionEnd();
+ m_pSentenceED->UndoActionEnd();
return 1;
}
//-----------------------------------------------------------------------
IMPL_LINK_NOARG(SpellDialog, UndoHdl)
{
- aSentenceED.Undo();
- if(!aSentenceED.GetUndoActionCount())
- aUndoPB.Enable(sal_False);
+ m_pSentenceED->Undo();
+ if(!m_pSentenceED->GetUndoActionCount())
+ m_pUndoPB->Enable(sal_False);
return 0;
}
@@ -770,14 +661,14 @@ IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction )
case SPELLUNDO_CHANGE_TEXTENGINE:
{
if(pAction->IsEnableChangePB())
- aChangePB.Enable(sal_False);
+ m_pChangePB->Enable(sal_False);
if(pAction->IsEnableChangeAllPB())
- aChangeAllPB.Enable(sal_False);
+ m_pChangeAllPB->Enable(sal_False);
}
break;
case SPELLUNDO_CHANGE_NEXTERROR:
{
- aSentenceED.MoveErrorMarkTo((sal_uInt16)pAction->GetOldErrorStart(), (sal_uInt16)pAction->GetOldErrorEnd(), false);
+ m_pSentenceED->MoveErrorMarkTo((sal_uInt16)pAction->GetOldErrorStart(), (sal_uInt16)pAction->GetOldErrorEnd(), false);
if(pAction->IsErrorLanguageSelected())
{
UpdateBoxes_Impl();
@@ -793,7 +684,7 @@ IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction )
case SPELLUNDO_MOVE_ERROREND :
{
if(pAction->GetOffset() != 0)
- aSentenceED.MoveErrorEnd(pAction->GetOffset());
+ m_pSentenceED->MoveErrorEnd(pAction->GetOffset());
}
break;
case SPELLUNDO_UNDO_EDIT_MODE :
@@ -815,16 +706,16 @@ void SpellDialog::Impl_Restore()
//clear the "ChangeAllList"
SvxGetChangeAllList()->clear();
//get a new sentence
- aSentenceED.SetText(rtl::OUString());
- aSentenceED.ResetModified();
+ m_pSentenceED->SetText(rtl::OUString());
+ m_pSentenceED->ResetModified();
//Resolves: fdo#39348 refill the dialog with the currently spelled sentence
SpellContinue_Impl(true);
- aIgnorePB.SetText(aIgnoreOnceST);
+ m_pIgnorePB->SetText(m_sIgnoreOnceST);
}
IMPL_LINK_NOARG(SpellDialog, IgnoreHdl)
{
- if(aIgnorePB.GetText() == aResumeST)
+ if (m_sResumeST.equals(m_pIgnorePB->GetText()))
{
Impl_Restore();
}
@@ -832,7 +723,7 @@ IMPL_LINK_NOARG(SpellDialog, IgnoreHdl)
{
//in case the error has been changed manually it has to be restored,
// since the users choice now was to ignore the error
- aSentenceED.RestoreCurrentError();
+ m_pSentenceED->RestoreCurrentError();
// the word is being ignored
SpellContinue_Impl( false, true );
@@ -853,14 +744,14 @@ sal_Bool SpellDialog::Close()
void SpellDialog::SetSelectedLang_Impl( LanguageType nLang )
{
- aLanguageLB.SelectLanguage( nLang );
+ m_pLanguageLB->SelectLanguage( nLang );
}
// -----------------------------------------------------------------------
LanguageType SpellDialog::GetSelectedLang_Impl() const
{
- sal_Int16 nLang = aLanguageLB.GetSelectLanguage();
+ sal_Int16 nLang = m_pLanguageLB->GetSelectLanguage();
return nLang;
}
@@ -873,22 +764,22 @@ IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox)
//if currently an error is selected then search for alternatives for
//this word and fill the alternatives ListBox accordingly
- String sError = aSentenceED.GetErrorText();
- aSuggestionLB.Clear();
+ String sError = m_pSentenceED->GetErrorText();
+ m_pSuggestionLB->Clear();
if(sError.Len())
{
LanguageType eLanguage = pBox->GetSelectLanguage();
Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage,
Sequence< PropertyValue >() );
if( xAlt.is() )
- aSentenceED.SetAlternatives( xAlt );
+ m_pSentenceED->SetAlternatives( xAlt );
else
{
- aSentenceED.ChangeMarkedWord( sError, eLanguage );
+ m_pSentenceED->ChangeMarkedWord( sError, eLanguage );
SpellContinue_Impl();
}
- aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink));
+ m_pSentenceED->AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink));
}
SpellDialog::UpdateBoxes_Impl();
return 0;
@@ -903,7 +794,7 @@ void SpellDialog::SetLanguage( sal_uInt16 nLang )
*/
{
SetTitle_Impl( nLang );
- aLanguageLB.SelectLanguage( nLang );
+ m_pLanguageLB->SelectLanguage( nLang );
}
static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl )
@@ -928,7 +819,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang)
int SpellDialog::InitUserDicts()
{
- const LanguageType nLang = aLanguageLB.GetSelectLanguage();
+ const LanguageType nLang = m_pLanguageLB->GetSelectLanguage();
const Reference< XDictionary > *pDic = 0;
@@ -952,8 +843,9 @@ int SpellDialog::InitUserDicts()
bool bEnable = false;
const sal_Int32 nSize = pImpl->aDics.getLength();
pDic = pImpl->aDics.getConstArray();
- delete aAddToDictMB.GetPopupMenu();
- PopupMenu* pMenu = new PopupMenu;
+ PopupMenu* pMenu = m_pAddToDictMB->GetPopupMenu();
+ assert(pMenu);
+ pMenu->Clear();
pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0
for (sal_Int32 i = 0; i < nSize; ++i)
@@ -987,14 +879,13 @@ int SpellDialog::InitUserDicts()
++nItemId;
}
}
- aAddToDictMB.SetPopupMenu(pMenu);
- aAddToDictMB.Enable( bEnable );
- aAddToDictPB.Enable( bEnable );
+ m_pAddToDictMB->Enable( bEnable );
+ m_pAddToDictPB->Enable( bEnable );
int nDicts = nItemId-1;
- aAddToDictMB.Show( nDicts > 1 );
- aAddToDictPB.Show( nDicts <= 1 );
+ m_pAddToDictMB->Show( nDicts > 1 );
+ m_pAddToDictPB->Show( nDicts <= 1 );
return nDicts;
}
@@ -1002,7 +893,7 @@ int SpellDialog::InitUserDicts()
//-----------------------------------------------------------------------
IMPL_LINK(SpellDialog, AddToDictClickHdl, PushButton*, EMPTYARG )
{
- return AddToDictionaryExecute(1, aAddToDictMB.GetPopupMenu());
+ return AddToDictionaryExecute(1, m_pAddToDictMB->GetPopupMenu());
}
//-----------------------------------------------------------------------
@@ -1014,11 +905,11 @@ IMPL_LINK(SpellDialog, AddToDictSelectHdl, MenuButton*, pButton )
//-----------------------------------------------------------------------
int SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu *pMenu )
{
- aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ m_pSentenceED->UndoActionStart( SPELLUNDO_CHANGE_GROUP );
//GetErrorText() returns the current error even if the text is already
//manually changed
- const String aNewWord= aSentenceED.GetErrorText();
+ const String aNewWord= m_pSentenceED->GetErrorText();
String aDicName ( pMenu->GetItemText( nItemId ) );
@@ -1042,7 +933,7 @@ int SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu *pMenu )
SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
pAction->SetDictionary( xDic );
pAction->SetAddedWord( aNewWord );
- aSentenceED.AddUndoAction( pAction );
+ m_pSentenceED->AddUndoAction( pAction );
}
// failed because there is already an entry?
if (DIC_ERR_NONE != nAddRes && xDic->getEntry( aNewWord ).is())
@@ -1056,32 +947,32 @@ int SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu *pMenu )
// go on
SpellContinue_Impl();
- aSentenceED.UndoActionEnd();
+ m_pSentenceED->UndoActionEnd();
return 0;
}
//-----------------------------------------------------------------------
IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd)
{
- if (&aSentenceED == pEd)
+ if (m_pSentenceED == pEd)
{
bModified = true;
- aSuggestionLB.SetNoSelection();
- aSuggestionLB.Disable();
- String sNewText( aSentenceED.GetText() );
- aAutoCorrPB.Enable( sNewText != aSentenceED.GetText() );
+ m_pSuggestionLB->SetNoSelection();
+ m_pSuggestionLB->Disable();
+ String sNewText( m_pSentenceED->GetText() );
+ m_pAutoCorrPB->Enable( sNewText != m_pSentenceED->GetText() );
SpellUndoAction_Impl* pSpellAction = new SpellUndoAction_Impl(SPELLUNDO_CHANGE_TEXTENGINE, aDialogUndoLink);
- if(!aChangeAllPB.IsEnabled())
+ if(!m_pChangeAllPB->IsEnabled())
{
- aChangeAllPB.Enable();
+ m_pChangeAllPB->Enable();
pSpellAction->SetEnableChangeAllPB();
}
- if(!aChangePB.IsEnabled())
+ if(!m_pChangePB->IsEnabled())
{
- aChangePB.Enable();
+ m_pChangePB->Enable();
pSpellAction->SetEnableChangePB();
}
- aSentenceED.AddUndoAction(pSpellAction);
+ m_pSentenceED->AddUndoAction(pSpellAction);
}
return 0;
};
@@ -1090,21 +981,12 @@ IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd)
IMPL_LINK_NOARG(SpellDialog, CancelHdl)
{
//apply changes and ignored text parts first - if there are any
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), false);
+ rParent.ApplyChangedSentence(m_pSentenceED->CreateSpellPortions(true), false);
Close();
return 0;
}
//-----------------------------------------------------------------------
-void SpellDialog::Paint( const Rectangle& rRect )
-{
- ModelessDialog::Paint(rRect );
- Rectangle aRect(aBackgroundGB.GetPosPixel(), aBackgroundGB.GetSizePixel());
- DecorationView aDecoView( this );
- aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL);
-}
-
-//-----------------------------------------------------------------------
long SpellDialog::Notify( NotifyEvent& rNEvt )
{
/* #i38338#
@@ -1137,25 +1019,25 @@ void SpellDialog::InvalidateDialog()
{
if( bFocusLocked )
return;
- aIgnorePB.SetText(aResumeST);
+ m_pIgnorePB->SetText(m_sResumeST);
Window* aDisableArr[] =
- {
- &aNotInDictFT,
- &aSentenceED,
- &aSuggestionFT,
- &aSuggestionLB,
- &aLanguageFT,
- &aLanguageLB,
- &aIgnoreAllPB,
- &aIgnoreRulePB,
- &aAddToDictMB,
- &aAddToDictPB,
- &aChangePB,
- &aChangeAllPB,
- &aAutoCorrPB,
- &aUndoPB,
- 0
- };
+ {
+ m_pNotInDictFT,
+ m_pSentenceED,
+ m_pSuggestionFT,
+ m_pSuggestionLB,
+ m_pLanguageFT,
+ m_pLanguageLB,
+ m_pIgnoreAllPB,
+ m_pIgnoreRulePB,
+ m_pAddToDictMB,
+ m_pAddToDictPB,
+ m_pChangePB,
+ m_pChangeAllPB,
+ m_pAutoCorrPB,
+ m_pUndoPB,
+ 0
+ };
sal_Int16 i = 0;
while(aDisableArr[i])
{
@@ -1172,10 +1054,10 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
if(!bUseSavedSentence)
{
//apply changes and ignored text parts
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck);
+ rParent.ApplyChangedSentence(m_pSentenceED->CreateSpellPortions(true), bRecheck);
}
- aSentenceED.ResetIgnoreErrorsAt();
- aSentenceED.ResetModified();
+ m_pSentenceED->ResetIgnoreErrorsAt();
+ m_pSentenceED->ResetModified();
SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck );
if(!bUseSavedSentence)
m_aSavedSentence = aSentence;
@@ -1205,7 +1087,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
sText += aStart->sText;
++aStart;
}
- aSentenceED.SetText(sText);
+ m_pSentenceED->SetText(sText);
aStart = aSentence.begin();
sal_Int32 nStartPosition = 0;
sal_Int32 nEndPosition = 0;
@@ -1224,7 +1106,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
sServiceName = xNamed->getName();
SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(),
aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName);
- aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
+ m_pSentenceED->SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
}
else if(aStart->bIsGrammarError )
{
@@ -1252,20 +1134,20 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
&aStart->aGrammarError.aFullComment,
&aStart->aGrammarError.aRuleIdentifier,
&sFullCommentURL );
- aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
+ m_pSentenceED->SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
}
if(aStart->bIsField)
- aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
- aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
+ m_pSentenceED->SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
+ m_pSentenceED->SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
nStartPosition = nEndPosition;
}
++aStart;
}
//the edit field needs to be modified to apply the change from the ApplyChangeAllList
if(!bHasReplaced)
- aSentenceED.ClearModifyFlag();
- aSentenceED.ResetUndo();
- aUndoPB.Enable(sal_False);
+ m_pSentenceED->ClearModifyFlag();
+ m_pSentenceED->ResetUndo();
+ m_pUndoPB->Enable(sal_False);
bRet = nStartPosition > 0;
}
return bRet;
@@ -1308,16 +1190,32 @@ bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
}
//-----------------------------------------------------------------------
-SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) :
- MultiLineEdit( pParent, rResId ),
- m_nErrorStart(0),
- m_nErrorEnd(0),
- m_bIsUndoEditMode(false)
+SentenceEditWindow_Impl::SentenceEditWindow_Impl(Window* pParent, const ResId& rResId)
+ : MultiLineEdit(pParent, rResId)
+ , m_nErrorStart(0)
+ , m_nErrorEnd(0)
+ , m_bIsUndoEditMode(false)
{
DisableSelectionOnFocus();
}
//-----------------------------------------------------------------------
+SentenceEditWindow_Impl::SentenceEditWindow_Impl(Window * pParent, WinBits nBits)
+ : MultiLineEdit(pParent, nBits)
+ , m_nErrorStart(0)
+ , m_nErrorEnd(0)
+ , m_bIsUndoEditMode(false)
+{
+ DisableSelectionOnFocus();
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSentenceEditWindow(Window *pParent,
+ VclBuilder::stringmap &)
+{
+ return new SentenceEditWindow_Impl(pParent, WB_BORDER|WB_VSCROLL|WB_IGNORETAB);
+}
+
+//-----------------------------------------------------------------------
SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
{
}
@@ -1733,7 +1631,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR ));
pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() &&
LanguageTag( pOldAttrib->GetErrorDescription().aLocale).getLanguageType() ==
- GetSpellDialog()->aLanguageLB.GetSelectLanguage());
+ GetSpellDialog()->m_pLanguageLB->GetSelectLanguage());
AddUndoAction(pAction);
}
else
@@ -1741,11 +1639,11 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
if( !bModified )
ClearModifyFlag();
SpellDialog* pSpellDialog = GetSpellDialog();
- pSpellDialog->aIgnorePB.Enable(bRet);
- pSpellDialog->aIgnoreAllPB.Enable(bRet);
- pSpellDialog->aAutoCorrPB.Enable(bRet);
- pSpellDialog->aAddToDictMB.Enable(bRet);
- pSpellDialog->aAddToDictPB.Enable(bRet);
+ pSpellDialog->m_pIgnorePB->Enable(bRet);
+ pSpellDialog->m_pIgnoreAllPB->Enable(bRet);
+ pSpellDialog->m_pAutoCorrPB->Enable(bRet);
+ pSpellDialog->m_pAddToDictMB->Enable(bRet);
+ pSpellDialog->m_pAddToDictPB->Enable(bRet);
return bRet;
}
@@ -2062,7 +1960,7 @@ void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, sal_Bool bT
{
::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager();
rUndoMgr.AddUndoAction(pAction, bTryMerg);
- GetSpellDialog()->aUndoPB.Enable();
+ GetSpellDialog()->m_pUndoPB->Enable();
}
//-----------------------------------------------------------------------
@@ -2101,18 +1999,18 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
SpellDialog* pSpellDialog = GetSpellDialog();
Control* aControls[] =
{
- &pSpellDialog->aChangeAllPB,
- &pSpellDialog->aExplainFT,
- &pSpellDialog->aIgnoreAllPB,
- &pSpellDialog->aIgnoreRulePB,
- &pSpellDialog->aIgnorePB,
- &pSpellDialog->aSuggestionLB,
- &pSpellDialog->aSuggestionFT,
- &pSpellDialog->aLanguageFT,
- &pSpellDialog->aLanguageLB,
- &pSpellDialog->aAddToDictMB,
- &pSpellDialog->aAddToDictPB,
- &pSpellDialog->aAutoCorrPB,
+ pSpellDialog->m_pChangeAllPB,
+ pSpellDialog->m_pExplainFT,
+ pSpellDialog->m_pIgnoreAllPB,
+ pSpellDialog->m_pIgnoreRulePB,
+ pSpellDialog->m_pIgnorePB,
+ pSpellDialog->m_pSuggestionLB,
+ pSpellDialog->m_pSuggestionFT,
+ pSpellDialog->m_pLanguageFT,
+ pSpellDialog->m_pLanguageLB,
+ pSpellDialog->m_pAddToDictMB,
+ pSpellDialog->m_pAddToDictPB,
+ pSpellDialog->m_pAutoCorrPB,
0
};
sal_Int32 nIdx = 0;
@@ -2131,7 +2029,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
SPELLUNDO_UNDO_EDIT_MODE, GetSpellDialog()->aDialogUndoLink);
AddUndoAction(pAction);
- pSpellDialog->aChangePB.Enable();
+ pSpellDialog->m_pChangePB->Enable();
}
IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc
deleted file mode 100644
index 39657fd6acea..000000000000
--- a/cui/source/dialogs/SpellDialog.hrc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#define FT_SUGGESTION 31
-#define LB_SUGGESTION 32
-#define FT_NOTINDICT 33
-#define ED_NEWWORD 34
-#define FT_LANGUAGE 35
-#define LB_LANGUAGE 36
-#define PB_IGNORE 37
-#define PB_IGNOREALL 38
-#define MB_ADDTODICT 39
-#define PB_CHANGE 40
-#define PB_CHANGEALL 41
-#define PB_AUTOCORR 42
-#define GB_BACKGROUND 43
-#define PB_OPTIONS 44
-#define PB_HELP 45
-#define PB_UNDO 46
-#define PB_CLOSE 47
-#define ST_NOSUGGESTIONS 48
-#define ST_RESUME 50
-#define ST_SPELLING 51
-#define ST_SPELLING_AND_GRAMMAR 52
-#define CB_CHECK_GRAMMAR 54
-#define LINK_EXPLAIN 55
-#define FT_EXPLAIN 56
-#define PB_IGNORERULE 59
-#define PB_ADDTODICT 60
diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src
deleted file mode 100644
index d65adfcdc892..000000000000
--- a/cui/source/dialogs/SpellDialog.src
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cuires.hrc>
-#include "helpid.hrc"
-#include "SpellDialog.hrc"
-
-// RID_SVXDLG_SPELLCHECK -------------------------------------------------
-
-#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }
-
-ModelessDialog RID_SVXDLG_SPELLCHECK
-{
- HelpId = HID_SPELLCHECK ;
- Size = MAP_APPFONT( 270, 208 );
- OutputSize = TRUE;
- Closeable = TRUE ;
- SVLook = TRUE;
- Hide = TRUE;
- Text [ en-US ] = "Spellcheck: " ;
-
- Moveable = TRUE ;
-
- FixedText FT_LANGUAGE
- {
- Pos = MAP_APPFONT( 6, 8 );
- Size = MAP_APPFONT( 100, 8 );
- Text [ en-US ] = "Text languag~e" ;
- };
- ListBox LB_LANGUAGE
- {
- HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_LANGUAGE";
- Pos = MAP_APPFONT( 110, 6 );
- Size = MAP_APPFONT( 93, 55 );
- Border = TRUE;
- Sort = TRUE;
- DropDown = TRUE;
- };
- FixedText FT_EXPLAIN
- {
- Pos = MAP_APPFONT( 1, 18 );
- Size = MAP_APPFONT( 239, 20 );
- VCenter = TRUE ;
- };
- FixedText LINK_EXPLAIN
- {
- Pos = MAP_APPFONT( 240, 18 );
- Size = MAP_APPFONT( 29, 20 );
- Text [ en-US ] = "More..." ;
- Right = TRUE ;
- VCenter = TRUE ;
- };
- FixedText FT_NOTINDICT
- {
- Pos = MAP_APPFONT( 6, 46 );
- Size = MAP_APPFONT( 120, 8 );
- Text [ en-US ] = "~Not in dictionary" ;
- };
-
- MultiLineEdit ED_NEWWORD
- {
- HelpID = "cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK:ED_NEWWORD";
- Pos = MAP_APPFONT( 6, 57 );
- Size = MAP_APPFONT( 197, 48 );
- Border = TRUE;
- VScroll = TRUE;
- IgnoreTab = TRUE;
- };
-
- FixedText FT_SUGGESTION
- {
- Pos = MAP_APPFONT( 6, 108 );
- Size = MAP_APPFONT( 120, 8 );
- Text [ en-US ] = "~Suggestions" ;
- };
- ListBox LB_SUGGESTION
- {
- HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION";
- Pos = MAP_APPFONT( 6, 119 );
- Size = MAP_APPFONT( 197, 48 );
- Border = TRUE;
- };
-
- CheckBox CB_CHECK_GRAMMAR
- {
- HelpID = "cui:CheckBox:RID_SVXDLG_SPELLCHECK:CB_CHECK_GRAMMAR";
- Pos = MAP_APPFONT( 6, 173 );
- Size = MAP_APPFONT( 100, 10 );
- Text [ en-US ] = "Check ~grammar" ;
- Hide = TRUE;
- };
-
- PushButton PB_IGNORE
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORE";
- Pos = MAP_APPFONT( 209, 57 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "~Ignore Once" ;
- };
-
- PushButton PB_IGNOREALL
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNOREALL";
- Pos = MAP_APPFONT( 209, 74 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "I~gnore All" ;
- };
-
- PushButton PB_IGNORERULE
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE";
- Pos = MAP_APPFONT( 209, 74 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "I~gnore Rule" ;
- Hide = TRUE;
- };
-
- MenuButton MB_ADDTODICT
- {
- HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT";
- Pos = MAP_APPFONT( 209, 91 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "~Add" ;
- };
-
- PushButton PB_ADDTODICT
- {
- HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT";
- Pos = MAP_APPFONT( 209, 91 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "~Add" ;
- };
-
- PushButton PB_CHANGE
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE";
- Pos = MAP_APPFONT( 209, 119 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "~Change" ;
- DefButton = TRUE ;
- };
-
- PushButton PB_CHANGEALL
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGEALL";
- Pos = MAP_APPFONT( 209, 137 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "Change A~ll" ;
- };
- PushButton PB_AUTOCORR
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR";
- Pos = MAP_APPFONT( 209, 154 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "AutoCor~rect" ;
- };
- GroupBox GB_BACKGROUND
- {
- Pos = MAP_APPFONT( 1, 41 );
- Size = MAP_APPFONT( 268, 146 );
- Hide=TRUE;
- };
-
- HelpButton PB_HELP
- {
- Pos = MAP_APPFONT( 6, 191 );
- Size = MAP_APPFONT( 55, 14 );
- };
- PushButton PB_OPTIONS
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_OPTIONS";
- Pos = MAP_APPFONT( 87, 191 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "O~ptions..." ;
- };
- PushButton PB_UNDO
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_UNDO";
- Pos = MAP_APPFONT( 148, 191 );
- Size = MAP_APPFONT( 55, 14 );
- Text [ en-US ] = "~Undo" ;
- };
-
- PushButton PB_CLOSE
- {
- HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CLOSE";
- Pos = MAP_APPFONT ( 209 , 191 ) ;
- Size = MAP_APPFONT ( 55 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Cl~ose" ;
- };
- String ST_RESUME
- {
- Text[ en-US ] = "Resu~me";
- };
- String ST_NOSUGGESTIONS
- {
- Text [en-US] = "(no suggestions)";
- };
- String ST_SPELLING
- {
- Text[ en-US ] = "Spelling: $LANGUAGE ($LOCATION)";
- };
- String ST_SPELLING_AND_GRAMMAR
- {
- Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION)";
- };
-};
- // ********************************************************************** EOF
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 60102a46e28a..d3004d2bddd8 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -70,13 +70,14 @@ private:
void CallModifyLink() {m_aModifyLink.Call(this);}
- SpellDialog* GetSpellDialog() const {return (SpellDialog*)GetParent();}
+ SpellDialog* GetSpellDialog() const {return (SpellDialog*)GetParentDialog();}
protected:
virtual long PreNotify( NotifyEvent& rNEvt );
public:
- SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId );
- ~SentenceEditWindow_Impl();
+ SentenceEditWindow_Impl(Window* pParent, const ResId& rResId);
+ SentenceEditWindow_Impl(Window* pParent, WinBits nBits);
+ ~SentenceEditWindow_Impl();
void SetModifyHdl(const Link& rLink) { m_aModifyLink = rLink;}
@@ -115,15 +116,6 @@ public:
void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); }
};
-class HelpFixedText : public FixedText
-{
- public:
- HelpFixedText( Window* pParent, const ResId& rResId );
-
- virtual void Paint( const Rectangle& rRect );
- long GetActualHeight( );
-};
-
// class SvxSpellDialog ---------------------------------------------
class SpellDialogChildWindow;
@@ -134,47 +126,41 @@ class SpellDialog : public SfxModelessDialog
friend class SentenceEditWindow_Impl;
private:
- FixedText aLanguageFT;
- SvxLanguageBox aLanguageLB;
-
- HelpFixedText aExplainFT;
- FixedHyperlink aExplainLink;
-
- FixedText aNotInDictFT;
- SentenceEditWindow_Impl aSentenceED;
+ FixedText* m_pLanguageFT;
+ SvxLanguageBox* m_pLanguageLB;
- FixedText aSuggestionFT;
- ListBox aSuggestionLB;
+ FixedText* m_pExplainFT;
+ FixedHyperlink* m_pExplainLink;
- PushButton aIgnorePB;
- PushButton aIgnoreAllPB;
- PushButton aIgnoreRulePB;
- MenuButton aAddToDictMB;
- PushButton aAddToDictPB;
+ FixedText* m_pNotInDictFT;
+ SentenceEditWindow_Impl* m_pSentenceED;
- PushButton aChangePB;
- PushButton aChangeAllPB;
- PushButton aAutoCorrPB;
+ FixedText* m_pSuggestionFT;
+ ListBox* m_pSuggestionLB;
- CheckBox aCheckGrammarCB;
+ PushButton* m_pIgnorePB;
+ PushButton* m_pIgnoreAllPB;
+ PushButton* m_pIgnoreRulePB;
+ PushButton* m_pAddToDictPB;
+ MenuButton* m_pAddToDictMB;
- HelpButton aHelpPB;
- PushButton aOptionsPB;
- PushButton aUndoPB;
- PushButton aClosePB;
+ PushButton* m_pChangePB;
+ PushButton* m_pChangeAllPB;
+ PushButton* m_pAutoCorrPB;
- GroupBox aBackgroundGB;
+ CheckBox* m_pCheckGrammarCB;
- Image aVendorImage;
+ PushButton* m_pOptionsPB;
+ PushButton* m_pUndoPB;
+ PushButton* m_pClosePB;
- String aResumeST;
- String aIgnoreOnceST;
- String aNoSuggestionsST;
+ OUString m_sResumeST;
+ OUString m_sIgnoreOnceST;
+ OUString m_sNoSuggestionsST;
- const String m_sTitleSpelling;
- const String m_sTitleSpellingGrammar;
+ String m_sTitleSpelling;
+ String m_sTitleSpellingGrammar;
- Size aOldWordEDSize;
Link aDialogUndoLink;
bool bModified;
@@ -225,7 +211,6 @@ private:
void SetTitle_Impl(LanguageType nLang);
protected:
- virtual void Paint( const Rectangle& rRect );
virtual long Notify( NotifyEvent& rNEvt );
String getReplacementString() const;
diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
index db0725d3b76f..f12b152ba758 100644
--- a/cui/source/inc/helpid.hrc
+++ b/cui/source/inc/helpid.hrc
@@ -187,12 +187,6 @@
#define HID_HANGULDLG_EDIT_NEWWORD "CUI_HID_HANGULDLG_EDIT_NEWWORD"
#define HID_OFA_SUBST_APPLY "CUI_HID_OFA_SUBST_APPLY"
#define HID_OFA_SUBST_DELETE "CUI_HID_OFA_SUBST_DELETE"
-#define HID_SPLDLG_BUTTON_CLOSE "CUI_HID_SPLDLG_BUTTON_CLOSE"
-#define HID_SPLDLG_BUTTON_IGNORE "CUI_HID_SPLDLG_BUTTON_IGNORE"
-#define HID_SPLDLG_BUTTON_IGNOREALL "CUI_HID_SPLDLG_BUTTON_IGNOREALL"
-#define HID_SPLDLG_BUTTON_CHANGE "CUI_HID_SPLDLG_BUTTON_CHANGE"
-#define HID_SPLDLG_BUTTON_CHANGEALL "CUI_HID_SPLDLG_BUTTON_CHANGEALL"
-#define HID_SPLDLG_BUTTON_EXPLAIN "CUI_HID_SPLDLG_BUTTON_EXPLAIN"
#define HID_CHARMAP_CTL_SHOWSET "CUI_HID_CHARMAP_CTL_SHOWSET"
#define HID_CHARMAP_CTL_SHOWTEXT "CUI_HID_CHARMAP_CTL_SHOWTEXT"
#define HID_CHARMAP_CTL_SHOWCHAR "CUI_HID_CHARMAP_CTL_SHOWCHAR"
@@ -236,7 +230,6 @@
#define HID_GALLERY_BROWSER "CUI_HID_GALLERY_BROWSER"
#define HID_GALLERY_SEARCH "CUI_HID_GALLERY_SEARCH"
#define HID_GALLERY_APPLY "CUI_HID_GALLERY_APPLY"
-#define HID_SPLDLG_BUTTON_IGNORERULE "CUI_HID_SPLDLG_BUTTON_IGNORERULE"
#define HID_CONFIG_ACCEL "CUI_HID_CONFIG_ACCEL"
#define HID_ACCELCONFIG_LISTBOX "CUI_HID_ACCELCONFIG_LISTBOX"
#define HID_CONFIGGROUP_ACC_LISTBOX "CUI_HID_CONFIGGROUP_ACC_LISTBOX"
@@ -250,7 +243,6 @@
#define HID_HANGULHANJA_EDIT_DLG "CUI_HID_HANGULHANJA_EDIT_DLG"
#define HID_HANGULHANJA_OPT_DICTS_LB "CUI_HID_HANGULHANJA_OPT_DICTS_LB"
#define HID_MULTIPATH "CUI_HID_MULTIPATH"
-#define HID_SPELLCHECK "CUI_HID_SPELLCHECK"
#define HID_TPSIZE_CTRL "CUI_HID_TPSIZE_CTRL"
#define HID_TPROTATION_CTRL1 "CUI_HID_TPROTATION_CTRL1"
#define HID_TPROTATION_CTRL2 "CUI_HID_TPROTATION_CTRL2"