LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 52 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 70 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "DrawViewShell.hxx"
      31                 :            : #include <svl/aeitem.hxx>
      32                 :            : #include <svl/itemset.hxx>
      33                 :            : #include <sfx2/request.hxx>
      34                 :            : #include <svx/svxids.hrc>
      35                 :            : 
      36                 :            : 
      37                 :            : #include <svx/fmshell.hxx>
      38                 :            : #include <sfx2/dispatch.hxx>
      39                 :            : 
      40                 :            : #include "app.hrc"
      41                 :            : #include "strings.hrc"
      42                 :            : #include "sdpage.hxx"
      43                 :            : #ifndef SD_FRAME_VIEW
      44                 :            : #include "FrameView.hxx"
      45                 :            : #endif
      46                 :            : #include "sdresid.hxx"
      47                 :            : #include "drawdoc.hxx"
      48                 :            : #include "DrawDocShell.hxx"
      49                 :            : #include "Window.hxx"
      50                 :            : #include "GraphicViewShell.hxx"
      51                 :            : #include "drawview.hxx"
      52                 :            : 
      53                 :            : #include "slideshow.hxx"
      54                 :            : 
      55                 :            : namespace sd {
      56                 :            : 
      57                 :            : #define TABCONTROL_INITIAL_SIZE     500
      58                 :            : 
      59                 :            : /*************************************************************************
      60                 :            : |*
      61                 :            : |* Sprung zu Bookmark
      62                 :            : |*
      63                 :            : \************************************************************************/
      64                 :            : 
      65                 :          0 : sal_Bool DrawViewShell::GotoBookmark(const String& rBookmark)
      66                 :            : {
      67                 :          0 :     sal_Bool bRet = sal_False;
      68                 :          0 :     ::sd::DrawDocShell* pDocSh = GetDocSh();
      69         [ #  # ]:          0 :     if( pDocSh )
      70                 :            :     {
      71         [ #  # ]:          0 :         if( !pDocSh->GetViewShell() ) //#i26016# this case occurs if the jump-target-document was opened already with file open dialog before triggering the jump via hyperlink
      72                 :          0 :             pDocSh->Connect(this);
      73                 :          0 :         bRet = (pDocSh->GotoBookmark(rBookmark));
      74                 :            :     }
      75                 :          0 :     return bRet;
      76                 :            : }
      77                 :            : 
      78                 :            : /*************************************************************************
      79                 :            : |*
      80                 :            : |* Bereich sichtbar machen (Bildausschnitt scrollen)
      81                 :            : |*
      82                 :            : \************************************************************************/
      83                 :            : 
      84                 :          0 : void DrawViewShell::MakeVisible(const Rectangle& rRect, ::Window& rWin)
      85                 :            : {
      86                 :            :     // In older versions, if in X or Y the size of the object was
      87                 :            :     // smaller than the visible area, the user-defined zoom was
      88                 :            :     // changed. This was decided to be a bug for 6.x, thus I developed a
      89                 :            :     // version which instead handles X/Y bigger/smaller and visibility
      90                 :            :     // questions seperately. The new behaviour is triggered with the
      91                 :            :     // bZoomAllowed parameter which for old behaviour should be set to
      92                 :            :     // sal_True. I looked at all uses of MakeVisible() in the application
      93                 :            :     // and found no valid reason for really changing the zoom factor, thus I
      94                 :            :     // decided to NOT expand (incompatible) this virtual method to get one
      95                 :            :     // more parameter. If this is wanted in later versions, feel free to add
      96                 :            :     // that bool to the parameter list.
      97                 :          0 :     sal_Bool bZoomAllowed(sal_False);
      98         [ #  # ]:          0 :     Size aLogicSize(rRect.GetSize());
      99                 :            : 
     100                 :            :     // Sichtbarer Bereich
     101                 :          0 :     Size aVisSizePixel(rWin.GetOutputSizePixel());
     102 [ #  # ][ #  # ]:          0 :     Rectangle aVisArea(rWin.PixelToLogic(Rectangle(Point(0,0), aVisSizePixel)));
     103         [ #  # ]:          0 :     Size aVisAreaSize(aVisArea.GetSize());
     104                 :            : 
     105 [ #  # ][ #  # ]:          0 :     if(!aVisArea.IsInside(rRect) && !SlideShow::IsRunning( GetViewShellBase() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     106                 :            :     {
     107                 :            :         // Objekt liegt nicht komplett im sichtbaren Bereich
     108                 :          0 :         sal_Int32 nFreeSpaceX(aVisAreaSize.Width() - aLogicSize.Width());
     109                 :          0 :         sal_Int32 nFreeSpaceY(aVisAreaSize.Height() - aLogicSize.Height());
     110                 :            : 
     111 [ #  # ][ #  # ]:          0 :         if(bZoomAllowed && (nFreeSpaceX < 0 || nFreeSpaceY < 0))
                 [ #  # ]
     112                 :            :         {
     113                 :            :             // Objekt passt nicht in sichtbaren Bereich -> auf Objektgroesse zoomen
     114         [ #  # ]:          0 :             SetZoomRect(rRect);
     115                 :            :         }
     116                 :            :         else
     117                 :            :         {
     118                 :            :             // allow a mode for move-only visibility without zooming.
     119                 :          0 :             const sal_Int32 nPercentBorder(30);
     120                 :            :             const Rectangle aInnerRectangle(
     121                 :          0 :                 aVisArea.Left() + ((aVisAreaSize.Width() * nPercentBorder) / 200),
     122                 :          0 :                 aVisArea.Top() + ((aVisAreaSize.Height() * nPercentBorder) / 200),
     123                 :          0 :                 aVisArea.Right() - ((aVisAreaSize.Width() * nPercentBorder) / 200),
     124                 :          0 :                 aVisArea.Bottom() - ((aVisAreaSize.Height() * nPercentBorder) / 200)
     125         [ #  # ]:          0 :                 );
     126                 :          0 :             Point aNewPos(aVisArea.TopLeft());
     127                 :            : 
     128         [ #  # ]:          0 :             if(nFreeSpaceX < 0)
     129                 :            :             {
     130         [ #  # ]:          0 :                 if(aInnerRectangle.Left() > rRect.Right())
     131                 :            :                 {
     132                 :            :                     // object moves out to the left
     133                 :          0 :                     aNewPos.X() -= aVisAreaSize.Width() / 2;
     134                 :            :                 }
     135                 :            : 
     136         [ #  # ]:          0 :                 if(aInnerRectangle.Right() < rRect.Left())
     137                 :            :                 {
     138                 :            :                     // object moves out to the right
     139                 :          0 :                     aNewPos.X() += aVisAreaSize.Width() / 2;
     140                 :            :                 }
     141                 :            :             }
     142                 :            :             else
     143                 :            :             {
     144 [ #  # ][ #  # ]:          0 :                 if(nFreeSpaceX > rRect.GetWidth())
     145         [ #  # ]:          0 :                     nFreeSpaceX = rRect.GetWidth();
     146                 :            : 
     147         [ #  # ]:          0 :                 while(rRect.Right() > aNewPos.X() + aVisAreaSize.Width())
     148                 :          0 :                     aNewPos.X() += nFreeSpaceX;
     149                 :            : 
     150         [ #  # ]:          0 :                 while(rRect.Left() < aNewPos.X())
     151                 :          0 :                     aNewPos.X() -= nFreeSpaceX;
     152                 :            :             }
     153                 :            : 
     154         [ #  # ]:          0 :             if(nFreeSpaceY < 0)
     155                 :            :             {
     156         [ #  # ]:          0 :                 if(aInnerRectangle.Top() > rRect.Bottom())
     157                 :            :                 {
     158                 :            :                     // object moves out to the top
     159                 :          0 :                     aNewPos.Y() -= aVisAreaSize.Height() / 2;
     160                 :            :                 }
     161                 :            : 
     162         [ #  # ]:          0 :                 if(aInnerRectangle.Bottom() < rRect.Top())
     163                 :            :                 {
     164                 :            :                     // object moves out to the right
     165                 :          0 :                     aNewPos.Y() += aVisAreaSize.Height() / 2;
     166                 :            :                 }
     167                 :            :             }
     168                 :            :             else
     169                 :            :             {
     170 [ #  # ][ #  # ]:          0 :                 if(nFreeSpaceY > rRect.GetHeight())
     171         [ #  # ]:          0 :                     nFreeSpaceY = rRect.GetHeight();
     172                 :            : 
     173         [ #  # ]:          0 :                 while(rRect.Bottom() > aNewPos.Y() + aVisAreaSize.Height())
     174                 :          0 :                     aNewPos.Y() += nFreeSpaceY;
     175                 :            : 
     176         [ #  # ]:          0 :                 while(rRect.Top() < aNewPos.Y())
     177                 :          0 :                     aNewPos.Y() -= nFreeSpaceY;
     178                 :            :             }
     179                 :            : 
     180                 :            :             // did position change? Does it need to be set?
     181         [ #  # ]:          0 :             if(aNewPos != aVisArea.TopLeft())
     182                 :            :             {
     183                 :          0 :                 aVisArea.SetPos(aNewPos);
     184         [ #  # ]:          0 :                 SetZoomRect(aVisArea);
     185                 :            :             }
     186                 :            :         }
     187                 :            :     }
     188                 :          0 : }
     189                 :            : 
     190                 :            : }
     191                 :            : 
     192                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10