[Libreoffice-commits] .: 3 commits - sw/source
Ivan Timofeev
ivantimofeev at kemper.freedesktop.org
Tue May 29 07:45:49 PDT 2012
sw/source/ui/uiview/pview.cxx | 77 +++++++++++++++++----------------------
sw/source/ui/uiview/viewport.cxx | 24 ++++--------
2 files changed, 42 insertions(+), 59 deletions(-)
New commits:
commit bdca5df2644d4653665f7360c24f7757f46dcef0
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Tue May 29 18:35:36 2012 +0400
SwPagePreView: fix some scrollbar bugs (still not perfect, just a quick fix)
Change-Id: I4ff31f31bf579ece69e62633b99986d96ca7d857
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 52814df..ecdc27d 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -1183,10 +1183,6 @@ void SwPagePreView::Init(const SwViewOption * pPrefs)
if( !bIsModified )
pESh->ResetModified();
-
- pVScrollbar->ExtendedShow(pPrefs->IsViewVScrollBar());
- pHScrollbar->ExtendedShow(pPrefs->IsViewHScrollBar());
- pScrollFill->Show(pPrefs->IsViewVScrollBar() && pPrefs->IsViewHScrollBar());
}
SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
@@ -1392,9 +1388,6 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
{
SvBorder aBorder;
CalcAndSetBorderPixel( aBorder, sal_False );
- ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(),
- sal_False, *pVScrollbar,
- *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, *pScrollFill );
//EditWin niemals einstellen!
@@ -1411,6 +1404,9 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
SvBorder aBorderNew;
CalcAndSetBorderPixel( aBorderNew, sal_False );
+ ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(),
+ sal_False, *pVScrollbar,
+ *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, *pScrollFill );
}
void SwPagePreView::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar )
@@ -1615,6 +1611,9 @@ void SwPagePreView::ScrollViewSzChg()
{
if(!GetViewShell())
return ;
+
+ bool bShowVScrollbar = false, bShowHScrollbar = false;
+
if(pVScrollbar)
{
if(GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow())
@@ -1645,25 +1644,10 @@ void SwPagePreView::ScrollViewSzChg()
aScrollbarRange.Max() += ( nVisPages - 1 );
pVScrollbar->SetRange( aScrollbarRange );
- if( nVisPages < mnPageCount )
- {
- ShowVScrollbar( sal_True );
- pPageUpBtn->Show( sal_True );
- pPageDownBtn->Show( sal_True );
- }
- else
- {
- ShowVScrollbar( sal_False );
- pPageUpBtn->Show( sal_False );
- pPageDownBtn->Show( sal_False );
- }
+ bShowVScrollbar = nVisPages < mnPageCount;
}
else //vertical scrolling by pixel
{
- ShowVScrollbar( sal_True );
- pPageUpBtn->Show( sal_True );
- pPageDownBtn->Show( sal_True );
-
const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
const Size& rPreviewSize =
GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
@@ -1673,7 +1657,13 @@ void SwPagePreView::ScrollViewSzChg()
pVScrollbar->SetThumbPos( rDocRect.Top() );
pVScrollbar->SetLineSize( nVisHeight / 10 );
pVScrollbar->SetPageSize( nVisHeight / 2 );
+
+ bShowVScrollbar = true;
}
+
+ ShowVScrollbar(bShowVScrollbar);
+ pPageUpBtn->Show(bShowVScrollbar);
+ pPageDownBtn->Show(bShowVScrollbar);
}
if(pHScrollbar)
{
@@ -1686,7 +1676,7 @@ void SwPagePreView::ScrollViewSzChg()
if(rDocRect.GetWidth() < rPreviewSize.Width())
{
- ShowHScrollbar( sal_True );
+ bShowHScrollbar = true;
nVisWidth = rDocRect.GetWidth();
nThumb = rDocRect.Left();
@@ -1698,9 +1688,10 @@ void SwPagePreView::ScrollViewSzChg()
pHScrollbar->SetLineSize( nVisWidth / 10 );
pHScrollbar->SetPageSize( nVisWidth / 2 );
}
- else
- ShowHScrollbar( sal_False );
+
+ ShowHScrollbar(bShowHScrollbar);
}
+ pScrollFill->Show(bShowVScrollbar && bShowHScrollbar);
}
void SwPagePreView::ScrollDocSzChg()
commit e7f7f4092a337cc98076ff500fb209a7f4dbb6b1
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Mon May 28 21:41:51 2012 +0400
these SwScrollbar::IsVisible(false) calls does not make sense to me...
Change-Id: Ic58be239044f75f1ad7f70df45813b59a4610737
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 44bd8c4..7acaa98 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -870,13 +870,10 @@ void ViewResizePixel( const Window &rRef,
const sal_Bool bVLineal = pVLineal && pVLineal->IsVisible();
const long nVLinSzWidth = bVLineal ?
pVLineal->GetSizePixel().Width() : 0;
- long nHBSzHeight2= rHScrollbar.IsVisible( sal_False ) || !rHScrollbar.IsAuto() ?
- rRef.GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
- long nHBSzHeight =
- rHScrollbar.IsVisible(sal_True) || (rHScrollbar.IsVisible( sal_False ) && !rHScrollbar.IsAuto()) ?
- nHBSzHeight2:0;
- long nVBSzWidth = rVScrollbar.IsVisible(sal_True) || (rVScrollbar.IsVisible( sal_False ) && !rVScrollbar.IsAuto()) ?
- rRef.GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
+
+ long nScrollBarSize = rRef.GetSettings().GetStyleSettings().GetScrollBarSize();
+ long nHBSzHeight = rHScrollbar.IsVisible(true) ? nScrollBarSize : 0;
+ long nVBSzWidth = rVScrollbar.IsVisible(true) ? nScrollBarSize : 0;
if(pVLineal)
{
@@ -920,7 +917,7 @@ void ViewResizePixel( const Window &rRef,
aPos.X() += nVBSzWidth;
}
- Size aSize( rSize.Width(), nHBSzHeight2 );
+ Size aSize( rSize.Width(), nHBSzHeight );
if ( nVBSzWidth )
aSize.Width() -= nVBSzWidth;
rHScrollbar.SetPosSizePixel( aPos, aSize );
@@ -968,15 +965,10 @@ void ViewResizePixel( const Window &rRef,
aPos.Y() += aImgSz.Height();
pPageDownBtn->SetPosSizePixel( aPos, aImgSz );
-
- if( rHScrollbar.IsVisible( sal_False ) )
- {
- aScrollFillPos.X() = aPos.X();
-
- rScrollBarBox.SetPosSizePixel( aScrollFillPos,
- Size( nHBSzHeight, nVBSzWidth) );
- }
+ aScrollFillPos.X() = aPos.X();
}
+
+ rScrollBarBox.SetPosSizePixel( aScrollFillPos, Size( nHBSzHeight, nVBSzWidth) );
}
void SwView::ShowAtResize()
commit 2b508cf6b431c2faeec95340d192e7d917f3e7c7
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Mon May 28 18:04:17 2012 +0400
set scrollbar parameters anyway, it is nesessary for mouse wheel handling
otherwise there is a bug:
in Writer's page preview mode scrolling can move the selection out of page range
if all pages fit into the window
(regression from d7b06ba7ec2c988e80c8ef14e2d9bfc2c29e2d24)
Change-Id: I6cebf0c5a4f944cfb8736469620b3097df0a0340
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 0bf63ec..52814df 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -1623,33 +1623,33 @@ void SwPagePreView::ScrollViewSzChg()
// adjust to new preview functionality
sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ 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 );
+
if( nVisPages < mnPageCount )
{
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
{
More information about the Libreoffice-commits
mailing list