[Libreoffice-commits] core.git: sc/source

Jan Holesovsky kendy at collabora.com
Tue Apr 14 08:53:48 PDT 2015


 sc/source/ui/view/tabview2.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 85ab76f7047abd14139548b3343cb27905f130e8
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Apr 14 17:47:22 2015 +0200

    sc: 0 as the default zoom is curious, should be 100.
    
    This fixes a fallout from bf8b86e932df3edaeaa887509a22e57cd3920bc1.
    
    Change-Id: Ie2d2a1329df0ec36f21a07938af142c32c74277a

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index fc9b1a8..9e7d4d0 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -1170,7 +1170,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
 
 sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
 {
-    sal_uInt16 nZoom = 0; // Ergebnis
+    sal_uInt16 nZoom = 100;
 
     switch ( eType )
     {
@@ -1298,7 +1298,9 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
                         //  (with frozen panes, the size of the individual parts
                         //  depends on the scale that is to be calculated)
 
-                        if ( !pGridWin[SC_SPLIT_BOTTOMLEFT] ) return 0;
+                        if (!pGridWin[SC_SPLIT_BOTTOMLEFT])
+                            return nZoom;
+
                         Size aWinSize = pGridWin[SC_SPLIT_BOTTOMLEFT]->GetOutputSizePixel();
                         ScSplitMode eHMode = aViewData.GetHSplitMode();
                         if ( eHMode != SC_SPLIT_NONE && pGridWin[SC_SPLIT_BOTTOMRIGHT] )
@@ -1338,19 +1340,18 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
                                                ( aPageSize.Width() * nPPTX ) );
                         long nZoomY = (long) ( aWinSize.Height() * 100 /
                                                ( aPageSize.Height() * nPPTY ) );
-                        long nNew = nZoomX;
 
-                        if (eType == SvxZoomType::WHOLEPAGE && nZoomY < nNew)
-                            nNew = nZoomY;
+                        if (nZoomX > 0)
+                            nZoom = static_cast<sal_uInt16>(nZoomX);
 
-                        nZoom = (sal_uInt16) nNew;
+                        if (eType == SvxZoomType::WHOLEPAGE && nZoomY > 0 && nZoomY < nZoom)
+                            nZoom = static_cast<sal_uInt16>(nZoomY);
                     }
                 }
                 break;
 
         default:
             OSL_FAIL("Unknown Zoom-Revision");
-            nZoom = 0;
     }
 
     return nZoom;


More information about the Libreoffice-commits mailing list