diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-01-20 23:44:52 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-01-21 09:08:45 -0500 |
commit | 96bee1507119ca0525845022019d90f0694996aa (patch) | |
tree | 8df55cecc7b0be28e387ddf6b2e880ae5d7749a4 | |
parent | ed46df1fcb5869818f5f74e0c7a5b19c65102e83 (diff) |
Fixed incorrect page number in page preview mode. (fdo#33155)
When the window is large enough to show several 'Page X' strings,
the page number was not properly incremented. This commit fixes
it.
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index fb5158ad7..6a58561b7 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1082,7 +1082,9 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, nPageNo += ((long)nColPos)*nRowBreaks+nRowPos; else nPageNo += ((long)nRowPos)*nColBreaks+nColPos; - aPageStr.SearchAndReplaceAscii("%1", String::CreateFromInt32(nPageNo)); + + String aThisPageStr = aPageStr; // Don't modify the original string. + aThisPageStr.SearchAndReplaceAscii("%1", String::CreateFromInt32(nPageNo)); if ( pEditEng ) { @@ -1091,7 +1093,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); - pEditEng->SetText( aPageStr ); + pEditEng->SetText( aThisPageStr ); Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() ); // 40% of width or 60% of height @@ -1113,7 +1115,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, // find right font size for DrawText aFont.SetSize( Size( 0,100 ) ); pContentDev->SetFont( aFont ); - Size aSize100( pContentDev->GetTextWidth( aPageStr ), pContentDev->GetTextHeight() ); + Size aSize100( pContentDev->GetTextWidth( aThisPageStr ), pContentDev->GetTextHeight() ); // 40% of width or 60% of height long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width(); @@ -1122,10 +1124,10 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, pContentDev->SetFont( aFont ); // centered output with DrawText - Size aTextSize( pContentDev->GetTextWidth( aPageStr ), pContentDev->GetTextHeight() ); + Size aTextSize( pContentDev->GetTextWidth( aThisPageStr ), pContentDev->GetTextHeight() ); Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2, (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 ); - pContentDev->DrawText( aPos, aPageStr ); + pContentDev->DrawText( aPos, aThisPageStr ); } } nPrStartX = nPrEndX + 1; |