Revert "Hori scroll fix in Writer and Calc Print Preview" & add new patch

This reverts commit eeeb4d9a1c.

Fix Scrollbar in Writer Print preview
This commit is contained in:
Noel Power
2012-04-03 16:33:41 +01:00
parent 2ac5b08361
commit d7b06ba7ec
2 changed files with 53 additions and 34 deletions

View File

@@ -308,21 +308,18 @@ void ScPreviewShell::UpdateScrollBars()
// page smaller than window -> center (but put scrollbar to 0) // page smaller than window -> center (but put scrollbar to 0)
aOfs.X() = 0; aOfs.X() = 0;
pPreview->SetXOffset( nMaxPos / 2 ); pPreview->SetXOffset( nMaxPos / 2 );
pHorScroll->Show( sal_False );
} }
else if (aOfs.X() < 0) else if (aOfs.X() < 0)
{ {
// page larger than window -> never use negative offset // page larger than window -> never use negative offset
aOfs.X() = 0; aOfs.X() = 0;
pPreview->SetXOffset( 0 ); pPreview->SetXOffset( 0 );
pHorScroll->Show( sal_True );
} }
else if (aOfs.X() > nMaxPos) else if (aOfs.X() > nMaxPos)
{ {
// limit offset to align with right edge of window // limit offset to align with right edge of window
aOfs.X() = nMaxPos; aOfs.X() = nMaxPos;
pPreview->SetXOffset(nMaxPos); pPreview->SetXOffset(nMaxPos);
pHorScroll->Show( sal_True );
} }
pHorScroll->SetThumbPos( aOfs.X() ); pHorScroll->SetThumbPos( aOfs.X() );
} }

View File

@@ -1365,9 +1365,9 @@ void SwPagePreView::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*
{ {
const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings(); const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings();
const long nTmp = rSet.GetScrollBarSize(); const long nTmp = rSet.GetScrollBarSize();
if ( pVScrollbar->IsVisible( sal_False )) if ( pVScrollbar->IsVisible( true ) )
rToFill.Right() = nTmp; rToFill.Right() = nTmp;
if ( pHScrollbar->IsVisible( sal_False ) ) if ( pHScrollbar->IsVisible( false ) )
rToFill.Bottom() = nTmp; rToFill.Bottom() = nTmp;
SetBorderPixel( rToFill ); SetBorderPixel( rToFill );
} }
@@ -1388,7 +1388,7 @@ void SwPagePreView::InnerResizePixel( const Point &rOfst, const Size &rSize )
//VisArea niemals einstellen! //VisArea niemals einstellen!
} }
void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize ) void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
{ {
SvBorder aBorder; SvBorder aBorder;
CalcAndSetBorderPixel( aBorder, sal_False ); CalcAndSetBorderPixel( aBorder, sal_False );
@@ -1404,11 +1404,13 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
//Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen //Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen
//Scrollrange immer die halbe Hoehe der VisArea abgezogen wird. //Scrollrange immer die halbe Hoehe der VisArea abgezogen wird.
if ( pVScrollbar && if ( pVScrollbar && aTmpSize.Width() > 0 && aTmpSize.Height() > 0 )
aTmpSize.Width() > 0 && aTmpSize.Height() > 0 ) {
{ ScrollDocSzChg();
ScrollDocSzChg(); }
}
SvBorder aBorderNew;
CalcAndSetBorderPixel( aBorderNew, sal_False );
} }
void SwPagePreView::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar ) void SwPagePreView::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar )
@@ -1620,30 +1622,48 @@ void SwPagePreView::ScrollViewSzChg()
//vertical scrolling by row //vertical scrolling by row
// adjust to new preview functionality // adjust to new preview functionality
sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol(); sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
pVScrollbar->SetVisibleSize( nVisPages );
// set selected page as scroll bar position, if( nVisPages < mnPageCount )
// if it is visible.
SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
if ( pPagePrevwLay->IsPageVisible( aViewWin.SelectedPage() ) )
{ {
pVScrollbar->SetThumbPos( aViewWin.SelectedPage() ); ShowVScrollbar( sal_True );
pPageUpBtn->Show( sal_True );
pPageDownBtn->Show( sal_True );
pVScrollbar->SetVisibleSize( nVisPages );
// set selected page as scroll bar position,
// if it is visible.
SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
if ( pPagePrevwLay->IsPageVisible( aViewWin.SelectedPage() ) )
{
pVScrollbar->SetThumbPos( aViewWin.SelectedPage() );
}
else
{
pVScrollbar->SetThumbPos( aViewWin.GetSttPage() );
}
pVScrollbar->SetLineSize( aViewWin.GetCol() );
pVScrollbar->SetPageSize( nVisPages );
// calculate and set scrollbar range
Range aScrollbarRange( 1, mnPageCount );
// increase range by one, because left-top-corner is left blank.
++aScrollbarRange.Max();
// increase range in order to access all pages
aScrollbarRange.Max() += ( nVisPages - 1 );
pVScrollbar->SetRange( aScrollbarRange );
} }
else else
{ {
pVScrollbar->SetThumbPos( aViewWin.GetSttPage() ); ShowVScrollbar( sal_False );
pPageUpBtn->Show( sal_False );
pPageDownBtn->Show( sal_False );
} }
pVScrollbar->SetLineSize( aViewWin.GetCol() );
pVScrollbar->SetPageSize( nVisPages );
// calculate and set scrollbar range
Range aScrollbarRange( 1, mnPageCount );
// increase range by one, because left-top-corner is left blank.
++aScrollbarRange.Max();
// increase range in order to access all pages
aScrollbarRange.Max() += ( nVisPages - 1 );
pVScrollbar->SetRange( aScrollbarRange );
} }
else //vertical scrolling by pixel else //vertical scrolling by pixel
{ {
ShowVScrollbar( sal_True );
pPageUpBtn->Show( sal_True );
pPageDownBtn->Show( sal_True );
const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect(); const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
const Size& rPreviewSize = const Size& rPreviewSize =
GetViewShell()->PagePreviewLayout()->GetPrevwDocSize(); GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
@@ -1666,18 +1686,20 @@ void SwPagePreView::ScrollViewSzChg()
if(rDocRect.GetWidth() < rPreviewSize.Width()) if(rDocRect.GetWidth() < rPreviewSize.Width())
{ {
pHScrollbar->Show( sal_True ); ShowHScrollbar( sal_True );
nVisWidth = rDocRect.GetWidth(); nVisWidth = rDocRect.GetWidth();
nThumb = rDocRect.Left(); nThumb = rDocRect.Left();
aRange = Range(0, rPreviewSize.Width()); aRange = Range(0, rPreviewSize.Width());
pHScrollbar->SetRange( aRange );
pHScrollbar->SetVisibleSize( nVisWidth );
pHScrollbar->SetThumbPos( nThumb );
pHScrollbar->SetLineSize( nVisWidth / 10 );
pHScrollbar->SetPageSize( nVisWidth / 2 );
} }
else else
pHScrollbar->Show( sal_False ); ShowHScrollbar( sal_False );
pHScrollbar->SetRange( aRange );
pHScrollbar->SetVisibleSize( nVisWidth );
pHScrollbar->SetThumbPos( nThumb );
pHScrollbar->SetLineSize( nVisWidth / 10 );
pHScrollbar->SetPageSize( nVisWidth / 2 );
} }
} }