[Libreoffice-commits] core.git: sw/source

Philipp Weissenbacher p.weissenbacher at gmail.com
Tue Jan 27 02:03:44 PST 2015


 sw/source/core/text/porexp.cxx  |   51 +++++++--------
 sw/source/core/text/porfld.cxx  |  136 +++++++++++++++++++++-------------------
 sw/source/core/text/porfld.hxx  |   27 ++++---
 sw/source/core/text/porfly.cxx  |   69 ++++++++++----------
 sw/source/core/text/porfly.hxx  |    6 -
 sw/source/core/text/porglue.cxx |   24 ++++---
 sw/source/core/text/txtdrop.cxx |   10 +-
 sw/source/core/text/txthyph.cxx |   74 +++++++++++----------
 8 files changed, 212 insertions(+), 185 deletions(-)

New commits:
commit acabab05c1f99f9bd47638b9d3899d2e64aca1de
Author: Philipp Weissenbacher <p.weissenbacher at gmail.com>
Date:   Sun Jan 25 17:35:00 2015 +0100

    fdo#39468 Translate German comments - sw/source/core/text
    
    Change-Id: Idee941019e87f4e132110adf566e432f99df79ce
    Reviewed-on: https://gerrit.libreoffice.org/14174
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 50f2370..5e9e10a 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -28,8 +28,8 @@ sal_Int32 SwExpandPortion::GetCrsrOfst( const sal_uInt16 nOfst ) const
 bool SwExpandPortion::GetExpTxt( const SwTxtSizeInfo&, OUString &rTxt ) const
 {
     rTxt.clear();
-    // Nicht etwa: return 0 != rTxt.Len();
-    // Weil: leere Felder ersetzen CH_TXTATR gegen einen Leerstring
+    // Do not do: return 0 != rTxt.Len();
+    // Reason being: empty fields replace CH_TXTATR with an empty string
     return true;
 }
 
@@ -44,19 +44,17 @@ SwPosSize SwExpandPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
     return rInf.GetTxtSize();
 }
 
-// 5010: Exp und Tabs
-
 bool SwExpandPortion::Format( SwTxtFormatInfo &rInf )
 {
     SwTxtSlot aDiffTxt( &rInf, this, true, false );
     const sal_Int32 nFullLen = rInf.GetLen();
 
-    // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
-    // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
-    // false returnen wegen SetFull ...
+    // As odd as it may seem: the query for GetLen() must return
+    // false due to the ExpandPortions _after_ the aDiffTxt (see SoftHyphs)
+    // caused by the SetFull ...
     if( !nFullLen )
     {
-        // nicht Init(), weil wir Hoehe und Ascent brauchen
+        // Do not Init(), because we need height and ascent
         Width(0);
         return false;
     }
@@ -75,7 +73,7 @@ void SwExpandPortion::Paint( const SwTxtPaintInfo &rInf ) const
     rInf.DrawBackBrush( *this );
     rInf.DrawBorder( *this );
 
-    // do we have to repaint a post it portion?
+    // Do we have to repaint a post it portion?
     if( rInf.OnWin() && pPortion && !pPortion->Width() )
         pPortion->PrePaint( rInf, this );
 
@@ -98,11 +96,11 @@ void SwExpandPortion::Paint( const SwTxtPaintInfo &rInf ) const
 
 SwLinePortion *SwBlankPortion::Compress() { return this; }
 
-// 5497: Es gibt schon Gemeinheiten auf der Welt...
-// Wenn eine Zeile voll mit HardBlanks ist und diese ueberlaeuft,
-// dann duerfen keine Underflows generiert werden!
-// Komplikationen bei Flys...
-
+/**
+ * If a Line is full of HardBlanks and overflows, we must not generate
+ * underflows!
+ * Causes problems with Fly
+ */
 sal_uInt16 SwBlankPortion::MayUnderflow( const SwTxtFormatInfo &rInf,
     sal_Int32 nIdx, bool bUnderflow ) const
 {
@@ -114,9 +112,10 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTxtFormatInfo &rInf,
     while( pPos && pPos->IsBlankPortion() )
         pPos = pPos->GetPortion();
     if( !pPos || !rInf.GetIdx() || ( !pPos->GetLen() && pPos == rInf.GetRoot() ) )
-        return 0; // Nur noch BlankPortions unterwegs
-    // Wenn vor uns ein Blank ist, brauchen wir kein Underflow ausloesen,
-    // wenn hinter uns ein Blank ist, brauchen wir kein Underflow weiterreichen
+        return 0; // There are just BlankPortions left
+
+    // If a Blank is preceding us, we do not need to trigger underflow
+    // If a Blank is succeeding us, we do not need to pass on the underflow
     if (bUnderflow && nIdx + 1 < rInf.GetTxt().getLength() && CH_BLANK == rInf.GetTxt()[nIdx + 1])
         return 0;
     if( nIdx && !const_cast<SwTxtFormatInfo&>(rInf).GetFly() )
@@ -125,9 +124,9 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTxtFormatInfo &rInf,
             pPos = pPos->GetPortion();
         if( !pPos )
         {
-        //Hier wird ueberprueft, ob es in dieser Zeile noch sinnvolle Umbrueche
-        //gibt, Blanks oder Felder etc., wenn nicht, kein Underflow.
-        //Wenn Flys im Spiel sind, lassen wir das Underflow trotzdem zu.
+        // We check to see if there are useful line breaks, blanks or fields etc. left
+        // In case there still are some, no underflow
+        // If there are Flys, we still allow the underflow
             sal_Int32 nBlank = nIdx;
             while( --nBlank > rInf.GetLineStart() )
             {
@@ -149,7 +148,9 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTxtFormatInfo &rInf,
     return 2;
 }
 
-// Format end of Line
+/**
+ * Format End of Line
+ */
 void SwBlankPortion::FormatEOL( SwTxtFormatInfo &rInf )
 {
     sal_uInt16 nMay = MayUnderflow( rInf, rInf.GetIdx() - nLineLength, true );
@@ -169,7 +170,9 @@ void SwBlankPortion::FormatEOL( SwTxtFormatInfo &rInf )
     }
 }
 
-// 7771: Underflows weiterreichen und selbst ausloesen!
+/**
+ * Pass on the underflows and trigger them ourselves!
+ */
 bool SwBlankPortion::Format( SwTxtFormatInfo &rInf )
 {
     const bool bFull = rInf.IsUnderflow() || SwExpandPortion::Format( rInf );
@@ -216,14 +219,14 @@ void SwPostItsPortion::Paint( const SwTxtPaintInfo &rInf ) const
 
 sal_uInt16 SwPostItsPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
 {
-    // Nicht zu fassen: PostIts sind immer zu sehen.
+    // Unbelievable: PostIts are always visible
     return rInf.OnWin() ? rInf.GetOpt().GetPostItsWidth( rInf.GetOut() ) : 0;
 }
 
 bool SwPostItsPortion::Format( SwTxtFormatInfo &rInf )
 {
     const bool bRet = SwLinePortion::Format( rInf );
-    // 32749: PostIts sollen keine Auswirkung auf Zeilenhoehe etc. haben
+    // PostIts should not have an effect on line height etc.
     SetAscent( 1 );
     Height( 1 );
     return bRet;
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 2db653d..450cb3f 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -131,8 +131,9 @@ sal_uInt16 SwFldPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
     return nViewWidth;
 }
 
-// 8653: in keinem Fall nur SetLen(0);
-
+/**
+ * Never just use SetLen(0)
+ */
 class SwFldSlot
 {
     const OUString *pOldTxt;
@@ -154,7 +155,7 @@ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor )
 {
     bOn = pPor->GetExpTxt( *pNew, aTxt );
 
-    // Der Text wird ausgetauscht...
+    // The text will be replaced ...
     if( bOn )
     {
         pInf = (SwTxtFormatInfo*)pNew;
@@ -257,10 +258,9 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
             if (nCurrDir == UBIDI_RTL)
             {
                 nTmp = SW_CTL;
-                //If we decided that this range was RTL after all and the
-                //previous range was complex but clipped to the start of this
-                //range, then extend it to be complex over the additional RTL
-                //range
+                // If we decided that this range was RTL after all and the
+                // previous range was complex but clipped to the start of this
+                // range, then extend it to be complex over the additional RTL range
                 if (nScript == i18n::ScriptType::COMPLEX)
                     nNextScriptChg = nNextDirChg;
             }
@@ -316,18 +316,18 @@ bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
 
         SwFontSave aSave( rInf, pFnt );
 
-        // 8674: Laenge muss 0 sein, bei bFull nach Format ist die Laenge
-        // gesetzt und wird in nRest uebertragen. Ansonsten bleibt die
-        // Laenge erhalten und wuerde auch in nRest einfliessen!
+        // Length must be 0: the length is set for bFull after format
+        // and passed along in nRest. Or else the old length would be
+        // retained and be used for nRest!
         SetLen(0);
         const sal_Int32 nFollow = IsFollow() ? 0 : 1;
 
-        // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
-        // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
-        // false returnen wegen SetFull ...
+        // As odd is may seem: the query for GetLen() must return false due
+        // to the ExpandPortions _after_ aDiffTxt (see SoftHyphs), caused
+        // by SetFull.
         if( !nFullLen )
         {
-            // nicht Init(), weil wir Hoehe und Ascent brauchen
+            // Don't Init(), as we need height and ascent
             Width(0);
             bFull = rInf.Width() <= rInf.GetPos().X();
         }
@@ -353,14 +353,14 @@ bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
         bEOL = !nTmpLen && nFollow && bFull;
         nRest = nOldFullLen - nTmpLen;
 
-        // Das Zeichen wird in der ersten Portion gehalten.
-        // Unbedingt nach Format!
+        // The char is held in the first position
+        // Unconditionally after format!
         SetLen( (m_bNoLength) ? 0 : nFollow );
 
         if( nRest )
         {
-            // aExpand ist noch nicht gekuerzt worden, der neue Ofst
-            // ergibt sich durch nRest.
+            // aExpand has not yet been shortened; the new Ofst is a
+            // result of nRest
             sal_Int32 nNextOfst = aExpand.getLength() - nRest;
 
             if ( IsQuoVadisPortion() )
@@ -403,10 +403,11 @@ bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
             }
             pFld->SetFollow( true );
             SetHasFollow( true );
-            // In nNextOffset steht bei einem neuangelegten Feld zunaechst
-            // der Offset, an dem es selbst im Originalstring beginnt.
-            // Wenn beim Formatieren ein FollowFeld angelegt wird, wird
-            // der Offset dieses FollowFelds in nNextOffset festgehalten.
+
+            // For a newly created field, nNextOffset contains the Offset
+            // of it's start of the original string
+            // If a FollowField is created when formatting, this FollowField's
+            // Offset is being held in nNextOffset
             nNextOffset = nNextOffset + nNextOfst;
             pFld->SetNextOffset( nNextOffset );
             rInf.SetRest( pFld );
@@ -425,7 +426,7 @@ void SwFldPortion::Paint( const SwTxtPaintInfo &rInf ) const
     OSL_ENSURE( GetLen() <= 1, "SwFldPortion::Paint: rest-portion pollution?" );
     if( Width() && ( !bPlaceHolder || rInf.GetOpt().IsShowPlaceHolderFields() ) )
     {
-        // Dies ist eine freizuegige Auslegung der Hintergrundbelegung ...
+        // A very liberal use of the background
         rInf.DrawViewOpt( *this, POR_FLD );
         SwExpandPortion::Paint( rInf );
     }
@@ -485,7 +486,7 @@ void SwHiddenPortion::Paint( const SwTxtPaintInfo &rInf ) const
 
 bool SwHiddenPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const
 {
-    // Nicht auf IsHidden() abfragen !
+    // Do not query for IsHidden()!
     return SwFldPortion::GetExpTxt( rInf, rTxt );
 }
 
@@ -521,11 +522,12 @@ SwFldPortion *SwNumberPortion::Clone( const OUString &rExpand ) const
                                 nMinDist, mbLabelAlignmentPosAndSpaceModeActive );
 }
 
-// 5010: Wir sind in der Lage, mehrzeilige NumFelder anzulegen!
-// 3689: Fies ist, wenn man in der Dialogbox soviel Davor-Text
-// eingibt, bis die Zeile ueberlaeuft.
-// Man muss die Fly-Ausweichmanoever beachten!
-
+/**
+ * We can create multiple NumFields
+ * Tricky, if one enters enough previous-text in the dialog box
+ * to cause the line to overflow
+ * We need to keep the Fly's evasion tactics in mind
+ */
 bool SwNumberPortion::Format( SwTxtFormatInfo &rInf )
 {
     SetHide( false );
@@ -558,9 +560,8 @@ bool SwNumberPortion::Format( SwTxtFormatInfo &rInf )
                 nDiff = rInf.Left() - rInf.First() + rInf.ForcedLeftMargin();
             }
         }
-        // proposal from Juergen and Volkmar:
-        // Der Textteil hinter der Numerierung sollte immer
-        // mindestens beim linken Rand beginnen.
+        // The text part of the numbering should always at least
+        // start at the left margin
         if( nDiff < 0 )
             nDiff = 0;
         else if ( nDiff > rInf.X() )
@@ -570,10 +571,11 @@ bool SwNumberPortion::Format( SwTxtFormatInfo &rInf )
 
         if( nDiff < nFixWidth + nMinDist )
             nDiff = nFixWidth + nMinDist;
-        // 2739: Numerierung weicht Fly aus, kein nDiff in der zweiten Runde
-        // fieser Sonderfall: FlyFrm liegt in dem Bereich,
-        // den wir uns gerade unter den Nagel reissen wollen.
-        // Die NumberPortion wird als verborgen markiert.
+
+        // Numbering evades the Fly, no nDiff in the second round
+        // Tricky special case: FlyFrm is in an Area we're just about to
+        // acquire
+        // The NumberPortion is marked as hidden
         const bool bFly = rInf.GetFly() ||
             ( rInf.GetLast() && rInf.GetLast()->IsFlyPortion() );
         if( nDiff > rInf.Width() )
@@ -596,12 +598,14 @@ bool SwNumberPortion::Format( SwTxtFormatInfo &rInf )
     return bFull;
 }
 
+
+/**
+ * A FormatEOL indicates that the subsequent text did not fit onto
+ * the line anymore. In order for the Numbering to follow through,
+ * we hide this NumberPortion
+ */
 void SwNumberPortion::FormatEOL( SwTxtFormatInfo& )
 {
-/*  Ein FormatEOL deutet daraufhin, dass der folgende Text
- *  nicht mit auf die Zeile passte. Damit die Numerierung mitwandert,
- *  wird diese NumberPortion verborgen.
- */
 
     // This caused trouble with flys anchored as characters.
     // If one of these is numbered but does not fit to the line,
@@ -610,12 +614,13 @@ void SwNumberPortion::FormatEOL( SwTxtFormatInfo& )
 //    SetHide( true );
 }
 
+
+/**
+ * A hidden NumberPortion is not displayed, unless there are TextPortions in
+ * this line or there's just one line at all
+ */
 void SwNumberPortion::Paint( const SwTxtPaintInfo &rInf ) const
 {
-/*  Eine verborgene NumberPortion wird nicht angezeigt, es sei denn, es gibt
- *  Textportions in dieser Zeile oder es gibt ueberhaupt nur eine einzige Zeile.
- */
-
     if ( IsHide() && rInf.GetParaPortion() && rInf.GetParaPortion()->GetNext() )
     {
         SwLinePortion *pTmp = GetPortion();
@@ -839,19 +844,19 @@ bool SwGrfNumPortion::Format( SwTxtFormatInfo &rInf )
     long nDiff = mbLabelAlignmentPosAndSpaceModeActive
                  ? 0
                  : rInf.Left() - rInf.First() + rInf.ForcedLeftMargin();
-    // proposal by Juergen and Volkmar:
-    // Der Textteil hinter der Numerierung sollte immer
-    // mindestens beim linken Rand beginnen.
+    // The TextPortion should at least always start on the
+    // left margin
     if( nDiff < 0 )
         nDiff = 0;
     else if ( nDiff > rInf.X() )
         nDiff -= rInf.X();
     if( nDiff < nFixWidth + nMinDist )
         nDiff = nFixWidth + nMinDist;
-    // 2739: Numerierung weicht Fly aus, kein nDiff in der zweiten Runde
-    // fieser Sonderfall: FlyFrm liegt in dem Bereich,
-    // den wir uns gerade unter den Nagel reissen wollen.
-    // Die NumberPortion wird als verborgen markiert.
+
+    // Numbering evades Fly, no nDiff in the second round
+    // Tricky special case: FlyFrm is in the Area we were just
+    // about to get a hold of.
+    // The NumberPortion is marked as hidden
     if( nDiff > rInf.Width() )
     {
         nDiff = rInf.Width();
@@ -864,13 +869,15 @@ bool SwGrfNumPortion::Format( SwTxtFormatInfo &rInf )
     return bFull;
 }
 
+
+/**
+ * A hidden NumberPortion is not displayed, unless there are TextPortions in
+ * this line or there's only one line at all
+ */
 void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
 {
     if( DontPaint() )
         return;
-/*  Eine verborgene NumberPortion wird nicht angezeigt, es sei denn, es gibt
- *  Textportions in dieser Zeile oder es gibt ueberhaupt nur eine einzige Zeile.
- */
     if ( IsHide() && rInf.GetParaPortion() && rInf.GetParaPortion()->GetNext() )
     {
         SwLinePortion *pTmp = GetPortion();
@@ -1009,10 +1016,8 @@ void SwGrfNumPortion::SetBase( long nLnAscent, long nLnDescent,
         {
             if( GetGrfHeight() >= nFlyAsc + nFlyDesc )
             {
-                // wenn ich genauso gross bin wie die Zeile, brauche ich mich
-                // nicht an der Zeile nicht weiter ausrichten, ich lasse
-                // dann auch den max. Ascent der Zeile unveraendert
-
+                // If I'm as large as the line, I do not need to adjust
+                // at the line; I'll leave the max. ascent unchanged
                 SetRelPos( nFlyAsc );
             }
             else if ( GetOrient() == text::VertOrientation::LINE_CENTER )
@@ -1038,9 +1043,9 @@ void SwTxtFrm::StopAnimation( OutputDevice* pOut )
             {
                 if( pPor->IsGrfNumPortion() )
                     static_cast<SwGrfNumPortion*>(pPor)->StopAnimation( pOut );
-                // Die Numerierungsportion sitzt immer vor dem ersten Zeichen,
-                // deshalb koennen wir abbrechen, sobald wir eine Portion mit
-                // einer Laenge > 0 erreicht haben.
+                // The NumberPortion is always at the first char,
+                // which means we can cancel as soon as we've reached a portion
+                // with a length > 0
                 pPor = pPor->GetLen() ? 0 : pPor->GetPortion();
             }
             pLine = pLine->GetLen() ? 0 : pLine->GetNext();
@@ -1048,7 +1053,9 @@ void SwTxtFrm::StopAnimation( OutputDevice* pOut )
     }
 }
 
-// initializes the script array and clears the width array
+/**
+ * Initializes the script array and clears the width array
+ */
 SwCombinedPortion::SwCombinedPortion( const OUString &rTxt )
     : SwFldPortion( rTxt )
     , nUpPos(0)
@@ -1059,6 +1066,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rTxt )
     SetWhichPor( POR_COMBINED );
     if( aExpand.getLength() > 6 )
         aExpand = aExpand.copy( 0, 6 );
+
     // Initialization of the scripttype array,
     // the arrays of width and position are filled by the format function
     if( g_pBreakIt->GetBreakIter().is() )
@@ -1113,8 +1121,9 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const
             if( i == nTop ) // change the row
                 aOutPos.Y() = aOldPos.Y() + nLowPos;    // Y of the second row
             aOutPos.X() = aOldPos.X() + aPos[i];        // X position
-            const sal_uInt8 nAct = aScrType[i];             // script type
+            const sal_uInt8 nAct = aScrType[i];        // script type
             aTmpFont.SetActual( nAct );
+
             // if there're more than 4 characters to display, we choose fonts
             // with 2/3 of the original font width.
             if( aWidth[ nAct ] )
@@ -1144,6 +1153,7 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
     }
 
     OSL_ENSURE( nCount < 7, "Too much combined characters" );
+
     // If there are leading "weak"-scripttyped characters in this portion,
     // they get the actual scripttype.
     for( sal_Int32 i = 0; i < nCount && SW_SCRIPTS == aScrType[i]; ++i )
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 952ff8f..19e5936 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -32,11 +32,11 @@ class SwFldPortion : public SwExpandPortion
 {
     friend class SwTxtFormatter;
 protected:
-    OUString  aExpand;              // The expanded field
-    SwFont  *pFnt;                  // For multi-line fields
-    sal_Int32 nNextOffset;         // Offset of the follow in the original string
+    OUString  aExpand;          // The expanded field
+    SwFont  *pFnt;              // For multi-line fields
+    sal_Int32 nNextOffset;      // Offset of the follow in the original string
     sal_Int32 nNextScriptChg;
-    sal_uInt16  nViewWidth;             // Screen width for empty fields
+    sal_uInt16  nViewWidth;     // Screen width for empty fields
     bool bFollow : 1;           // 2nd or later part of a field
     bool bLeft : 1;             // Used by SwNumberPortion
     bool bHide : 1;             // Used by SwNumberPortion
@@ -107,8 +107,9 @@ public:
     OUTPUT_OPERATOR_OVERRIDE
 };
 
-// Distinguish only for painting/hide
-
+/**
+ * Distinguish only for painting/hide
+ */
 class SwHiddenPortion : public SwFldPortion
 {
 public:
@@ -202,12 +203,14 @@ public:
     OUTPUT_OPERATOR_OVERRIDE
 };
 
-// Used in for asian layout specialities to display up to six characters
-// in 2 rows and 2-3 columns.
-// e.g.
-//
-//       A..  A..  A.B  A.B   A.B.C   A.B.C
-//       ...  ..B  .C.  C.D   .D.E.   D.E.F
+/**
+ * Used in for asian layout specialities to display up to six characters
+ * in 2 rows and 2-3 columns.
+ * E.g.: <pre>
+ *        A..  A..  A.B  A.B   A.B.C   A.B.C
+ *        ...  ..B  .C.  C.D   .D.E.   D.E.F
+ *        </pre>
+ */
 class SwCombinedPortion : public SwFldPortion
 {
     sal_uInt16 aPos[6];     // up to six X positions
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 2fbb5069b..c756fce 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -42,7 +42,9 @@
 
 #include <sortedobjs.hxx>
 
-// class SwFlyPortion => we expect a frame-locale SwRect!
+/**
+ * class SwFlyPortion => we expect a frame-locale SwRect!
+ */
 
 void SwFlyPortion::Paint( const SwTxtPaintInfo& ) const
 {
@@ -51,7 +53,8 @@ void SwFlyPortion::Paint( const SwTxtPaintInfo& ) const
 bool SwFlyPortion::Format( SwTxtFormatInfo &rInf )
 {
     OSL_ENSURE( Fix() >= rInf.X(), "SwFlyPortion::Format" );
-    // tabs must be expanded (Bug 8537)
+
+    // tabs must be expanded
     if( rInf.GetLastTab() )
         rInf.GetLastTab()->FormatEOL( rInf );
 
@@ -99,9 +102,9 @@ bool SwFlyCntPortion::Format( SwTxtFormatInfo &rInf )
 
     if( bFull )
     {
-        // 3924: if the line is full, and the character-bound frame is at
-        //       the beginning of a line
-        // 5157: if it is not possible to side step into a Fly
+        // If the line is full, and the character-bound frame is at
+        // the beginning of a line
+        // If it is not possible to side step into a Fly
         // "Begin of line" criteria ( ! rInf.X() ) has to be extended.
         // KerningPortions at beginning of line, e.g., for grid layout
         // must be considered.
@@ -151,9 +154,7 @@ void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, sal_Int32 nStart, sal_Int32 nEnd )
     {
         for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i )
         {
-            // OD 2004-03-29 #i26791#
-            // #i28701# - consider changed type of
-            // <SwSortedList> entries
+            // Consider changed type of <SwSortedList> entries
             SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
             const SwFmtAnchor& rAnch = pAnchoredObj->GetFrmFmt().GetAnchor();
             if (rAnch.GetAnchorId() == FLY_AS_CHAR)
@@ -208,16 +209,15 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
     {
         if( !((SwDrawContact*)pContact)->GetAnchorFrm() )
         {
-            // OD 2004-04-01 #i26791# - no direct positioning of the drawing
-            // object is needed.
+            // No direct positioning of the drawing object is needed
             SwDrawContact* pDrawContact = static_cast<SwDrawContact*>(pContact);
             pDrawContact->ConnectToLayout();
         }
     }
     else
     {
-        // baseline output
-        // 7922: re-paint everything at a CompletePaint call
+        // Baseline output
+        // Re-paint everything at a CompletePaint call
         SwRect aRepaintRect( rInf.GetPaintRect() );
 
         if ( rInf.GetTxtFrm()->IsRightToLeft() )
@@ -255,8 +255,9 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
     }
 }
 
-// use the dimensions of pFly->OutRect()
-// OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
+/**
+ * Use the dimensions of pFly->OutRect()
+ */
 SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
                                   SwFlyInCntFrm *pFly, const Point &rBase,
                                   long nLnAscent, long nLnDescent,
@@ -274,7 +275,6 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
     SetWhichPor( POR_FLYCNT );
 }
 
-// OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
 SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
                                   SwDrawContact *pDrawContact, const Point &rBase,
                                   long nLnAscent, long nLnDescent,
@@ -288,10 +288,10 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
     OSL_ENSURE( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" );
     if( !pDrawContact->GetAnchorFrm() )
     {
-        // OD 2004-04-01 #i26791# - no direct positioning needed any more
+        // No direct positioning needed any more
         pDrawContact->ConnectToLayout();
-        // #i40333# - follow-up of #i35635#
-        // move object to visible layer
+
+        // Move object to visible layer
         pDrawContact->MoveObjToVisibleLayer( pDrawContact->GetMaster() );
     }
     nLineLength = 1;
@@ -302,31 +302,33 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
     SetWhichPor( POR_FLYCNT );
 }
 
-// after setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos.
-// OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
-/// @param rBase CAUTION:needs to be an absolute value
+/**
+ * After setting the RefPoints, the ascent needs to be recalculated
+ * because it is dependent on RelPos
+ *
+ * @param rBase CAUTION: needs to be an absolute value!
+ */
 void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
                                long nLnAscent, long nLnDescent,
                                long nFlyAsc, long nFlyDesc,
                                objectpositioning::AsCharFlags nFlags )
 {
-    // OD 28.10.2003 #113049# - use new class to position object
-    // determine drawing object
+    // Use new class to position object
+    // Determine drawing object
     SdrObject* pSdrObj = 0L;
     if( bDraw )
     {
-        // OD 20.06.2003 #108784# - determine drawing object ('master' or 'virtual')
-        // by frame.
+        // Determine drawing object ('master' or 'virtual') by frame
         pSdrObj = GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm );
         if ( !pSdrObj )
         {
             OSL_FAIL( "SwFlyCntPortion::SetBase(..) - No drawing object found by <GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm )>" );
             pSdrObj = GetDrawContact()->GetMaster();
         }
-        // #i65798#
-        // call <SwAnchoredDrawObject::MakeObjPos()> to assure that flag at
+
+        // Call <SwAnchoredDrawObject::MakeObjPos()> to assure that flag at
         // the <DrawFrmFmt> and at the <SwAnchoredDrawObject> instance are
-        // correctly set.
+        // correctly set
         if ( pSdrObj )
         {
             GetDrawContact()->GetAnchoredObj( pSdrObj )->MakeObjPos();
@@ -346,9 +348,8 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
                                     rBase, nFlags,
                                     nLnAscent, nLnDescent, nFlyAsc, nFlyDesc );
 
-    // OD 2004-04-13 #i26791# - scope of local variable <aObjPosInProgress>
+    // Scope of local variable <aObjPosInProgress>
     {
-        // OD 2004-04-13 #i26791#
         SwObjPositioningInProgress aObjPosInProgress( *pSdrObj );
         aObjPositioning.CalcPosition();
     }
@@ -416,10 +417,10 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
 sal_Int32 SwFlyCntPortion::GetFlyCrsrOfst( const sal_uInt16 nOfst,
     const Point &rPoint, SwPosition *pPos, SwCrsrMoveState* pCMS ) const
 {
-    // Da die FlyCnt nicht an der Seite haengen, wird ihr
-    // GetCrsrOfst() nicht gerufen. Um die Layoutseite
-    // von unnoetiger Verwaltung zu entlasten, ruft der Absatz
-    // das GetCrsrOfst des FlyFrm, wenn es erforderlich ist.
+    // As the FlyCnt are not attached to the side, their GetCrsrOfst() will
+    // not be called.
+    // In order to reduce management overhead for the layout page, the paragraph
+    // calls the FlyFrm's GetCrsrOfst() only when needed
     Point aPoint( rPoint );
     if( !pPos || bDraw || !( GetFlyFrm()->GetCrsrOfst( pPos, aPoint, pCMS ) ) )
         return SwLinePortion::GetCrsrOfst( nOfst );
diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx
index 1921c1b..31be954 100644
--- a/sw/source/core/text/porfly.hxx
+++ b/sw/source/core/text/porfly.hxx
@@ -52,12 +52,12 @@ class SwFlyCntPortion : public SwLinePortion
     virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
 
 public:
-    // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
+    // Use new datatype for parameter <nFlags>
     SwFlyCntPortion( const SwTxtFrm& rFrm, SwFlyInCntFrm *pFly,
                      const Point &rBase,
                      long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
                      objectpositioning::AsCharFlags nFlags );
-    // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
+    // Use new datatype for parameter <nFlags>
     SwFlyCntPortion( const SwTxtFrm& rFrm, SwDrawContact *pDrawContact,
                      const Point &rBase,
                      long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
@@ -74,7 +74,7 @@ public:
     inline sal_uInt8 GetAlign() const { return nAlign; }
     inline void SetAlign( sal_uInt8 nNew ) { nAlign = nNew; }
     inline void SetMax( bool bNew ) { bMax = bNew; }
-    // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
+    // Use new datatype for parameter <nFlags>
     void SetBase( const SwTxtFrm& rFrm, const Point &rBase,
                   long nLnAscent, long nLnDescent,
                   long nFlyAscent, long nFlyDescent,
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 77432df..a0e5af1 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -118,7 +118,7 @@ void SwGluePortion::MoveGlue( SwGluePortion *pTarget, const short nPrtGlue )
 
 void SwGluePortion::Join( SwGluePortion *pVictim )
 {
-    // Die GluePortion wird ausgesogen und weggespuelt ...
+    // The GluePortion is extracted and flushed away ...
     AddPrtWidth( pVictim->PrtWidth() );
     SetLen( pVictim->GetLen() + GetLen() );
     if( Height() < pVictim->Height() )
@@ -129,7 +129,9 @@ void SwGluePortion::Join( SwGluePortion *pVictim )
     delete pVictim;
 }
 
-// Wir erwarten ein framelokales SwRect !
+/**
+ * We're expecting a frame-local SwRect!
+ */
 SwFixPortion::SwFixPortion( const SwRect &rRect )
        :SwGluePortion( sal_uInt16(rRect.Width()) ), nFix( sal_uInt16(rRect.Left()) )
 {
@@ -149,14 +151,16 @@ SwMarginPortion::SwMarginPortion( const sal_uInt16 nFixedWidth )
     SetWhichPor( POR_MARGIN );
 }
 
-// In the outer loop all portions are inspected - the GluePortions
-// at the end are processed first.
-// The end is shifted forwardly till no more GluePortions remain.
-// Always GluePortion-pairs (pLeft and pRight) are treated, where
-// textportions between pLeft and pRight are moved at the back of
-// pRight if pRight has enough Glue. With every move part of the
-// Glue is transferred from pRight to pLeft.
-// The next loop starts with the processed pLeft as pRight.
+/**
+ * In the outer loop all portions are inspected - the GluePortions
+ * at the end are processed first.
+ * The end is shifted forwardly till no more GluePortions remain.
+ * Always GluePortion-pairs (pLeft and pRight) are treated, where
+ * textportions between pLeft and pRight are moved at the back of
+ * pRight if pRight has enough Glue. With every move part of the
+ * Glue is transferred from pRight to pLeft.
+ * The next loop starts with the processed pLeft as pRight.
+ */
 void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
 {
     SwGluePortion *pRight = 0;
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 95b4ebe..c684268 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -315,10 +315,8 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const
     const_cast<SwDropPortion*>(this)->Width( Width() - nX );
     const_cast<SwDropPortion*>(this)->SetAscent( nDropHeight );
 
-    // adapt Clipregion to us
-    // Und zwar immer, und nie mit dem bestehenden ClipRect
-    // verrechnen, weil dies auf die Zeile eingestellt sein koennte.
-
+    // Always adapt Clipregion to us, never set it off using the existing ClipRect
+    // as that could be set for the line
     SwRect aClipRect;
     if ( rInf.OnWin() )
     {
@@ -327,7 +325,8 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const
     }
     SwSaveClip aClip( (OutputDevice*)rInf.GetOut() );
     aClip.ChgClip( aClipRect, rInf.GetTxtFrm() );
-    // Das machen, was man sonst nur macht ...
+
+    // Just do, what we always do ...
     PaintTxt( rInf );
 
     // save old values
@@ -376,6 +375,7 @@ bool SwDropPortion::FormatTxt( SwTxtFormatInfo &rInf )
     Truncate();
     SetLen( nOldLen );
     rInf.SetLen( nOldInfLen );
+
     return true;
 }
 
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index e0ae055..059e24e 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -399,8 +399,8 @@ SwSoftHyphPortion::SwSoftHyphPortion() :
 
 sal_uInt16 SwSoftHyphPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
 {
-    // Wir stehen zwar im const, aber nViewWidth sollte erst im letzten
-    // Moment errechnet werden:
+    // Although we're in the const, nViewWidth should be calculated at
+    // the last possible moment
     if( !Width() && rInf.OnWin() && rInf.GetOpt().IsSoftHyph() && !IsExpand() )
     {
         if( !nViewWidth )
@@ -412,13 +412,15 @@ sal_uInt16 SwSoftHyphPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
     return nViewWidth;
 }
 
-/*  Faelle:
- *  1) SoftHyph steht in der Zeile, ViewOpt aus.
- *     -> unsichtbar, Nachbarn unveraendert
- *  2) SoftHyph steht in der Zeile, ViewOpt an.
- *     -> sichtbar, Nachbarn veraendert
- *  3) SoftHyph steht am Zeilenende, ViewOpt aus/an.
- *     -> immer sichtbar, Nachbarn unveraendert
+/**
+ * Cases:
+ *
+ *  1) SoftHyph is in the line, ViewOpt off
+ *     -> invisible, neighbors unchanged
+ *  2) SoftHyph is in the line, ViewOpt on
+ *     -> visible, neighbors unchanged
+ *  3) SoftHyph is at the end of the line, ViewOpt or or off
+ *     -> always visible, neighbors unchanged
  */
 void SwSoftHyphPortion::Paint( const SwTxtPaintInfo &rInf ) const
 {
@@ -429,20 +431,22 @@ void SwSoftHyphPortion::Paint( const SwTxtPaintInfo &rInf ) const
     }
 }
 
-/* Die endgueltige Breite erhalten wir im FormatEOL().
- * In der Underflow-Phase stellen wir fest, ob ueberhaupt ein
- * alternatives Spelling vorliegt. Wenn ja ...
+/**
+ * We get the final width from the FormatEOL()
  *
- * Fall 1: "Au-to"
- * 1) {Au}{-}{to}, {to} passt nicht mehr => Underflow
- * 2) {-} ruft Hyphenate => keine Alternative
- * 3) FormatEOL() und bFull = true
+ * During the underflow-phase we determine, whether or not
+ * there's an alternative spelling at all ...
  *
- * Fall 2: "Zuc-ker"
- * 1) {Zuc}{-}{ker}, {ker} passt nicht mehr => Underflow
- * 2) {-} ruft Hyphenate => Alternative!
- * 3) Underflow() und bFull = true
- * 4) {Zuc} ruft Hyphenate => {Zuk}{-}{ker}
+ * Case 1: "Au-to"
+ * 1) {Au}{-}{to}, {to} does not fit anymore => underflow
+ * 2) {-} calls hyphenate => no alternative
+ * 3) FormatEOL() and bFull = true
+ *
+ * Case 2: "Zuc-ker"
+ * 1) {Zuc}{-}{ker}, {ker} does not fit anymore => underflow
+ * 2) {-} calls hyphenate => alternative!
+ * 3) Underflow() and bFull = true
+ * 4) {Zuc} calls hyphenate => {Zuk}{-}{ker}
  */
 bool SwSoftHyphPortion::Format( SwTxtFormatInfo &rInf )
 {
@@ -492,15 +496,16 @@ bool SwSoftHyphPortion::Format( SwTxtFormatInfo &rInf )
     SetExpand( false );
     if( !bFull )
     {
-        // default-maessig besitzen wir keine Breite, aber eine Hoehe
+        // By default, we do not have a width, but we do have a height
         nHyphWidth = Width();
         Width(0);
     }
     return bFull;
 }
 
-// Format end of Line
-
+/**
+ * Format End of Line
+ */
 void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf )
 {
     if( !IsExpand() )
@@ -509,7 +514,7 @@ void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf )
         if( rInf.GetLast() == this )
             rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
 
-        // 5964: alte Werte muessen wieder zurueckgesetzt werden.
+        // We need to reset the old values
         const SwTwips nOldX  = rInf.X();
         const sal_Int32 nOldIdx = rInf.GetIdx();
         rInf.X( rInf.X() - PrtWidth() );
@@ -517,9 +522,8 @@ void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf )
         const bool bFull = SwHyphPortion::Format( rInf );
         nHyphWidth = Width();
 
-        // 6976: Eine truebe Sache: Wir werden erlaubterweise breiter,
-        // aber gleich wird noch ein Fly verarbeitet, der eine korrekte
-        // X-Position braucht.
+        // Shady business: We're allowed to get wider, but a Fly is also
+        // being processed, which needs a correct X position
         if( bFull || !rInf.GetFly() )
             rInf.X( nOldX );
         else
@@ -528,10 +532,12 @@ void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf )
     }
 }
 
-// Wir expandieren:
-// - wenn die Sonderzeichen sichtbar sein sollen
-// - wenn wir am Ende der Zeile stehen.
-// - wenn wir vor einem (echten/emuliertem) Zeilenumbruch stehen
+/**
+ * We're expanding:
+ * - if the special characters should be visible
+ * - if we're at the end of the line
+ * - if we're before a (real/emulated) line break
+ */
 bool SwSoftHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const
 {
     if( IsExpand() || ( rInf.OnWin() && rInf.GetOpt().IsSoftHyph() ) ||
@@ -554,8 +560,8 @@ void SwSoftHyphPortion::HandlePortion( SwPortionHandler& rPH ) const
 
 void SwSoftHyphStrPortion::Paint( const SwTxtPaintInfo &rInf ) const
 {
-    // Bug oder feature?:
-    // {Zu}{k-}{ker}, {k-} wird grau statt {-}
+    // Bug or feature?:
+    // {Zu}{k-}{ker}, {k-} will be gray instead of {-}
     rInf.DrawViewOpt( *this, POR_SOFTHYPH );
     SwHyphStrPortion::Paint( rInf );
 }


More information about the Libreoffice-commits mailing list