summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/text/itrform2.cxx14
-rw-r--r--sw/source/core/text/itrpaint.cxx7
-rw-r--r--sw/source/core/text/pormulti.cxx28
-rw-r--r--sw/source/core/txtnode/fntcache.cxx235
4 files changed, 139 insertions, 145 deletions
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 4639e8de6e1f..fce3321b3842 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: itrform2.cxx,v $
*
- * $Revision: 1.53 $
+ * $Revision: 1.54 $
*
- * last change: $Author: fme $ $Date: 2002-01-31 14:29:52 $
+ * last change: $Author: fme $ $Date: 2002-02-01 12:35:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -492,7 +492,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
#ifdef VERTICAL_LAYOUT
const sal_Bool bHasGrid =
- pFrm->GetGridValue( GRID_ON );
+ pFrm->GetGridValue( GRID_ON ) && pFrm->GetGridValue( GRID_CELLS );
const USHORT nGridWidth =
pFrm->GetGridValue( GRID_HEIGHT );
@@ -1087,8 +1087,8 @@ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
#ifdef VERTICAL_LAYOUT
if ( ! pPor && ! pCurr->GetPortion() )
{
- SwPageFrm* pPageFrm = GetTxtFrm()->FindPageFrm();
- if ( pPageFrm->HasGrid() )
+ if ( GetTxtFrm()->GetGridValue( GRID_ON ) &&
+ GetTxtFrm()->GetGridValue( GRID_CELLS ) )
pPor = new SwKernPortion( *pCurr );
}
#endif
@@ -1144,8 +1144,8 @@ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
#ifdef VERTICAL_LAYOUT
if ( ! pPor && ! pCurr->GetPortion() )
{
- SwPageFrm* pPageFrm = GetTxtFrm()->FindPageFrm();
- if ( pPageFrm->HasGrid() )
+ if ( GetTxtFrm()->GetGridValue( GRID_ON ) &&
+ GetTxtFrm()->GetGridValue( GRID_CELLS ) )
pPor = new SwKernPortion( *pCurr );
}
#endif
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 7a283a7e8e82..840848ff249c 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: itrpaint.cxx,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: fme $ $Date: 2002-01-31 14:29:52 $
+ * last change: $Author: fme $ $Date: 2002-02-01 12:35:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -356,8 +356,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
// if no special vertical alignment is used,
// we calculate Y value for the whole line
#ifdef VERTICAL_LAYOUT
- SwPageFrm* pPageFrm = GetTxtFrm()->FindPageFrm();
- const sal_Bool bHasGrid = pPageFrm->HasGrid();
+ const sal_Bool bHasGrid = GetTxtFrm()->GetGridValue( GRID_ON );
sal_Bool bAdjustBaseLine = GetLineInfo().HasSpecialAlign() || bHasGrid;
if ( ! bAdjustBaseLine )
#else
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index f93373e3d0a0..708e341a2887 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pormulti.cxx,v $
*
- * $Revision: 1.48 $
+ * $Revision: 1.49 $
*
- * last change: $Author: fme $ $Date: 2002-01-31 14:29:52 $
+ * last change: $Author: fme $ $Date: 2002-02-01 12:34:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1430,18 +1430,20 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
else
{
// special treatment for ruby portions in grid mode
-
- // Portions which are bigger than on grid distance
- // are centered inside the whole line.
- // this does not apply to portions inside the ruby line
- USHORT nAdjustment = 0;
- if ( rMulti.IsRuby() &&
- ( ( bRubyTop && pLay != &rMulti.GetRoot() ) ||
- ( ! bRubyTop && pLay == &rMulti.GetRoot() ) ) )
+ SwTwips nAdjustment = 0;
+ if ( rMulti.IsRuby() )
{
- ASSERT( pCurr->Height() - nRubyHeight >= pPor->Height(),
- "Wrong adjusting of ruby portion" )
- nAdjustment = ( pCurr->Height() - nRubyHeight - pPor->Height() ) / 2;
+ if ( ( bRubyTop && pLay != &rMulti.GetRoot() ) ||
+ ( ! bRubyTop && pLay == &rMulti.GetRoot() ) )
+ {
+ // adjust base text
+ ASSERT( pCurr->Height() - nRubyHeight >= pPor->Height(),
+ "Wrong adjusting of ruby portion" )
+ nAdjustment = ( pCurr->Height() - nRubyHeight - pPor->Height() ) / 2;
+ }
+ else
+ // adjust ruby text
+ nAdjustment = ( nRubyHeight - pPor->Height() ) / 2;
}
GetInfo().Y( nOfst + nAdjustment + pPor->GetAscent() );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index e633a310d54a..4a29836a532b 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fntcache.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: fme $ $Date: 2002-01-31 14:31:03 $
+ * last change: $Author: fme $ $Date: 2002-02-01 12:37:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -799,83 +799,81 @@ static sal_Char __READONLY_DATA sDoubleSpace[] = " ";
rInf.SetLen( rInf.GetText().Len() );
#ifdef VERTICAL_LAYOUT
- if ( rInf.GetFrm() )
+ if ( rInf.GetFrm() && rInf.GetFrm()->GetGridValue( GRID_ON ) &&
+ rInf.GetFrm()->GetGridValue( GRID_CELLS ) && rInf.GetFont() &&
+ SW_CJK == rInf.GetFont()->GetActual() )
{
- if ( rInf.GetFrm()->GetGridValue( GRID_ON ) && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
- {
- const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
- long* pKernArray = new long[rInf.GetLen()];
+ const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
+ long* pKernArray = new long[rInf.GetLen()];
- if ( pPrinter )
- pPrinter->GetTextArray( rInf.GetText(), pKernArray,
+ if ( pPrinter )
+ pPrinter->GetTextArray( rInf.GetText(), pKernArray,
+ rInf.GetIdx(), rInf.GetLen() );
+ else
+ rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
rInf.GetIdx(), rInf.GetLen() );
- else
- rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
- rInf.GetIdx(), rInf.GetLen() );
- long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+ long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+
+ const USHORT i = nWidthPerChar ?
+ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+ 1;
- const USHORT i = nWidthPerChar ?
- ( nWidthPerChar - 1 ) / nGridWidth + 1:
- 1;
+ nWidthPerChar = i * nGridWidth;
- nWidthPerChar = i * nGridWidth;
+ // position of first character, we take the printer position
+ long nCharWidth = pKernArray[ 0 ];
+ USHORT nHalfWidth = nWidthPerChar / 2;
- // position of first character, we take the printer position
- long nCharWidth = pKernArray[ 0 ];
- USHORT nHalfWidth = nWidthPerChar / 2;
+ long nNextFix;
- long nNextFix;
+ // punctuation characters are not centered
+ xub_Unicode cChar = rInf.GetText().GetChar( rInf.GetIdx() );
+ BYTE nType = lcl_WhichPunctuation( cChar );
+ switch ( nType )
+ {
+ case SwScriptInfo::NONE :
+ aPos.X() += ( nWidthPerChar - nCharWidth ) / 2;
+ nNextFix = nCharWidth / 2;
+ break;
+ case SwScriptInfo::SPECIAL_RIGHT :
+ nNextFix = nHalfWidth;
+ break;
+ default:
+ aPos.X() += nWidthPerChar - nCharWidth;
+ nNextFix = nCharWidth - nHalfWidth;
+ }
+
+ // calculate offsets
+ for ( xub_StrLen j = 1; j < rInf.GetLen(); ++j )
+ {
+ long nScr = pKernArray[ j ] - pKernArray[ j - 1 ];
+ nNextFix += nWidthPerChar;
// punctuation characters are not centered
- xub_Unicode cChar = rInf.GetText().GetChar( rInf.GetIdx() );
- BYTE nType = lcl_WhichPunctuation( cChar );
+ cChar = rInf.GetText().GetChar( rInf.GetIdx() + j );
+ nType = lcl_WhichPunctuation( cChar );
switch ( nType )
{
case SwScriptInfo::NONE :
- aPos.X() += ( nWidthPerChar - nCharWidth ) / 2;
- nNextFix = nCharWidth / 2;
+ pKernArray[ j - 1 ] = nNextFix - ( nScr / 2 );
break;
case SwScriptInfo::SPECIAL_RIGHT :
- nNextFix = nHalfWidth;
+ pKernArray[ j - 1 ] = nNextFix - nHalfWidth;
break;
default:
- aPos.X() += nWidthPerChar - nCharWidth;
- nNextFix = nCharWidth - nHalfWidth;
- }
-
- // calculate offsets
- for ( xub_StrLen j = 1; j < rInf.GetLen(); ++j )
- {
- long nScr = pKernArray[ j ] - pKernArray[ j - 1 ];
- nNextFix += nWidthPerChar;
-
- // punctuation characters are not centered
- cChar = rInf.GetText().GetChar( rInf.GetIdx() + j );
- nType = lcl_WhichPunctuation( cChar );
- switch ( nType )
- {
- case SwScriptInfo::NONE :
- pKernArray[ j - 1 ] = nNextFix - ( nScr / 2 );
- break;
- case SwScriptInfo::SPECIAL_RIGHT :
- pKernArray[ j - 1 ] = nNextFix - nHalfWidth;
- break;
- default:
- pKernArray[ j - 1 ] = nNextFix + nHalfWidth - nScr;
- }
+ pKernArray[ j - 1 ] = nNextFix + nHalfWidth - nScr;
}
+ }
- if ( bSwitchH2V )
- rInf.GetFrm()->SwitchHorizontalToVertical( aPos );
+ if ( bSwitchH2V )
+ rInf.GetFrm()->SwitchHorizontalToVertical( aPos );
- rInf.GetOut().DrawTextArray( aPos, rInf.GetText(),
- pKernArray, rInf.GetIdx(), rInf.GetLen() );
+ rInf.GetOut().DrawTextArray( aPos, rInf.GetText(),
+ pKernArray, rInf.GetIdx(), rInf.GetLen() );
- delete[] pKernArray;
- return;
- }
+ delete[] pKernArray;
+ return;
}
#endif
@@ -1452,39 +1450,37 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
rInf.GetText().Len();
#ifdef VERTICAL_LAYOUT
- if ( rInf.GetFrm() && nLn )
+ if ( rInf.GetFrm() && nLn && rInf.GetFrm()->GetGridValue( GRID_ON ) &&
+ rInf.GetFrm()->GetGridValue( GRID_CELLS ) && rInf.GetFont() &&
+ SW_CJK == rInf.GetFont()->GetActual() )
{
- if ( rInf.GetFrm()->GetGridValue( GRID_ON ) && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
- {
- const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
+ const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
- OutputDevice* pOutDev;
+ OutputDevice* pOutDev;
- if ( pPrinter )
- {
- if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
- pPrinter->SetFont(*pPrtFont);
- pOutDev = pPrinter;
- }
- else
- pOutDev = rInf.GetpOut();
+ if ( pPrinter )
+ {
+ if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
+ pPrinter->SetFont(*pPrtFont);
+ pOutDev = pPrinter;
+ }
+ else
+ pOutDev = rInf.GetpOut();
- aTxtSize.Width() =
- pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn );
- aTxtSize.Height() = pOutDev->GetTextHeight() + nLeading;
+ aTxtSize.Width() =
+ pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn );
+ aTxtSize.Height() = pOutDev->GetTextHeight() + nLeading;
- long nWidthPerChar = aTxtSize.Width() / nLn;
+ long nWidthPerChar = aTxtSize.Width() / nLn;
- const USHORT i = nWidthPerChar ?
- ( nWidthPerChar - 1 ) / nGridWidth + 1:
- 1;
+ const USHORT i = nWidthPerChar ?
+ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+ 1;
- aTxtSize.Width() = i * nGridWidth * nLn;
+ aTxtSize.Width() = i * nGridWidth * nLn;
- rInf.SetKanaDiff( 0 );
- return aTxtSize;
- }
+ rInf.SetKanaDiff( 0 );
+ return aTxtSize;
}
#endif
@@ -1620,28 +1616,27 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
long nKernSum = 0;
#ifdef VERTICAL_LAYOUT
- if ( rInf.GetFrm() && rInf.GetLen() )
+ if ( rInf.GetFrm() && rInf.GetLen() &&
+ rInf.GetFrm()->GetGridValue( GRID_ON ) &&
+ rInf.GetFrm()->GetGridValue( GRID_CELLS ) && rInf.GetFont() &&
+ SW_CJK == rInf.GetFont()->GetActual() )
{
- if ( rInf.GetFrm()->GetGridValue( GRID_ON ) && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
- {
- const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
+ const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
- long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+ long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
- USHORT i = nWidthPerChar ?
- ( nWidthPerChar - 1 ) / nGridWidth + 1:
- 1;
+ USHORT i = nWidthPerChar ?
+ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+ 1;
- nWidthPerChar = i * nGridWidth;
+ nWidthPerChar = i * nGridWidth;
- nCnt = (USHORT)(rInf.GetOfst() / nWidthPerChar);
- if ( 2 * ( rInf.GetOfst() - nCnt * nWidthPerChar ) > nWidthPerChar )
- ++nCnt;
+ nCnt = (USHORT)(rInf.GetOfst() / nWidthPerChar);
+ if ( 2 * ( rInf.GetOfst() - nCnt * nWidthPerChar ) > nWidthPerChar )
+ ++nCnt;
- delete[] pKernArray;
- return nCnt;
- }
+ delete[] pKernArray;
+ return nCnt;
}
#endif
@@ -1806,36 +1801,34 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
: rInf.GetLen() );
#ifdef VERTICAL_LAYOUT
- if ( rInf.GetFrm() )
+ if ( rInf.GetFrm() && rInf.GetFrm()->GetGridValue( GRID_ON ) &&
+ rInf.GetFrm()->GetGridValue( GRID_CELLS ) && rInf.GetFont() &&
+ SW_CJK == rInf.GetFont()->GetActual() )
{
- if ( rInf.GetFrm()->GetGridValue( GRID_ON ) && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
- {
- const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
+ const USHORT nGridWidth = rInf.GetFrm()->GetGridValue( GRID_HEIGHT );
- long* pKernArray = new long[rInf.GetLen()];
- rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
- rInf.GetIdx(), rInf.GetLen() );
+ long* pKernArray = new long[rInf.GetLen()];
+ rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
+ rInf.GetIdx(), rInf.GetLen() );
- long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+ long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
- const USHORT i = nWidthPerChar ?
- ( nWidthPerChar - 1 ) / nGridWidth + 1:
- 1;
+ const USHORT i = nWidthPerChar ?
+ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+ 1;
- nWidthPerChar = i * nGridWidth;
- long nCurrPos = nWidthPerChar;
+ nWidthPerChar = i * nGridWidth;
+ long nCurrPos = nWidthPerChar;
- while( nTxtBreak < rInf.GetLen() && nTextWidth >= nCurrPos )
- {
- nCurrPos += nWidthPerChar;
- ++nTxtBreak;
- }
-
- delete[] pKernArray;
- return nTxtBreak + rInf.GetIdx();
+ while( nTxtBreak < rInf.GetLen() && nTextWidth >= nCurrPos )
+ {
+ nCurrPos += nWidthPerChar;
+ ++nTxtBreak;
}
+
+ delete[] pKernArray;
+ return nTxtBreak + rInf.GetIdx();
}
#endif