Kaydet (Commit) 7f5ca4c9 authored tarafından Noel Power's avatar Noel Power

fix scroll top & scroll left

Change-Id: If333932a0f3cfde6e8459ca3506a609207982f96
üst be045f69
...@@ -56,12 +56,11 @@ void ScrollableDialog::lcl_Scroll( long nX, long nY ) ...@@ -56,12 +56,11 @@ void ScrollableDialog::lcl_Scroll( long nX, long nY )
{ {
long nXScroll = mnScrollPos.X() - nX; long nXScroll = mnScrollPos.X() - nX;
long nYScroll = mnScrollPos.Y() - nY; long nYScroll = mnScrollPos.Y() - nY;
printf( "ScrollableDialog::lcl_Scroll %d, %d nXScroll %d, nYScroll %d\n", nX, nY, nXScroll, nYScroll ); printf( "ScrollableDialog::lcl_Scroll %d, %d resulting in delta nXScroll %d, nYScroll %d for ( %d ) children\n", nX, nY, nXScroll, nYScroll, GetChildCount() -2 );
mnScrollPos = Point( nX, nY ); mnScrollPos = Point( nX, nY );
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() ); Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
Window::Scroll(nXScroll, nYScroll, aScrollableArea ); Window::Scroll(nXScroll, nYScroll, aScrollableArea );
// Manually scroll all children ( except the scrollbars ) // Manually scroll all children ( except the scrollbars )
for ( int index = 0; index < GetChildCount(); ++index ) for ( int index = 0; index < GetChildCount(); ++index )
{ {
...@@ -89,18 +88,20 @@ void ScrollableDialog::SetScrollTop( long nTop ) ...@@ -89,18 +88,20 @@ void ScrollableDialog::SetScrollTop( long nTop )
{ {
printf("ScrollableDialog::SetScrollTop(%d)\n", nTop ); printf("ScrollableDialog::SetScrollTop(%d)\n", nTop );
Point aOld = mnScrollPos; Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() , nTop ); lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
printf("about to set thumb\n"); printf("about to set thumb\n");
maHScrollBar.SetThumbPos( 0 ); maHScrollBar.SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld; mnScrollPos = aOld;
} }
void ScrollableDialog::SetScrollLeft( long nLeft ) void ScrollableDialog::SetScrollLeft( long nLeft )
{ {
printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft ); printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft );
Point aOld = mnScrollPos; Point aOld = mnScrollPos;
lcl_Scroll( nLeft , mnScrollPos.Y() ); lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
printf("about to set thumb\n"); printf("about to set thumb\n");
maVScrollBar.SetThumbPos( 0 ); maVScrollBar.SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld; mnScrollPos = aOld;
} }
void ScrollableDialog::SetScrollWidth( long nWidth ) void ScrollableDialog::SetScrollWidth( long nWidth )
......
...@@ -358,6 +358,15 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons ...@@ -358,6 +358,15 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
if ( maTopWindowListeners.getLength() ) if ( maTopWindowListeners.getLength() )
xTW->addTopWindowListener( &maTopWindowListeners ); xTW->addTopWindowListener( &maTopWindowListeners );
// there must be a better way than doing this, we can't
// process the scrolltop & scrollleft in XDialog because
// the children haven't been added when those props are applied
Reference< XPropertySet > xDlgProps( getModel(), UNO_QUERY );
Reference< XPropertySet > xPeerProps( getPeer(), uno::UNO_QUERY );
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
} }
} }
...@@ -1089,6 +1098,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) ...@@ -1089,6 +1098,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
SimpleFontMetric aFM; SimpleFontMetric aFM;
FontDescriptor aFD; FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) ); Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
aVal >>= aFD; aVal >>= aFD;
if ( !aFD.StyleName.isEmpty() ) if ( !aFD.StyleName.isEmpty() )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment