summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/atrhndl.hxx10
-rw-r--r--sw/source/core/text/atrstck.cxx34
-rw-r--r--sw/source/core/text/blink.cxx9
-rw-r--r--sw/source/core/text/guess.hxx4
-rw-r--r--sw/source/core/text/inftxt.cxx47
-rw-r--r--sw/source/core/text/inftxt.hxx34
-rw-r--r--sw/source/core/text/itratr.cxx69
-rw-r--r--sw/source/core/text/txthyph.cxx52
-rw-r--r--sw/source/core/text/widorp.cxx58
9 files changed, 172 insertions, 145 deletions
diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx
index ed41f2a00ffc..c1ecd6a8e89f 100644
--- a/sw/source/core/text/atrhndl.hxx
+++ b/sw/source/core/text/atrhndl.hxx
@@ -32,20 +32,22 @@ class SwViewShell;
class SfxPoolItem;
extern const sal_uInt8 StackPos[];
-// Used by Attribute Iterators to organize attributes on stacks to
-// find the valid attribute in each category
+/**
+ * Used by Attribute Iterators to organize attributes on stacks to
+ * find the valid attribute in each category
+ */
class SwAttrHandler
{
private:
- // Container for SwTxtAttr Objects
+ /// Container for SwTxtAttr Objects
class SwAttrStack
{
private:
SwTxtAttr* pInitialArray[ INITIAL_NUM_ATTR ];
SwTxtAttr** pArray;
sal_uInt16 nCount; // number of elements on stack
- sal_uInt16 nSize; // number of positions in Array
+ sal_uInt16 nSize; // number of positions in Array
public:
// Ctor, Dtor
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 8590ecfd93cb..365cca4493a4 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -56,8 +56,8 @@
#define STACK_INCREMENT 4
-/*
- * Attribute to Stack Mapping
+/**
+ * Attribute to Stack Mapping
*
* Attributes applied to a text are pushed on different stacks. For each
* stack, the top most attribute on the stack is valid. Because some
@@ -131,7 +131,7 @@ const sal_uInt8 StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] =
namespace CharFmt
{
-// Returns the item set associated with an character/inet/auto style
+/// Returns the item set associated with an character/inet/auto style
const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr )
{
const SfxItemSet* pSet = 0;
@@ -155,7 +155,7 @@ const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr )
return pSet;
}
-// Extracts pool item of type nWhich from rAttr
+/// Extracts pool item of type nWhich from rAttr
const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, sal_uInt16 nWhich )
{
if ( RES_TXTATR_INETFMT == rAttr.Which() ||
@@ -175,7 +175,7 @@ const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, sal_uInt16 nWhich )
return ( nWhich == rAttr.Which() ) ? &rAttr.GetAttr() : 0;
}
-// checks if item is included in character/inet/auto style
+/// Checks if item is included in character/inet/auto style
bool IsItemIncluded( const sal_uInt16 nWhich, const SwTxtAttr *pAttr )
{
bool bRet = false;
@@ -188,11 +188,13 @@ bool IsItemIncluded( const sal_uInt16 nWhich, const SwTxtAttr *pAttr )
}
}
-// The color of hyperlinks is taken from the associated character attribute,
-// depending on its 'visited' state. There are actually two cases, which
-// should override the colors from the character attribute:
-// 1. We never take the 'visited' color during printing/pdf export/preview
-// 2. The user has chosen to override these colors in the view options
+/**
+ * The color of hyperlinks is taken from the associated character attribute,
+ * depending on its 'visited' state. There are actually two cases, which
+ * should override the colors from the character attribute:
+ * 1. We never take the 'visited' color during printing/pdf export/preview
+ * 2. The user has chosen to override these colors in the view options
+ */
static bool lcl_ChgHyperLinkColor( const SwTxtAttr& rAttr,
const SfxPoolItem& rItem,
const SwViewShell* pShell,
@@ -526,7 +528,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
}
}
-// only used during redlining
+/// Only used during redlining
void SwAttrHandler::Pop( const SwTxtAttr& rAttr )
{
OSL_ENSURE( rAttr.Which() < RES_TXTATR_WITHEND_END,
@@ -625,9 +627,11 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
rFnt.GetInputField()--;
}
-// When popping an attribute from the stack, the top mose remaining
-// attribute in the stack becomes valid. The following function change
-// a font depending on the stack id.
+/**
+ * When popping an attribute from the stack, the top mose remaining
+ * attribute in the stack becomes valid. The following function change
+ * a font depending on the stack id.
+ */
void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
{
switch ( rItem.Which() )
@@ -893,7 +897,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
}
}
-// Takes the default font and calculated the ascent and height
+/// Takes the default font and calculated the ascent and height
void SwAttrHandler::GetDefaultAscentAndHeight( SwViewShell* pShell, OutputDevice& rOut,
sal_uInt16& nAscent, sal_uInt16& nHeight ) const
{
diff --git a/sw/source/core/text/blink.cxx b/sw/source/core/text/blink.cxx
index 70b994b751da..9fb4baebb7b8 100644
--- a/sw/source/core/text/blink.cxx
+++ b/sw/source/core/text/blink.cxx
@@ -24,12 +24,13 @@
#include "porlin.hxx"
#include "porlay.hxx"
-// Sichtbare Zeit:
+// Visible time
#define BLINK_ON_TIME 2400L
-// Nihct sichtbare Zeit:
+// Invisible time
#define BLINK_OFF_TIME 800L
-/* pBlink points to the instance where blinking portions need to register.
+/**
+ * pBlink points to the instance where blinking portions need to register.
* If necessary, it needs to be created by SwBlink.
* They are then triggered rhythimcally for a repaint. They can query
* for being visible or invisible with IsVisible().
@@ -49,7 +50,7 @@ SwBlink::~SwBlink( )
aTimer.Stop();
}
-/*
+/**
* SwBlink::Blinker (timer):
* Toggle visibility flag
* Determine the repaint rectangle and invalidate them in their OleShells.
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index 4d33c6bf4ce0..250868687165 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -34,8 +34,8 @@ class SwTxtGuess
sal_Int32 nBreakStart; // start index of word containing line break
sal_Int32 nBreakPos; // start index of break position
sal_Int32 nFieldDiff; // absolut positions can be wrong if we
- // a field in the text has been expanded
- sal_uInt16 nBreakWidth; // width of the broken portion
+ // a field in the text has been expanded
+ sal_uInt16 nBreakWidth; // width of the broken portion
public:
inline SwTxtGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 1b78155a20d2..9730e62aad80 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -495,7 +495,7 @@ SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf )
extern Color aGlobalRetoucheColor;
-// Returns if the current background color is dark.
+/// Returns if the current background color is dark.
static bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
{
const Color* pCol = rInf.GetFont()->GetBackColor();
@@ -777,12 +777,16 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
}
}
-// Draws a special portion, e.g., line break portion, tab portion.
-// rPor - The portion
-// rRect - The rectangle surrounding the character
-// rCol - Specify a color for the character
-// bCenter - Draw the character centered, otherwise left aligned
-// bRotate - Rotate the character if character rotation is set
+/**
+ * Draws a special portion
+ * E.g.: line break portion, tab portion
+ *
+ * @param rPor The portion
+ * @param rRect The rectangle surrounding the character
+ * @param rCol Specify a color for the character
+ * @param bCenter Draw the character centered, otherwise left aligned
+ * @param bRotate Rotate the character if character rotation is set
+ */
static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
SwRect& rRect, const Color& rCol, sal_Unicode cChar,
sal_uInt8 nOptions )
@@ -1338,11 +1342,13 @@ void SwTxtFormatInfo::CtorInitTxtFormatInfo( SwTxtFrm *pNewFrm, const bool bNewI
Init();
}
-// If the Hyphenator returns ERROR or the language is set to NOLANGUAGE
-// we do not hyphenate.
-// Else, we always hyphenate if we do interactive hyphenation.
-// If we do not do interactive hyphenation, we only hyphenate if ParaFmt is
-// set to automatic hyphenation.
+/**
+ * If the Hyphenator returns ERROR or the language is set to NOLANGUAGE
+ * we do not hyphenate.
+ * Else, we always hyphenate if we do interactive hyphenation.
+ * If we do not do interactive hyphenation, we only hyphenate if ParaFmt is
+ * set to automatic hyphenation.
+ */
bool SwTxtFormatInfo::IsHyphenate() const
{
if( !bInterHyph && !bAutoHyph )
@@ -1408,12 +1414,14 @@ void SwTxtFormatInfo::Init()
SetPaintOfst(0);
}
-// There are a few differences between a copy constructor
-// and the following constructor for multi-line formatting.
-// The root is the first line inside the multi-portion,
-// the line start is the actual position in the text,
-// the line width is the rest width from the surrounding line
-// and the bMulti and bFirstMulti-flag has to be set correctly.
+/**
+ * There are a few differences between a copy constructor
+ * and the following constructor for multi-line formatting.
+ * The root is the first line inside the multi-portion,
+ * the line start is the actual position in the text,
+ * the line width is the rest width from the surrounding line
+ * and the bMulti and bFirstMulti-flag has to be set correctly.
+ */
SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf,
SwLineLayout& rLay, SwTwips nActWidth ) : SwTxtPaintInfo( rInf ),
bTabOverflow( false )
@@ -1489,9 +1497,9 @@ sal_Int32 SwTxtFormatInfo::ScanPortionEnd( const sal_Int32 nStart,
sal_Int32 i = nStart;
// Used for decimal tab handling:
-
const sal_Unicode cTabDec = GetLastTab() ? (sal_Unicode)GetTabDecimal() : 0;
const sal_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
+
// #i45951# German (Switzerland) uses ' as thousand separator
const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
@@ -1539,7 +1547,6 @@ sal_Int32 SwTxtFormatInfo::ScanPortionEnd( const sal_Int32 nStart,
// Compatibility: First non-digit character behind a
// a digit character becomes the hook character
-
if ( bTabCompat )
{
if ( ( 0x2F < cPos && cPos < 0x3A ) ||
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index f9246e33e248..575cd434f0b0 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -122,7 +122,7 @@ class SwTxtInfo
// Implementation in txthyph.cxx
friend void SetParaPortion( SwTxtInfo *pInf, SwParaPortion *pRoot );
SwParaPortion *pPara;
- sal_Int32 nTxtStart; // TxtOfst for Follows
+ sal_Int32 nTxtStart; // TxtOfst for Follows
protected:
SwTxtInfo()
@@ -172,18 +172,18 @@ protected:
bool m_bStopUnderflow : 1; // Underflow was stopped e.g. by a FlyPortion
bool m_bFtnInside : 1; // the current line contains a footnote
bool m_bOtherThanFtnInside : 1; // the current line contains another portion than a footnote portion.
- // needed for checking keep together of footnote portion with previous portion
+ // needed for checking keep together of footnote portion with previous portion
bool m_bMulti : 1; // inside a multiportion
bool m_bFirstMulti : 1; // this flag is used for two purposes:
- // - the multiportion is the first lineportion
- // - indicates, if we are currently in second
- // line of multi portion
+ // - the multiportion is the first lineportion
+ // - indicates, if we are currently in second
+ // line of multi portion
bool m_bRuby : 1; // during the formatting of a phonetic line
bool m_bHanging : 1; // formatting of hanging punctuation allowed
bool m_bScriptSpace : 1; // space between different scripts (Asian/Latin)
bool m_bForbiddenChars : 1; // Forbidden start/endline characters
bool m_bSnapToGrid : 1; // paragraph snaps to grid
- sal_uInt8 m_nDirection : 2; // writing direction: 0/90/180/270 degree
+ sal_uInt8 m_nDirection : 2; // writing direction: 0/90/180/270 degree
protected:
void CtorInitTxtSizeInfo( SwTxtFrm *pFrm, SwFont *pFnt = 0,
@@ -535,11 +535,11 @@ class SwTxtFormatInfo : public SwTxtPaintInfo
SwTwips nLeft; // Left margin
SwTwips nRight; // Right margin
SwTwips nFirst; // EZE
- sal_uInt16 nRealWidth; // "real" line width
- sal_uInt16 nWidth; // "virtual" line width
- sal_uInt16 nLineHeight; // Final height after CalcLine
- sal_uInt16 nLineNettoHeight; // line height without spacing
- sal_uInt16 nForcedLeftMargin; // Shift of left margin due to frame
+ sal_uInt16 nRealWidth; // "real" line width
+ sal_uInt16 nWidth; // "virtual" line width
+ sal_uInt16 nLineHeight; // Final height after CalcLine
+ sal_uInt16 nLineNettoHeight; // line height without spacing
+ sal_uInt16 nForcedLeftMargin; // Shift of left margin due to frame
sal_Int16 nMinLeading; // minimum number of chars before hyphenation point
sal_Int16 nMinTrailing; // minimum number of chars after hyphenation point
@@ -728,11 +728,13 @@ public:
inline bool IsTabOverflow() { return bTabOverflow; }
};
-// For the text replacement and restoration of SwTxtSizeInfo.
-// The way this is done is a bit of a hack: Although rInf is const we change it
-// anyway.
-// Because rInf is restorated again in the DTOR, we can do this.
-// You could call it a "logical const", if you wish.
+/**
+ * For the text replacement and restoration of SwTxtSizeInfo.
+ * The way this is done is a bit of a hack: Although rInf is const we change it
+ * anyway.
+ * Because rInf is restorated again in the DTOR, we can do this.
+ * You could call it a "logical const", if you wish.
+ */
class SwTxtSlot
{
OUString aTxt;
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index a66618f9076f..726354549439 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -87,16 +87,21 @@ SwAttrIter::~SwAttrIter()
delete pFnt;
}
-// Liefert fuer eine Position das Attribut, wenn das Attribut genau auf
-// der Position nPos liegt und kein EndIndex besitzt.
-// GetAttr() wird fuer Attribute benoetigt, die die Formatierung beeinflussen
-// sollen, ohne dabei den Inhalt des Strings zu veraendern. Solche "entarteten"
-// Attribute sind z.B. Felder (die expandierten Text bereit halten) und
-// zeilengebundene Frames. Um Mehrdeutigkeiten zwischen verschiedenen
-// solcher Attribute zu vermeiden, werden beim Anlegen eines Attributs
-// an der Startposition ein Sonderzeichen in den String einfuegt.
-// Der Formatierer stoesst auf das Sonderzeichen und holt sich per
-// GetAttr() das entartete Attribut.
+/**
+ * Returns the attribute for a position
+ *
+ * Only if the attribute is exactly at the position @param nPos and
+ * does not have an EndIndex
+ *
+ * We need this function for attributes which should alter formatting without
+ * changing the content of the string.
+ * Such "degenerated" attributes are e.g.: fields which retain expanded text and
+ * line-bound Frames.
+ * In order to avoid ambiguities between different such attributes, we insert a
+ * special character at the start of the string, when creating such an attribute.
+ * The Formatter later on encounters such a special character and retrieves the
+ * degenerate attribute via GetAttr().
+ */
SwTxtAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const
{
return (m_pTxtNode) ? m_pTxtNode->GetTxtAttrForCharAt(nPosition) : 0;
@@ -192,17 +197,17 @@ void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
{
SwTxtAttr *pTxtAttr;
- if ( nStartIndex ) // wenn ueberhaupt schon Attribute geoeffnet wurden...
+ if ( nStartIndex ) // If attributes have been opened at all ...
{
- // Schliesse Attr, die z. Z. geoeffnet sind, vor nNewPos+1 aber enden.
+ // Close attributes that are currently open, but stop at nNewPos+1
- // Solange wir noch nicht am Ende des EndArrays angekommen sind &&
- // das TextAttribut vor oder an der neuen Position endet ...
+ // As long as we've not yet reached the end of EndArray and the
+ // TextAttribute ends before or at the new position ...
while ( ( nEndIndex < pHints->GetEndCount() ) &&
(*(pTxtAttr=pHints->GetEnd(nEndIndex))->GetAnyEnd()<=nNewPos))
{
- // schliesse die TextAttribute, deren StartPos vor
- // oder an der alten nPos lag, die z.Z. geoeffnet sind.
+ // Close the TextAttributes, whoes StartPos were before or at
+ // the old nPos and are currently open
if (pTxtAttr->GetStart() <= nPos) Rst( pTxtAttr );
nEndIndex++;
}
@@ -215,8 +220,9 @@ void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
nEndIndex++;
}
}
- // Solange wir noch nicht am Ende des StartArrays angekommen sind &&
- // das TextAttribut vor oder an der neuen Position beginnt ...
+
+ // As long as we've not yet reached the end of EndArray and the
+ // TextAttribute ends before or at the new position ...
while ( ( nStartIndex < pHints->GetStartCount() ) &&
((pTxtAttr=pHints->GetStart(nStartIndex))->GetStart()<=nNewPos) )
{
@@ -303,7 +309,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
}
}
if (m_pTxtNode!=NULL) {
- // TODO maybe use hints like FieldHints for this instead of looking at the text...
+ // TODO: maybe use hints like FieldHints for this instead of looking at the text...
const sal_Int32 l = nNext<m_pTxtNode->Len() ? nNext : m_pTxtNode->Len();
sal_Int32 p=nPos;
const sal_Unicode* aStr = m_pTxtNode->GetTxt().getStr();
@@ -545,8 +551,9 @@ static void lcl_MinMaxNode( SwFrmFmt* pNd, SwMinMaxNodeArgs* pIn )
#define FLYINCNT_MIN_WIDTH 284
-// changing this method very likely requires changing of
-// "GetScalingOfSelectedText"
+/**
+ * Changing this method very likely requires changing of GetScalingOfSelectedText
+ */
void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax,
sal_uLong& rAbsMin, OutputDevice* pOut ) const
{
@@ -765,18 +772,20 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
rMax += aNodeArgs.nMaxWidth;
rMax += nLROffset;
rMax += nAdd;
- if( rMax < rMin ) // z.B. Rahmen mit Durchlauf gehen zunaechst nur
- rMax = rMin; // in das Minimum ein
+ if( rMax < rMin ) // e.g. Frames with flow through only contribute to the minimum
+ rMax = rMin;
pOut->SetMapMode( aOldMap );
}
-// Calculates the width of the text part specified by nStt and nEnd,
-// the height of the line containing nStt is devided by this width,
-// indicating the scaling factor, if the text part is rotated.
-// Having CH_BREAKs in the text part, this method returns the scaling
-// factor for the longest of the text parts separated by the CH_BREAKs.
-//
-// changing this method very likely requires changing of "GetMinMaxSize"
+/**
+ * Calculates the width of the text part specified by nStt and nEnd,
+ * the height of the line containing nStt is devided by this width,
+ * indicating the scaling factor, if the text part is rotated.
+ * Having CH_BREAKs in the text part, this method returns the scaling
+ * factor for the longest of the text parts separated by the CH_BREAK
+ *
+ * Changing this method very likely requires changing of "GetMinMaxSize"
+ */
sal_uInt16 SwTxtNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
const
{
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index 33c980142481..6dafd4eceb42 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -51,35 +51,40 @@ Reference< XHyphenatedWord > SwTxtFormatInfo::HyphWord(
}
-// Wir formatieren eine Zeile fuer die interaktive Trennung
+/**
+ * We format a row for interactive hyphenation
+ */
bool SwTxtFrm::Hyphenate( SwInterHyphInfo &rHyphInf )
{
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTxtFrm::Hyphenate" );
if( !g_pBreakIt->GetBreakIter().is() )
return false;
- // Wir machen den Laden erstmal dicht:
+
+ // We lock it, to start with
OSL_ENSURE( !IsLocked(), "SwTxtFrm::Hyphenate: this is locked" );
- // 4935: Der frame::Frame muss eine gueltige SSize haben!
+
+ // The frame::Frame must have a valid SSize!
Calc();
GetFormatted();
bool bRet = false;
if( !IsEmpty() )
{
- // Wir muessen die Trennung immer einschalten.
- // Keine Angst, der SwTxtIter sichert im Hyphenate die alte Zeile.
+ // We always need to enable hyphenation
+ // Don't be afraid: the SwTxtIter saves the old row in the hyphenate
SwTxtFrmLocker aLock( this );
if ( IsVertical() )
SwapWidthAndHeight();
- SwTxtFormatInfo aInf( this, true ); // true for interactive hyph!
+ SwTxtFormatInfo aInf( this, true ); // true for interactive hyph!
SwTxtFormatter aLine( this, &aInf );
aLine.CharToLine( rHyphInf.nStart );
- // Wenn wir innerhalb des ersten Wortes einer Zeile stehen, so koennte
- // dieses in der vorherigen getrennt werden, deshalb gehen wir ein Zeile
- // zurueck.
+
+ // If we're within the first word of a row, it could've been hyphenated
+ // in the row earlier.
+ // That's why we go one row back.
if( aLine.Prev() )
{
SwLinePortion *pPor = aLine.GetCurr()->GetFirstPortion();
@@ -104,14 +109,13 @@ bool SwTxtFrm::Hyphenate( SwInterHyphInfo &rHyphInf )
return bRet;
}
-// Wir formatieren eine Zeile fuer die interaktive Trennung
-//
-// Wir koennen davon ausgehen, dass bereits formatiert wurde.
-// Fuer die CeBIT'93 gehen wir den einfachen, sicheren Weg:
-// Die Zeile wird einfach neu formatiert, der Hyphenator wird dann
-// so vorbereitet, wie ihn die UI erwartet.
-// Hier stehen natuerlich enorme Optimierungsmoeglichkeiten offen.
-
+/**
+ * We format a row for interactive hyphenation
+ * We can assume that we've already formatted.
+ * We just reformat the row, the hyphenator will be prepared like
+ * the UI expects it to be.
+ * TODO: We can of course optimize this a lot.
+ */
void SetParaPortion( SwTxtInfo *pInf, SwParaPortion *pRoot )
{
OSL_ENSURE( pRoot, "SetParaPortion: no root anymore" );
@@ -122,18 +126,18 @@ bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf )
{
SwTxtFormatInfo &rInf = GetInfo();
- // In der letzten Zeile gibt es nie etwas zu trennen.
- // Es sei denn, es befindet sich eine FlyPortion darin,
- // oder es ist die letzte Zeile des Masters
+ // We never need to hyphenate anything in the last row
+ // Except for, if it contains a FlyPortion or if it's the
+ // last row of the Master
if( !GetNext() && !rInf.GetTxtFly().IsOn() && !pFrm->GetFollow() )
return false;
sal_Int32 nWrdStart = nStart;
- // Wir muessen die alte Zeile erhalten. Ein Beispiel:
- // Das Attribut fuer Trennung wurde nicht gesetzt,
- // in SwTxtFrm::Hyphenate wird es jedoch immer gesetzt,
- // weil wir Trennpositionen im Hyphenator einstellen wollen.
+ // We need to retain the old row
+ // E.g.: The attribute for hyphenation was not set, but
+ // it's always set in SwTxtFrm::Hyphenate, because we want
+ // to set breakpoints.
SwLineLayout *pOldCurr = pCurr;
InitCntHyph();
diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index 78ad39bb79d9..76fc1c0d728a 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -80,7 +80,8 @@ SwTxtFrmBreak::SwTxtFrmBreak( SwTxtFrm *pNewFrm, const SwTwips nRst )
UNDO_SWAP( pFrm )
}
-/* BP 18.6.93: Widows.
+/**
+ * BP 18.6.93: Widows.
* In contrast to the first implementation the Widows are not calculated
* in advance but detected when formatting the split Follow.
* In Master the Widows-calculation is dropped completely
@@ -89,9 +90,7 @@ SwTxtFrmBreak::SwTxtFrmBreak( SwTxtFrm *pNewFrm, const SwTwips nRst )
* A special problem is when the Widow rule applies but in Master
* there are some lines available.
*
- */
-
-/* BP(22.07.92): Calculation of Widows and Orphans.
+ * BP(22.07.92): Calculation of Widows and Orphans.
* The method returns true if one of the rules matches.
*
* One difficulty with Widows and different formats between
@@ -101,7 +100,6 @@ SwTxtFrmBreak::SwTxtFrmBreak( SwTxtFrm *pNewFrm, const SwTwips nRst )
* be done until the Follow is formated. Unfortunately this is crucial
* to decide if the whole paragraph goes to the next page or not.
*/
-
bool SwTxtFrmBreak::IsInside( SwTxtMargin &rLine ) const
{
bool bFit = false;
@@ -203,7 +201,7 @@ bool SwTxtFrmBreak::IsBreakNow( SwTxtMargin &rLine )
return bBreak;
}
-// OD 2004-02-27 #106629# - no longer inline
+/// OD 2004-02-27 #106629# - no longer inline
void SwTxtFrmBreak::SetRstHeight( const SwTxtMargin &rLine )
{
// OD, FME 2004-02-27 #106629# - consider bottom margin
@@ -298,11 +296,11 @@ WidowsAndOrphans::WidowsAndOrphans( SwTxtFrm *pNewFrm, const SwTwips nRst,
UNDO_SWAP( pFrm )
}
-/* The Find*-Methodes do not only search, but adjust the SwTxtMargin to the
+/**
+ * The Find*-Methodes do not only search, but adjust the SwTxtMargin to the
* line where the paragraph should have a break and truncate the paragraph there.
* FindBreak()
*/
-
bool WidowsAndOrphans::FindBreak( SwTxtFrm *pFrame, SwTxtMargin &rLine,
bool bHasToFit )
{
@@ -350,12 +348,12 @@ bool WidowsAndOrphans::FindBreak( SwTxtFrm *pFrame, SwTxtMargin &rLine,
return bRet;
}
-/* FindWidows positions the SwTxtMargin of the Master to the line where to
- * break by examining and formatting the Follow.
- * Returns true if the Widows-rule matches, that means that the
- * paragraph should not be split (keep) !
+/**
+ * FindWidows positions the SwTxtMargin of the Master to the line where to
+ * break by examining and formatting the Follow.
+ * Returns true if the Widows-rule matches, that means that the
+ * paragraph should not be split (keep) !
*/
-
bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine )
{
OSL_ENSURE( ! pFrame->IsVertical() || ! pFrame->IsSwapped(),
@@ -366,7 +364,7 @@ bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine )
rLine.Bottom();
- // Wir koennen noch was abzwacken
+ // We can still cut something off
SwTxtFrm *pMaster = pFrame->FindMaster();
OSL_ENSURE(pMaster, "+WidowsAndOrphans::FindWidows: Widows in a master?");
if( !pMaster )
@@ -445,21 +443,21 @@ bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine )
}
// Master to Follow
- // Wenn der Follow nach seiner Formatierung weniger Zeilen enthaelt
- // als Widows, so besteht noch die Chance, einige Zeilen des Masters
- // abzuzwacken. Wenn dadurch die Orphans-Regel des Masters in Kraft
- // tritt muss im CalcPrep() des Master-Frame der Frame so vergroessert
- // werden, dass er nicht mehr auf seine urspruengliche Seite passt.
- // Wenn er noch ein paar Zeilen entbehren kann, dann muss im CalcPrep()
- // ein Shrink() erfolgen, der Follow mit dem Widows rutscht dann auf
- // die Seite des Masters, haelt sich aber zusammen, so dass er (endlich)
- // auf die naechste Seite rutscht. - So die Theorie!
-
- // Wir fordern nur noch ein Zeile zur Zeit an, weil eine Zeile des Masters
- // bei uns durchaus mehrere Zeilen ergeben koennten.
- // Dafuer behaelt CalcFollow solange die Kontrolle, bis der Follow alle
- // notwendigen Zeilen bekommen hat.
- sal_uInt16 nNeed = 1; // frueher: nWidLines - rLine.GetLineNr();
+ // If the Follow contains fewer rows than Widows after formatting,
+ // we still can cut off some rows from the Master. If the Orphans
+ // rule of the Master hereby comes into effect, we need to enlarge
+ // the Frame in CalcPrep() of the Master Frame, as it won't fit into
+ // the original page anymore.
+ // If the Master Frame can still miss a few more rows, we need to
+ // do a Shrink() in the CalcPrep(): the Follow with the Widows then
+ // moves onto the page of the Master, but remains unsplit, so that
+ // it (finally) moves onto the next page. So much for the theory!
+ //
+ // We only request one row at a time for now, because a Master's row could
+ // result in multiple lines for us.
+ // Therefore, the CalcFollow() remains in control until the Follow got all
+ // necessary rows.
+ sal_uInt16 nNeed = 1; // was: nWidLines - rLine.GetLineNr();
// Special case: Master cannot give lines to follow
// #i91421#
@@ -483,7 +481,7 @@ bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine )
bool WidowsAndOrphans::WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight, bool bTst )
{
// Here it does not matter, if pFrm is swapped or not.
- // IsInside() takes care for itself
+ // IsInside() takes care of itself
// We expect that rLine is set to the last line
OSL_ENSURE( !rLine.GetNext(), "WouldFit: aLine::Bottom missed!" );