diff options
author | Kurt Zenker <kz@openoffice.org> | 2004-01-19 16:55:45 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2004-01-19 16:55:45 +0000 |
commit | 647f4917d7463e2119038df65c9469a70fe5b045 (patch) | |
tree | 2ed53a11237788c2ba022a7f63d66e2c5933505e /svtools | |
parent | 99a300e39ace4f9bd1af8ad85ef49f35f7117fc7 (diff) |
INTEGRATION: CWS gh5 (1.29.26); FILE MERGED
2004/01/15 12:18:20 mt 1.29.26.3: #i24438# Set mbFormatted to FALSE in FormatFullDoc
2004/01/15 07:13:09 mt 1.29.26.2: #i23795# Restore TextColor after painting selected area...
2003/12/11 15:54:33 mt 1.29.26.1: #i23427# #114283# Fixed bug in mnCurTextWidth caching, and never call FormatDoc without UpdateViews
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/edit/texteng.cxx | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index e38a2d20aaa6..4601c51bdaff 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -2,9 +2,9 @@ * * $RCSfile: texteng.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: obo $ $Date: 2003-11-12 17:18:22 $ + * last change: $Author: kz $ $Date: 2004-01-19 17:55:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -916,7 +916,7 @@ Rectangle TextEngine::PaMtoEditCursor( const TextPaM& rPaM, BOOL bSpecial ) Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, BOOL bSpecial, BOOL bPreferPortionStart ) { if ( !IsFormatted() && !IsFormatting() ) - FormatDoc(); + FormatAndUpdate(); TEParaPortion* pPortion = mpTEParaPortions->GetObject( rPaM.GetPara() ); TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() ); @@ -1182,7 +1182,7 @@ ULONG TextEngine::GetTextHeight() const DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: GetTextHeight" ); if ( !IsFormatted() && !IsFormatting() ) - ((TextEngine*)this)->FormatDoc(); + ((TextEngine*)this)->FormatAndUpdate(); return mnCurTextHeight; } @@ -1192,7 +1192,7 @@ ULONG TextEngine::GetTextHeight( ULONG nParagraph ) const DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: GetTextHeight" ); if ( !IsFormatted() && !IsFormatting() ) - ((TextEngine*)this)->FormatDoc(); + ((TextEngine*)this)->FormatAndUpdate(); return CalcParaHeight( nParagraph ); } @@ -1219,7 +1219,7 @@ ULONG TextEngine::CalcTextWidth( ULONG nPara ) ULONG TextEngine::CalcTextWidth() { if ( !IsFormatted() && !IsFormatting() ) - FormatDoc(); + FormatAndUpdate(); if ( mnCurTextWidth == 0xFFFFFFFF ) { @@ -1577,16 +1577,16 @@ void TextEngine::FormatFullDoc() { for ( ULONG nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ ) { - TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion ); - USHORT nLen = pTEParaPortion->GetNode()->GetText().Len(); + TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion ); USHORT nLen = pTEParaPortion->GetNode()->GetText().Len(); pTEParaPortion->MarkSelectionInvalid( 0, nLen ); } + mbFormatted = FALSE; FormatDoc(); } void TextEngine::FormatDoc() { - if ( !GetUpdateMode() || IsFormatting() ) + if ( IsFormatted() || !GetUpdateMode() || IsFormatting() ) return; mbIsFormatting = TRUE; @@ -1594,6 +1594,7 @@ void TextEngine::FormatDoc() long nY = 0; BOOL bGrow = FALSE; + ULONG nOldCurTextWidth = mnCurTextWidth; maInvalidRec = Rectangle(); // leermachen for ( ULONG nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ ) @@ -1626,7 +1627,7 @@ void TextEngine::FormatDoc() maInvalidRec.Bottom() = nY + CalcParaHeight( nPara ); } - if ( ( mnCurTextWidth != 0xFFFFFFFF ) && ( nOldParaWidth == mnCurTextWidth ) ) + if ( ( mnCurTextWidth != 0xFFFFFFFF ) && ( nOldParaWidth == nOldCurTextWidth ) ) { ULONG nNewParaWidth = CalcTextWidth( nPara ); if ( nNewParaWidth >= mnCurTextWidth ) @@ -2106,16 +2107,21 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan nL = nEnd-nTmpIndex; if ( aTextEnd > *pSelEnd ) nL = pSelEnd->GetIndex() - nTmpIndex; - pOutDev->SetTextColor( rStyleSettings.GetHighlightTextColor() ); - pOutDev->SetTextFillColor( rStyleSettings.GetHighlightColor() ); - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, pLine, nTmpIndex, nTmpIndex+nL ); - pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); - nTmpIndex += nL; + if ( nL ) + { + Color aOldTextColor = pOutDev->GetTextColor(); + pOutDev->SetTextColor( rStyleSettings.GetHighlightTextColor() ); + pOutDev->SetTextFillColor( rStyleSettings.GetHighlightColor() ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, pLine, nTmpIndex, nTmpIndex+nL ); + pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); + pOutDev->SetTextColor( aOldTextColor ); + pOutDev->SetTextFillColor(); + nTmpIndex += nL; + } // 3) Bereich nach Selektion if ( nTmpIndex < nEnd ) { - pOutDev->SetFont( aFont ); nL = nEnd-nTmpIndex; aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, pLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex ); @@ -2585,17 +2591,9 @@ BOOL TextEngine::Read( SvStream& rInput, const TextSelection* pSel ) SetUpdateMode( bUpdate ); FormatAndUpdate( GetActiveView() ); -// if ( GetActiveView() ) -// GetActiveView()->SetSelection( aNewSel ); - return rInput.GetError() ? FALSE : TRUE; -} -#if SUPD < 540 -BOOL TextEngine::Write( SvStream& rOutput, const TextSelection* pSel ) -{ - return Write( rOutput, pSel, FALSE ); + return rInput.GetError() ? FALSE : TRUE; } -#endif BOOL TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, BOOL bHTML ) { |