summaryrefslogtreecommitdiff
path: root/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/dialog/SwSpellDialogChildWindow.cxx')
-rw-r--r--sw/source/ui/dialog/SwSpellDialogChildWindow.cxx104
1 files changed, 49 insertions, 55 deletions
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
index abd3c50a3297..d99365d1573f 100644
--- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
@@ -66,23 +66,23 @@ SFX_IMPL_CHILDWINDOW_WITHID(SwSpellDialogChildWindow, FN_SPELL_GRAMMAR_DIALOG)
struct SpellState
{
bool m_bInitialCall;
- bool m_bLockFocus; //lock the focus notification while a modal dialog is active
+ bool m_bLockFocus; // lock the focus notification while a modal dialog is active
bool m_bLostFocus;
- //restart and progress information
+ // restart and progress information
sal_uInt16 m_SpellStartPosition;
- bool m_bBodySpelled; //body already spelled
- bool m_bOtherSpelled; //frames, footnotes, headers and footers spelled
- bool m_bStartedInOther; //started the spelling insided of the _other_ area
+ bool m_bBodySpelled; // body already spelled
+ bool m_bOtherSpelled; // frames, footnotes, headers and footers spelled
+ bool m_bStartedInOther; // started the spelling insided of the _other_ area
bool m_bStartedInSelection; // there was an initial text selection
SwPaM* pOtherCursor; // position where the spelling inside the _other_ area started
- bool m_bDrawingsSpelled; //all drawings spelled
- Reference<XTextRange> m_xStartRange; //text range that marks the start of spelling
- const SdrObject* m_pStartDrawing; //draw text object spelling started in
- ESelection m_aStartDrawingSelection; //draw text start selection
+ bool m_bDrawingsSpelled; // all drawings spelled
+ Reference<XTextRange> m_xStartRange; // text range that marks the start of spelling
+ const SdrObject* m_pStartDrawing; // draw text object spelling started in
+ ESelection m_aStartDrawingSelection; // draw text start selection
bool m_bRestartDrawing; // the first selected drawing object is found again
- //lose/get focus information to decide if spelling can be continued
+ // lose/get focus information to decide if spelling can be continued
ShellModes m_eSelMode;
const SwNode* m_pPointNode;
const SwNode* m_pMarkNode;
@@ -91,7 +91,7 @@ struct SpellState
const SdrOutliner* m_pOutliner;
ESelection m_aESelection;
- //iterating over draw text objects
+ // iterating over draw text objects
std::list<SdrTextObj*> m_aTextObjects;
bool m_bTextObjectsCollected;
@@ -109,7 +109,7 @@ struct SpellState
m_pStartDrawing(0),
m_bRestartDrawing(false),
- m_eSelMode(SHELL_MODE_OBJECT), //initially invalid
+ m_eSelMode(SHELL_MODE_OBJECT), // initially invalid
m_pPointNode(0),
m_pMarkNode(0),
m_nPointPos(0),
@@ -141,7 +141,7 @@ static void lcl_LeaveDrawText(SwWrtShell& rSh)
{
rSh.GetDrawView()->SdrEndTextEdit( sal_True );
Point aPt(LONG_MIN, LONG_MIN);
- //go out of the frame
+ // go out of the frame
rSh.SelectObj(aPt, SW_LEAVE_FRAME);
rSh.EnterStdMode();
rSh.GetView().AttrChangedNotify(&rSh);
@@ -198,12 +198,12 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck)
SHELL_MODE_LIST_TEXT == eSelMode ||
SHELL_MODE_TABLE_LIST_TEXT == eSelMode ||
SHELL_MODE_TEXT == eSelMode;
- //Writer text outside of the body
+ // Writer text outside of the body
bool bOtherText = false;
if( m_pSpellState->m_bInitialCall )
{
- //if no text selection exists the cursor has to be set into the text
+ // if no text selection exists the cursor has to be set into the text
if(!bDrawText && !bNormalText)
{
if(!MakeTextSelection_Impl(*pWrtShell, eSelMode))
@@ -218,7 +218,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck)
}
if(bNormalText)
{
- //set cursor to the start of the sentence
+ // set cursor to the start of the sentence
if(!pWrtShell->HasSelection())
pWrtShell->GoStartSentence();
else
@@ -226,7 +226,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck)
pWrtShell->ExpandToSentenceBorders();
m_pSpellState->m_bStartedInSelection = true;
}
- //determine if the selection is outside of the body text
+ // determine if the selection is outside of the body text
bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY);
m_pSpellState->m_SpellStartPosition = bOtherText ? SPELL_START_OTHER : SPELL_START_BODY;
if(bOtherText)
@@ -238,7 +238,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck)
else
{
SwPaM* pCrsr = pWrtShell->GetCrsr();
- //mark the start position only if not at start of doc
+ // mark the start position only if not at start of doc
if(!pWrtShell->IsStartOfDoc())
{
m_pSpellState->m_xStartRange =
@@ -285,10 +285,10 @@ The code below would only be part of the solution.
if(!FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet))
{
lcl_LeaveDrawText(*pWrtShell);
- //now the drawings have been spelled
+ // now the drawings have been spelled
m_pSpellState->m_bDrawingsSpelled = true;
- //the spelling continues at the other content
- //if there's any that has not been spelled yet
+ // the spelling continues at the other content
+ // if there's any that has not been spelled yet
if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt())
{
pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART );
@@ -300,7 +300,7 @@ The code below would only be part of the solution.
}
else
m_pSpellState->m_bOtherSpelled = true;
- //if no result has been found try at the body text - completely
+ // if no result has been found try at the body text - completely
if(!m_pSpellState->m_bBodySpelled && !aRet.size())
{
pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START );
@@ -316,14 +316,14 @@ The code below would only be part of the solution.
}
else
{
- //spell inside of the Writer text
+ // spell inside of the Writer text
if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
{
// if there is a selection (within body or header/footer text)
// then spell/grammar checking should not move outside of it.
if (!m_pSpellState->m_bStartedInSelection)
{
- //find out which text has been spelled body or other
+ // find out which text has been spelled body or other
bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY);
if(bOtherText && m_pSpellState->m_bStartedInOther && m_pSpellState->pOtherCursor)
{
@@ -337,12 +337,12 @@ The code below would only be part of the solution.
}
if(!aRet.size())
{
- //end spelling
+ // end spelling
pWrtShell->SpellEnd();
if(bOtherText)
{
m_pSpellState->m_bOtherSpelled = true;
- //has the body been spelled?
+ // has the body been spelled?
if(!m_pSpellState->m_bBodySpelled)
{
pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START );
@@ -370,7 +370,7 @@ The code below would only be part of the solution.
}
}
- //search for a draw text object that contains error and spell it
+ // search for a draw text object that contains error and spell it
if(!aRet.size() &&
(m_pSpellState->m_bDrawingsSpelled ||
!FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet)))
@@ -383,7 +383,6 @@ The code below would only be part of the solution.
}
// now only the rest of the body text can be spelled -
// if the spelling started inside of the body
- //
bool bCloseMessage = true;
if(!aRet.size() && !m_pSpellState->m_bStartedInSelection)
{
@@ -407,11 +406,11 @@ The code below would only be part of the solution.
}
m_pSpellState->m_xStartRange = 0;
LockFocusNotification( false );
- //take care that the now valid selection is stored
+ // take care that the now valid selection is stored
LoseFocus();
}
else
- bCloseMessage = false; //no closing message if a wrap around has been denied
+ bCloseMessage = false; // no closing message if a wrap around has been denied
}
}
if(!aRet.size())
@@ -420,15 +419,15 @@ The code below would only be part of the solution.
{
LockFocusNotification( true );
OUString sInfo(SW_RES(STR_SPELLING_COMPLETED));
- //#i84610#
+ // #i84610#
Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5
InfoBox(pTemp, sInfo ).Execute();
LockFocusNotification( false );
- //take care that the now valid selection is stored
+ // take care that the now valid selection is stored
LoseFocus();
}
- //close the spelling dialog
+ // close the spelling dialog
GetBindings().GetDispatcher()->Execute(FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
}
}
@@ -533,7 +532,7 @@ void SwSpellDialogChildWindow::GetFocus()
ShellModes eSelMode = pWrtShell->GetView().GetShellMode();
if(eSelMode != m_pSpellState->m_eSelMode)
{
- //prevent initial invalidation
+ // prevent initial invalidation
if(m_pSpellState->m_bLostFocus)
bInvalidate = true;
}
@@ -583,7 +582,7 @@ void SwSpellDialogChildWindow::GetFocus()
void SwSpellDialogChildWindow::LoseFocus()
{
- //prevent initial invalidation
+ // prevent initial invalidation
m_pSpellState->m_bLostFocus = true;
if(m_pSpellState->m_bLockFocus)
return;
@@ -602,7 +601,7 @@ void SwSpellDialogChildWindow::LoseFocus()
case SHELL_MODE_TABLE_TEXT:
case SHELL_MODE_TABLE_LIST_TEXT:
{
- //store a node pointer and a pam-position to be able to check on next GetFocus();
+ // store a node pointer and a pam-position to be able to check on next GetFocus();
SwPaM* pCursor = pWrtShell->GetCrsr();
m_pSpellState->m_pPointNode = pCursor->GetNode(true);
m_pSpellState->m_pMarkNode = pCursor->GetNode(false);
@@ -624,7 +623,7 @@ void SwSpellDialogChildWindow::LoseFocus()
}
}
break;
- default:;//prevent warning
+ default:;// prevent warning
}
}
else
@@ -658,10 +657,8 @@ SwWrtShell* SwSpellDialogChildWindow::GetWrtShell_Impl()
return pView ? pView->GetWrtShellPtr(): 0;
}
-/*-------------------------------------------------------------------------
- set the cursor into the body text - necessary if any object is selected
- on start of the spelling dialog
- -----------------------------------------------------------------------*/
+// set the cursor into the body text - necessary if any object is selected
+// on start of the spelling dialog
bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellModes eSelMode)
{
SwView& rView = rShell.GetView();
@@ -692,7 +689,7 @@ bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellM
rView.AttrChangedNotify(&rShell);
break;
}
- //otherwise no break to deselect the object
+ // otherwise no break to deselect the object
case SHELL_MODE_GRAPHIC:
case SHELL_MODE_OBJECT:
{
@@ -713,7 +710,7 @@ bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellM
{
rView.LeaveDrawCreate();
Point aPt(LONG_MIN, LONG_MIN);
- //go out of the frame
+ // go out of the frame
rShell.SelectObj(aPt, SW_LEAVE_FRAME);
SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
rBind.Invalidate( SID_ATTR_SIZE );
@@ -723,13 +720,12 @@ bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellM
}
}
break;
- default:; //prevent warning
+ default:; // prevent warning
}
return true;
}
-/*-------------------------------------------------------------------------
- select the next draw text object that has a spelling error
- -----------------------------------------------------------------------*/
+
+// select the next draw text object that has a spelling error
bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
{
bool bNextDoc = false;
@@ -739,7 +735,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
SwView& rView = rSh.GetView();
SwDoc* pDoc = rView.GetDocShell()->GetDoc();
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
- //start at the current draw object - if there is any selected
+ // start at the current draw object - if there is any selected
SdrTextObj* pCurrentTextObj = 0;
if ( rMarkList.GetMarkCount() == 1 )
{
@@ -747,7 +743,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
if( pObj && pObj->ISA(SdrTextObj) )
pCurrentTextObj = static_cast<SdrTextObj*>(pObj);
}
- //at first fill the list of drawing objects
+ // at first fill the list of drawing objects
if(!m_pSpellState->m_bTextObjectsCollected )
{
m_pSpellState->m_bTextObjectsCollected = true;
@@ -798,10 +794,10 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
}
if(bHasSpellError)
{
- //now the current one has to be deselected
+ // now the current one has to be deselected
if(pCurrentTextObj)
pDrView->SdrEndTextEdit( sal_True );
- //and the found one should be activated
+ // and the found one should be activated
rSh.MakeVisible(pTextObj->GetLogicRect());
Point aTmp( 0,0 );
rSh.SelectObj( aTmp, 0, pTextObj );
@@ -816,7 +812,6 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
return bNextDoc;
}
-
bool SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, ::svx::SpellPortions& rPortions)
{
bool bRet = false;
@@ -826,8 +821,8 @@ bool SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, ::svx::SpellP
if(pOutliner)
{
bRet = pOutliner->SpellSentence(pSdrView->GetTextEditOutlinerView()->GetEditView(), rPortions, m_bIsGrammarCheckingOn);
- //find out if the current selection is in the first spelled drawing object
- //and behind the initial selection
+ // find out if the current selection is in the first spelled drawing object
+ // and behind the initial selection
if(bRet && m_pSpellState->m_bRestartDrawing)
{
OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
@@ -850,5 +845,4 @@ void SwSpellDialogChildWindow::LockFocusNotification(bool bLock)
m_pSpellState->m_bLockFocus = bLock;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */