sw/source/core/doc/docfly.cxx | 137 +++++++++------------ sw/source/core/doc/docfmt.cxx | 270 ++++++++++++++++++++---------------------- 2 files changed, 193 insertions(+), 214 deletions(-)
New commits: commit b8c18bbb837c892657d189f1456ceee31d7740e3 Author: Philipp Weissenbacher <p.weissenbac...@gmail.com> Date: Wed Nov 30 03:41:57 2011 +0100 Translate German comments diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 394a049..10cd5f7 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -53,15 +53,15 @@ #include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> -#include <hints.hxx> // fuer SwHyphenBug (in SetDefault) +#include <hints.hxx> // for SwHyphenBug (in SetDefault) #include <ndtxt.hxx> #include <pam.hxx> #include <UndoCore.hxx> #include <UndoAttribute.hxx> #include <ndgrf.hxx> -#include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt +#include <pagedesc.hxx> // For special treatment in InsFrmFmt #include <rolbck.hxx> // Undo-Attr -#include <mvsave.hxx> // servieren: Veraenderungen erkennen +#include <mvsave.hxx> // serve: Recognize changes #include <txatbase.hxx> #include <swtable.hxx> #include <swtblfmt.hxx> @@ -86,11 +86,11 @@ using namespace ::com::sun::star::uno; SV_IMPL_PTRARR(SwFrmFmts,SwFrmFmtPtr) SV_IMPL_PTRARR(SwCharFmts,SwCharFmtPtr) -//Spezifische Frameformate (Rahmen) +// Specific frame formats (frames) SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr) /* - * interne Funktionen + * Internal functions */ sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) @@ -104,10 +104,10 @@ sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) } /* - * Zuruecksetzen der harten Formatierung fuer Text + * Reset the text's hard formatting */ -// Uebergabeparameter fuer _Rst und lcl_SetTxtFmtColl +// Parameters for _Rst and lcl_SetTxtFmtColl struct ParaRstFmt { SwFmtColl* pFmtColl; @@ -152,8 +152,8 @@ struct ParaRstFmt {} }; -/* in pArgs steht die ChrFmtTablle vom Dokument - * (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt) +/* pArgs contains the document's ChrFmtTable + * Is need for selections at the beginning/end and with no SSelection. */ sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) @@ -174,7 +174,7 @@ sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) if( pPara->pHistory ) { - // fuers Undo alle Attribute sichern + // Save all attributes for the Undo. SwRegHistory aRHst( *pTxtNode, pPara->pHistory ); pTxtNode->GetpSwpHints()->Register( &aRHst ); pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich, @@ -363,8 +363,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwIndex& rSt = pPam->GetPoint()->nContent; sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); - // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut - // dann wird dessen Bereich genommen + // Special case: if the Crsr is located within a URL attribute, we take over it's area SwTxtAttr const*const pURLAttr( pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT)); if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len()) @@ -401,7 +400,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, } // #i96644# -// SwDataChanged aTmp( *pPam, 0 ); + // SwDataChanged aTmp( *pPam, 0 ); std::auto_ptr< SwDataChanged > pDataChanged; if ( bSendDataChangedEvents ) { @@ -452,9 +451,9 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, sal_Bool bAdd = sal_True; SwNodeIndex aTmpStt( pStt->nNode ); SwNodeIndex aTmpEnd( pEnd->nNode ); - if( pStt->nContent.GetIndex() ) // nur ein Teil + if( pStt->nContent.GetIndex() ) // just one part { - // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr + // set up a later, and all CharFmtAttr -> TxtFmtAttr SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode(); if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() ) { @@ -472,7 +471,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, aTmpStt++; } if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() ) - // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr + // set up a later, and all CharFmtAttr -> TxtFmtAttr aTmpEnd++, bAdd = sal_False; else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() ) { @@ -515,14 +514,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, #define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; } -// Einfuegen der Hints nach Inhaltsformen; -// wird in SwDoc::Insert(..., SwFmtHint &rHt) benutzt +// Insert Hints according to content types; +// Is used in SwDoc::Insert(..., SwFmtHint &rHt) static bool lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, const SetAttrMode nFlags, SwUndoAttr *const pUndo) { - // teil die Sets auf (fuer Selektion in Nodes) + // Divide the Sets (for selections in Nodes) const SfxItemSet* pCharSet = 0; const SfxItemSet* pOtherSet = 0; bool bDelete = false; @@ -630,7 +629,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, const SwIndex& rSt = pStt->nContent; - // Attribute ohne Ende haben keinen Bereich + // Attributes without an end do not have a range if ( !bCharAttr && !bOtherAttr ) { SfxItemSet aTxtSet( pDoc->GetAttrPool(), @@ -659,11 +658,10 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } } - // TextAttribute mit Ende expandieren nie ihren Bereich + // TextAttributes with an end never expand their range if ( !bCharAttr && !bOtherAttr ) { - // CharFmt wird gesondert behandelt !!! - // JP 22.08.96: URL-Attribute auch!! + // CharFmt and URL attributes are treated seperately! // TEST_TEMP ToDo: AutoFmt! SfxItemSet aTxtSet( pDoc->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK, @@ -685,9 +683,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count()))) { - // wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende) + // Was text content inserted? (RefMark/TOXMarks without an end) sal_Bool bTxtIns = nInsCnt != rSt.GetIndex(); - // wurde Inhalt eingefuegt oder ueber die Selektion gesetzt? + // Was content inserted or set over the selection? SwPaM aPam( pStt->nNode, bTxtIns ? nInsCnt + 1 : nEnd, pStt->nNode, nInsCnt ); if( pUndo ) @@ -703,8 +701,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } } - // bei PageDesc's, die am Node gesetzt werden, muss immer das - // Auto-Flag gesetzt werden!! + // We always have to set the auto flag for PageDescs that are set at the Node! if( pOtherSet && pOtherSet->Count() ) { SwTableNode* pTblNd; @@ -714,12 +711,12 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { if( pNode ) { - // Auto-Flag setzen, nur in Vorlagen ist ohne Auto ! + // Set auto flag. Only in the template it's without auto! SwFmtPageDesc aNew( *pDesc ); - // Bug 38479: AutoFlag wird jetzt in der WrtShell gesetzt + // 38479: AutoFlag is now being set in the WrtShell // aNew.SetAuto(); - // Tabellen kennen jetzt auch Umbrueche + // Tables now also know line breaks if( 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) && 0 != ( pTblNd = pNode->FindTableNode() ) ) { @@ -727,7 +724,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) ) pTblNd = pCurTblNd; - // dann am Tabellen Format setzen + // set the table format SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt(); SwRegHistory aRegH( pFmt, *pTblNd, pHistory ); pFmt->SetFmtAttr( aNew ); @@ -754,7 +751,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } } - // Tabellen kennen jetzt auch Umbrueche + // Tables now also know line breaks const SvxFmtBreakItem* pBreak; if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) && 0 != (pTblNd = pNode->FindTableNode() ) && @@ -765,7 +762,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) ) pTblNd = pCurTblNd; - // dann am Tabellen Format setzen + // set the table format SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt(); SwRegHistory aRegH( pFmt, *pTblNd, pHistory ); pFmt->SetFmtAttr( *pBreak ); @@ -786,7 +783,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } { - // wenns eine PoolNumRule ist, diese ggfs. anlegen + // If we have a PoolNumRule, create it if needed const SwNumRuleItem* pRule; sal_uInt16 nPoolId; if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE, @@ -799,7 +796,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } - if( !rRg.HasMark() ) // kein Bereich + if( !rRg.HasMark() ) // no range { if( !pNode ) { @@ -814,8 +811,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); const String& rStr = pTxtNd->GetTxt(); - // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut - // dann wird dessen Bereich genommen + // Special case: if the Crsr is located within a URL attribute, we take over it's area SwTxtAttr const*const pURLAttr( pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT)); if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len()) @@ -842,17 +838,17 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, nPtPos = nMkPos = rSt.GetIndex(); } - // erstmal die zu ueberschreibenden Attribute aus dem - // SwpHintsArray entfernen, wenn die Selektion den gesamten - // Absatz umspannt. (Diese Attribute werden als FormatAttr. - // eingefuegt und verdraengen nie die TextAttr.!) + // Remove the overriding attributes from the SwpHintsArray, + // if the selection spans across the whole paragraph. + // These attributes are inserted as FormatAttributes and + // never override the TextAttributes! if( !(nFlags & nsSetAttrMode::SETATTR_DONTREPLACE ) && pTxtNd->HasHints() && !nMkPos && nPtPos == rStr.Len() ) { SwIndex aSt( pTxtNd ); if( pHistory ) { - // fuers Undo alle Attribute sichern + // Save all attributes for the Undo. SwRegHistory aRHst( *pTxtNd, pHistory ); pTxtNd->GetpSwpHints()->Register( &aRHst ); pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet ); @@ -894,7 +890,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true); } - /* jetzt wenn Bereich */ + /* now if range */ sal_uLong nNodes = 0; SwNodeIndex aSt( pDoc->GetNodes() ); @@ -924,7 +920,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, bRet = pNode->SetAttr( *pOtherSet ) || bRet; } - // lediglich Selektion in einem Node. + // Only selection in a Node. if( pStt->nNode == pEnd->nNode ) { DELETECHARSETS @@ -935,15 +931,15 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } else aSt = pStt->nNode; - aCntEnd = pEnd->nContent; // aEnd wurde veraendert !! + aCntEnd = pEnd->nContent; // aEnd was changed! } else aSt.Assign( pStt->nNode.GetNode(), +1 ); - // aSt zeigt jetzt auf den ersten vollen Node + // aSt points to the first full Node now /* - * die Selektion umfasst mehr als einen Node + * The selection spans more than one Node. */ if( pStt->nNode < pEnd->nNode ) { @@ -979,10 +975,10 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, else aEnd.Assign( pEnd->nNode.GetNode(), +1 ); - // aEnd zeigt jetzt HINTER den letzten voll Node + // aEnd points BEHIND the last full node now - /* Bearbeitung der vollstaendig selektierten Nodes. */ -// alle Attribute aus dem Set zuruecksetzen !! + /* Edit the fully selected Nodes. */ + // Reset all attributes from the set! if( pCharSet && pCharSet->Count() && !( nsSetAttrMode::SETATTR_DONTREPLACE & nFlags ) ) { @@ -1084,8 +1080,8 @@ bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet, } - // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird - // das alte in die Undo-History aufgenommen + // Set the attribute according to the stated format. If Undo is enabled, the old values is + // added to the Undo history. void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt ) { SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() ); @@ -1094,8 +1090,8 @@ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt ) } - // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird - // das alte in die Undo-History aufgenommen + // Set the attribute according to the stated format. If Undo is enabled, the old values is + // added to the Undo history. void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) { if (GetIDocumentUndoRedo().DoesUndo()) @@ -1143,17 +1139,16 @@ void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, SvxTabStopItem& rChgTabStop ) { - // dann aender bei allen TabStop die default's auf den neuen Wert - // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet, - // damit nicht in allen Sets die gleiche Berechnung - // auf dem gleichen TabStop (gepoolt!) vorgenommen - // wird. Als Modify wird ein FmtChg verschickt. + // Set the default values of all TabStops to the new value. + // Attention: we always work with the PoolAttribut here, so that + // we don't calculate the same value on the same TabStop (pooled!) for all sets. + // We send a FmtChg to modify. sal_uInt16 nOldCnt = rChgTabStop.Count(); if( !nOldCnt || nOldWidth == nNewWidth ) return sal_False; - // suche den Anfang der Defaults + // Find the default's beginning SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart()) + (nOldCnt-1); sal_uInt16 n; @@ -1162,13 +1157,13 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() ) break; ++n; - if( n < nOldCnt ) // die DefTabStops loeschen + if( n < nOldCnt ) // delete the DefTabStops rChgTabStop.Remove( n, nOldCnt - n ); return sal_True; } -// Setze das Attribut als neues default Attribut in diesem Dokument. -// Ist Undo aktiv, wird das alte in die Undo-History aufgenommen +// Set the attribute as new default attribute in this document. +// If Undi is enabled, the old value is added to the Undo history. void SwDoc::SetDefault( const SfxPoolItem& rAttr ) { SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() ); @@ -1223,7 +1218,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) aCallMod.Add( pDfltFrmFmt ); } - // copy also the defaults + // also copy the defaults if( bCheckSdrDflt ) { sal_uInt16 nEdtWhich, nSlotId; @@ -1256,12 +1251,10 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) aNew.GetItemState( RES_PARATR_TABSTOP, sal_False, &pTmpItem ) ) && ((SvxTabStopItem*)pTmpItem)->Count() ) { - // TabStop-Aenderungen behandeln wir erstmal anders: - // dann aender bei allen TabStop die dafault's auf den neuen Wert - // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet, - // damit nicht in allen Sets die gleiche Berechnung - // auf dem gleichen TabStop (gepoolt!) vorgenommen - // wird. Als Modify wird ein FmtChg verschickt. + // Set the default values of all TabStops to the new value. + // Attention: we always work with the PoolAttribut here, so that + // we don't calculate the same value on the same TabStop (pooled!) for all sets. + // We send a FmtChg to modify. SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(), nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); @@ -1277,7 +1270,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) if( bChg ) { SwFmtChg aChgFmt( pDfltCharFmt ); - // dann sage mal den Frames bescheid + // notify the frames aCallMod.ModifyNotification( &aChgFmt, &aChgFmt ); } } @@ -1287,10 +1280,10 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { SwAttrSetChg aChgOld( aOld, aOld ); SwAttrSetChg aChgNew( aNew, aNew ); - aCallMod.ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt + aCallMod.ModifyNotification( &aChgOld, &aChgNew ); // all changed are sent } - // und die default-Formate wieder beim Object austragen + // remove the default formats from the object again SwClient* pDep; while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) ) aCallMod.Remove( pDep ); @@ -1298,14 +1291,14 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) SetModified(); } - // Erfrage das Default Attribut in diesem Dokument. +// Get the default attribute in this document const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFmtHint ) const { return GetAttrPool().GetDefaultItem( nFmtHint ); } /* - * Loeschen der Formate + * Delete the formats */ void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast) { @@ -1340,15 +1333,14 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast ) { if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt )) { - OSL_ENSURE( !this, "Format steht nicht mehr im DocArray, " - "kann per delete geloescht werden" ); + OSL_ENSURE( !this, "Format is not in the DocArray any more, " + "so it can be deleted with delete" ); delete pFmt; } else { - //Das Format muss in einem der beiden Arrays stehen, in welchem - //werden wir schon merken. + // The format has to be in the one or the other, we'll see in which one. sal_uInt16 nPos; if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) ) { @@ -1384,7 +1376,7 @@ void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt ) } /* - * Erzeugen der Formate + * Create the formats */ SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const String &rFmtName, SwFrmFmt *pDerivedFrom ) @@ -1525,7 +1517,7 @@ SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName, /* - * Erzeugen der FormatCollections + * Create the FormatCollections */ // TXT // #i40550# - add parameter <bAuto> - not relevant @@ -1600,10 +1592,10 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast) { OSL_ENSURE( nFmtColl, "Remove fuer Coll 0." ); - // Wer hat die zu loeschende als Next + // Who has the to-be-deleted as their Next? SwTxtFmtColl *pDel = (*pTxtFmtCollTbl)[nFmtColl]; if( pDfltTxtFmtColl == pDel ) - return; // default nie loeschen !! + return; // never delete default! if (bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA, @@ -1617,9 +1609,9 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast) GetIDocumentUndoRedo().AppendUndo(pUndo); } - // Die FmtColl austragen + // Remove the FmtColl pTxtFmtCollTbl->Remove(nFmtColl); - // Next korrigieren + // Correct next pTxtFmtCollTbl->ForEach( 1, pTxtFmtCollTbl->Count(), &SetTxtFmtCollNext, pDel ); delete pDel; @@ -1694,8 +1686,7 @@ sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) } } - // erst in die History aufnehmen, damit ggfs. alte Daten - // gesichert werden koennen + // add to History so that old data is saved, if necessary if( pPara->pHistory ) pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(), ND_TEXTNODE ); @@ -1735,7 +1726,7 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg, GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_SetTxtFmtColl, &aPara ); if( !aPara.nWhich ) - bRet = sal_False; // keinen gueltigen Node gefunden + bRet = sal_False; // didn't find a valid Node if( bRet ) SetModified(); @@ -1743,45 +1734,45 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg, } -// ---- Kopiere die Formate in sich selbst (SwDoc) ---------------------- +// ---- Copy the formats to itself (SwDoc) ---------------------- SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, const SvPtrarr& rFmtArr, FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt ) { - // kein-Autoformat || default Format || Collection-Format - // dann suche danach. + // It's no autoformat, default format or collection format, + // then search for it. if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() ) for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { - // ist die Vorlage schon im Doc vorhanden ?? + // Does the Doc already contain the template? if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() )) return (SwFmt*)rFmtArr[n]; } - // suche erstmal nach dem "Parent" + // Search for the "parent" first SwFmt* pParent = (SwFmt*)&rDfltFmt; if( rFmt.DerivedFrom() && pParent != rFmt.DerivedFrom() ) pParent = CopyFmt( *rFmt.DerivedFrom(), rFmtArr, fnCopyFmt, rDfltFmt ); - // erzeuge das Format und kopiere die Attribute + // Create the format and copy the attributes // #i40550# SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, sal_False, sal_True ); pNewFmt->SetAuto( rFmt.IsAuto() ); - pNewFmt->CopyAttrs( rFmt, sal_True ); // kopiere Attribute + pNewFmt->CopyAttrs( rFmt, sal_True ); // copy the attributes pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() ); pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() ); - // HelpFile-Id immer auf dflt setzen !! + // Always set the HelpFile Id to dflt! pNewFmt->SetPoolHlpFileId( UCHAR_MAX ); return pNewFmt; } -// ---- kopiere das Frame-Format -------- +// ---- copy the frame format -------- SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt ) { @@ -1789,7 +1780,7 @@ SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt ) *GetDfltFrmFmt() ); } -// ---- kopiere das Char-Format -------- +// ---- copy the char format -------- SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt ) { return (SwCharFmt*)CopyFmt( rFmt, *GetCharFmts(), @@ -1798,7 +1789,7 @@ SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt ) } -// --- Kopiere TextNodes ---- +// --- copy TextNodes ---- SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) { @@ -1806,7 +1797,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) if( pNewColl ) return pNewColl; - // suche erstmal nach dem "Parent" + // search for the "parent" first SwTxtFmtColl* pParent = pDfltTxtFmtColl; if( pParent != rColl.DerivedFrom() ) pParent = CopyTxtColl( *(SwTxtFmtColl*)rColl.DerivedFrom() ); @@ -1821,7 +1812,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl->SetAuto( sal_False ); SetModified(); - // Kopiere noch die Bedingungen + // copy the conditions ((SwConditionTxtFmtColl*)pNewColl)->SetConditions( ((SwConditionTxtFmtColl&)rColl).GetCondColls() ); } @@ -1829,7 +1820,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) //FEATURE::CONDCOLL pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent ); - // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute + // copy the auto formats or the attributes pNewColl->CopyAttrs( rColl, sal_True ); if(rColl.IsAssignedToListLevelOfOutlineStyle()) @@ -1838,13 +1829,13 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() ); pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() ); - // HelpFile-Id immer auf dflt setzen !! + // Always set the HelpFile Id to dflt! pNewColl->SetPoolHlpFileId( UCHAR_MAX ); if( &rColl.GetNextTxtFmtColl() != &rColl ) pNewColl->SetNextTxtFmtColl( *CopyTxtColl( rColl.GetNextTxtFmtColl() )); - // ggfs. die NumRule erzeugen + // create the NumRule if necessary if( this != rColl.GetDoc() ) { const SfxPoolItem* pItem; @@ -1868,7 +1859,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) return pNewColl; } -// --- Kopiere GrafikNodes ---- +// --- copy the graphic nodes ---- SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) { @@ -1876,21 +1867,21 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) if( pNewColl ) return pNewColl; - // suche erstmal nach dem "Parent" + // Search for the "parent" first SwGrfFmtColl* pParent = pDfltGrfFmtColl; if( pParent != rColl.DerivedFrom() ) pParent = CopyGrfColl( *(SwGrfFmtColl*)rColl.DerivedFrom() ); - // falls nicht, so kopiere sie + // if not, copy them pNewColl = MakeGrfFmtColl( rColl.GetName(), pParent ); - // noch die Attribute kopieren + // copy the attributes pNewColl->CopyAttrs( rColl ); pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() ); pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() ); - // HelpFile-Id immer auf dflt setzen !! + // Always set the HelpFile Id to dflt! pNewColl->SetPoolHlpFileId( UCHAR_MAX ); return pNewColl; @@ -1915,7 +1906,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, sal_uInt16 nSrc; SwFmt* pSrc, *pDest; - // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!) + // 1st step: Create all formats (skip the 0th - it's the default one) for( nSrc = rSourceArr.Count(); nSrc > 1; ) { pSrc = (SwFmt*)rSourceArr[ --nSrc ]; @@ -1932,7 +1923,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, } } - // 2. Schritt alle Attribute kopieren, richtige Parents setzen + // 2nd step: Copy all attributes, set the right parents for( nSrc = rSourceArr.Count(); nSrc > 1; ) { pSrc = (SwFmt*)rSourceArr[ --nSrc ]; @@ -1970,7 +1961,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, pDest->SetPoolFmtId( pSrc->GetPoolFmtId() ); pDest->SetPoolHelpId( pSrc->GetPoolHelpId() ); - // HelpFile-Id immer auf dflt setzen !! + // Always set the HelpFile Id to dflt! pDest->SetPoolHlpFileId( UCHAR_MAX ); if( pSrc->DerivedFrom() ) @@ -1991,8 +1982,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, //FEATURE::CONDCOLL if( RES_CONDTXTFMTCOLL == pSrc->Which() ) - // Kopiere noch die Bedingungen - // aber erst die alten loeschen! + // Copy the conditions, but delete the old ones first! ((SwConditionTxtFmtColl*)pDstColl)->SetConditions( ((SwConditionTxtFmtColl*)pSrc)->GetCondColls() ); //FEATURE::CONDCOLL @@ -2003,15 +1993,14 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt ) { - // jetzt noch Header-/Footer-Attribute richtig behandeln - // Contenten Nodes Dokumentuebergreifend kopieren! + // Treat the header and footer attributes in the right way: + // Copy content nodes across documents! sal_uInt16 nAttr = static_cast<sal_uInt16>( bCpyHeader ? RES_HEADER : RES_FOOTER ); const SfxPoolItem* pItem; if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, sal_False, &pItem )) return ; - // Im Header steht noch der Verweis auf das Format aus dem - // anderen Document!! + // The header only contains the reference to the format from the other document! SfxPoolItem* pNewItem = pItem->Clone(); SwFrmFmt* pOldFmt; @@ -2076,7 +2065,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, { rDstDesc.SetPoolFmtId( rSrcDesc.GetPoolFmtId() ); rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() ); - // HelpFile-Id immer auf dflt setzen !! + // Always set the HelpFile Id to dflt! rDstDesc.SetPoolHlpFileId( UCHAR_MAX ); } @@ -2086,7 +2075,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, rSrcDesc.GetFollow()->GetName() ); if( !pFollow ) { - // dann mal kopieren + // copy sal_uInt16 nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() ); pFollow = aPageDescs[ nPos ]; CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow ); @@ -2095,8 +2084,8 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, bNotifyLayout = sal_True; } - // die Header/Footer-Attribute werden gesondert kopiert, die Content- - // Sections muessen vollstaendig mitgenommen werden! + // the header and footer attributes are copied seperately + // the content sections have to be copied in their entirety { SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() ); aAttrSet.ClearItem( RES_HEADER ); @@ -2132,8 +2121,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));//swmod 080226 } - //Wenn sich FussnotenInfo veraendert, so werden die Seiten - //angetriggert. + // If foot notes change the pages have to be triggered if( !(rDstDesc.GetFtnInfo() == rSrcDesc.GetFtnInfo()) ) { rDstDesc.SetFtnInfo( rSrcDesc.GetFtnInfo() ); @@ -2158,14 +2146,14 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource ) CopyFmtArr( *rSource.pTxtFmtCollTbl, *pTxtFmtCollTbl, &SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl ); - // und jetzt noch die Seiten-Vorlagen + // and now the page templates sal_uInt16 nCnt = rSource.aPageDescs.Count(); if( nCnt ) { - // ein anderes Doc -> Numberformatter muessen gemergt werden + // a different Doc -> Number formatter needs to be merged SwTblNumFmtMerge aTNFM( rSource, *this ); - // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!) + // 1st step: Create all formats (skip the 0th - it's the default!) while( nCnt ) { SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; @@ -2173,7 +2161,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource ) MakePageDesc( pSrc->GetName() ); } - // 2. Schritt alle Attribute kopieren, richtige Parents setzen + // 2nd step: Copy all attributes, set the right parents for( nCnt = rSource.aPageDescs.Count(); nCnt; ) { SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; @@ -2181,7 +2169,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource ) } } - //JP 08.04.99: und dann sind da noch die Numerierungs-Vorlagen + // then there are the numbering templates nCnt = rSource.GetNumRuleTbl().Count(); if( nCnt ) { @@ -2215,7 +2203,7 @@ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, SwFmt* pFnd = 0; for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { - // ist die Vorlage schon im Doc vorhanden ?? + // Does the Doc already contain the template? if( ((SwFmt*)rFmtArr[n])->GetName() == rName ) { pFnd = (SwFmt*)rFmtArr[n]; @@ -2321,7 +2309,7 @@ void SwDoc::_CreateNumberFormatter() { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::_CreateNumberFormatter" ); - OSL_ENSURE( !pNumberFormatter, "ist doch schon vorhanden" ); + OSL_ENSURE( !pNumberFormatter, "is already there" ); LanguageType eLang = LANGUAGE_SYSTEM; @@ -2336,7 +2324,7 @@ void SwDoc::_CreateNumberFormatter() SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ) : pNFmt( 0 ) { - // ein anderes Doc -> Numberformatter muessen gemergt werden + // a different Doc -> Number formatter needs to be merged SvNumberFormatter* pN; if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( sal_False ) )) ( pNFmt = rDest.GetNumberFormatter( sal_True ))->MergeFormatter( *pN ); @@ -2361,20 +2349,20 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, if( mbIsAutoFmtRedline && pTNd ) { - // dann das Redline Object anlegen + // create the redline object const SwTxtFmtColl& rColl = *pTNd->GetTxtColl(); SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FMTCOLL, aPam ); pRedl->SetMark(); - // interressant sind nur die Items, die vom Set NICHT wieder - // in den Node gesetzt werden. Also muss man die Differenz nehmen + // Only those items that are not set by the Set again in the Node + // are of interest. Thus, we take the difference. SwRedlineExtraData_FmtColl aExtraData( rColl.GetName(), rColl.GetPoolFmtId() ); if( pSet && pTNd->HasSwAttrSet() ) { SfxItemSet aTmp( *pTNd->GetpSwAttrSet() ); aTmp.Differentiate( *pSet ); - // das Adjust Item behalten wir extra + // we handle the adjust item seperately const SfxPoolItem* pItem; if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState( RES_PARATR_ADJUST, sal_False, &pItem )) @@ -2383,7 +2371,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, } pRedl->SetExtraData( &aExtraData ); -// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!! + //TODO: Undo is still missing! AppendRedline( pRedl, true ); } @@ -2405,18 +2393,18 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet ) if( mbIsAutoFmtRedline && pTNd ) { - // dann das Redline Object anlegen + // create the redline object SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rPam ); if( !pRedl->HasMark() ) pRedl->SetMark(); - // interressant sind nur die Items, die vom Set NICHT wieder - // in den Node gesetzt werden. Also muss man die Differenz nehmen + // Only those items that are not set by the Set again in the Node + // are of interest. Thus, we take the difference. SwRedlineExtraData_Format aExtraData( rSet ); pRedl->SetExtraData( &aExtraData ); -// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!! + //TODO: Undo is still missing! AppendRedline( pRedl, true ); SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); commit b184d422893015e1c7086f7b31fe0a53814a2bb0 Author: Philipp Weissenbacher <p.weissenbac...@gmail.com> Date: Mon Nov 28 18:53:42 2011 +0100 Translate German comments diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index b7f4da5..e867da1 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -216,16 +216,16 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNewFrms ) { - //Ankerwechsel sind fast immer in alle 'Richtungen' erlaubt. - //Ausnahme: Absatz- bzw. Zeichengebundene Rahmen duerfen wenn sie in - //Kopf-/Fusszeilen stehen nicht Seitengebunden werden. + // Changing anchors is almost always allowed. + // Exception: Paragraph and character bound frames must not become + // page bound, if they are located in the header or footer. const SwFmtAnchor &rOldAnch = rFmt.GetAnchor(); const RndStdIds nOld = rOldAnch.GetAnchorId(); SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) ); RndStdIds nNew = aNewAnch.GetAnchorId(); - // ist der neue ein gueltiger Anker? + // Is the new anchor valid? if( !aNewAnch.GetCntntAnchor() && (FLY_AT_FLY == nNew || (FLY_AT_PARA == nNew) || (FLY_AS_CHAR == nNew) || (FLY_AT_CHAR == nNew) )) @@ -240,16 +240,17 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNew Point aOldAnchorPos( ::lcl_FindAnchorLayPos( *this, rOldAnch, &rFmt )); Point aNewAnchorPos( ::lcl_FindAnchorLayPos( *this, aNewAnch, 0 )); - //Die alten Frms vernichten. Dabei werden die Views implizit gehidet und - //doppeltes hiden waere so eine art Show! + // Destroy the old Frames. + // The Views are hidden implicitly, so hiding them another time would be + // kind of a show! rFmt.DelFrms(); if ( FLY_AS_CHAR == nOld ) { - //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet - //werden. Leider reisst dies neben den Frms auch noch das Format mit - //in sein Grab. Um dass zu unterbinden loesen wir vorher die - //Verbindung zwischen Attribut und Format. + // We need to handle InCntnts in a special way: + // The TxtAttribut needs to be destroyed which, unfortunately, also + // destroys the format. To avoid that, we disconnect the format from + // the attribute. const SwPosition *pPos = rOldAnch.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); @@ -262,27 +263,25 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNew "Wrong TxtFlyCnt-Hint." ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); - //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet - //werden. + // They are disconnected. We now have to destroy the attribute. pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx ); } - //Endlich kann das Attribut gesetzt werden. Es muss das erste Attribut - //sein; Undo depends on it! + // We can finally set the attribute. It needs to be the first one! + // Undo depends on it! rFmt.SetFmtAttr( aNewAnch ); - //Positionskorrekturen + // Correct the position const SfxPoolItem* pItem; switch( nNew ) { case FLY_AS_CHAR: - //Wenn keine Positionsattribute hereinkommen, dann muss dafuer - //gesorgt werden, das keine unerlaubte automatische Ausrichtung - //bleibt. + // If no position attributes are received, we have to make sure + // that no forbidden automatic alignment is left. { const SwPosition *pPos = aNewAnch.GetCntntAnchor(); SwTxtNode *pNd = pPos->nNode.GetNode().GetTxtNode(); - OSL_ENSURE( pNd, "Crsr steht nicht auf TxtNode." ); + OSL_ENSURE( pNd, "Crsr does not point to TxtNode." ); SwFmtFlyCnt aFmt( static_cast<SwFlyFrmFmt*>(&rFmt) ); pNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 ); @@ -307,16 +306,14 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNew break; case FLY_AT_PARA: - case FLY_AT_CHAR: // LAYER_IMPL - case FLY_AT_FLY: // LAYER_IMPL + case FLY_AT_CHAR: // LAYER_IMPL + case FLY_AT_FLY: // LAYER_IMPL case FLY_AT_PAGE: { - //Wenn keine Positionsattribute hereinschneien korrigieren wir - //die Position so, dass die Dokumentkoordinaten des Flys erhalten - //bleiben. - //Chg: Wenn sich in den Positionsattributen lediglich die - //Ausrichtung veraendert (text::RelOrientation::FRAME vs. text::RelOrientation::PRTAREA), dann wird die - //Position ebenfalls korrigiert. + // If no position attributes are coming in, we correct the position in a way + // such that the fly's document coordinates are preserved. + // If only the alignment changes in the position attributes (text::RelOrientation::FRAME + // vs. text::RelOrientation::PRTAREA), we also correct the position. if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, sal_False, &pItem )) pItem = 0; @@ -379,9 +376,9 @@ lcl_SetFlyFrmAttr(SwDoc & rDoc, // objects of type SwUndoFrmFmt on the undo stack. We don't want them. ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); - //Ist das Ankerattribut dabei? Falls ja ueberlassen wir die Verarbeitung - //desselben einer Spezialmethode. Sie Returnt sal_True wenn der Fly neu - //erzeugt werden muss (z.B. weil ein Wechsel des FlyTyps vorliegt). + // Is the anchor attribute included? + // If so, we pass it to a special method, which returns sal_True + // if the Fly needs to be created anew, because we e.g change the FlyType. sal_Int8 const nMakeFrms = (SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, sal_False )) ? (rDoc.*pSetFlyFrmAnchor)( rFlyFmt, rSet, sal_False ) @@ -399,8 +396,8 @@ lcl_SetFlyFrmAttr(SwDoc & rDoc, case RES_PAGEDESC: case RES_CNTNT: case RES_FOOTER: - OSL_FAIL( ":-) Unbekanntes Attribut fuer Fly." ); - // kein break; + OSL_FAIL( "Unknown Fly attribute." ); + // no break; case RES_CHAIN: rSet.ClearItem( nWhich ); break; @@ -527,8 +524,8 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, // 2 objects of type SwUndoFrmFmt on the undo stack. We don't want them. ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); - //Erstmal die Spalten setzen, sonst gibts nix als Aerger mit dem - //Set/Reset/Abgleich usw. + // Set the column first, or we'll have trouble with + //Set/Reset/Synch. and so on const SfxPoolItem* pItem; if( SFX_ITEM_SET != rNewFmt.GetAttrSet().GetItemState( RES_COL )) rFmt.ResetFmtAttr( RES_COL ); @@ -537,8 +534,8 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, { rFmt.SetDerivedFrom( &rNewFmt ); - // 1. wenn nicht automatisch -> ignorieren, sonst -> wech - // 2. wech damit, MB! + // 1. If not automatic = ignore; else = dispose + // 2. Dispose of it! if( SFX_ITEM_SET == rNewFmt.GetAttrSet().GetItemState( RES_FRM_SIZE, sal_False )) { rFmt.ResetFmtAttr( RES_FRM_SIZE ); @@ -555,8 +552,8 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, *pSet, sal_False ); else { - //JP 23.04.98: muss den FlyFmt-Range haben, denn im SetFlyFrmAnchor - // werden Attribute in diesen gesetzt! + // Needs to have the FlyFmt range, because we set attributes in it, + // in SetFlyFrmAnchor. SfxItemSet aFlySet( *rNewFmt.GetAttrSet().GetPool(), rNewFmt.GetAttrSet().GetRanges() ); aFlySet.Put( *pItem ); @@ -565,11 +562,10 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, } } - //Hori und Vert nur dann resetten, wenn in der Vorlage eine - //automatische Ausrichtung eingestellt ist, anderfalls den alten Wert - //wieder hineinstopfen. - // beim Update der RahmenVorlage sollte der Fly NICHT - // seine Orientierng verlieren (diese wird nicht geupdatet!) + // Only reset vertical and horizontal orientation, if we have automatic alignment + // set in the template. Otherwise use the old value. + // If we update the frame template the Fly should NOT lose its orientation (which + // is not being updated!). // text::HoriOrientation::NONE and text::VertOrientation::NONE are allowed now if (!bKeepOrient) { @@ -610,7 +606,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, const sal_Bool _bSameOnly, const sal_Bool _bPosCorr ) { - OSL_ENSURE( GetCurrentLayout(), "Ohne Layout geht gar nichts" ); + OSL_ENSURE( GetCurrentLayout(), "No layout!" ); if ( !_rMrkList.GetMarkCount() || _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) @@ -698,8 +694,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, case FLY_AT_FLY: // LAYER_IMPL { - //Ausgehend von der linken oberen Ecke des Fly den - //dichtesten SwFlyFrm suchen. + // Search the closest SwFlyFrm starting from the upper left corner. SwFrm *pTxtFrm; { SwCrsrMoveState aState( MV_SETONLYTEXT ); @@ -738,7 +733,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } break; case FLY_AS_CHAR: - if( _bSameOnly ) // Positions/Groessenaenderung + if( _bSameOnly ) // Change of position/size { if( !pOldAnchorFrm ) { @@ -747,7 +742,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } ((SwTxtFrm*)pOldAnchorFrm)->Prepare(); } - else // Ankerwechsel + else // Change of anchors { // allow drawing objects in header/footer pNewAnchorFrm = ::FindAnchor( pOldAnchorFrm, aPt, false ); @@ -759,13 +754,13 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, bUnmark = ( 0 != i ); Point aPoint( aPt ); - aPoint.X() -= 1; // nicht im DrawObj landen!! + aPoint.X() -= 1; // Do not load in the DrawObj! aNewAnch.SetType( FLY_AS_CHAR ); SwPosition aPos( *((SwCntntFrm*)pNewAnchorFrm)->GetNode() ); if ( pNewAnchorFrm->Frm().IsInside( aPoint ) ) { - // es muss ein TextNode gefunden werden, denn nur dort - // ist ein inhaltsgebundenes DrawObjekt zu verankern + // We need to find a TextNode, because only there we can anchor a + // content-bound DrawObject. SwCrsrMoveState aState( MV_SETONLYTEXT ); GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); //swmod 080218 } @@ -826,10 +821,10 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // #i54336# if ( pNewAnchorFrm && pOldAsCharAnchorPos ) { - //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet - //werden. Leider reisst dies neben den Frms auch noch das Format mit - //in sein Grab. Um dass zu unterbinden loesen wir vorher die - //Verbindung zwischen Attribut und Format. + // We need to handle InCntnts in a special way: + // The TxtAttribut needs to be destroyed which, unfortunately, also + // destroys the format. To avoid that, we disconnect the format from + // the attribute. const xub_StrLen nIndx( pOldAsCharAnchorPos->nContent.GetIndex() ); SwTxtNode* pTxtNode( pOldAsCharAnchorPos->nNode.GetNode().GetTxtNode() ); OSL_ENSURE( pTxtNode, "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object" ); @@ -838,8 +833,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, pTxtNode->GetTxtAttrForCharAt( nIndx, RES_TXTATR_FLYCNT ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); - //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet - //werden. + // They are disconnected. We now have to destroy the attribute. pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIndx, nIndx ); delete pOldAsCharAnchorPos; } @@ -854,13 +848,12 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) { - //Die Source darf noch keinen Follow haben. + // The Source must not yet have a Follow. const SwFmtChain &rOldChain = rSource.GetChain(); if ( rOldChain.GetNext() ) return SW_CHAIN_SOURCE_CHAINED; - //Ziel darf natuerlich nicht gleich Source sein und es - //darf keine geschlossene Kette entstehen. + // Target must not be equal to Source and we also must not have a closed chain. const SwFrmFmt *pFmt = &rDest; do { if( pFmt == &rSource ) @@ -868,17 +861,16 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) pFmt = pFmt->GetChain().GetNext(); } while ( pFmt ); - //Auch eine Verkettung von Innen nach aussen oder von aussen - //nach innen ist nicht zulaessig. + // There must not be a chaining from outside to inside or the other way around. if( rDest.IsLowerOf( rSource ) || rSource .IsLowerOf( rDest ) ) return SW_CHAIN_SELF; - //Das Ziel darf noch keinen Master haben. + // The Target must not yet have a Master. const SwFmtChain &rChain = rDest.GetChain(); if( rChain.GetPrev() ) return SW_CHAIN_IS_IN_CHAIN; - //Das Ziel muss leer sein. + // Target must be empty. const SwNodeIndex* pCntIdx = rDest.GetCntnt().GetCntntIdx(); if( !pCntIdx ) return SW_CHAIN_NOT_FOUND; @@ -910,11 +902,10 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) } } - //Auf die richtige Area muessen wir auch noch einen Blick werfen. - //Beide Flys muessen im selben Bereich (Body, Head/Foot, Fly) sitzen - //Wenn die Source nicht der selektierte Rahmen ist, so reicht es - //Wenn ein passender gefunden wird (Der Wunsch kann z.B. von der API - //kommen). + // We also need to consider the right area. + // Both Flys need to be located in the same area (Body, Header/Footer, Fly). + // If the Source is not the selected frame, it's enough to find a suitable + // one. e.g. if it's requested by the API. // both in the same fly, header, footer or on the page? const SwFmtAnchor &rSrcAnchor = rSource.GetAnchor(), @@ -960,7 +951,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest; - //Follow an den Master haengen. + // Attach Follow to the Master. SwFmtChain aChain = rDestFmt.GetChain(); aChain.SetPrev( &(SwFlyFrmFmt&)rSource ); SetAttr( aChain, rDestFmt ); @@ -968,12 +959,12 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) SfxItemSet aSet( GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE, RES_CHAIN, RES_CHAIN, 0 ); - //Follow an den Master haengen. + // Attach Follow to the Master. aChain.SetPrev( &(SwFlyFrmFmt&)rSource ); SetAttr( aChain, rDestFmt ); - //Master an den Follow haengen und dafuer sorgen, dass der Master - //eine fixierte Hoehe hat. + // Attach Master to the Follow. + // Make sure that the Master has a fixed height. aChain = rSource.GetChain(); aChain.SetNext( &rDestFmt ); aSet.Put( aChain ); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits