diff options
author | Eike Rathke <erack@redhat.com> | 2011-11-27 20:19:46 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-11-28 15:25:26 +0100 |
commit | 618bc5d6bd7d08441680338815f9100fbf3dd4a8 (patch) | |
tree | c20137830e58151d049f5dc5231e0e909cd377b3 /sc/source/ui/view/preview.cxx | |
parent | e2e5ef04347bfb17abd7415dafa72561bd6dbfcf (diff) |
dr78: #i114518# don't resize/invalidate in DataChanged if called from Paint
# HG changeset patch
# User Niklas Nebel <nn@openoffice.org>
# Date 1290179165 -3600
# Node ID 1ae0b7505c139ccfdb550df74c87e1da09a62eee
# Parent addf2b12858c100fe23e1979a720231ed447a4f4
Diffstat (limited to 'sc/source/ui/view/preview.cxx')
-rw-r--r-- | sc/source/ui/view/preview.cxx | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 2c2699a8c46d..d24f663d08dc 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -112,6 +112,7 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView pDrawView( NULL ), nCurTab ( ScDocShell::GetCurTab() ), bInPaint( false ), + bInSetZoom( false ), bInGetState( false ), pDocShell( pDocSh ), pViewShell( pViewSh ), @@ -490,6 +491,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) //Issue51656 Add resizeable margin on page preview from maoyg void ScPreview::Paint( const Rectangle& /* rRect */ ) { + bool bWasInPaint = bInPaint; // nested calls shouldn't be necessary, but allow for now + bInPaint = true; + if (!bValid) { CalcPages(0); @@ -673,6 +677,8 @@ void ScPreview::Paint( const Rectangle& /* rRect */ ) } } pViewShell->UpdateScrollBars(); + + bInPaint = bWasInPaint; } //Issue51656 Add resizeable margin on page preview from maoyg @@ -791,9 +797,9 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); - bInPaint = sal_True; // don't scroll during SetYOffset in UpdateScrollBars + bInSetZoom = true; // don't scroll during SetYOffset in UpdateScrollBars pViewShell->UpdateScrollBars(); - bInPaint = false; + bInSetZoom = false; bStateValid = false; InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -902,7 +908,7 @@ void ScPreview::SetXOffset( long nX ) { long nDif = LogicToPixel(aOffset).X() - LogicToPixel(Point(nX,0)).X(); aOffset.X() = nX; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( nDif, 0 ); @@ -912,7 +918,7 @@ void ScPreview::SetXOffset( long nX ) else { aOffset.X() = nX; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -929,7 +935,7 @@ void ScPreview::SetYOffset( long nY ) { long nDif = LogicToPixel(aOffset).Y() - LogicToPixel(Point(0,nY)).Y(); aOffset.Y() = nY; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( 0, nDif ); @@ -939,7 +945,7 @@ void ScPreview::SetYOffset( long nY ) else { aOffset.Y() = nY; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -1003,15 +1009,19 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) if ( rDCEvt.GetType() == DATACHANGED_FONTS ) pDocShell->UpdateFontList(); - if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + // #i114518# Paint of form controls may modify the window's settings. + // Ignore the event if it is called from within Paint. + if ( !bInPaint ) { - // scroll bar size may have changed - pViewShell->InvalidateBorder(); // calls OuterResizePixel + if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + // scroll bar size may have changed + pViewShell->InvalidateBorder(); // calls OuterResizePixel + } + Invalidate(); + InvalidateLocationData( SC_HINT_DATACHANGED ); } - - Invalidate(); - InvalidateLocationData( SC_HINT_DATACHANGED ); } } |