summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/edit/textund2.hxx6
-rw-r--r--vcl/source/edit/textundo.cxx53
-rw-r--r--vcl/source/edit/textview.cxx146
-rw-r--r--vcl/source/edit/vclmedit.cxx38
-rw-r--r--vcl/source/edit/xtextedt.cxx35
5 files changed, 108 insertions, 170 deletions
diff --git a/vcl/source/edit/textund2.hxx b/vcl/source/edit/textund2.hxx
index 17a29181134f..396317e937b0 100644
--- a/vcl/source/edit/textund2.hxx
+++ b/vcl/source/edit/textund2.hxx
@@ -26,9 +26,9 @@
class TextUndoDelPara : public TextUndo
{
private:
- sal_Bool mbDelObject;
- sal_uLong mnPara;
- TextNode* mpNode; // Zeigt auf das gueltige, nicht zerstoerte Objekt!
+ sal_Bool mbDelObject;
+ sal_uLong mnPara;
+ TextNode* mpNode; // points at the valid not-destroyed object
public:
TYPEINFO();
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index 3cbb85d6999c..51b3826da802 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -65,10 +65,6 @@ void Shorten (OUString& rString)
} // namespace
-//
-// TextUndoManager
-// ===============
-//
TextUndoManager::TextUndoManager( TextEngine* p )
{
@@ -115,9 +111,6 @@ sal_Bool TextUndoManager::Redo()
void TextUndoManager::UndoRedoStart()
{
DBG_ASSERT( GetView(), "Undo/Redo: Active View?" );
-
-// if ( GetView() )
-// GetView()->HideSelection();
}
void TextUndoManager::UndoRedoEnd()
@@ -134,12 +127,6 @@ void TextUndoManager::UndoRedoEnd()
mpTextEngine->FormatAndUpdate( GetView() );
}
-
-//
-// TextUndo
-// ========
-//
-
TextUndo::TextUndo( TextEngine* p )
{
mpTextEngine = p;
@@ -160,12 +147,6 @@ void TextUndo::SetSelection( const TextSelection& rSel )
GetView()->ImpSetSelection( rSel );
}
-
-//
-// TextUndoDelPara
-// ===============
-//
-
TextUndoDelPara::TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, sal_uLong nPara )
: TextUndo( pTextEngine )
{
@@ -183,7 +164,7 @@ TextUndoDelPara::~TextUndoDelPara()
void TextUndoDelPara::Undo()
{
GetTextEngine()->InsertContent( mpNode, mnPara );
- mbDelObject = sal_False; // gehoert wieder der Engine
+ mbDelObject = sal_False; // belongs again to the engine
if ( GetView() )
{
@@ -194,18 +175,17 @@ void TextUndoDelPara::Undo()
void TextUndoDelPara::Redo()
{
- // pNode stimmt nicht mehr, falls zwischendurch Undos, in denen
- // Absaetze verschmolzen sind.
+ // pNode is not valid anymore in case an Undo joined paragraphs
mpNode = GetDoc()->GetNodes().GetObject( mnPara );
delete GetTEParaPortions()->GetObject( mnPara );
GetTEParaPortions()->Remove( mnPara );
- // Node nicht loeschen, haengt im Undo!
+ // do not delete Node because of Undo!
GetDoc()->GetNodes().Remove( mnPara );
GetTextEngine()->ImpParagraphRemoved( mnPara );
- mbDelObject = sal_True; // gehoert wieder dem Undo
+ mbDelObject = sal_True; // belongs again to the Undo
sal_uLong nParas = GetDoc()->GetNodes().Count();
sal_uLong n = mnPara < nParas ? mnPara : (nParas-1);
@@ -219,12 +199,6 @@ OUString TextUndoDelPara::GetComment () const
return ResId(STR_TEXTUNDO_DELPARA, *ImplGetResMgr());
}
-
-//
-// TextUndoConnectParas
-// ====================
-//
-
TextUndoConnectParas::TextUndoConnectParas( TextEngine* pTextEngine, sal_uLong nPara, sal_uInt16 nPos )
: TextUndo( pTextEngine )
{
@@ -253,12 +227,6 @@ OUString TextUndoConnectParas::GetComment () const
return ResId(STR_TEXTUNDO_CONNECTPARAS, *ImplGetResMgr());
}
-
-//
-// TextUndoSplitPara
-// =================
-//
-
TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, sal_uLong nPara, sal_uInt16 nPos )
: TextUndo( pTextEngine )
{
@@ -287,12 +255,6 @@ OUString TextUndoSplitPara::GetComment () const
return ResId(STR_TEXTUNDO_SPLITPARA, *ImplGetResMgr());
}
-
-//
-// TextUndoInsertChars
-// ===================
-//
-
TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
: TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
@@ -342,13 +304,6 @@ OUString TextUndoInsertChars::GetComment () const
return OUString(ResId(STR_TEXTUNDO_INSERTCHARS, *ImplGetResMgr())).replaceAll("$1", sText);
}
-
-
-//
-// TextUndoRemoveChars
-// ===================
-//
-
TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
: TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 44836161a8de..5b5adde5ef7b 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -177,9 +177,6 @@ struct ImpTextView
bool mbCursorAtEndOfLine;
};
-// -------------------------------------------------------------------------
-// (+) class TextView
-// -------------------------------------------------------------------------
TextView::TextView( TextEngine* pEng, Window* pWindow ) :
mpImpl(new ImpTextView)
{
@@ -254,12 +251,11 @@ void TextView::Invalidate()
void TextView::SetSelection( const TextSelection& rTextSel, sal_Bool bGotoCursor )
{
- // Falls jemand gerade ein leeres Attribut hinterlassen hat,
- // und dann der Outliner die Selektion manipulitert:
+ // if someone left an empty attribute and then the Outliner manipulated the selection
if ( !mpImpl->maSelection.HasRange() )
mpImpl->mpTextEngine->CursorMoved( mpImpl->maSelection.GetStart().GetPara() );
- // Wenn nach einem KeyInput die Selection manipuliert wird:
+ // if the selection is manipulated after a KeyInput
mpImpl->mpTextEngine->CheckIdleFormatter();
HideSelection();
@@ -303,8 +299,8 @@ void TextView::ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle c
pSelection = NULL;
else
{
- // Richtige Hintergrundfarbe einstellen.
- // Ich bekomme leider nicht mit, ob sich diese inzwischen geaendert hat.
+ // set correct background color;
+ // unfortunately we cannot detect if it has changed
Font aFont = mpImpl->mpTextEngine->GetFont();
Color aColor = pOut->GetBackground().GetColor();
aColor.SetTransparency( 0 );
@@ -353,8 +349,8 @@ void TextView::ImpPaint( const Rectangle& rRect, sal_Bool bUseVirtDev )
}
else
{
- // Das VirtDev kann bei einem Resize sehr gross werden =>
- // irgendwann mal kleiner machen!
+ // the VirtDev can get very large on Resize =>
+ // shrink now and then
if ( ( aOutSz.Height() > ( rRect.GetHeight() + 20 ) ) ||
( aOutSz.Width() > ( rRect.GetWidth() + 20 ) ) )
{
@@ -367,7 +363,7 @@ void TextView::ImpPaint( const Rectangle& rRect, sal_Bool bUseVirtDev )
}
if ( !bVDevValid )
{
- ImpPaint( rRect, sal_False /* ohne VDev */ );
+ ImpPaint( rRect, sal_False /* without VDev */ );
return;
}
@@ -420,7 +416,7 @@ void TextView::ImpHighlight( const TextSelection& rSel )
if ( nPara == nEndPara )
nEndLine = pTEParaPortion->GetLineNumber( aSel.GetEnd().GetIndex(), sal_True );
- // ueber die Zeilen iterieren....
+ // iterate over all lines
for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ )
{
TextLine* pLine = pTEParaPortion->GetLines()[ nLine ];
@@ -431,7 +427,7 @@ void TextView::ImpHighlight( const TextSelection& rSel )
if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) )
nEndIndex = aSel.GetEnd().GetIndex();
- // Kann passieren, wenn am Anfang einer umgebrochenen Zeile.
+ // possible if at the beginning of a wrapped line
if ( nEndIndex < nStartIndex )
nEndIndex = nStartIndex;
@@ -446,7 +442,7 @@ void TextView::ImpHighlight( const TextSelection& rSel )
Point aBottomRight( aTmpRect.BottomRight() );
aBottomRight.X()--;
- // Nur Painten, wenn im sichtbaren Bereich...
+ // only paint if in the visible region
if ( ( aTopLeft.X() < aBottomRight.X() ) && ( aBottomRight.Y() >= aVisArea.Top() ) )
{
Point aPnt1( GetWindowPos( aTopLeft ) );
@@ -540,12 +536,12 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
sal_Bool bDone = sal_True;
sal_Bool bModified = sal_False;
sal_Bool bMoved = sal_False;
- sal_Bool bEndKey = sal_False; // spezielle CursorPosition
+ sal_Bool bEndKey = sal_False; // special CursorPosition
sal_Bool bAllowIdle = sal_True;
- // Um zu pruefen ob durch irgendeine Aktion mModified, das lokale
- // bModified wird z.B. bei Cut/Paste nicht gesetzt, weil dort an anderen
- // Stellen das updaten erfolgt.
+ // check mModified;
+ // the local bModified is not set e.g. by Cut/Paste, as here
+ // the update happens somewhere else
sal_Bool bWasModified = mpImpl->mpTextEngine->IsModified();
mpImpl->mpTextEngine->SetModified( sal_False );
@@ -588,7 +584,7 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
}
break;
- default: // wird dann evtl. unten bearbeitet.
+ default: // might get processed below
eFunc = KEYFUNC_DONTKNOW;
}
}
@@ -717,8 +713,8 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
break;
case KEY_RETURN:
{
- // Shift-RETURN darf nicht geschluckt werden, weil dann keine
- // mehrzeilige Eingabe in Dialogen/Property-Editor moeglich.
+ // do not swallow Shift-RETURN, as this would disable multi-line entries
+ // in dialogs & property editors
if ( !mpImpl->mbReadOnly && !rKeyEvent.GetKeyCode().IsMod1() &&
!rKeyEvent.GetKeyCode().IsMod2() && ImplCheckTextLen( OUString('x') ) )
{
@@ -755,7 +751,7 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
if ( TextEngine::IsSimpleCharInput( rKeyEvent ) )
{
sal_Unicode nCharCode = rKeyEvent.GetCharCode();
- if ( !mpImpl->mbReadOnly && ImplCheckTextLen( OUString(nCharCode) ) ) // sonst trotzdem das Zeichen schlucken...
+ if ( !mpImpl->mbReadOnly && ImplCheckTextLen( OUString(nCharCode) ) ) // otherwise swallow the character anyway
{
aCurSel = mpImpl->mpTextEngine->ImpInsertText( nCharCode, aCurSel, !IsInsertMode(), sal_True );
bModified = sal_True;
@@ -777,7 +773,7 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
if ( bModified )
{
- // Idle-Formatter nur, wenn AnyInput.
+ // Idle-Formatter only if AnyInput
if ( bAllowIdle && Application::AnyInput( VCL_INPUT_KEYBOARD) )
mpImpl->mpTextEngine->IdleFormatAndUpdate( this );
else
@@ -785,7 +781,7 @@ sal_Bool TextView::KeyInput( const KeyEvent& rKeyEvent )
}
else if ( bMoved )
{
- // Selection wird jetzt gezielt in ImpMoveCursor gemalt.
+ // selection is painted now in ImpMoveCursor
ImpShowCursor( mpImpl->mbAutoScroll, sal_True, bEndKey );
}
@@ -819,7 +815,7 @@ void TextView::MouseButtonUp( const MouseEvent& rMouseEvent )
void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
- mpImpl->mpTextEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown
+ mpImpl->mpTextEngine->CheckIdleFormatter(); // for fast typing and MouseButtonDown
mpImpl->mnTravelXPos = TRAVEL_X_DONTKNOW;
mpImpl->mbClickedInSelection = IsSelectionAtPoint( rMouseEvent.GetPosPixel() );
@@ -833,19 +829,19 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
// we need to reevaluate the selection after the notification has been fired.
mpImpl->mbClickedInSelection = IsSelectionAtPoint( rMouseEvent.GetPosPixel() );
- // Sonderbehandlungen
+ // special cases
if ( !rMouseEvent.IsShift() && ( rMouseEvent.GetClicks() >= 2 ) )
{
if ( rMouseEvent.IsMod2() )
{
HideSelection();
ImpSetSelection( mpImpl->maSelection.GetEnd() );
- SetCursorAtPoint( rMouseEvent.GetPosPixel() ); // Wird von SelectionEngine bei MOD2 nicht gesetzt
+ SetCursorAtPoint( rMouseEvent.GetPosPixel() ); // not set by SelectionEngine for MOD2
}
if ( rMouseEvent.GetClicks() == 2 )
{
- // Wort selektieren
+ // select word
if ( mpImpl->maSelection.GetEnd().GetIndex() < mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection.GetEnd().GetPara() ) )
{
HideSelection();
@@ -882,7 +878,7 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
}
else if ( rMouseEvent.GetClicks() == 3 )
{
- // Absatz selektieren
+ // select paragraph
if ( mpImpl->maSelection.GetStart().GetIndex() || ( mpImpl->maSelection.GetEnd().GetIndex() < mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection.GetEnd().GetPara() ) ) )
{
HideSelection();
@@ -906,7 +902,7 @@ void TextView::MouseMove( const MouseEvent& rMouseEvent )
void TextView::Command( const CommandEvent& rCEvt )
{
- mpImpl->mpTextEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown
+ mpImpl->mpTextEngine->CheckIdleFormatter(); // for fast typing and MouseButtonDown
mpImpl->mpTextEngine->SetActiveView( this );
if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
@@ -919,7 +915,7 @@ void TextView::Command( const CommandEvent& rCEvt )
}
else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT )
{
- DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "COMMAND_ENDEXTTEXTINPUT => Kein Start ?" );
+ DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "COMMAND_ENDEXTTEXTINPUT => No Start ?" );
if( mpImpl->mpTextEngine->mpIMEInfos )
{
TEParaPortion* pPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( mpImpl->mpTextEngine->mpIMEInfos->aPos.GetPara() );
@@ -940,7 +936,7 @@ void TextView::Command( const CommandEvent& rCEvt )
}
else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT )
{
- DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "COMMAND_EXTTEXTINPUT => Kein Start ?" );
+ DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "COMMAND_EXTTEXTINPUT => No Start ?" );
if( mpImpl->mpTextEngine->mpIMEInfos )
{
const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
@@ -1044,7 +1040,7 @@ void TextView::Command( const CommandEvent& rCEvt )
void TextView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor )
{
- // Die Einstellung hat mehr Gewicht:
+ // this setting has more weight
if ( !mpImpl->mbAutoScroll )
bGotoCursor = sal_False;
ImpShowCursor( bGotoCursor, bForceVisCursor, sal_False );
@@ -1057,7 +1053,7 @@ void TextView::HideCursor()
void TextView::Scroll( long ndX, long ndY )
{
- DBG_ASSERT( mpImpl->mpTextEngine->IsFormatted(), "Scroll: Nicht formatiert!" );
+ DBG_ASSERT( mpImpl->mpTextEngine->IsFormatted(), "Scroll: Not formatted!" );
if ( !ndX && !ndY )
return;
@@ -1122,7 +1118,7 @@ void TextView::Copy( uno::Reference< datatransfer::clipboard::XClipboard >& rxCl
{
TETextDataObject* pDataObj = new TETextDataObject( GetSelected() );
- if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // Dann auch als HTML
+ if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // then also as HTML
mpImpl->mpTextEngine->Write( pDataObj->GetHTMLStream(), &mpImpl->maSelection, sal_True );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
@@ -1236,7 +1232,7 @@ void TextView::SetReadOnly( sal_Bool bReadOnly )
TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
{
- // Eigentlich nur bei Up/Down noetig, aber was solls.
+ // normally only needed for Up/Down; but who cares
mpImpl->mpTextEngine->CheckIdleFormatter();
TextPaM aPaM( mpImpl->maSelection.GetEnd() );
@@ -1312,7 +1308,7 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
break;
}
- // Bewirkt evtl. ein CreateAnchor oder Deselection all
+ // might cause a CreateAnchor or Deselection all
mpImpl->mpSelEngine->CursorPosChanging( bSelect, aTranslatedKeyEvent.GetKeyCode().IsMod1() );
if ( aOldEnd != aPaM )
@@ -1323,7 +1319,7 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
aNewSelection.GetEnd() = aPaM;
if ( bSelect )
{
- // Dann wird die Selektion erweitert...
+ // extend the selection
ImpSetSelection( aNewSelection );
ShowSelection( TextSelection( aOldEnd, aPaM ) );
}
@@ -1468,7 +1464,7 @@ TextPaM TextView::CursorWordRight( const TextPaM& rPaM )
TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
{
- if ( mpImpl->maSelection.HasRange() ) // dann nur Sel. loeschen
+ if ( mpImpl->maSelection.HasRange() ) // only delete selection
return mpImpl->mpTextEngine->ImpDeleteText( mpImpl->maSelection );
TextPaM aStartPaM = mpImpl->maSelection.GetStart();
@@ -1495,7 +1491,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
aEndPaM.GetIndex() = 0;
else if ( aEndPaM.GetPara() )
{
- // Absatz davor
+ // previous paragraph
aEndPaM.GetPara()--;
aEndPaM.GetIndex() = 0;
}
@@ -1521,7 +1517,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
aEndPaM.GetIndex() = pNode->GetText().Len();
else if ( aEndPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) )
{
- // Absatz danach
+ // next paragraph
aEndPaM.GetPara()++;
TextNode* pNextNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
aEndPaM.GetIndex() = pNextNode->GetText().Len();
@@ -1549,18 +1545,18 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM )
TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), sal_False );
- if ( nLine ) // gleicher Absatz
+ if ( nLine ) // same paragraph
{
sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine-1, nX );
aPaM.GetIndex() = nCharPos;
- // Wenn davor eine autom.Umgebrochene Zeile, und ich muss genau an das
- // Ende dieser Zeile, landet der Cursor in der aktuellen Zeile am Anfang
- // Siehe Problem: Letztes Zeichen einer autom.umgebr. Zeile = Cursor
+ // If we need to go to the end of a line that was wrapped automatically,
+ // the cursor ends up at the beginning of the 2nd line
+ // Problem: Last character of an automatically wrapped line = Cursor
TextLine* pLine = pPPortion->GetLines()[ nLine - 1 ];
if ( aPaM.GetIndex() && ( aPaM.GetIndex() == pLine->GetEnd() ) )
aPaM.GetIndex()--;
}
- else if ( rPaM.GetPara() ) // vorheriger Absatz
+ else if ( rPaM.GetPara() ) // previous paragraph
{
aPaM.GetPara()--;
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
@@ -1592,12 +1588,12 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX );
aPaM.GetIndex() = nCharPos;
- // Sonderbehandlung siehe CursorUp...
+ // special case CursorUp
TextLine* pLine = pPPortion->GetLines()[ nLine + 1 ];
if ( ( aPaM.GetIndex() == pLine->GetEnd() ) && ( aPaM.GetIndex() > pLine->GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().Len() )
aPaM.GetIndex()--;
}
- else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) ) // naechster Absatz
+ else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) ) // next paragraph
{
aPaM.GetPara()++;
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
@@ -1632,14 +1628,14 @@ TextPaM TextView::CursorEndOfLine( const TextPaM& rPaM )
TextLine* pLine = pPPortion->GetLines()[ nLine ];
aPaM.GetIndex() = pLine->GetEnd();
- if ( pLine->GetEnd() > pLine->GetStart() ) // Leerzeile
+ if ( pLine->GetEnd() > pLine->GetStart() ) // empty line
{
sal_Unicode cLastChar = pPPortion->GetNode()->GetText().GetChar((sal_uInt16)(aPaM.GetIndex()-1) );
if ( ( cLastChar == ' ' ) && ( aPaM.GetIndex() != pPPortion->GetNode()->GetText().Len() ) )
{
- // Bei einem Blank in einer autom. umgebrochenen Zeile macht es Sinn,
- // davor zu stehen, da der Anwender hinter das Wort will.
- // Wenn diese geaendert wird, Sonderbehandlung fuer Pos1 nach End!
+ // for a blank in an automatically-wrapped line it is better to stand before it,
+ // as the user will intend to stand behind the prior word.
+ // If there is a change, special case for Pos1 after End!
aPaM.GetIndex()--;
}
}
@@ -1789,18 +1785,18 @@ void TextView::ImpShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
{
aNewStartPos.X() += ( aEditCursor.Right() - nVisEndX );
- // Darfs ein bischen mehr sein?
+ // do you want some more?
aNewStartPos.X() += nMoreX;
}
else if ( aEditCursor.Left() <= nVisStartX )
{
aNewStartPos.X() -= ( nVisStartX - aEditCursor.Left() );
- // Darfs ein bischen mehr sein?
+ // do you want some more?
aNewStartPos.X() -= nMoreX;
}
- // X kann durch das 'bischen mehr' falsch sein:
+ // X can be wrong for the 'some more' above:
// sal_uLong nMaxTextWidth = mpImpl->mpTextEngine->GetMaxTextWidth();
// if ( !nMaxTextWidth || ( nMaxTextWidth > 0x7FFFFFFF ) )
// nMaxTextWidth = 0x7FFFFFFF;
@@ -1814,7 +1810,7 @@ void TextView::ImpShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
else if ( aNewStartPos.X() > nMaxX )
aNewStartPos.X() = nMaxX;
- // Y sollte nicht weiter unten als noetig liegen:
+ // Y should not be further down than needed
long nYMax = mpImpl->mpTextEngine->GetTextHeight() - aOutSz.Height();
if ( nYMax < 0 )
nYMax = 0;
@@ -1847,7 +1843,7 @@ sal_Bool TextView::SetCursorAtPoint( const Point& rPosPixel )
TextPaM aPaM = mpImpl->mpTextEngine->GetPaM( aDocPos );
- // aTmpNewSel: Diff zwischen alt und neu, nicht die neue Selektion
+ // aTmpNewSel: Diff between old and new; not the new selection
TextSelection aTmpNewSel( mpImpl->maSelection.GetEnd(), aPaM );
TextSelection aNewSel( mpImpl->maSelection );
aNewSel.GetEnd() = aPaM;
@@ -1877,10 +1873,10 @@ sal_Bool TextView::IsSelectionAtPoint( const Point& rPosPixel )
Point aDocPos = GetDocPos( rPosPixel );
TextPaM aPaM = mpImpl->mpTextEngine->GetPaM( aDocPos, sal_False );
- // Bei Hyperlinks D&D auch ohne Selektion starten.
- // BeginDrag wird aber nur gerufen, wenn IsSelectionAtPoint()
- // Problem: IsSelectionAtPoint wird bei Command() nicht gerufen,
- // wenn vorher im MBDown schon sal_False returnt wurde.
+ // For Hyperlinks D&D also start w/o a selection.
+ // BeginDrag is only called, however, if IsSelectionAtPoint()
+ // Problem: IsSelectionAtPoint is not called by Command()
+ // if before MBDown returned sal_False.
return ( IsInSelection( aPaM ) ||
( /* mpImpl->mpSelEngine->IsInCommand() && */ mpImpl->mpTextEngine->FindAttrib( aPaM, TEXTATTR_HYPERLINK ) ) );
}
@@ -1993,7 +1989,7 @@ sal_Bool TextView::ImplCheckTextLen( const String& rNewText )
n += rNewText.Len();
if ( n > mpImpl->mpTextEngine->GetMaxTextLen() )
{
- // nur dann noch ermitteln, wie viel Text geloescht wird
+ // calculate how much text is being deleted
n -= mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection );
if ( n > mpImpl->mpTextEngine->GetMaxTextLen() )
bOK = sal_False;
@@ -2016,14 +2012,14 @@ void TextView::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd:
TETextDataObject* pDataObj = new TETextDataObject( GetSelected() );
- if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // Dann auch als HTML
+ if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // then also as HTML
mpImpl->mpTextEngine->Write( pDataObj->GetHTMLStream(), &mpImpl->maSelection, sal_True );
/*
- // D&D eines Hyperlinks.
- // Besser waere es im MBDown sich den MBDownPaM zu merken,
- // ist dann aber inkompatibel => spaeter mal umstellen.
+ // D&D of a Hyperlink
+ // TODO: Better would be to store MBDownPaM in MBDown,
+ // but this would be incompatible => change later
TextPaM aPaM( mpImpl->mpTextEngine->GetPaM( GetDocPos( GetWindow()->GetPointerPosPixel() ) ) );
const TextCharAttrib* pAttr = mpImpl->mpTextEngine->FindCharAttrib( aPaM, TEXTATTR_HYPERLINK );
if ( pAttr )
@@ -2066,7 +2062,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
{
ImpHideDDCursor();
- // Daten fuer das loeschen nach einem DROP_MOVE:
+ // Data for deleting after DROP_MOVE:
TextSelection aPrevSel( mpImpl->maSelection );
aPrevSel.Justify();
sal_uLong nPrevParaCount = mpImpl->mpTextEngine->GetParagraphCount();
@@ -2114,7 +2110,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
!mpImpl->mbSupportProtectAttribute && // don't remove currently selected element
(( rDTDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) || !bStarterOfDD) )
{
- // ggf. Selection anpasssen:
+ // adjust selection if necessary
if ( ( mpImpl->mpDDInfo->maDropPos.GetPara() < aPrevSel.GetStart().GetPara() ) ||
( ( mpImpl->mpDDInfo->maDropPos.GetPara() == aPrevSel.GetStart().GetPara() )
&& ( mpImpl->mpDDInfo->maDropPos.GetIndex() < aPrevSel.GetStart().GetIndex() ) ) )
@@ -2139,7 +2135,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
}
else
{
- // aktuelle Selektion anpassen
+ // adjust current selection
TextPaM aPaM = mpImpl->maSelection.GetStart();
aPaM.GetPara() -= ( aPrevSel.GetEnd().GetPara() - aPrevSel.GetStart().GetPara() );
if ( aPrevSel.GetEnd().GetPara() == mpImpl->mpDDInfo->maDropPos.GetPara() )
@@ -2208,7 +2204,7 @@ void TextView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDr
}
else
{
- // Alten Cursor wegzeichnen...
+ // delete old Cursor
if ( !mpImpl->mpDDInfo->mbVisCursor || ( aPrevDropPos != mpImpl->mpDDInfo->maDropPos ) )
{
ImpHideDDCursor();
@@ -2231,7 +2227,7 @@ Point TextView::ImpGetOutputStartPos( const Point& rStartDocPos ) const
Point TextView::GetDocPos( const Point& rWindowPos ) const
{
- // Fensterposition => Dokumentposition
+ // Window Position => Document Position
Point aPoint;
@@ -2252,7 +2248,7 @@ Point TextView::GetDocPos( const Point& rWindowPos ) const
Point TextView::GetWindowPos( const Point& rDocPos ) const
{
- // Dokumentposition => Fensterposition
+ // Document Position => Window Position
Point aPoint;
@@ -2305,7 +2301,7 @@ void TextSelFunctionSet::CreateAnchor()
// aSel.GetStart() = aSel.GetEnd();
// mpView->SetSelection( aSel );
- // Es darf kein ShowCursor folgen:
+ // may not be followed by ShowCursor
mpView->HideSelection();
mpView->ImpSetSelection( mpView->mpImpl->maSelection.GetEnd() );
}
@@ -2327,12 +2323,12 @@ void TextSelFunctionSet::DeselectAll()
void TextSelFunctionSet::DeselectAtPoint( const Point& )
{
- // Nur bei Mehrfachselektion
+ // only for multiple selection
}
void TextSelFunctionSet::DestroyAnchor()
{
- // Nur bei Mehrfachselektion
+ // only for multiple selection
}
TextEngine* TextView::GetTextEngine() const
{ return mpImpl->mpTextEngine; }
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index f4993d0ff1d3..e112fc779597 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -340,13 +340,6 @@ IMPL_LINK( ImpVclMEdit, ScrollHdl, ScrollBar*, pCurScrollBar )
return 0;
}
-
-// void ImpVclMEdit::ImpModified()
-// {
-// // Wann wird das gerufen ?????????????????????
-// pVclMultiLineEdit->Modify();
-// }
-
void ImpVclMEdit::SetAlign( WinBits nWinStyle )
{
sal_Bool bRTL = Application::GetSettings().GetLayoutRTL();
@@ -373,7 +366,7 @@ sal_Bool ImpVclMEdit::IsModified() const
void ImpVclMEdit::SetReadOnly( sal_Bool bRdOnly )
{
mpTextWindow->GetTextView()->SetReadOnly( bRdOnly );
- // Farbe anpassen ???????????????????????????
+ // TODO: Adjust color?
}
sal_Bool ImpVclMEdit::IsReadOnly() const
@@ -608,10 +601,10 @@ const Selection& ImpVclMEdit::GetSelection() const
maSelection = Selection();
TextSelection aTextSel( mpTextWindow->GetTextView()->GetSelection() );
aTextSel.Justify();
- // Selektion flachklopfen => jeder Umbruch ein Zeichen...
+ // flatten selection => every line-break a character
ExtTextEngine* pExtTextEngine = mpTextWindow->GetTextEngine();
- // Absaetze davor:
+ // paragraphs before
sal_uLong n;
for ( n = 0; n < aTextSel.GetStart().GetPara(); n++ )
{
@@ -619,7 +612,7 @@ const Selection& ImpVclMEdit::GetSelection() const
maSelection.Min()++;
}
- // Erster Absatz mit Selektion:
+ // first paragraph with selection
maSelection.Max() = maSelection.Min();
maSelection.Min() += aTextSel.GetStart().GetIndex();
@@ -749,7 +742,7 @@ void TextWindow::MouseButtonDown( const MouseEvent& rMEvt )
if ( !mbTextSelectable )
return;
- mbInMBDown = sal_True; // Dann im GetFocus nicht alles selektieren wird
+ mbInMBDown = sal_True; // so that GetFocus does not select everything
mpExtTextView->MouseButtonDown( rMEvt );
Window::MouseButtonDown( rMEvt );
GrabFocus();
@@ -777,7 +770,7 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent )
{
if ( Edit::GetGetSpecialCharsFunction() )
{
- // Damit die Selektion erhalten bleibt
+ // to maintain the selection
mbActivePopup = sal_True;
OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
if (!aChars.isEmpty())
@@ -849,7 +842,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
Point aPos = rCEvt.GetMousePosPixel();
if ( !rCEvt.IsMouseEvent() )
{
- // !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
+ // Sometime do show Menu centered in the selection !!!
Size aSize = GetOutputSizePixel();
aPos = Point( aSize.Width()/2, aSize.Height()/2 );
}
@@ -909,7 +902,7 @@ void TextWindow::GetFocus()
&& ( mbSelectOnTab &&
(!mbInMBDown || ( GetSettings().GetStyleSettings().GetSelectionOptions() & SELECTION_OPTION_FOCUS ) )) )
{
- // Alles selektieren, aber nicht scrollen
+ // select everything, but do not scroll
sal_Bool bAutoScroll = mpExtTextView->IsAutoScroll();
mpExtTextView->SetAutoScroll( sal_False );
mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
@@ -999,8 +992,8 @@ void VclMultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForegro
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- // Der Font muss immer mit manipuliert werden, weil die TextEngine
- // sich nicht um TextColor/Background kuemmert
+ // The Font has to be adjusted, as the TextEngine does not take care of
+ // TextColor/Background
Color aTextColor = rStyleSettings.GetFieldTextColor();
if ( IsControlForeground() )
@@ -1039,8 +1032,7 @@ void VclMultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForegro
pImpVclMEdit->GetTextWindow()->SetBackground( GetControlBackground() );
else
pImpVclMEdit->GetTextWindow()->SetBackground( rStyleSettings.GetFieldColor() );
- // Auch am VclMultiLineEdit einstellen, weil die TextComponent
- // ggf. die Scrollbars hidet.
+ // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
SetBackground( pImpVclMEdit->GetTextWindow()->GetBackground() );
}
}
@@ -1223,7 +1215,7 @@ Size VclMultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const
sal_Int32 nLeft, nTop, nRight, nBottom;
((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
- // In der Hoehe auf ganze Zeilen justieren
+ // center vertically for whole lines
long nHeight = aSz.Height() - nTop - nBottom;
long nLineHeight = pImpVclMEdit->CalcSize( 1, 1 ).Height();
@@ -1354,7 +1346,7 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size&
}
}
- // Inhalt
+ // contents
if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
pDev->SetTextColor( Color( COL_BLACK ) );
else
@@ -1385,7 +1377,7 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size&
{
Rectangle aClip( aPos, aSize );
if ( aTextSz.Height() > aSize.Height() )
- aClip.Bottom() += aTextSz.Height() - aSize.Height() + 1; // Damit HP-Drucker nicht 'weg-optimieren'
+ aClip.Bottom() += aTextSz.Height() - aSize.Height() + 1; // so that HP-printer does not 'optimize-away'
pDev->IntersectClipRegion( aClip );
}
@@ -1503,7 +1495,7 @@ long VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt )
}
//
-// Internas fuer abgeleitete Klassen, z.B. TextComponent
+// Internals for derived classes, e.g. TextComponent
ExtTextEngine* VclMultiLineEdit::GetTextEngine() const
{
diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx
index e9b4e73a27b4..a22d88e9f262 100644
--- a/vcl/source/edit/xtextedt.cxx
+++ b/vcl/source/edit/xtextedt.cxx
@@ -27,10 +27,6 @@
using namespace ::com::sun::star;
-
-// -------------------------------------------------------------------------
-// class ExtTextEngine
-// -------------------------------------------------------------------------
ExtTextEngine::ExtTextEngine() : maGroupChars(OUString("(){}[]"))
{
}
@@ -52,7 +48,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
{
if ( ( nMatchChar % 2 ) == 0 )
{
- // Vorwaerts suchen...
+ // search forwards
sal_Unicode nSC = maGroupChars.GetChar( nMatchChar );
sal_Unicode nEC = maGroupChars.GetChar( nMatchChar+1 );
@@ -80,7 +76,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
nCur = 0;
}
}
- if ( nLevel == 0 ) // gefunden
+ if ( nLevel == 0 ) // found
{
aSel.GetStart() = rCursor;
aSel.GetEnd() = TextPaM( nPara, nCur+1 );
@@ -88,7 +84,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
}
else
{
- // Rueckwaerts suchen...
+ // search backwards
sal_Unicode nEC = maGroupChars.GetChar( nMatchChar );
sal_Unicode nSC = maGroupChars.GetChar( nMatchChar-1 );
@@ -119,17 +115,17 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
if ( nPara )
{
nPara--;
- nCur = GetTextLen( nPara )-1; // egal ob negativ, weil if Len()
+ nCur = GetTextLen( nPara )-1; // no matter if negativ, as if Len()
}
else
break;
}
}
- if ( nLevel == 0 ) // gefunden
+ if ( nLevel == 0 ) // found
{
aSel.GetStart() = rCursor;
- aSel.GetStart().GetIndex()++; // hinter das Zeichen
+ aSel.GetStart().GetIndex()++; // behind the char
aSel.GetEnd() = TextPaM( nPara, nCur );
}
}
@@ -165,7 +161,7 @@ sal_Bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions&
aOptions.Locale = Application::GetSettings().GetLanguageTag().getLocale();
utl::TextSearch aSearcher( rSearchOptions );
- // ueber die Absaetze iterieren...
+ // iterate over the paragraphs
for ( sal_uLong nNode = nStartNode;
bForward ? ( nNode <= nEndNode) : ( nNode >= nEndNode );
bForward ? nNode++ : nNode-- )
@@ -199,7 +195,6 @@ sal_Bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions&
rSel.GetStart().GetIndex() = nStartPos;
rSel.GetEnd().GetPara() = nNode;
rSel.GetEnd().GetIndex() = nEndPos;
- // Ueber den Absatz selektieren?
// Select over the paragraph?
// FIXME This should be max long...
if( nEndPos == sal::static_int_cast<sal_uInt16>(-1) ) // sal_uInt16 for 0 and -1 !
@@ -219,7 +214,7 @@ sal_Bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions&
break;
}
- if ( !bForward && !nNode ) // Bei rueckwaertsuche, wenn nEndNode = 0:
+ if ( !bForward && !nNode ) // if searching backwards, if nEndNode == 0:
break;
}
@@ -263,8 +258,8 @@ sal_Bool ExtTextView::Search( const util::SearchOptions& rSearchOptions, sal_Boo
if ( ((ExtTextEngine*)GetTextEngine())->Search( aSel, rSearchOptions, bForward ) )
{
bFound = sal_True;
- // Erstmal den Anfang des Wortes als Selektion einstellen,
- // damit das ganze Wort in den sichtbaren Bereich kommt.
+ // First add the beginning of the word to the selection,
+ // so that the whole word is in the visible region.
SetSelection( aSel.GetStart() );
ShowCursor( sal_True, sal_False );
}
@@ -289,7 +284,7 @@ sal_uInt16 ExtTextView::Replace( const util::SearchOptions& rSearchOptions, sal_
{
InsertText( rSearchOptions.replaceString );
nFound = 1;
- Search( rSearchOptions, bForward ); // gleich zum naechsten
+ Search( rSearchOptions, bForward ); // right away to the next
}
else
{
@@ -299,7 +294,7 @@ sal_uInt16 ExtTextView::Replace( const util::SearchOptions& rSearchOptions, sal_
}
else
{
- // Der Writer ersetzt alle, vom Anfang bis Ende...
+ // the writer replaces all, from beginning to end
ExtTextEngine* pTextEngine = (ExtTextEngine*)GetTextEngine();
@@ -351,20 +346,20 @@ sal_Bool ExtTextView::ImpIndentBlock( sal_Bool bRight )
sal_uLong nEndPara = aSel.GetEnd().GetPara();
if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() )
{
- nEndPara--; // den dann nicht einruecken...
+ nEndPara--; // do not indent
}
for ( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
if ( bRight )
{
- // Tabs hinzufuegen
+ // add tabs
GetTextEngine()->ImpInsertText( TextPaM( nPara, 0 ), '\t' );
bDone = sal_True;
}
else
{
- // Tabs/Blanks entfernen
+ // remove Tabs/Blanks
String aText = GetTextEngine()->GetText( nPara );
if ( aText.Len() && (
( aText.GetChar( 0 ) == '\t' ) ||