[Libreoffice-commits] .: 2 commits - sw/source

Michael Stahl mst at kemper.freedesktop.org
Wed Apr 4 05:48:14 PDT 2012


 sw/source/core/layout/flowfrm.cxx |   49 +++++++--------
 sw/source/core/text/txtfly.cxx    |  118 ++++++++++++++++++--------------------
 2 files changed, 81 insertions(+), 86 deletions(-)

New commits:
commit 3fd17063706df98b1606f7a5426019ce8f1db201
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Apr 4 14:46:35 2012 +0200

    flowfrm.cxx: tweak comment translation

diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index ed88edc..51fa1be 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -313,28 +313,26 @@ sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRe
     // it's reasonable to relocate and test-format (2).
     //
     // Bit 1 in this case means that there are objects anchored to myself,
-    // bit 2 means that I have to avoid other objects.
+    // bit 2 means that I have to evade other objects.
 
-    // If a SurroundObj that desires to be wrapped around overlaps with the Rect,
-    // it's required to float (because we can't guess the relationships).
+    // If a SurroundObj that desires to be wrapped around overlaps with the
+    // Rect, it's required to flow (because we can't guess the relationships).
     // However it's possible for a test formatting to happen.
-    //
-    // If the SurroundObj is a Fly and I'm a Lower, or the Fly is a lower of
+    // If the SurroundObj is a Fly and I'm a Lower, or the Fly is a Lower of
     // mine, then it doesn't matter.
-    //
     // If the SurroundObj is anchored in a character bound Fly, and I'm not
     // a Lower of that character bound Fly myself, then the Fly doesn't matter.
 
-    //#32639# If the object is anchored with me, i can neglect it, because
-    //it's likely that it will follow the flow. A test formatting is not
-    //allowed in that case, however!
+    // #32639# If the object is anchored with me, i can ignore it, because
+    // it's likely that it will follow me with the flow. A test formatting is
+    // not allowed in that case, however!
     sal_uInt8 nRet = 0;
     SwFlowFrm *pTmp = this;
     do
     {   // If there are objects hanging either on me or on a follow, we can't
         // do a test formatting, because paragraph bound objects wouldn't
         // be properly considered, and character bound objects shouldn't
-        // be test formatted either.
+        // be test formatted at all.
         if( pTmp->GetFrm()->GetDrawObjs() )
             nRet = 1;
         pTmp = pTmp->GetFollow();
@@ -372,7 +370,7 @@ sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRe
                 }
 
                 // Don't do this if the object is anchored behind me in the text
-                // flow, because then I wouldn't avoid it.
+                // flow, because then I wouldn't evade it.
                 if ( ::IsFrmInSameKontext( pAnchor, &rThis ) )
                 {
                     if ( rFmt.GetAnchor().GetAnchorId() == FLY_AT_PARA )
@@ -381,7 +379,7 @@ sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRe
                         sal_uLong nTmpIndex = rFmt.GetAnchor().GetCntntAnchor()->nNode.GetIndex();
                         // Now we're going to check whether the current paragraph before
                         // the anchor of the displacing object sits in the text. If this
-                        // is the case, we don't try to avoid it.
+                        // is the case, we don't try to evade it.
                         // The index is being determined via SwFmtAnchor, because it's
                         // getting quite expensive otherwise.
                         if( ULONG_MAX == nIndex )
@@ -473,7 +471,7 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart )
             while ( pCnt && pLay->IsAnLower( pCnt ) )
             {
                 // It's possible for the CntFrm to be locked, and we don't want
-                // to end up in an endless sideways movement, so we're not even
+                // to end up in an endless page migration, so we're not even
                 // going to call Calc!
                 OSL_ENSURE( pCnt->IsTxtFrm(), "The Graphic has landed." );
                 if ( ((SwTxtFrm*)pCnt)->IsLocked() ||
@@ -498,7 +496,7 @@ sal_Bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibl
     //returns sal_True if there's a LayoutFrm in the chain.
     sal_Bool bRet = sal_False;
 
-    // The chain beginning with pStart is being hanged before the sibling
+    // The chain beginning with pStart is inserted before pSibling
     // under the parent. We take care to invalidate as required.
 
     // I'm receiving a finished chain. We need to update the pointers for
@@ -790,8 +788,8 @@ SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const
 |*
 |*  SwFrm::GetLeaf()
 |*
-|*  Description        Returns the next/previous Layout leave that's NOT
-|*      below this (or even is this itself). Also, that leave must be in the same
+|*  Description        Returns the next/previous Layout leaf that's NOT below
+|*      this (or even is this itself). Also, that leaf must be in the same
 |*      text flow as the pAnch origin frm (Body, Ftn)
 |*
 |*************************************************************************/
@@ -895,7 +893,7 @@ sal_Bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
     // because then it's likely for the next page to have been
     // wrong and having been swapped because of that.
     // This in turn means that I have a new (and correct) page,
-    // but the conditions to swap are still not given.
+    // but the conditions to swap still apply.
     // Way out of the situation: Try to preliminarily insert a
     // new page once (empty pages are already inserted by InsertPage()
     // if required)
@@ -1149,8 +1147,9 @@ sal_Bool SwFlowFrm::IsPrevObjMove() const
         if( SwFlowFrm::CastFlowFrm( pPre )->IsAnFollow( this ) )
             return sal_False;
         SwLayoutFrm* pPreUp = pPre->GetUpper();
-        // If the upper is a SectionFrm, or a column of a SectionFrm, we're allowed
-        // to protrude it. However, we need to respect the Upper of the SectionFrm.
+        // If the upper is a SectionFrm, or a column of a SectionFrm, we're
+        // allowed to protrude out of it.  However, we need to respect the
+        // Upper of the SectionFrm.
         if( pPreUp->IsInSct() )
         {
             if( pPreUp->IsSctFrm() )
@@ -1201,7 +1200,7 @@ sal_Bool SwFlowFrm::IsPrevObjMove() const
 |*      predecessor (AFTER). If there's no predecessor on the page, we don't
 |*      need to think further.
 |*      Also, a page break (or the need for one) is also present if
-|*      the FrmFmt tells us so.
+|*      the FrmFmt contains a PageDesc.
 |*      The implementation works only on CntntFrms! - the definition
 |*      of the predecessor is not clear for LayoutFrms.
 |*
@@ -1256,11 +1255,11 @@ sal_Bool SwFlowFrm::IsPageBreak( sal_Bool bAct ) const
 |*
 |*  sal_Bool SwFlowFrm::IsColBreak()
 |*
-|*  Description        If there's a hard column break before the Frm AND there is
+|*      If there's a hard column break before the Frm AND there is
 |*      a predecessor in the same column, we return sal_True (we need to create
-|*      a PageBreak. Otherwise, we return sal_False.
+|*      a ColBreak). Otherwise, we return sal_False.
 |*      If bAct is set to sal_True, we return sal_True if there's a ColBreak.
-|*      Of course, we don't evaluate the hard page break for follows.
+|*      Of course, we don't evaluate the hard column break for follows.
 |*
 |*      The column break is in it's own FrmFmt (BEFORE) or in the FrmFmt of the
 |*      predecessor (AFTER). If there's no predecessor in the column, we don't
@@ -1965,7 +1964,7 @@ sal_Bool SwFlowFrm::MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool b
 
         if( bNoFwd )
         {
-            // It's allowed to mve PageBreaks if the Frm isn't the first
+            // It's allowed to move PageBreaks if the Frm isn't the first
             // one on the page.
             if ( !bPageBreak )
                 return sal_False;
@@ -2376,7 +2375,7 @@ sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat )
                 SwFlowFrm::SetMoveBwdJump( sal_True );
         }
     }
-    else // No breaks - we can float back.
+    else // No breaks - we can flow back.
         pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, sal_False );
 
     // #i27801# - no move backward of 'master' text frame,
commit 4f22b335169af39c07d56b8b85ddbef3e34fa0b6
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Apr 4 13:19:32 2012 +0200

    txtfly.cxx: translate comments

diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index d9aa118..f8ed3b5 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -234,9 +234,8 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
 
         if ( pObj->ISA(SwVirtFlyDrawObj) )
         {
-            // Vorsicht #37347: Das GetContour() fuehrt zum Laden der Grafik,
-            // diese aendert dadurch ggf. ihre Groesse, ruft deshalb ein
-            // ClrObject() auf.
+            // GetContour() causes the graphic to be loaded, which may cause
+            // the graphic to change its size, call ClrObject()
             PolyPolygon aPoly;
             if( !((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetContour( aPoly ) )
                 aPoly = PolyPolygon( ((SwVirtFlyDrawObj*)pObj)->
@@ -258,8 +257,8 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
         const SvxULSpaceItem &rULSpace = pFmt->GetULSpace();
         memmove( pTextRanger + 1, pTextRanger, nObjCnt * sizeof( TextRanger* ) );
         memmove( (SdrObject**)pSdrObj + 1, pSdrObj, nObjCnt++ * sizeof( SdrObject* ) );
-        pSdrObj[ 0 ] = pObj; // Wg. #37347 darf das Object erst nach dem
-                             // GetContour() eingetragen werden.
+        pSdrObj[ 0 ] = pObj; // due to #37347 the Object must be entered only
+                             // after GetContour()
         pTextRanger[ 0 ] = new TextRanger( aPolyPolygon, pPolyPolygon, 20,
             (sal_uInt16)rLRSpace.GetLeft(), (sal_uInt16)rLRSpace.GetRight(),
             pFmt->GetSurround().IsOutside(), sal_False, pFrm->IsVertical() );
@@ -317,13 +316,13 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
         sal_Bool bOdd = (nIdx % 2) ? sal_True : sal_False;
         sal_Bool bSet = sal_True;
         if( bOdd )
-            --nIdx; // innerhalb eines Intervalls
+            --nIdx; // within interval
         else if( ! bRight && ( nIdx >= nCount || (*pTmp)[ nIdx ] != nXPos ) )
         {
             if( nIdx )
-                nIdx -= 2; // ein Intervall nach links gehen
+                nIdx -= 2; // an interval to the left
             else
-                bSet = sal_False; // vor dem erstem Intervall
+                bSet = sal_False; // before the first interval
         }
 
         if( bSet && nIdx < nCount )
@@ -801,11 +800,11 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj,
             if (FLY_AT_PAGE == rNewA.GetAnchorId())
                 return sal_True;  // We always avoid page anchored ones
 
-            // Wenn absatzgebundene Flys in einem FlyCnt gefangen sind, so
-            // endet deren Einflussbereich an den Grenzen des FlyCnt!
-            // Wenn wir aber gerade den Text des FlyCnt formatieren, dann
-            // muss er natuerlich dem absatzgebundenen Frm ausweichen!
-            // pCurrFrm ist der Anker von pNew?
+            // If Flys anchored at paragraph are caught in a FlyCnt, then
+            // their influence ends at the borders of the FlyCnt!
+            // If we are currently formatting the text of the FlyCnt, then
+            // it has to get out of the way of the Frm anchored at paragraph!
+            // pCurrFrm ist the anchor of pNew?
             // #i26945#
             const SwFrm* pTmp = _pAnchoredObj->GetAnchorFrm();
             if( pTmp == pCurrFrm )
@@ -857,13 +856,13 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj,
                     return sal_True;
 
                 // Compare indices:
-                // Den Index des anderen erhalten wir immer ueber das Ankerattr.
+                // The Index of the other is retrieved from the anchor attr.
                 sal_uLong nTmpIndex = rNewA.GetCntntAnchor()->nNode.GetIndex();
-                // Jetzt wird noch ueberprueft, ob der aktuelle Absatz vor dem
-                // Anker des verdraengenden Objekts im Text steht, dann wird
-                // nicht ausgewichen.
-                // Der Index wird moeglichst ueber einen SwFmtAnchor ermittelt,
-                // da sonst recht teuer.
+                // Now check whether the current paragraph is before the anchor
+                // of the displaced object in the text, then we don't have to
+                // get out of its way.
+                // If possible determine Index via SwFmtAnchor because
+                // otherwise it's quite expensive.
                 if( ULONG_MAX == nIndex )
                     nIndex = pCurrFrm->GetNode()->GetIndex();
 
@@ -913,8 +912,8 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
         {
             aRect = pCurrFrm->Frm();
         }
-        // Wir machen uns etwas kleiner als wir sind,
-        // damit Ein-Twip-Ueberlappungen ignoriert werden. (#49532)
+        // Make ourselves a little smaller than we are,
+        // so that 1-Twip-overlappings are ignored (#49532)
         SWRECTFN( pCurrFrm )
         const long nRight = (aRect.*fnRect->fnGetRight)() - 1;
         const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1;
@@ -1071,9 +1070,9 @@ sal_Bool SwTxtFly::ForEach( const SwRect &rRect, SwRect* pRect, sal_Bool bAvoid
                 const SwFmtSurround &rSur = pFmt->GetSurround();
                 if( bAvoid )
                 {
-                    // Wenn der Text drunter durchlaeuft, bleibt die
-                    // Formatierung unbeeinflusst. Im LineIter::DrawText()
-                    // muessen "nur" geschickt die ClippingRegions gesetzt werden ...
+                    // If the text flows below, it has no influence on
+                    // formatting. In LineIter::DrawText() it is "just"
+                    // necessary to clevely set the ClippingRegions
                     const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
                     if( ( SURROUND_THROUGHT == rSur.GetSurround() &&
                           ( !rSur.IsAnchorOnly() ||
@@ -1144,7 +1143,7 @@ void SwTxtFly::CalcRightMargin( SwRect &rFly,
                                 SwAnchoredObjList::size_type nFlyPos,
                                 const SwRect &rLine ) const
 {
-    // Normalerweise ist der rechte Rand der rechte Rand der Printarea.
+    // Usually the right margin is the right margin of the Printarea
     OSL_ENSURE( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(),
             "SwTxtFly::CalcRightMargin with swapped frame" );
     SWRECTFN( pCurrFrm )
@@ -1155,12 +1154,11 @@ void SwTxtFly::CalcRightMargin( SwRect &rFly,
     (aLine.*fnRect->fnSetRight)( nRight );
     (aLine.*fnRect->fnSetLeft)( (rFly.*fnRect->fnGetLeft)() );
 
-    // Es koennte aber sein, dass in die gleiche Zeile noch ein anderes
-    // Object hineinragt, welches _ueber_ uns liegt.
-    // Wunder der Technik: Flys mit Durchlauf sind fuer die darunterliegenden
-    // unsichtbar, das heisst, dass sie bei der Berechnung der Raender
-    // anderer Flys ebenfalls nicht auffallen.
-    // 3301: pNext->Frm().IsOver( rLine ) ist noetig
+    // It is possible that there is another object that is _above_ us
+    // and protrudes into the same line.
+    // Flys with run-through are invisible for those below, i.e., they
+    // are ignored for computing the margins of other Flys.
+    // 3301: pNext->Frm().IsOver( rLine ) is necessary
     // #i68520#
     SwSurround eSurroundForTextWrap;
 
@@ -1188,27 +1186,26 @@ void SwTxtFly::CalcRightMargin( SwRect &rFly,
                 ( pNext, aLine, pCurrFrm, nFlyRight, sal_True ) );
         SwTwips nTmpRight = (aTmp.*fnRect->fnGetRight)();
 
-        // Optimierung:
-        // In nNextTop wird notiert, an welcher Y-Positon mit Aenderung der
-        // Rahmenverhaeltnisse gerechnet werden muss. Dies dient dazu, dass,
-        // obwohl nur die Rahmen in der aktuellen Zeilenhoehe betrachtet werden,
-        // bei Rahmen ohne Umlauf die Zeilenhoehe so erhoeht wird, dass mit einer
-        // einzigen Zeile die Unterkante das Rahmens oder ggf. die Oberkante des
-        // naechsten Rahmen erreicht wird.
-        // Insbesondere bei HTML-Dokumenten kommen oft (Dummy-)Absaetze in einer
-        // 2-Pt.-Schrift vor, bis diese einem groesseren Rahmen ausgewichen sind,
-        // erforderte es frueher Unmengen von Leerzeilen.
+        // optimization:
+        // Record in nNextTop at which Y-position frame related changes are
+        // likely.  This is so that, despite only looking at frames in the
+        // current line height, for frames without wrap the line height is
+        // incremented so that with a single line the lower border of the frame
+        // (or possibly the upper border of another frame) is reached.
+        // Especially in HTML documents there are often (dummy) paragraphs in
+        // 2 pt font, and they used to only evade big frames after huge numbers
+        // of empty lines.
         const long nTmpTop = (aTmp.*fnRect->fnGetTop)();
         if( (*fnRect->fnYDiff)( nTmpTop, (aLine.*fnRect->fnGetTop)() ) > 0 )
         {
             if( (*fnRect->fnYDiff)( nNextTop, nTmpTop ) > 0 )
-                SetNextTop( nTmpTop ); // Die Oberkante des "naechsten" Rahmens
+                SetNextTop( nTmpTop ); // upper border of next frame
         }
-        else if( ! (aTmp.*fnRect->fnGetWidth)() ) // Typisch fuer Objekte mit Konturumlauf
-        {   // Bei Objekten mit Konturumlauf, die vor der aktuellen Zeile beginnen
-            // und hinter ihr enden, trotzdem aber nicht mit ihr ueberlappen,
-            // muss die Optimierung ausgeschaltet werden, denn bereits in der
-            // naechsten Zeile kann sich dies aendern.
+        else if (!(aTmp.*fnRect->fnGetWidth)()) // typical for Objects with contour wrap
+        {   // For Objects with contour wrap that start before the current
+            // line, and end below it, but do not actually overlap it, the
+            // optimization has to be disabled, because the circumstances
+            // can change in the next line.
             if( ! (aTmp.*fnRect->fnGetHeight)() ||
                 (*fnRect->fnYDiff)( (aTmp.*fnRect->fnGetBottom)(),
                                     (aLine.*fnRect->fnGetTop)() ) > 0 )
@@ -1220,7 +1217,7 @@ void SwTxtFly::CalcRightMargin( SwRect &rFly,
             if( SURROUND_RIGHT == eSurroundForTextWrap ||
                 SURROUND_PARALLEL == eSurroundForTextWrap )
             {
-                // der FlyFrm wird ueberstimmt.
+                // overrule the FlyFrm
                 if( nRight > nFlyRight )
                     nRight = nFlyRight;
                 bStop = sal_True;
@@ -1248,12 +1245,11 @@ void SwTxtFly::CalcLeftMargin( SwRect &rFly,
     SwRect aLine( rLine );
     (aLine.*fnRect->fnSetLeft)( nLeft );
 
-    // Es koennte aber sein, dass in die gleiche Zeile noch ein anderes
-    // Object hineinragt, welches _ueber_ uns liegt.
-    // Wunder der Technik: Flys mit Durchlauf sind fuer die darunterliegenden
-    // unsichtbar, das heisst, dass sie bei der Berechnung der Raender
-    // anderer Flys ebenfalls nicht auffallen.
-    // 3301: pNext->Frm().IsOver( rLine ) ist noetig
+    // It is possible that there is another object that is _above_ us
+    // and protrudes into the same line.
+    // Flys with run-through are invisible for those below, i.e., they
+    // are ignored for computing the margins of other Flys.
+    // 3301: pNext->Frm().IsOver( rLine ) is necessary
 
     // #i68520#
     SwAnchoredObjList::size_type nMyPos = nFlyPos;
@@ -1313,16 +1309,16 @@ SwRect SwTxtFly::AnchoredObjToRect( const SwAnchoredObject* pAnchoredObj,
     if( !aFly.Width() )
         return aFly;
 
-    SetNextTop( (aFly.*fnRect->fnGetBottom)() ); // Damit die Zeile ggf. bis zur Unterkante
-                                 // des Rahmens waechst.
+    // so the line may grow up to the lower edge of the frame
+    SetNextTop( (aFly.*fnRect->fnGetBottom)() );
     SwAnchoredObjList::size_type nFlyPos = GetPos( pAnchoredObj );
 
     // LEFT and RIGHT, we grow the rectangle.
     // We have some problems, when several frames are to be seen.
     // At the moment, only the easier case is assumed:
-    //  + LEFT means that the text muss flaw on the left of the frame,
-    //    that is that the trame expands to the right edge of the
-    //    print area or to the the next frame.
+    //  + LEFT means that the text must flow on the left of the frame,
+    //    that is the frame expands to the right edge of the print area
+    //    or to the next frame.
     //  + RIGHT is the opposite.
     // Otherwise the set distance between text and frame is always
     // added up.
@@ -1374,7 +1370,7 @@ SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredO
         }
     }
 
-    // Beim Durchlauf und Nowrap wird smart ignoriert.
+    // in cause of run-through and nowrap ignore smartly
     if( SURROUND_THROUGHT == eSurroundForTextWrap ||
         SURROUND_NONE == eSurroundForTextWrap )
         return eSurroundForTextWrap;
@@ -1388,7 +1384,7 @@ SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredO
             eSurroundForTextWrap = SURROUND_LEFT;
     }
 
-    // "idealer Seitenumlauf":
+    // "ideal page wrap":
     if ( SURROUND_IDEAL == eSurroundForTextWrap )
     {
         SWRECTFN( pCurrFrm )


More information about the Libreoffice-commits mailing list