SlsScrollBarManager.cxx (5b190011) | SlsScrollBarManager.cxx (b862c97c) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 77 unchanged lines hidden (view full) --- 86{ 87} 88 89 90 91 92void ScrollBarManager::Connect (void) 93{ | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 77 unchanged lines hidden (view full) --- 86{ 87} 88 89 90 91 92void ScrollBarManager::Connect (void) 93{ |
94 if (mpVerticalScrollBar != NULL) | 94 if( bool(mpVerticalScrollBar)) |
95 { 96 mpVerticalScrollBar->SetScrollHdl ( 97 LINK(this, ScrollBarManager, VerticalScrollBarHandler)); 98 } | 95 { 96 mpVerticalScrollBar->SetScrollHdl ( 97 LINK(this, ScrollBarManager, VerticalScrollBarHandler)); 98 } |
99 if (mpHorizontalScrollBar != NULL) | 99 if( bool(mpHorizontalScrollBar)) |
100 { 101 mpHorizontalScrollBar->SetScrollHdl( 102 LINK(this, ScrollBarManager, HorizontalScrollBarHandler)); 103 } 104} 105 106 107 108 109void ScrollBarManager::Disconnect (void) 110{ | 100 { 101 mpHorizontalScrollBar->SetScrollHdl( 102 LINK(this, ScrollBarManager, HorizontalScrollBarHandler)); 103 } 104} 105 106 107 108 109void ScrollBarManager::Disconnect (void) 110{ |
111 if (mpVerticalScrollBar != NULL) | 111 if( bool(mpVerticalScrollBar) ) |
112 { 113 mpVerticalScrollBar->SetScrollHdl (Link()); 114 } | 112 { 113 mpVerticalScrollBar->SetScrollHdl (Link()); 114 } |
115 if (mpHorizontalScrollBar != NULL) | 115 if( bool(mpHorizontalScrollBar) ) |
116 { 117 mpHorizontalScrollBar->SetScrollHdl (Link()); 118 } 119} 120 121 122 123 --- 13 unchanged lines hidden (view full) --- 137 const bool bIsHorizontalScrollBarAllowed, 138 const bool bIsVerticalScrollBarAllowed) 139{ 140 Rectangle aRemainingSpace (DetermineScrollBarVisibilities( 141 rAvailableArea, 142 bIsHorizontalScrollBarAllowed, 143 bIsVerticalScrollBarAllowed)); 144 | 116 { 117 mpHorizontalScrollBar->SetScrollHdl (Link()); 118 } 119} 120 121 122 123 --- 13 unchanged lines hidden (view full) --- 137 const bool bIsHorizontalScrollBarAllowed, 138 const bool bIsVerticalScrollBarAllowed) 139{ 140 Rectangle aRemainingSpace (DetermineScrollBarVisibilities( 141 rAvailableArea, 142 bIsHorizontalScrollBarAllowed, 143 bIsVerticalScrollBarAllowed)); 144 |
145 if (mpHorizontalScrollBar!=NULL && mpHorizontalScrollBar->IsVisible()) | 145 if( bool(mpHorizontalScrollBar) && mpHorizontalScrollBar->IsVisible()) |
146 PlaceHorizontalScrollBar (rAvailableArea); 147 | 146 PlaceHorizontalScrollBar (rAvailableArea); 147 |
148 if (mpVerticalScrollBar!=NULL && mpVerticalScrollBar->IsVisible()) | 148 if( bool(mpVerticalScrollBar) && mpVerticalScrollBar->IsVisible()) |
149 PlaceVerticalScrollBar (rAvailableArea); 150 | 149 PlaceVerticalScrollBar (rAvailableArea); 150 |
151 if (mpScrollBarFiller!=NULL && mpScrollBarFiller->IsVisible()) | 151 if( bool(mpScrollBarFiller) && mpScrollBarFiller->IsVisible()) |
152 PlaceFiller (rAvailableArea); 153 154 return aRemainingSpace; 155} 156 157 158 159 --- 54 unchanged lines hidden (view full) --- 214void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling) 215{ 216 Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea()); 217 SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); 218 Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel())); 219 220 // The horizontal scroll bar is only shown when the window is 221 // horizontally smaller than the view. | 152 PlaceFiller (rAvailableArea); 153 154 return aRemainingSpace; 155} 156 157 158 159 --- 54 unchanged lines hidden (view full) --- 214void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling) 215{ 216 Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea()); 217 SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); 218 Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel())); 219 220 // The horizontal scroll bar is only shown when the window is 221 // horizontally smaller than the view. |
222 if (mpHorizontalScrollBar != NULL && mpHorizontalScrollBar->IsVisible()) | 222 if( bool(mpHorizontalScrollBar) && mpHorizontalScrollBar->IsVisible()) |
223 { 224 mpHorizontalScrollBar->Show(); 225 mpHorizontalScrollBar->SetRange ( 226 Range(aModelArea.Left(), aModelArea.Right())); 227 if (bResetThumbPosition) 228 { 229 mpHorizontalScrollBar->SetThumbPos (0); 230 mnHorizontalPosition = 0; --- 13 unchanged lines hidden (view full) --- 244 mpHorizontalScrollBar->SetPageSize ((nWidth * 9) / 10); 245 } 246 else 247 { 248 mnHorizontalPosition = 0; 249 } 250 251 // The vertical scroll bar is always shown. | 223 { 224 mpHorizontalScrollBar->Show(); 225 mpHorizontalScrollBar->SetRange ( 226 Range(aModelArea.Left(), aModelArea.Right())); 227 if (bResetThumbPosition) 228 { 229 mpHorizontalScrollBar->SetThumbPos (0); 230 mnHorizontalPosition = 0; --- 13 unchanged lines hidden (view full) --- 244 mpHorizontalScrollBar->SetPageSize ((nWidth * 9) / 10); 245 } 246 else 247 { 248 mnHorizontalPosition = 0; 249 } 250 251 // The vertical scroll bar is always shown. |
252 if (mpVerticalScrollBar != NULL && mpVerticalScrollBar->IsVisible()) | 252 if( bool(mpVerticalScrollBar) && mpVerticalScrollBar->IsVisible()) |
253 { 254 mpVerticalScrollBar->SetRange ( 255 Range(aModelArea.Top(), aModelArea.Bottom())); 256 if (bResetThumbPosition) 257 { 258 mpVerticalScrollBar->SetThumbPos (0); 259 mnVerticalPosition = 0; 260 } --- 32 unchanged lines hidden (view full) --- 293 294 295 296IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar) 297{ 298 if (pScrollBar!=NULL 299 && pScrollBar==mpVerticalScrollBar.get() 300 && pScrollBar->IsVisible() | 253 { 254 mpVerticalScrollBar->SetRange ( 255 Range(aModelArea.Top(), aModelArea.Bottom())); 256 if (bResetThumbPosition) 257 { 258 mpVerticalScrollBar->SetThumbPos (0); 259 mnVerticalPosition = 0; 260 } --- 32 unchanged lines hidden (view full) --- 293 294 295 296IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar) 297{ 298 if (pScrollBar!=NULL 299 && pScrollBar==mpVerticalScrollBar.get() 300 && pScrollBar->IsVisible() |
301 && mrSlideSorter.GetContentWindow()!=NULL) | 301 && bool(mrSlideSorter.GetContentWindow()) ) |
302 { 303 double nRelativePosition = double(pScrollBar->GetThumbPos()) 304 / double(pScrollBar->GetRange().Len()); 305 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 306 mrSlideSorter.GetContentWindow()->SetVisibleXY(-1, nRelativePosition); 307 mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking(); 308 } 309 return sal_True; 310} 311 312 313 314 315IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar) 316{ 317 if (pScrollBar!=NULL 318 && pScrollBar==mpHorizontalScrollBar.get() 319 && pScrollBar->IsVisible() | 302 { 303 double nRelativePosition = double(pScrollBar->GetThumbPos()) 304 / double(pScrollBar->GetRange().Len()); 305 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 306 mrSlideSorter.GetContentWindow()->SetVisibleXY(-1, nRelativePosition); 307 mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking(); 308 } 309 return sal_True; 310} 311 312 313 314 315IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar) 316{ 317 if (pScrollBar!=NULL 318 && pScrollBar==mpHorizontalScrollBar.get() 319 && pScrollBar->IsVisible() |
320 && mrSlideSorter.GetContentWindow()!=NULL) | 320 && bool(mrSlideSorter.GetContentWindow()) ) |
321 { 322 double nRelativePosition = double(pScrollBar->GetThumbPos()) 323 / double(pScrollBar->GetRange().Len()); 324 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 325 mrSlideSorter.GetContentWindow()->SetVisibleXY(nRelativePosition, -1); 326 mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking(); 327 } 328 return sal_True; --- 156 unchanged lines hidden (view full) --- 485 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 486} 487 488 489 490 491sal_Int32 ScrollBarManager::GetTop (void) const 492{ | 321 { 322 double nRelativePosition = double(pScrollBar->GetThumbPos()) 323 / double(pScrollBar->GetRange().Len()); 324 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 325 mrSlideSorter.GetContentWindow()->SetVisibleXY(nRelativePosition, -1); 326 mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking(); 327 } 328 return sal_True; --- 156 unchanged lines hidden (view full) --- 485 mrSlideSorter.GetView().InvalidatePageObjectVisibilities(); 486} 487 488 489 490 491sal_Int32 ScrollBarManager::GetTop (void) const 492{ |
493 if (mpVerticalScrollBar != NULL) | 493 if( bool(mpVerticalScrollBar)) |
494 return mpVerticalScrollBar->GetThumbPos(); 495 else 496 return 0; 497} 498 499 500 501 502sal_Int32 ScrollBarManager::GetLeft (void) const 503{ | 494 return mpVerticalScrollBar->GetThumbPos(); 495 else 496 return 0; 497} 498 499 500 501 502sal_Int32 ScrollBarManager::GetLeft (void) const 503{ |
504 if (mpHorizontalScrollBar != NULL) | 504 if( bool(mpHorizontalScrollBar)) |
505 return mpHorizontalScrollBar->GetThumbPos(); 506 else 507 return 0; 508} 509 510 511 512 513int ScrollBarManager::GetVerticalScrollBarWidth (void) const 514{ | 505 return mpHorizontalScrollBar->GetThumbPos(); 506 else 507 return 0; 508} 509 510 511 512 513int ScrollBarManager::GetVerticalScrollBarWidth (void) const 514{ |
515 if (mpVerticalScrollBar != NULL && mpVerticalScrollBar->IsVisible()) | 515 if( bool(mpVerticalScrollBar) && mpVerticalScrollBar->IsVisible()) |
516 return mpVerticalScrollBar->GetSizePixel().Width(); 517 else 518 return 0; 519} 520 521 522 523 524int ScrollBarManager::GetHorizontalScrollBarHeight (void) const 525{ | 516 return mpVerticalScrollBar->GetSizePixel().Width(); 517 else 518 return 0; 519} 520 521 522 523 524int ScrollBarManager::GetHorizontalScrollBarHeight (void) const 525{ |
526 if (mpHorizontalScrollBar != NULL && mpHorizontalScrollBar->IsVisible()) | 526 if( bool(mpHorizontalScrollBar) && mpHorizontalScrollBar->IsVisible()) |
527 return mpHorizontalScrollBar->GetSizePixel().Height(); 528 else 529 return 0; 530} 531 532 533 534 --- 5 unchanged lines hidden (view full) --- 540 int nDy = 0; 541 542 Size aWindowSize = pWindow->GetOutputSizePixel(); 543 Rectangle aWindowArea (pWindow->GetPosPixel(), aWindowSize); 544 Rectangle aViewPixelArea ( 545 pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea())); 546 547 if (aWindowSize.Width() > maScrollBorder.Width() * 3 | 527 return mpHorizontalScrollBar->GetSizePixel().Height(); 528 else 529 return 0; 530} 531 532 533 534 --- 5 unchanged lines hidden (view full) --- 540 int nDy = 0; 541 542 Size aWindowSize = pWindow->GetOutputSizePixel(); 543 Rectangle aWindowArea (pWindow->GetPosPixel(), aWindowSize); 544 Rectangle aViewPixelArea ( 545 pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea())); 546 547 if (aWindowSize.Width() > maScrollBorder.Width() * 3 |
548 && mpHorizontalScrollBar != NULL | 548 && bool(mpHorizontalScrollBar) |
549 && mpHorizontalScrollBar->IsVisible()) 550 { 551 if (rMouseWindowPosition.X() < maScrollBorder.Width() 552 && aWindowArea.Left() > aViewPixelArea.Left()) 553 { 554 nDx = -1 + (int)(mnHorizontalScrollFactor 555 * (rMouseWindowPosition.X() - maScrollBorder.Width())); 556 } --- 177 unchanged lines hidden --- | 549 && mpHorizontalScrollBar->IsVisible()) 550 { 551 if (rMouseWindowPosition.X() < maScrollBorder.Width() 552 && aWindowArea.Left() > aViewPixelArea.Left()) 553 { 554 nDx = -1 + (int)(mnHorizontalScrollFactor 555 * (rMouseWindowPosition.X() - maScrollBorder.Width())); 556 } --- 177 unchanged lines hidden --- |