summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorLuc Castermans <luc@bassenge.castermans.org>2012-07-01 21:10:41 +0200
committerPhilipp Riemer <ruderphilipp@gmail.com>2012-07-02 01:27:30 +0200
commit16c4e5506b10284611f2653f867fe09ce75b6a18 (patch)
treea4aabb9a296723691c3ee0369c1c3a8028aa334a /vcl/source/control
parenta4a4bde34e5e3f60143ca8d5ae053237da18712e (diff)
translated german comments
Change-Id: Ia99de2167bbc401d212eb9cf04883f3f8270f44f
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/button.cxx39
-rw-r--r--vcl/source/control/edit.cxx42
-rw-r--r--vcl/source/control/field.cxx66
-rw-r--r--vcl/source/control/field2.cxx132
4 files changed, 127 insertions, 152 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 3e09946ed16f..57f50f41314d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1273,7 +1273,7 @@ void PushButton::Tracking( const TrackingEvent& rTEvt )
ImplDrawPushButton();
- // Bei Abbruch kein Click-Handler rufen
+ // do not call Click handler if aborted
if ( !rTEvt.IsTrackingCanceled() )
{
if ( ! ( ( GetStyle() & WB_REPEAT ) &&
@@ -1760,7 +1760,7 @@ OKButton::OKButton( Window* pParent, const ResId& rResId ) :
void OKButton::Click()
{
SAL_WARN_IF(!GetClickHdl(), "vcl", "No handler installed for OKButton");
- // Ist kein Link gesetzt, dann schliesse Parent
+ // close parent if no link set
if ( !GetClickHdl() )
{
Window* pParent = GetParent();
@@ -1770,7 +1770,7 @@ void OKButton::Click()
{
if ( ((Dialog*)pParent)->IsInExecute() )
((Dialog*)pParent)->EndDialog( sal_True );
- // gegen rekursive Aufrufe schuetzen
+ // prevent recursive calls
else if ( !((Dialog*)pParent)->IsInClose() )
{
if ( pParent->GetStyle() & WB_CLOSEABLE )
@@ -1827,7 +1827,7 @@ CancelButton::CancelButton( Window* pParent, const ResId& rResId ) :
void CancelButton::Click()
{
SAL_WARN_IF(!GetClickHdl(), "vcl", "No handler installed for CancelButton");
- // Ist kein Link gesetzt, dann schliesse Parent
+ // close parent if link not set
if ( !GetClickHdl() )
{
Window* pParent = GetParent();
@@ -1837,7 +1837,7 @@ void CancelButton::Click()
{
if ( ((Dialog*)pParent)->IsInExecute() )
((Dialog*)pParent)->EndDialog( sal_False );
- // gegen rekursive Aufrufe schuetzen
+ // prevent recursive calls
else if ( !((Dialog*)pParent)->IsInClose() )
{
if ( pParent->GetStyle() & WB_CLOSEABLE )
@@ -1894,7 +1894,7 @@ HelpButton::HelpButton( Window* pParent, const ResId& rResId ) :
void HelpButton::Click()
{
SAL_WARN_IF(!GetClickHdl(), "vcl", "No handler installed for HelpButton");
- // Ist kein Link gesetzt, loese Hilfe aus
+ // trigger help if no link set
if ( !GetClickHdl() )
{
Window* pFocusWin = Application::GetFocusWindow();
@@ -2066,7 +2066,7 @@ if ( bNativeOK == sal_False )
aImageSize.Width() = CalcZoom( aImageSize.Width() );
aImageSize.Height() = CalcZoom( aImageSize.Height() );
- // Border und Selektionsstatus ausgeben
+ // display border and selection status
aImageRect = aDecoView.DrawFrame( aImageRect, nButtonStyle );
if ( (ImplGetButtonState() & BUTTON_DRAW_PRESSED) || !bEnabled )
SetFillColor( rStyleSettings.GetFaceColor() );
@@ -2075,7 +2075,7 @@ if ( bNativeOK == sal_False )
SetLineColor();
DrawRect( aImageRect );
- // Image ausgeben
+ // display image
nButtonStyle = 0;
if ( !bEnabled )
nButtonStyle |= IMAGE_DRAW_DISABLE;
@@ -2138,7 +2138,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
pDev->Push( PUSH_CLIPREGION );
pDev->IntersectClipRegion( Rectangle( rPos, rSize ) );
- // kein Image-RadioButton
+ // no image radio button
if ( !maImage )
{
if ( ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) ) ||
@@ -2206,8 +2206,8 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
ImplSetFocusRect( rStateRect );
-/* und oben -1, da CalcSize() auch Focus-Rechteck nicht mit einrechnet,
-da im Writer ansonsten die Images noch weiter oben haengen
+/* and above -1 because CalcSize() does not include focus-rectangle since images would be even
+ positioned higher in writer
rFocusRect = rStateRect;
rFocusRect.Left()--;
rFocusRect.Top()--;
@@ -2224,7 +2224,7 @@ da im Writer ansonsten die Images noch weiter oben haengen
long nTextHeight = pDev->GetTextHeight();
long nTextWidth = pDev->GetCtrlTextWidth( aText );
- // Positionen und Groessen berechnen
+ // calculate position and sizes
if ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) )
{
Size aTmpSize( (aImageSize.Width()+8), (aImageSize.Height()+8) );
@@ -2239,7 +2239,7 @@ da im Writer ansonsten die Images noch weiter oben haengen
aImageRect.Right() = aImageRect.Left()+aTmpSize.Width();
aImageRect.Bottom() = aImageRect.Top()+aTmpSize.Height();
- // Text ausgeben
+ // display text
Point aTxtPos = rPos;
if ( bTopImage )
{
@@ -2324,7 +2324,7 @@ void RadioButton::ImplUncheckAllOther()
{
mpWindowImpl->mnStyle |= WB_TABSTOP;
- // Gruppe mit RadioButtons durchgehen und die gecheckten Buttons
+ // iterate over radio button group and checked buttons
Window* pWindow;
WinBits nStyle;
if ( !(GetStyle() & WB_GROUP) )
@@ -2345,8 +2345,7 @@ void RadioButton::ImplUncheckAllOther()
return;
pWindow->ImplRemoveDel( &aDelData );
}
- // Um falsch gesetzt WB_TABSTOPS immer zu entfernen, nicht
- // innerhalb der if-Abfrage
+ // not inside if clause to always remove wrongly set WB_TABSTOPS
pWindow->mpWindowImpl->mnStyle &= ~WB_TABSTOP;
}
@@ -2376,8 +2375,8 @@ void RadioButton::ImplUncheckAllOther()
return;
pWindow->ImplRemoveDel( &aDelData );
}
- // Um falsch gesetzt WB_TABSTOPS immer zu entfernen, nicht
- // innerhalb der if-Abfrage
+
+ // not inside if clause to always remove wrongly set WB_TABSTOPS
pWindow->mpWindowImpl->mnStyle &= ~WB_TABSTOP;
}
@@ -2484,7 +2483,7 @@ void RadioButton::Tracking( const TrackingEvent& rTEvt )
ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED;
- // Bei Abbruch kein Click-Handler rufen
+ // do not call click handler if aborted
if ( !rTEvt.IsTrackingCanceled() )
ImplCallClick();
else
@@ -3399,7 +3398,7 @@ void CheckBox::Tracking( const TrackingEvent& rTEvt )
ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED;
- // Bei Abbruch kein Click-Handler rufen
+ // do not call click handler if aborted
if ( !rTEvt.IsTrackingCanceled() )
ImplCheck();
else
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index a18208c911ed..adeaf5ca6ddf 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1002,8 +1002,7 @@ void Edit::ImplInsertText( const rtl::OUString& rStr, const Selection* pNewSel,
void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection )
{
- // Der Text wird dadurch geloescht das der alte Text komplett 'selektiert'
- // wird, dann InsertText, damit flackerfrei.
+ // we delete text by "selecting" the old text completely then calling InsertText; this is flicker free
if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) )
{
ImplClearLayoutData();
@@ -1192,7 +1191,7 @@ void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible )
nCursorWidth = GetTextWidth( aText, (xub_StrLen)maSelection.Max(), 1 );
long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
- // Cursor muss im sichtbaren Bereich landen:
+ // cursor should land in visible area
const Size aOutSize = GetOutputSizePixel();
if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) )
{
@@ -1271,8 +1270,7 @@ void Edit::ImplAlign()
}
else if( mnAlign == EDIT_ALIGN_CENTER )
{
- // Mit Abfrage schoener, wenn gescrollt, dann aber nicht zentriert im gescrollten Zustand...
-// if ( nTextWidth < nOutWidth )
+ // would be nicer with check while scrolling but then it's not centred in scrolled state
mnXOffset = (nOutWidth - nTextWidth) / 2;
}
}
@@ -1465,7 +1463,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt )
StartTracking( STARTTRACK_SCROLLREPEAT );
}
- mbInMBDown = sal_True; // Dann im GetFocus nicht alles selektieren
+ mbInMBDown = sal_True; // then do not select all in GetFocus
GrabFocus();
mbInMBDown = sal_False;
}
@@ -1574,7 +1572,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
}
break;
- default: // wird dann evtl. unten bearbeitet.
+ default:
eFunc = KEYFUNC_DONTKNOW;
}
}
@@ -1590,7 +1588,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
{
if ( pImplFncGetSpecialChars )
{
- Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
+ Selection aSaveSel = GetSelection(); // if someone changes the selection in Get/LoseFocus, e.g. URL bar
XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
SetSelection( aSaveSel );
if ( aChars.Len() )
@@ -1823,7 +1821,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
{
if ( IsCharInput( rKEvt ) )
{
- bDone = sal_True; // Auch bei ReadOnly die Zeichen schlucken.
+ bDone = sal_True; // read characters also when in ReadOnly
if ( !mbReadOnly )
{
ImplInsertText(rtl::OUString(rKEvt.GetCharCode()), 0, sal_True);
@@ -1954,7 +1952,7 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_u
{
Rectangle aClip( aPos, aSize );
if ( nTextHeight > aSize.Height() )
- aClip.Bottom() += nTextHeight-aSize.Height()+1; // Damit HP-Drucker nicht 'weg-optimieren'
+ aClip.Bottom() += nTextHeight-aSize.Height()+1; // prevent HP printers from 'optimizing'
pDev->IntersectClipRegion( aClip );
}
@@ -2139,11 +2137,11 @@ void Edit::Command( const CommandEvent& rCEvt )
}
mbActivePopup = sal_True;
- Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
+ Selection aSaveSel = GetSelection(); // if someone changes selection in Get/LoseFocus, e.g. URL bar
Point aPos = rCEvt.GetMousePosPixel();
if ( !rCEvt.IsMouseEvent() )
{
- // !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
+ // Show menu enventually centered in selection
Size aSize = GetOutputSizePixel();
aPos = Point( aSize.Width()/2, aSize.Height()/2 );
}
@@ -2237,8 +2235,8 @@ void Edit::Command( const CommandEvent& rCEvt )
sal_Bool bInsertMode = !mpIMEInfos->bWasCursorOverwrite;
delete mpIMEInfos;
mpIMEInfos = NULL;
- // Font wieder ohne Attribute einstellen, wird jetzt im Repaint nicht
- // mehr neu initialisiert
+
+ // set font without attributes, because it will not be re-initialised in Repaint anymore
ImplInitSettings( sal_True, sal_False, sal_False );
SetInsertMode( bInsertMode );
@@ -2335,7 +2333,7 @@ void Edit::StateChanged( StateChangedType nType )
{
if ( !mpSubEdit )
{
- mnXOffset = 0; // Falls vorher GrabFocus, als Groesse noch falsch.
+ mnXOffset = 0; // if GrabFocus before while size was still wrong
ImplAlign();
if ( !mpSubEdit )
ImplShowCursor( sal_False );
@@ -2347,7 +2345,7 @@ void Edit::StateChanged( StateChangedType nType )
{
if ( !mpSubEdit )
{
- // Es aendert sich nur die Textfarbe...
+ // change text color only
ImplInvalidateOrRepaint( 0, 0xFFFF );
}
}
@@ -2615,8 +2613,8 @@ void Edit::SetMaxTextLen( xub_StrLen nMaxLen )
void Edit::SetSelection( const Selection& rSelection )
{
- // Wenn von aussen z.B. im MouseButtonDown die Selektion geaendert wird,
- // soll nicht gleich ein Tracking() zuschlagen und die Selektion aendern.
+ // If the selection was changed from outside, e.g. by MouseButtonDown, don't call Tracking()
+ // directly afterwards which would change the selection again
if ( IsTracking() )
EndTracking();
else if ( mpSubEdit && mpSubEdit->IsTracking() )
@@ -2765,10 +2763,10 @@ void Edit::Undo()
void Edit::SetText( const XubString& rStr )
{
if ( mpSubEdit )
- mpSubEdit->SetText( rStr ); // Nicht direkt ImplSetText, falls SetText ueberladen
+ mpSubEdit->SetText( rStr ); // not directly ImplSetText if SetText overloaded
else
{
- Selection aNewSel( 0, 0 ); // Damit nicht gescrollt wird
+ Selection aNewSel( 0, 0 ); // prevent scrolling
ImplSetText( rStr, &aNewSel );
}
}
@@ -2880,8 +2878,8 @@ Size Edit::GetOptimalSize(WindowSizeType eType) const
Size Edit::CalcSize( xub_StrLen nChars ) const
{
- // Breite fuer n Zeichen, unabhaengig vom Inhalt.
- // Funktioniert nur bei FixedFont richtig, sonst Mittelwert.
+ // width for N characters, independent from content.
+ // works only correct for fixed fonts, average otherwise
Size aSz( GetTextWidth( XubString( 'x' ) ), GetTextHeight() );
aSz.Width() *= nChars;
aSz = CalcWindowSize( aSz );
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 0bc5425b1fc2..34448cfb1571 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -107,14 +107,14 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
xub_StrLen nDecPos;
xub_StrLen i;
- // Reaktion auf leeren String
+ // react on empty string
if ( !rStr.Len() )
return sal_False;
- // Fuehrende und nachfolgende Leerzeichen entfernen
+ // remove leading and trailing spaces
aStr = string::strip(aStr, ' ');
- // Position des Dezimalpunktes suchen
+ // find position of decimal point
nDecPos = aStr.Search( rLocaleDataWrappper.getNumDecimalSep() );
if ( nDecPos != STRING_NOTFOUND )
{
@@ -124,7 +124,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
else
aStr1 = aStr;
- // Negativ ?
+ // negative?
if ( bCurrency )
{
if ( (aStr.GetChar( 0 ) == '(') && (aStr.GetChar( aStr.Len()-1 ) == ')') )
@@ -167,7 +167,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
bNegative = sal_True;
}
- // Alle unerwuenschten Zeichen rauswerfen
+ // remove all unwanted charaters
for ( i=0; i < aStr1.Len(); )
{
if ( (aStr1.GetChar( i ) >= '0') && (aStr1.GetChar( i ) <= '9') )
@@ -191,7 +191,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
if ( bNegative )
aStr1.Insert( '-', 0 );
- // Nachkommateil zurechtstutzen und dabei runden
+ // prune and round fraction
sal_Bool bRound = sal_False;
if ( aStr2.Len() > nDecDigits )
{
@@ -205,7 +205,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
aStr = aStr1;
aStr += aStr2;
- // Bereichsueberpruefung
+ // check range
double nValue = rtl::OUString(aStr).toDouble();
if ( bRound )
{
@@ -742,19 +742,15 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
{
if ( GetField() )
{
- // !!! TH-18.2.99: Wenn wir Zeit haben sollte mal geklaert werden,
- // !!! warum nicht bei ImplSetUserValue() geprueft wird, ob
- // !!! sich der Wert aendert. Denn auch hier muesste dieses
- // !!! gemacht werden, da ansonsten der Modify-Aufruf
- // !!! nicht gemacht werden duerfte. Jedenfalls sollten die
- // !!! Wege von ImplNewFieldValue, ImplSetUserValue und
- // !!! ImplSetText ueberprueft und klarer gestalltet (mit Kommentar)
- // !!! werden, damit wir mal wissen, was dort ablaeuft!!!
+ // !!! We should check why we do not validate in ImplSetUserValue() if the value was
+ // changed. This should be done there as well since otherwise the call to Modify would not
+ // be allowed. Anyway, the paths from ImplNewFieldValue, ImplSetUserValue, and ImplSetText
+ // should be checked and clearly traced (with comment) in order to find out what happens.
Selection aSelection = GetField()->GetSelection();
aSelection.Justify();
XubString aText = GetField()->GetText();
- // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+ // leave it as is if selected until end
if ( (xub_StrLen)aSelection.Max() == aText.Len() )
{
if ( !aSelection.Len() )
@@ -766,7 +762,7 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
ImplSetUserValue( nNewValue, &aSelection );
mnLastValue = nOldLastValue;
- // Modify am Edit wird nur bei KeyInput gesetzt...
+ // Modify during Edit is only set during KeyInput
if ( GetField()->GetText() != aText )
{
GetField()->SetModifyFlag();
@@ -1029,8 +1025,7 @@ void NumericBox::InsertValue( sal_Int64 nValue, sal_uInt16 nPos )
static sal_Bool ImplMetricProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
sal_Bool, sal_Bool bUseThousandSep, const LocaleDataWrapper& rWrapper )
{
- // Es gibt hier kein sinnvolles StrictFormat, also alle
- // Zeichen erlauben
+ // no meaningfull strict format; therefore allow all characters
return ImplNumericProcessKeyInput( pEdit, rKEvt, sal_False, bUseThousandSep, rWrapper );
}
@@ -1038,7 +1033,7 @@ static sal_Bool ImplMetricProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
static rtl::OUString ImplMetricGetUnitText(const rtl::OUString& rStr)
{
- // Einheitentext holen
+ // fetch unit text
rtl::OUStringBuffer aStr;
for (sal_Int32 i = rStr.getLength()-1; i >= 0; --i)
{
@@ -1506,7 +1501,7 @@ XubString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
void MetricFormatter::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit )
{
- // Umrechnen auf eingestellte Einheiten
+ // convert to previously configured units
nNewValue = MetricField::ConvertValue( nNewValue, mnBaseValue, GetDecimalDigits(), eInUnit, meUnit );
NumericFormatter::SetUserValue( nNewValue );
}
@@ -1529,7 +1524,7 @@ sal_Int64 MetricFormatter::GetValue( FieldUnit eOutUnit ) const
else if ( nTempValue < mnMin )
nTempValue = (double)mnMin;
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
return MetricField::ConvertValue( (sal_Int64)nTempValue, mnBaseValue, GetDecimalDigits(), meUnit, eOutUnit );
}
@@ -1553,7 +1548,7 @@ sal_Int64 MetricFormatter::GetValue() const
void MetricFormatter::SetMin( sal_Int64 nNewMin, FieldUnit eInUnit )
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
NumericFormatter::SetMin( MetricField::ConvertValue( nNewMin, mnBaseValue, GetDecimalDigits(),
eInUnit, meUnit ) );
}
@@ -1562,7 +1557,7 @@ void MetricFormatter::SetMin( sal_Int64 nNewMin, FieldUnit eInUnit )
sal_Int64 MetricFormatter::GetMin( FieldUnit eOutUnit ) const
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
return MetricField::ConvertValue( NumericFormatter::GetMin(), mnBaseValue,
GetDecimalDigits(), meUnit, eOutUnit );
}
@@ -1571,7 +1566,7 @@ sal_Int64 MetricFormatter::GetMin( FieldUnit eOutUnit ) const
void MetricFormatter::SetMax( sal_Int64 nNewMax, FieldUnit eInUnit )
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
NumericFormatter::SetMax( MetricField::ConvertValue( nNewMax, mnBaseValue, GetDecimalDigits(),
eInUnit, meUnit ) );
}
@@ -1580,7 +1575,7 @@ void MetricFormatter::SetMax( sal_Int64 nNewMax, FieldUnit eInUnit )
sal_Int64 MetricFormatter::GetMax( FieldUnit eOutUnit ) const
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
return MetricField::ConvertValue( NumericFormatter::GetMax(), mnBaseValue,
GetDecimalDigits(), meUnit, eOutUnit );
}
@@ -1597,7 +1592,7 @@ void MetricFormatter::SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit )
sal_Int64 MetricFormatter::GetBaseValue( FieldUnit eOutUnit ) const
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
return MetricField::ConvertValue( mnBaseValue, mnBaseValue, GetDecimalDigits(),
meUnit, eOutUnit );
}
@@ -1637,7 +1632,7 @@ void MetricFormatter::Reformat()
sal_Int64 MetricFormatter::GetCorrectedValue( FieldUnit eOutUnit ) const
{
- // Umrechnen auf gewuenschte Einheiten
+ // convert to requested units
return MetricField::ConvertValue( mnCorrectedValue, mnBaseValue, GetDecimalDigits(),
meUnit, eOutUnit );
}
@@ -1732,7 +1727,7 @@ sal_Int64 MetricField::GetFirst( FieldUnit eOutUnit ) const
void MetricField::SetLast( sal_Int64 nNewLast, FieldUnit eInUnit )
{
- // Umrechnen
+ // convert
nNewLast = MetricField::ConvertValue( nNewLast, mnBaseValue, GetDecimalDigits(),
eInUnit, meUnit );
mnLast = nNewLast;
@@ -1742,7 +1737,7 @@ void MetricField::SetLast( sal_Int64 nNewLast, FieldUnit eInUnit )
sal_Int64 MetricField::GetLast( FieldUnit eOutUnit ) const
{
- // Umrechnen
+ // conver
return MetricField::ConvertValue( mnLast, mnBaseValue, GetDecimalDigits(),
meUnit, eOutUnit );
}
@@ -1957,7 +1952,7 @@ void MetricBox::CustomConvert()
void MetricBox::InsertValue( sal_Int64 nValue, FieldUnit eInUnit, sal_uInt16 nPos )
{
- // Umrechnen auf eingestellte Einheiten
+ // convert to previously configured units
nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(),
eInUnit, meUnit );
ComboBox::InsertEntry( CreateFieldText( nValue ), nPos );
@@ -1971,7 +1966,7 @@ sal_Int64 MetricBox::GetValue( sal_uInt16 nPos, FieldUnit eOutUnit ) const
ImplMetricGetValue( ComboBox::GetEntry( nPos ), nValue, mnBaseValue,
GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit );
- // Umrechnen auf eingestellte Einheiten
+ // convert to previously configured units
sal_Int64 nRetValue = MetricField::ConvertValue( (sal_Int64)nValue, mnBaseValue, GetDecimalDigits(),
meUnit, eOutUnit );
@@ -1982,7 +1977,7 @@ sal_Int64 MetricBox::GetValue( sal_uInt16 nPos, FieldUnit eOutUnit ) const
sal_uInt16 MetricBox::GetValuePos( sal_Int64 nValue, FieldUnit eInUnit ) const
{
- // Umrechnen auf eingestellte Einheiten
+ // convert to previously configured units
nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(),
eInUnit, meUnit );
return ComboBox::GetEntryPos( CreateFieldText( nValue ) );
@@ -2009,8 +2004,7 @@ sal_Int64 MetricBox::GetValue() const
static sal_Bool ImplCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
sal_Bool, sal_Bool bUseThousandSep, const LocaleDataWrapper& rWrapper )
{
- // Es gibt hier kein sinnvolles StrictFormat, also alle
- // Zeichen erlauben
+ // no strict format set; therefore allow all characters
return ImplNumericProcessKeyInput( pEdit, rKEvt, sal_False, bUseThousandSep, rWrapper );
}
@@ -2019,7 +2013,7 @@ static sal_Bool ImplCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
inline sal_Bool ImplCurrencyGetValue( const XubString& rStr, double& rValue,
sal_uInt16 nDecDigits, const LocaleDataWrapper& rWrapper )
{
- // Zahlenwert holen
+ // fetch number
return ImplNumericGetValue( rStr, rValue, nDecDigits, rWrapper, sal_True );
}
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 32e285e4f025..9244df52870f 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -265,19 +265,17 @@ static XubString ImplPatternReformat( const XubString& rStr,
cLiteral = rLiteralMask.GetChar(i);
cMask = rEditMask[i];
- // Aktuelle Position ein Literal
+ // current position is a literal
if ( cMask == EDITMASK_LITERAL )
{
- // Wenn es das Literal-Zeichen ist, uebernehmen, ansonsten
- // ignorieren, da es das naechste gueltige Zeichen vom String
- // sein kann
+ // if it is a literal copy otherwise ignore because it might be the next valid
+ // character of the string
if ( ImplKommaPointCharEqual( cChar, cLiteral ) )
nStrIndex++;
else
{
- // Ansonsten testen wir, ob es ein ungueltiges Zeichen ist.
- // Dies ist dann der Fall, wenn es nicht in das Muster
- // des naechsten nicht Literal-Zeichens passt
+ // Otherwise we check if it is a invalid character. This is the case if it does not
+ // fit in the pattern of the next non-literal character.
n = i+1;
while ( n < rEditMask.getLength() )
{
@@ -294,25 +292,23 @@ static XubString ImplPatternReformat( const XubString& rStr,
}
else
{
- // Gueltiges Zeichen an der Stelle
+ // valid character at this position
cTempChar = ImplPatternChar( cChar, cMask );
if ( cTempChar )
{
- // dann Zeichen uebernehmen
+ // use this character
aOutStr.SetChar( i, cTempChar );
nStrIndex++;
}
else
{
- // Wenn es das Literalzeichen ist, uebernehmen
+ // copy if it is a literal character
if ( cLiteral == cChar )
nStrIndex++;
else
{
- // Wenn das ungueltige Zeichen das naechste Literalzeichen
- // sein kann, dann springen wir bis dahin vor, ansonten
- // das Zeichen ignorieren
- // Nur machen, wenn leere Literale erlaubt sind
+ // If the invalid character might be the next literal character then we jump
+ // ahead to it, otherwise we ignore it. Do only if empty literals are allowed.
if ( nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS )
{
n = i;
@@ -349,11 +345,10 @@ static void ImplPatternMaxPos( const XubString rStr, const rtl::OString& rEditMa
sal_uInt16 nCursorPos, sal_uInt16& rPos )
{
- // Letzte Position darf nicht groesser als der enthaltene String sein
+ // last position must not be longer than the contained string
xub_StrLen nMaxPos = rStr.Len();
- // Wenn keine leeren Literale erlaubt sind, auch Leerzeichen
- // am Ende ignorieren
+ // if non empty literals are allowed ignore blanks at the end as well
if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) )
{
while ( nMaxPos )
@@ -364,8 +359,7 @@ static void ImplPatternMaxPos( const XubString rStr, const rtl::OString& rEditMa
nMaxPos--;
}
- // Wenn wir vor einem Literal stehen, dann solange weitersuchen,
- // bis erste Stelle nach Literal
+ // if we are in front of a literal, continue search until first character after the literal
xub_StrLen nTempPos = nMaxPos;
while ( nTempPos < rEditMask.getLength() )
{
@@ -380,7 +374,8 @@ static void ImplPatternMaxPos( const XubString rStr, const rtl::OString& rEditMa
if ( rPos > nMaxPos )
rPos = nMaxPos;
- // Zeichen sollte nicht nach links wandern
+
+ // charactr should not move left
if ( rPos < nCursorPos )
rPos = nCursorPos;
}
@@ -394,7 +389,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
{
XubString aText = pEdit->GetText();
- // Leerzeichen am Anfang entfernen
+ // remove leading blanks
if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) )
{
xub_StrLen i = 0;
@@ -407,7 +402,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
i++;
}
- // Alle Literalzeichen beibehalten
+ // keep all literal characters
while ( i && (rEditMask[i] == EDITMASK_LITERAL) )
i--;
aText.Erase( 0, i );
@@ -416,8 +411,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
XubString aNewText = ImplPatternReformat( aText, rEditMask, rLiteralMask, nFormatFlags );
if ( aNewText != aText )
{
- // Selection so anpassen, das diese wenn sie vorher am Ende
- // stand, immer noch am Ende steht
+ // adjust selection such that it remains at the end if it was there before
Selection aSel = pEdit->GetSelection();
sal_uLong nMaxSel = Max( aSel.Min(), aSel.Max() );
if ( nMaxSel >= aText.Len() )
@@ -442,7 +436,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
static xub_StrLen ImplPatternLeftPos(const rtl::OString& rEditMask, xub_StrLen nCursorPos)
{
- // Vorheriges Zeichen suchen, was kein Literal ist
+ // search non-literal predecessor
xub_StrLen nNewPos = nCursorPos;
xub_StrLen nTempPos = nNewPos;
while ( nTempPos )
@@ -463,7 +457,7 @@ static xub_StrLen ImplPatternRightPos( const XubString& rStr, const rtl::OString
sal_uInt16 nFormatFlags, sal_Bool bSameMask,
xub_StrLen nCursorPos )
{
- // Naechstes Zeichen suchen, was kein Literal ist
+ // search non-literal successor
xub_StrLen nNewPos = nCursorPos;
xub_StrLen nTempPos = nNewPos;
while ( nTempPos < rEditMask.getLength() )
@@ -513,9 +507,8 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
}
else if ( nKeyCode == KEY_RIGHT )
{
- // Hier nehmen wir Selectionsanfang als minimum, da falls durch
- // Focus alles selektiert ist, ist eine kleine Position schon
- // erlaubt.
+ // Use the start of selection as minimum; even a small position is allowed in case that
+ // all was selected by the focus
Selection aSel( aOldSel );
aSel.Justify();
nCursorPos = (xub_StrLen)aSel.Min();
@@ -529,12 +522,13 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
}
else if ( nKeyCode == KEY_HOME )
{
- // Home ist Position des ersten nicht literalen Zeichens
+ // Home is the position of the first non-literal character
nNewPos = 0;
while ( (nNewPos < rEditMask.getLength()) &&
(rEditMask[nNewPos] == EDITMASK_LITERAL) )
nNewPos++;
- // Home sollte nicht nach rechts wandern
+
+ // Home should not move to the right
if ( nCursorPos < nNewPos )
nNewPos = nCursorPos;
Selection aSel( nNewPos );
@@ -545,14 +539,13 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
}
else if ( nKeyCode == KEY_END )
{
- // End ist die Position des letzten nicht literalen Zeichens
+ // End is position of last non-literal character
nNewPos = rEditMask.getLength();
while ( nNewPos &&
(rEditMask[nNewPos-1] == EDITMASK_LITERAL) )
nNewPos--;
- // Hier nehmen wir Selectionsanfang als minimum, da falls durch
- // Focus alles selektiert ist, ist eine kleine Position schon
- // erlaubt.
+ // Use the start of selection as minimum; even a small position is allowed in case that
+ // all was selected by the focus
Selection aSel( aOldSel );
aSel.Justify();
nCursorPos = (xub_StrLen)aSel.Min();
@@ -574,7 +567,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
aSel.Justify();
nNewPos = (xub_StrLen)aSel.Min();
- // Wenn Selection, dann diese Loeschen
+ // if selection then delete it
if ( aSel.Len() )
{
if ( bSameMask )
@@ -627,9 +620,8 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
}
else if ( nKeyCode == KEY_INSERT )
{
- // InsertModus kann man beim PatternField nur einstellen,
- // wenn Maske an jeder Eingabeposition die gleiche
- // ist
+ // you can only set InsertModus for a PatternField if the
+ // mask is equal at all input positions
if ( !bSameMask )
{
Sound::Beep();
@@ -652,23 +644,20 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
cChar = cPattChar;
else
{
- // Wenn kein gueltiges Zeichen, dann testen wir, ob der
- // Anwender zum naechsten Literal springen wollte. Dies machen
- // wir nur, wenn er hinter einem Zeichen steht, damit
- // eingebene Literale die automatisch uebersprungenen wurden
- // nicht dazu fuehren, das der Anwender dann da steht, wo
- // er nicht stehen wollte.
+ // If no valid character, check if the user wanted to jump to next literal. We do this
+ // only if we're after a character, so that literals that were skipped automatically
+ // do not influence the position anymore.
if ( nNewPos &&
(rEditMask[nNewPos-1] != EDITMASK_LITERAL) &&
!aSel.Len() )
{
- // Naechstes Zeichen suchen, was kein Literal ist
+ // search for next character not being a literal
nTempPos = nNewPos;
while ( nTempPos < rEditMask.getLength() )
{
if ( rEditMask[nTempPos] == EDITMASK_LITERAL )
{
- // Gilt nur, wenn ein Literalzeichen vorhanden
+ // only valid if no literal present
if ( (rEditMask[nTempPos+1] != EDITMASK_LITERAL ) &&
ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar(nTempPos) ) )
{
@@ -697,8 +686,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
sal_Bool bError = sal_False;
if ( bSameMask && pEdit->IsInsertMode() )
{
- // Text um Spacezeichen und Literale am Ende kuerzen, bis zur
- // aktuellen Position
+ // crop spaces and literals at the end until current position
xub_StrLen n = aStr.Len();
while ( n && (n > nNewPos) )
{
@@ -715,7 +703,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
if ( aStr.Len() < rEditMask.getLength() )
{
- // String evtl. noch bis Cursor-Position erweitern
+ // possibly extend string until cursor position
if ( aStr.Len() < nNewPos )
aStr += rLiteralMask.Copy( aStr.Len(), nNewPos-aStr.Len() );
if ( nNewPos < aStr.Len() )
@@ -731,7 +719,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
{
if ( aSel.Len() )
{
- // Selection loeschen
+ // delete selection
XubString aRep = rLiteralMask.Copy( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
aStr.Replace( (xub_StrLen)aSel.Min(), aRep.Len(), aRep );
}
@@ -777,10 +765,8 @@ void PatternFormatter::ImplSetMask(const rtl::OString& rEditMask,
maLiteralMask.Expand(m_aEditMask.getLength(), ' ');
}
- // StrictModus erlaubt nur Input-Mode, wenn als Maske nur
- // gleiche Zeichen zugelassen werden und als Vorgabe nur
- // Spacezeichen vorgegeben werden, die durch die Maske
- // nicht zugelassen sind
+ // Strict mode allows only the input mode if only equal characters are allowed as mask and if
+ // only spaces are specified which are not allowed by the mask
xub_StrLen i = 0;
sal_Char c = 0;
while ( i < rEditMask.getLength() )
@@ -1270,7 +1256,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
sal_uInt16 nTwoDigitYearStart = utl::MiscCfg().GetYear2000();
sal_uInt16 nYear = rDate.GetYear();
- // Wenn Jahr nicht im 2stelligen Grenzbereich liegt,
+ // If year is not in double digit range
if ( (nYear < nTwoDigitYearStart) || (nYear >= nTwoDigitYearStart+100) )
bShowCentury = sal_True;
}
@@ -1421,7 +1407,7 @@ sal_Bool DateFormatter::ImplAllowMalformedInput() const
void DateField::ImplDateSpinArea( sal_Bool bUp )
{
- // Wenn alles selektiert ist, Tage hochzaehlen
+ // increment days if all is selected
if ( GetField() )
{
Date aDate( GetDate() );
@@ -1442,7 +1428,7 @@ void DateField::ImplDateSpinArea( sal_Bool bUp )
}
else
{
- // Area suchen
+ // search area
xub_StrLen nPos = 0;
String aDateSep = ImplGetDateSep( ImplGetLocaleDataWrapper(), eFormat );
for ( xub_StrLen i = 1; i <= 3; i++ )
@@ -1767,7 +1753,8 @@ void DateFormatter::ImplNewFieldValue( const Date& rDate )
Selection aSelection = GetField()->GetSelection();
aSelection.Justify();
XubString aText = GetField()->GetText();
- // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+
+ // If selected until the end then keep it that way
if ( (xub_StrLen)aSelection.Max() == aText.Len() )
{
if ( !aSelection.Len() )
@@ -1779,7 +1766,7 @@ void DateFormatter::ImplNewFieldValue( const Date& rDate )
ImplSetUserDate( rDate, &aSelection );
maLastDate = aOldLastDate;
- // Modify am Edit wird nur bei KeyInput gesetzt...
+ // Modify at Edit is only set at KeyInput
if ( GetField()->GetText() != aText )
{
GetField()->SetModifyFlag();
@@ -1805,10 +1792,8 @@ Date DateFormatter::GetDate() const
}
else
{
- // !!! TH-18.2.99: Wenn wir Zeit haben sollte einmal
- // !!! geklaert werden, warum dieses beim Datum gegenueber
- // !!! allen anderen Feldern anders behandelt wird.
- // !!! Siehe dazu Bug: 52304
+ // !!! We should find out why dates are treated differently than other fields (see
+ // also bug: 52384)
if ( !ImplAllowMalformedInput() )
{
@@ -1999,10 +1984,8 @@ long DateField::Notify( NotifyEvent& rNEvt )
{
if ( MustBeReformatted() )
{
- // !!! TH-18.2.99: Wenn wir Zeit haben sollte einmal
- // !!! geklaert werden, warum dieses beim Datum gegenueber
- // !!! allen anderen Feldern anders behandelt wird.
- // !!! Siehe dazu Bug: 52304
+ // !!! We should find out why dates are treated differently than other fields (see
+ // also bug: 52384)
sal_Bool bTextLen = GetText().Len() != 0;
if ( bTextLen || !IsEmptyFieldValueEnabled() )
@@ -2262,14 +2245,14 @@ static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime,
if ( !rStr.Len() )
return sal_False;
- // Nach Separatoren suchen
+ // Search for separators
if (!rLocaleDataWrapper.getTimeSep().isEmpty())
{
rtl::OUStringBuffer aSepStr(",.;:/");
if ( !bDuration )
aSepStr.append('-');
- // Die obigen Zeichen durch das Separatorzeichen ersetzen
+ // Replace characters above by the separator character
for (sal_Int32 i = 0; i < aSepStr.getLength(); ++i)
{
if (string::equals(rLocaleDataWrapper.getTimeSep(), aSepStr[i]))
@@ -2367,7 +2350,7 @@ static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime,
if ( n100Sec )
{
- xub_StrLen nLen = 1; // mindestens eine Ziffer, weil sonst n100Sec==0
+ xub_StrLen nLen = 1; // at least one digit, otherwise n100Sec==0
while ( aStr.GetChar(nLen) >= '0' && aStr.GetChar(nLen) <= '9' )
nLen++;
@@ -2379,7 +2362,7 @@ static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime,
n100Sec = n100Sec / 10;
nLen--;
}
- // Rundung bei negativen Zahlen???
+ // round if negative?
n100Sec = (n100Sec + 5) / 10;
}
else
@@ -2734,7 +2717,8 @@ void TimeFormatter::ImplNewFieldValue( const Time& rTime )
Selection aSelection = GetField()->GetSelection();
aSelection.Justify();
XubString aText = GetField()->GetText();
- // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+
+ // If selected until the end then keep it that way
if ( (xub_StrLen)aSelection.Max() == aText.Len() )
{
if ( !aSelection.Len() )
@@ -2746,7 +2730,7 @@ void TimeFormatter::ImplNewFieldValue( const Time& rTime )
ImplSetUserTime( rTime, &aSelection );
maLastTime = aOldLastTime;
- // Modify am Edit wird nur bei KeyInput gesetzt...
+ // Modify at Edit is only set at KeyInput
if ( GetField()->GetText() != aText )
{
GetField()->SetModifyFlag();