summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Martens <ama@openoffice.org>2000-11-21 10:29:48 +0000
committerAndreas Martens <ama@openoffice.org>2000-11-21 10:29:48 +0000
commitd05f64ba91ca0524224b7d580b68e19c8a787fa8 (patch)
treefca80931276a47385994c6abf83c3d44bd6348f4
parent9f603cd8b867573772ef88c06f9620978666e9f9 (diff)
New: Hanging punctuation
-rw-r--r--sw/source/core/inc/txtfrm.hxx7
-rw-r--r--sw/source/core/layout/ssfrm.cxx9
-rw-r--r--sw/source/core/text/frmform.cxx30
-rw-r--r--sw/source/core/text/frmpaint.cxx15
-rw-r--r--sw/source/core/text/guess.hxx14
-rw-r--r--sw/source/core/text/inftxt.cxx9
-rw-r--r--sw/source/core/text/porlay.cxx61
-rw-r--r--sw/source/core/text/porlay.hxx22
-rw-r--r--sw/source/core/text/porlin.hxx6
-rw-r--r--sw/source/core/text/porrst.hxx22
-rw-r--r--sw/source/core/text/portxt.cxx32
11 files changed, 169 insertions, 58 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index dae73db78137..0d02c0ddb7ac 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtfrm.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ama $ $Date: 2000-11-09 11:35:30 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:11:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -320,6 +320,9 @@ public:
inline const SwParaPortion *GetPara() const;
inline sal_Bool HasPara() const;
sal_Bool _HasPara() const;
+ // If there are any hanging punctuation portions in the margin
+ // the offset will be returned.
+ SwTwips HangingMargin() const;
// RTTI
TYPEINFO();
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index b4fab9067001..520df1604a94 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ssfrm.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-19 00:08:22 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:13:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -316,6 +316,9 @@ const SwRect SwFrm::UnionFrm( BOOL bBorder ) const
aRet.Left( aRet.Left() + Prt().Left() );
if( Prt().Left() + Prt().Width() > Frm().Width() )
aRet.Width(aRet.Width() + Prt().Left() + Prt().Width() - Frm().Width());
+ SwTwips nRight = aRet.Left() + aRet.Width();
+ if( IsTxtFrm() && ((SwTxtFrm*)this)->HasPara() )
+ nRight += ((SwTxtFrm*)this)->HangingMargin();
if( bBorder )
{
SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
@@ -337,6 +340,8 @@ const SwRect SwFrm::UnionFrm( BOOL bBorder ) const
aRet.SSize().Width() += rShadow.CalcShadowSpace(SHADOW_RIGHT);
}
}
+ if( nRight > aRet.Left() + aRet.Width() )
+ aRet.Width( nRight - aRet.Left() );
return aRet;
}
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index d0781e533c20..b5f9334eead8 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frmform.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: ama $ $Date: 2000-11-09 11:34:16 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:20:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1044,7 +1044,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
const xub_StrLen nOldLen = pOldCur->GetLen();
const KSHORT nOldAscent = pOldCur->GetAscent();
const KSHORT nOldHeight = pOldCur->Height();
- const KSHORT nOldWidth = pOldCur->Width();
+ const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
const sal_Bool bOldHyph = pOldCur->IsEndHyph();
SwTwips nOldTop = 0;
SwTwips nOldBottom;
@@ -1116,17 +1116,17 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
rLine.SetUnclipped( sal_False );
}
}
- if ( rRepaint.GetOfst() )
- {
- SwTwips nRght = Max( nOldWidth, pNew->Width() );
- ViewShell *pSh = GetShell();
- const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : 0;
- if( pOpt && (pOpt->IsParagraph() || pOpt->IsLineBreak()) )
- nRght += ( Max( nOldAscent, pNew->GetAscent() ) );
- else
- nRght += ( Max( nOldAscent, pNew->GetAscent() ) / 4);
- rRepaint.SetRightOfst( rLine.GetLeftMargin() + nRght );
- }
+ SwTwips nRght = Max( nOldWidth, pNew->Width() +
+ pNew->GetHangingMargin() );
+ ViewShell *pSh = GetShell();
+ const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : 0;
+ if( pOpt && (pOpt->IsParagraph() || pOpt->IsLineBreak()) )
+ nRght += ( Max( nOldAscent, pNew->GetAscent() ) );
+ else
+ nRght += ( Max( nOldAscent, pNew->GetAscent() ) / 4);
+ nRght += rLine.GetLeftMargin();
+ if( rRepaint.GetOfst() || rRepaint.GetRightOfst() < nRght )
+ rRepaint.SetRightOfst( nRght );
}
if( !bUnChg )
rLine.SetChanges();
@@ -1253,6 +1253,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
rRepaint.SetOfst( 0 );
rRepaint.SetRightOfst( 0 );
rRepaint.Chg( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+ if( pPara->IsMargin() )
+ rRepaint.Width( rRepaint.Width() + pPara->GetHangingMargin() );
rRepaint.Top( rLine.Y() );
// 6792: Rrand < LRand und Repaint
if( 0 >= rRepaint.Width() )
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 964d5a73bdb9..1d6866dd0199 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frmpaint.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-19 00:08:24 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:21:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -451,14 +451,13 @@ SwRect SwTxtFrm::Paint()
SwRepaint *pRepaint = GetPara()->GetRepaint();
long l;
if( pRepaint->GetOfst() )
- {
pRepaint->Left( pRepaint->GetOfst() );
- pRepaint->SetOfst( 0 );
- l = pRepaint->GetRightOfst();
- if ( l && l < pRepaint->Right() )
- pRepaint->Right( l );
- }
+
+ l = pRepaint->GetRightOfst();
+ if( l && ( pRepaint->GetOfst() || l > pRepaint->Right() ) )
+ pRepaint->Right( l );
l = Frm().Bottom();
+ pRepaint->SetOfst( 0 );
if ( pRepaint->Bottom() > l )
pRepaint->Bottom( l );
aRet = *pRepaint;
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index 2c8bd3c2f4b2..1d26e2daead7 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: guess.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tl $ $Date: 2000-10-27 12:09:37 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:29:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,7 @@
#include "txttypes.hxx"
#include "breakit.hxx"
+#include "porrst.hxx" // SwHangingPortion
class SwTxtSizeInfo;
class SwTxtFormatInfo;
@@ -87,6 +88,7 @@ using namespace ::com::sun::star::linguistic2;
class SwTxtGuess
{
uno::Reference< XHyphenatedWord > xHyphWord;
+ SwHangingPortion *pHanging; // for hanging punctuation
xub_StrLen nLeftPos; // untere Kante: Idx
xub_StrLen nRightPos; // obere Kante: Idx
KSHORT nLeftWidth; // untere Kante: Width
@@ -95,14 +97,16 @@ class SwTxtGuess
xub_StrLen GetWordEnd( const SwTxtFormatInfo &rInf,
const xub_StrLen nPos, const sal_Bool bFwd = sal_True ) const;
public:
- inline SwTxtGuess(): nLeftPos(0), nLeftWidth(0), nRightPos(0),
- nRightWidth(0), nHeight(0)
-
+ inline SwTxtGuess(): pHanging( NULL ), nLeftPos(0), nRightPos(0),
+ nLeftWidth(0), nRightWidth(0), nHeight(0)
{ }
+ ~SwTxtGuess() { delete pHanging; }
// liefert zuerueck, ob es noch passte
sal_Bool Guess( const SwTxtFormatInfo &rInf, const KSHORT nHeight );
+ inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
+ inline void ClearHangingPortion() { pHanging = NULL; }
inline xub_StrLen LeftPos() const { return nLeftPos; }
inline KSHORT LeftWidth() const { return nLeftWidth; }
inline xub_StrLen RightPos() const { return nRightPos; }
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 227db4c7a4b7..8ae2b423deda 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: inftxt.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: tl $ $Date: 2000-11-19 11:33:39 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:25:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -149,6 +149,9 @@
#ifndef _PORFTN_HXX
#include <porftn.hxx> // SwFtnPortion
#endif
+#ifndef _PORRST_HXX
+#include <porrst.hxx> // SwHangingPortion
+#endif
#ifndef _FRMSH_HXX
#include <frmsh.hxx>
#endif
@@ -603,6 +606,8 @@ SwRect lcl_CalcRect( const SwTxtPaintInfo *pInf, const SwLinePortion &rPor )
{
SwRect aRect( GetDrawPos( pInf->GetPos(), rPor ),
Size( rPor.Width(), rPor.Height() ) );
+ if( rPor.IsHangingPortion() )
+ aRect.Width( ((SwHangingPortion&)rPor).GetInnerWidth() );
if( rPor.InSpaceGrp() && pInf->GetSpaceAdd() )
{
SwTwips nAdd = rPor.CalcSpacing( pInf->GetSpaceAdd(), *pInf );
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 1742b744fa55..fce269648ea2 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porlay.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-19 00:08:25 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:17:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,9 @@
#include "blink.hxx" // pBlink
#include "redlnitr.hxx" // SwRedlineItr
#include "porfly.hxx" // SwFlyCntPortion
+#ifndef _PORRST_HXX
+#include <porrst.hxx> // SwHangingPortion
+#endif
/*************************************************************************
@@ -229,6 +232,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine )
KSHORT nFlyHeight;
KSHORT nFlyDescent;
sal_Bool bOnlyPostIts = sal_True;
+ SetHanging( sal_False );
sal_Bool bTmpDummy = ( 0 == GetLen() );
SwFlyCntPortion* pFlyCnt = 0;
@@ -292,7 +296,11 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine )
ASSERT( nPosHeight >= nPosAscent,
"SwLineLayout::CalcLine: bad ascent or height" );
-
+ if( pPos->IsHangingPortion() )
+ {
+ SetHanging( sal_True );
+ rInf.GetParaPortion()->SetMargin( sal_True );
+ }
// Damit ein Paragraphende-Zeichen nicht durch ein Descent zu einer
// geaenderten Zeilenhoehe und zum Umformatieren fuehrt.
@@ -446,7 +454,7 @@ SwCharRange &SwCharRange::operator+=(const SwCharRange &rRange)
SwParaPortion::SwParaPortion()
{
FormatReset();
- bFlys = bFtnNum = sal_False;
+ bFlys = bFtnNum = bMargin = sal_False;
SetWhichPor( POR_PARA );
}
@@ -501,4 +509,49 @@ void SwLineLayout::Init( SwLinePortion* pNextPortion )
SetPortion( pNextPortion );
}
+/*-----------------16.11.00 11:04-------------------
+ * HangingMargin()
+ * looks for hanging punctuation portions in the paragraph
+ * and return the maximum right offset of them.
+ * If no such portion is found, the Margin/Hanging-flags will be atualized.
+ * --------------------------------------------------*/
+
+SwTwips SwLineLayout::_GetHangingMargin() const
+{
+ SwLinePortion* pPor = GetPortion();
+ BOOL bFound = sal_False;
+ SwTwips nDiff = 0;
+ while( pPor)
+ {
+ if( pPor->IsHangingPortion() )
+ {
+ nDiff = ((SwHangingPortion*)pPor)->GetInnerWidth() - pPor->Width();
+ if( nDiff )
+ bFound = sal_True;
+ }
+ pPor = pPor->GetPortion();
+ }
+ if( !bFound ) // actualize the hanging-flag
+ ((SwLineLayout*)this)->SetHanging( sal_False );
+ return nDiff;
+}
+
+SwTwips SwTxtFrm::HangingMargin() const
+{
+ ASSERT( HasPara(), "Don't call me without a paraportion" );
+ if( !GetPara()->IsMargin() )
+ return 0;
+ const SwLineLayout* pLine = GetPara();
+ SwTwips nRet = 0;
+ do
+ {
+ SwTwips nDiff = pLine->GetHangingMargin();
+ if( nDiff > nRet )
+ nRet = nDiff;
+ pLine = pLine->GetNext();
+ } while ( pLine );
+ if( !nRet ) // actualize the margin-flag
+ ((SwParaPortion*)GetPara())->SetMargin( sal_False );
+ return nRet;
+}
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index bbc6fc35cb85..44724f8f4d55 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porlay.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-19 00:08:25 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:16:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -151,6 +151,9 @@ private:
sal_Bool bContent : 1; // enthaelt Text, fuer Zeilennumerierung
sal_Bool bRedline : 1; // enthaelt Redlining
sal_Bool bForcedLeftMargin : 1; // vom Fly verschobener linker Einzug
+ sal_Bool bHanging : 1; // contents a hanging portion in the margin
+
+ SwTwips _GetHangingMargin() const;
public:
// von SwLinePortion
@@ -184,6 +187,8 @@ public:
inline sal_Bool HasRedline() const { return bRedline; }
inline void SetForcedLeftMargin( const sal_Bool bNew = sal_True ) { bForcedLeftMargin = bNew; }
inline sal_Bool HasForcedLeftMargin() const { return bForcedLeftMargin; }
+ inline void SetHanging( const sal_Bool bNew = sal_True ) { bHanging = bNew; }
+ inline sal_Bool IsHanging() const { return bHanging; }
// Beruecksichtigung von Dummyleerzeilen
// 4147, 8221:
@@ -211,6 +216,9 @@ public:
// Erstellt bei kurzen Zeilen die Glue-Kette.
SwMarginPortion *CalcLeftMargin();
+ inline SwTwips GetHangingMargin() const
+ { if( IsHanging() ) return _GetHangingMargin(); return 0; }
+
// fuer die Sonderbehandlung bei leeren Zeilen
virtual sal_Bool Format( SwTxtFormatInfo &rInf );
@@ -250,7 +258,7 @@ class SwParaPortion : public SwLineLayout
sal_Bool bFixLineHeight : 1; // Feste Zeilenhoehe
sal_Bool bFtnNum : 1; // contents a footnotenumberportion
- sal_Bool bFlag09 : 1; //
+ sal_Bool bMargin : 1; // contents a hanging punctuation in the margin
sal_Bool bFlag00 : 1; //
sal_Bool bFlag11 : 1; //
@@ -303,8 +311,8 @@ public:
inline void SetFtnNum( const sal_Bool bNew = sal_True ) { bFtnNum = bNew; }
inline sal_Bool IsFtnNum() const { return bFtnNum; }
- inline void SetFlag09( const sal_Bool bNew = sal_True ) { bFlag09 = bNew; }
- inline sal_Bool IsFlag09() const { return bFlag09; }
+ inline void SetMargin( const sal_Bool bNew = sal_True ) { bMargin = bNew; }
+ inline sal_Bool IsMargin() const { return bMargin; }
inline void SetFlag00( const sal_Bool bNew = sal_True ) { bFlag00 = bNew; }
inline sal_Bool IsFlag00() const { return bFlag00; }
inline void SetFlag11( const sal_Bool bNew = sal_True ) { bFlag11 = bNew; }
@@ -341,7 +349,7 @@ inline void SwLineLayout::ResetFlags()
{
bFormatAdj = bDummy = bFntChg = bTab = bEndHyph = bMidHyph = bFly = bFlyCnt
= bRest = bBlinking = bClipping = bContent = bRedline
- = bForcedLeftMargin = sal_False;
+ = bForcedLeftMargin = bHanging = sal_False;
pSpaceAdd = NULL;
}
@@ -366,7 +374,7 @@ inline void SwParaPortion::FormatReset()
// neu formatieren, wenn der Rahmen aus dem Bereich verschwindet.
// bFlys = sal_False;
ResetPreps();
- bFollowField = bFixLineHeight = sal_False;
+ bFollowField = bFixLineHeight = bMargin = sal_False;
}
#ifdef UNX
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 261125f82adb..a8a2270ccf4a 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porlin.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: ama $ $Date: 2000-10-30 10:00:05 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:18:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,6 +109,7 @@ class SwTxtFormatInfo;
#define POR_LAY 0x8001
#define POR_PARA 0x8002
#define POR_URL 0x8003
+#define POR_HNG 0x8004
#define POR_DROP 0x8080
#define POR_TOX 0x8089
@@ -247,6 +248,7 @@ public:
inline const sal_Bool IsPostItsPortion()const{ return nWhichPor == POR_POSTITS;}
inline const sal_Bool IsTextPortion( ) const{ return nWhichPor == POR_TXT; }
inline const sal_Bool IsURLPortion( ) const{ return nWhichPor == POR_URL; }
+ inline const sal_Bool IsHangingPortion( ) const{ return nWhichPor == POR_HNG; }
inline const sal_Bool IsKernPortion( ) const{ return nWhichPor == POR_KERN; }
inline const sal_Bool IsArrowPortion( ) const{ return nWhichPor == POR_ARROW; }
inline const sal_Bool IsMultiPortion( ) const{ return nWhichPor == POR_MULTI; }
diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx
index 7f48e9d53762..940ab1d3fe94 100644
--- a/sw/source/core/text/porrst.hxx
+++ b/sw/source/core/text/porrst.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porrst.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-19 00:08:26 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:14:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,6 +136,24 @@ public:
OUTPUT_OPERATOR
};
+/*************************************************************************
+ * class SwHangingPortion
+ * The characters which are forbidden at the start of a line like the dot and
+ * other punctuation marks are allowed to display in the margin of the page
+ * by a user option.
+ * The SwHangingPortion is the corresponding textportion to do that.
+ *************************************************************************/
+
+class SwHangingPortion : public SwTxtPortion
+{
+ KSHORT nInnerWidth;
+public:
+ inline SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() )
+ { SetWhichPor( POR_HNG ); SetLen( 1 ); Height( aSize.Height() ); }
+
+ inline KSHORT GetInnerWidth() const { return nInnerWidth; }
+};
+
/*************************************************************************
* inline - Implementations
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 439ec677850d..3648b2ab501d 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: portxt.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ama $ $Date: 2000-10-16 12:47:04 $
+ * last change: $Author: ama $ $Date: 2000-11-21 11:28:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -409,7 +409,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )
const sal_Bool bFull = !aGuess.Guess( rInf, Height() );
if( !InExpGrp() || IsFtnPortion() )
Height( aGuess.Height() );
- if( bFull )
+ if( bFull && !aGuess.GetHangingPortion() )
BreakLine( rInf, aGuess );
else
{
@@ -426,15 +426,27 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )
<< aSize.Height() << "!=" << Height() << endl;
}
#endif
- short nKern = rInf.GetFont()->CheckKerning();
- if( nKern > 0 && rInf.Width() < rInf.X() + Width() + nKern )
+ if( aGuess.GetHangingPortion() )
{
- nKern = rInf.Width() - rInf.X() - Width();
- if( nKern < 0 )
- nKern = 0;
+ Insert( aGuess.GetHangingPortion() );
+ SwTwips nTmpW = rInf.Width() - rInf.X() - Width();
+ if( nTmpW > 0 )
+ aGuess.GetHangingPortion()->Width( nTmpW );
+ aGuess.GetHangingPortion()->SetAscent( GetAscent() );
+ aGuess.ClearHangingPortion();
+ }
+ else
+ {
+ short nKern = rInf.GetFont()->CheckKerning();
+ if( nKern > 0 && rInf.Width() < rInf.X() + Width() + nKern )
+ {
+ nKern = rInf.Width() - rInf.X() - Width();
+ if( nKern < 0 )
+ nKern = 0;
+ }
+ if( nKern )
+ new SwKernPortion( *this, nKern );
}
- if( nKern )
- new SwKernPortion( *this, nKern );
}
return bFull;
}