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

Michael Stahl mstahl at redhat.com
Wed Mar 29 21:46:24 UTC 2017


 sw/source/core/txtnode/atrflyin.cxx |  117 ++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 63 deletions(-)

New commits:
commit 726b34c9c788af74bea005f2717e4c1da4814183
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Mar 29 23:38:58 2017 +0200

    sw: translate german comments
    
    Change-Id: I65dd604fac39b8ea39affbc6f336d2618e6d605a

diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index 7efe6df4ad6a..ee79239ac192 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -62,44 +62,39 @@ SwTextFlyCnt::SwTextFlyCnt( SwFormatFlyCnt& rAttr, sal_Int32 nStartPos )
     SetHasDummyChar(true);
 }
 
-/*
- * An dieser Stelle soll einmal der Gesamtzusammenhang bei der Erzeugung
- * eines neuen SwTextFlyCnt erlaeutert werden.
- * Das MakeTextHint() wird z.B. im SwTextNode::Copy() gerufen.
- * Fuer die komplette Verdopplung sind folgende Schritte notwendig:
- * 1) Duplizieren des pFormat incl. Inhalt, Attributen etc.
- * 2) Setzen des Ankers
- * 3) Benachrichtigung
- * Da fuer die Bewaeltigung der Aufgaben nicht immer alle Informationen
- * bereitstehen und darueber hinaus bestimmte Methoden erst zu einem
- * spaeteren Zeitpunkt gerufen werden duerfen (weil nocht nicht alle
- * Nodeinformationen vorliegen), verteilt sich der Ablauf.
- * ad 1) MakeTextHint() wird durch den Aufruf von SwDoc::CopyLayout()
- * der das neue FlyFrameFormat erzeugt und mit dem duplizierten Inhalt des
- * FlyFrame verbunden.
- * ad 2) SetAnchor() wird von SwTextNode::Insert() gerufen und sorgt fuer das
- * setzen des Ankers (die SwPosition des Dummy-Zeichens wird dem FlyFrameFormat
- * per SetAttr bekannt gegeben). Dies kann nicht im MakeTextHint erledigt
- * werden, da der Zielnode unbestimmt ist.
- * ad 3) GetFlyFrame_() wird im Formatierungsprozess vom LineIter gerufen
- * und sucht den FlyFrame zum Dummyzeichen des aktuellen ContentFrame. Wird keiner
- * gefunden, so wird ein neuer FlyFrame angelegt.
- * Kritisch an diesem Vorgehen ist, dass das pContent->AppendFly() eine
- * sofortige Neuformatierung von pContent anstoesst. Die Rekursion kommt
- * allerdings durch den Lockmechanismus in SwTextFrame::Format() nicht
- * zu stande.
- * Attraktiv ist der Umstand, dass niemand ueber die vom Node abhaengigen
- * ContentFrames iterieren braucht, um die FlyInContentFrame anzulegen. Dies geschieht
- * bei der Arbeit.
+/** An overview of how a new SwTextFlyCnt is created:
+ * MakeTextAttr() is called e.g. by SwTextNode::CopyText().
+ * The following steps are required to clone:
+ * 1) copying the pFormat with content, attributes etc.
+ * 2) setting the anchor
+ * 3) notification
+ * Because not all required information is available at all times,
+ * the steps are distributed variously:
+ * ad 1) MakeTextAttr() calls DocumentLayoutManager::CopyLayoutFormat()
+ *  which creates the new SwFlyFrameFormat and copies the content of the
+ *  fly frame.
+ * ad 2) SetAnchor() is called by SwTextNode::InsertHint() and sets the anchor
+ *  position in the SwFlyFrameFormat to the SwPosition of the dummy
+ *  CH_TXTATR_BREAKWORD.  This cannot be done in MakeTextAttr() because it
+ *  doesn't know the target text node.
+ * ad 3) GetFlyFrame_() is called during text formatting by SwTextFormatter
+ *  and searches for the SwFlyFrame for the dummy char of the current
+ *  SwTextFrame.  If none is found, a new SwFlyInContentFrame is created.
+ *  Important: pTextFrame->AppendFly() immediately triggers a reformat
+ *  of pTextFrame.  However, the recursion is blocked by the lock mechanism
+ *  in SwTextFrame::Format().
+ * The advantage of all this is that it's not necessary to explicitly iterate
+ * over all SwTextFrames that depend on the SwTextNode to create the
+ * SwFlyInContentFrame - this is done automatically already.
  */
 
 void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
 {
     SwFrameFormat* pFormat = GetFlyCnt().GetFrameFormat();
     OSL_ENSURE( pFormat, "von welchem Format soll ich eine Kopie erzeugen?" );
-    // Das FlyFrameFormat muss dupliziert werden.
-    // In CopyLayoutFormat (siehe doclay.cxx) wird das FlyFrameFormat erzeugt
-    // und der Inhalt dupliziert.
+    // The FlyFrameFormat must be copied - CopyLayoutFormat
+    // (DocumentLayoutManager.cxx) creates the FlyFrameFormat and copies the
+    // content.
 
     // disable undo while copying attribute
     ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
@@ -107,9 +102,8 @@ void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
     if ((RndStdIds::FLY_AT_PAGE != aAnchor.GetAnchorId()) &&
         (pDoc != pFormat->GetDoc()))   // different documents?
     {
-        // JP 03.06.96: dann sorge dafuer, das der koperierte Anker auf
-        //              gueltigen Content zeigt! Die Umsetzung auf die
-        //              richtige Position erfolgt spaeter.
+        // JP 03.06.96: ensure that the copied anchor points to valid content!
+        //              setting it to the correct position is done later.
         SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), +2 );
         SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
         if( !pCNd )
@@ -133,16 +127,14 @@ void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
     ((SwFormatFlyCnt&)GetFlyCnt()).SetFlyFormat( pNew );
 }
 
-// SetAnchor() wird von SwTextNode::Insert() gerufen und sorgt fuer das
-// setzen des Ankers (die SwPosition des Dummy-Zeichens wird dem FlyFrameFormat
-// per SetAttr bekannt gegeben). Dies kann nicht im MakeTextHint erledigt
-// werden, da der Zielnode unbestimmt ist.
-// (siehe Kommentar in SwTextFlyCnt::MakeTextHint)
+/** SetAnchor() is called by SwTextNode::InsertHint() and sets the anchor
+ *  position in the SwFlyFrameFormat to the SwPosition of the dummy
+ *  CH_TXTATR_BREAKWORD.  This cannot be done in MakeTextAttr() because it
+ *  doesn't know the target text node.
+ */
 void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
 {
-    // fuers Undo muss der neue Anker schon bekannt sein !
-
-    // Wir ermitteln den Index im Nodesarray zum Node
+    // for Undo, the new anchor must be known already!
 
     SwDoc* pDoc = const_cast<SwDoc*>(pNode->GetDoc());
 
@@ -167,14 +159,14 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
     aAnchor.SetType( RndStdIds::FLY_AS_CHAR );        // default!
     aAnchor.SetAnchor( &aPos );
 
-    // beim Ankerwechsel werden immer alle FlyFrames vom Attribut geloescht
-    // JP 25.04.95: wird innerhalb des SplitNodes die Frames verschoben
-    //              koennen die Frames erhalten bleiben.
+    // in case of anchor change, delete all FlyFrames
+    // JP 25.04.95: if the Frames can be moved within SplitNode, they don't
+    //              need to be deleted
     if( ( !pNode->GetpSwpHints() || !pNode->GetpSwpHints()->IsInSplitNode() )
         && RES_DRAWFRMFMT != pFormat->Which() )
         pFormat->DelFrames();
 
-    // stehen wir noch im falschen Dokument ?
+    // copy into a different document?
     if( pDoc != pFormat->GetDoc() )
     {
         // disable undo while copying attribute
@@ -191,7 +183,7 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
             RES_DRAWFRMFMT != pFormat->Which() )
     {
         pFormat->LockModify();
-        pFormat->SetFormatAttr( aAnchor );        // nur den Anker neu setzen
+        pFormat->SetFormatAttr( aAnchor );  // only set the anchor
         // tdf#91228 must notify the anchor nodes despite LockModify
         assert(pOldNode);
         pOldNode->RemoveAnchoredFly(pFormat);
@@ -201,23 +193,24 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
     else
     {
         assert(!pFormat->IsModifyLocked()); // need to notify anchor node
-        pFormat->SetFormatAttr( aAnchor );        // nur den Anker neu setzen
+        pFormat->SetFormatAttr( aAnchor );  // only set the anchor
     }
 
-    // Am Node haengen u.a. abhaengige ContentFrames.
-    // Fuer jeden ContentFrame wird ein SwFlyInContentFrame angelegt.
+    // The node may have several SwTextFrames - for every SwTextFrame a
+    // SwFlyInContentFrame is created.
 }
 
-// GetFlyFrame_() wird im Formatierungsprozess vom LineIter gerufen
-// und sucht den FlyFrame zum Dummyzeichen des aktuellen ContentFrame. Wird keiner
-// gefunden, so wird ein neuer FlyFrame angelegt.
-// (siehe Kommentar ind SwTextFlyCnt::MakeTextHint)
+
+/** GetFlyFrame_() is called during text formatting by SwTextFormatter
+ *  and searches for the SwFlyFrame for the dummy char of the current
+ *  SwTextFrame.  If none is found, a new SwFlyInContentFrame is created.
+ */
 SwFlyInContentFrame *SwTextFlyCnt::GetFlyFrame_( const SwFrame *pCurrFrame )
 {
     SwFrameFormat* pFrameFormat = GetFlyCnt().GetFrameFormat();
     if( RES_DRAWFRMFMT == pFrameFormat->Which() )
     {
-        OSL_ENSURE(  false, "SwTextFlyCnt::GetFlyFrame_: DrawInCnt-Baustelle!" );
+        OSL_ENSURE(  false, "SwTextFlyCnt::GetFlyFrame_: DrawInCnt-under construction!" );
         return nullptr;
     }
 
@@ -250,18 +243,16 @@ SwFlyInContentFrame *SwTextFlyCnt::GetFlyFrame_( const SwFrame *pCurrFrame )
         } while( pFrame );
     }
 
-    // Wir haben keinen passenden FlyFrame gefunden, deswegen wird ein
-    // neuer angelegt.
-    // Dabei wird eine sofortige Neuformatierung von pCurrFrame angestossen.
-    // Die Rekursion wird durch den Lockmechanismus in SwTextFrame::Format()
-    // abgewuergt.
+    // We did not find a matching FlyFrame, so create a new one.
+    // AppendFly() triggers a reformat of pCurrentFrame.  However, the
+    // recursion is blocked by the lock mechanism in SwTextFrame::Format().
     SwFrame* pCurrentFrame = const_cast<SwFrame*>(pCurrFrame);
     SwFlyInContentFrame *pFly = new SwFlyInContentFrame(static_cast<SwFlyFrameFormat*>(pFrameFormat), pCurrentFrame, pCurrentFrame);
     pCurrentFrame->AppendFly(pFly);
     pFly->RegistFlys();
 
-    // 7922: Wir muessen dafuer sorgen, dass der Inhalt des FlyInCnt
-    // nach seiner Konstruktion stramm durchformatiert wird.
+    // We must ensure that the content of the FlyInCnt is fully formatted
+    // right after construction.
     // #i26945# - Use new object formatter to format Writer
     // fly frame and its content.
     SwObjectFormatter::FormatObj( *pFly, const_cast<SwFrame*>(pCurrFrame),


More information about the Libreoffice-commits mailing list