diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-29 15:26:37 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-29 15:26:37 +0000 |
commit | 04a59adcc7fd221ee6b7644aa1fa53fed8dd3c0e (patch) | |
tree | 98e45c3b1a1418ca54ef4a83f6022691099078e0 /svtools/source/edit/svmedit.cxx | |
parent | 554b7023a920d8701ef9d38c6e4952ebb41d1b5f (diff) | |
parent | c0bfd066e3d8355d35c2ea22d5a98ac7f43406da (diff) |
ab71: merge with DEV300_m54
Diffstat (limited to 'svtools/source/edit/svmedit.cxx')
-rw-r--r-- | svtools/source/edit/svmedit.cxx | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 279af7c83cef..135761195e48 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -452,46 +452,62 @@ String ImpSvMEdit::GetSelected( LineEnd aSeparator ) const void ImpSvMEdit::Resize() { - WinBits nWinStyle( pSvMultiLineEdit->GetStyle() ); - if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL ) - ImpUpdateSrollBarVis( nWinStyle ); - - Size aSz = pSvMultiLineEdit->GetOutputSizePixel(); - Size aEditSize = aSz; - long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize(); - nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth ); - - if ( mpHScrollBar ) - aSz.Height() -= nSBWidth+1; - if ( mpVScrollBar ) - aSz.Width() -= nSBWidth+1; + size_t nIteration = 1; + do + { + WinBits nWinStyle( pSvMultiLineEdit->GetStyle() ); + if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL ) + ImpUpdateSrollBarVis( nWinStyle ); - Size aTextWindowSz( aSz ); - aTextWindowSz.Width() -= maTextWindowOffset.X(); - aTextWindowSz.Height() -= maTextWindowOffset.Y(); - Point aTextWindowPos( maTextWindowOffset ); + Size aSz = pSvMultiLineEdit->GetOutputSizePixel(); + Size aEditSize = aSz; + long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize(); + nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth ); - if ( !mpHScrollBar ) - mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() ); + if ( mpHScrollBar ) + aSz.Height() -= nSBWidth+1; + if ( mpVScrollBar ) + aSz.Width() -= nSBWidth+1; - if ( mpHScrollBar ) - mpHScrollBar->SetPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth ); + if ( !mpHScrollBar ) + mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() ); + else + mpHScrollBar->SetPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth ); - if ( mpVScrollBar ) - { - if( Application::GetSettings().GetLayoutRTL() ) + Point aTextWindowPos( maTextWindowOffset ); + if ( mpVScrollBar ) { - mpVScrollBar->SetPosSizePixel( 0, 0, nSBWidth, aSz.Height() ); - aTextWindowPos.X() += nSBWidth; + if( Application::GetSettings().GetLayoutRTL() ) + { + mpVScrollBar->SetPosSizePixel( 0, 0, nSBWidth, aSz.Height() ); + aTextWindowPos.X() += nSBWidth; + } + else + mpVScrollBar->SetPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() ); } - else - mpVScrollBar->SetPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() ); - } - mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSz ); + if ( mpScrollBox ) + mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth ); + + Size aTextWindowSize( aSz ); + aTextWindowSize.Width() -= maTextWindowOffset.X(); + aTextWindowSize.Height() -= maTextWindowOffset.Y(); + if ( aTextWindowSize.Width() < 0 ) + aTextWindowSize.Width() = 0; + if ( aTextWindowSize.Height() < 0 ) + aTextWindowSize.Height() = 0; + + Size aOldTextWindowSize( mpTextWindow->GetSizePixel() ); + mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSize ); + if ( aOldTextWindowSize == aTextWindowSize ) + break; + + // Changing the text window size might effectively have changed the need for + // scrollbars, so do another iteration. + ++nIteration; + OSL_ENSURE( nIteration < 3, "ImpSvMEdit::Resize: isn't this expected to terminate with the second iteration?" ); - if ( mpScrollBox ) - mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth ); + } while ( nIteration <= 3 ); // artificial break after four iterations ImpInitScrollBars(); } |