LCOV - code coverage report
Current view: top level - basctl/source/dlged - dlgedview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 87 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "dlgedview.hxx"
      21                 :            : #include "dlged.hxx"
      22                 :            : #include <dlgedpage.hxx>
      23                 :            : 
      24                 :            : #include <svx/svxids.hrc>
      25                 :            : #include <sfx2/viewfrm.hxx>
      26                 :            : 
      27                 :            : #include <basidesh.hxx>
      28                 :            : #include <iderdll.hxx>
      29                 :            : #include "dlgedobj.hxx"
      30                 :            : 
      31                 :          0 : TYPEINIT1( DlgEdView, SdrView );
      32                 :            : 
      33                 :            : //----------------------------------------------------------------------------
      34                 :            : 
      35                 :          0 : DlgEdView::DlgEdView( SdrModel* pModel, OutputDevice* pOut, DlgEditor* pEditor )
      36                 :            :     :SdrView( pModel, pOut )
      37                 :          0 :     ,pDlgEditor( pEditor )
      38                 :            : {
      39                 :            :     // #114898#
      40                 :          0 :     SetBufferedOutputAllowed(true);
      41                 :          0 :     SetBufferedOverlayAllowed(true);
      42                 :          0 : }
      43                 :            : 
      44                 :            : //----------------------------------------------------------------------------
      45                 :            : 
      46                 :          0 : DlgEdView::~DlgEdView()
      47                 :            : {
      48                 :          0 : }
      49                 :            : 
      50                 :            : //----------------------------------------------------------------------------
      51                 :            : 
      52                 :          0 : void DlgEdView::MarkListHasChanged()
      53                 :            : {
      54                 :          0 :     SdrView::MarkListHasChanged();
      55                 :            : 
      56                 :          0 :     DlgEdHint aHint( DLGED_HINT_SELECTIONCHANGED );
      57                 :          0 :     if ( pDlgEditor )
      58                 :            :     {
      59                 :          0 :         pDlgEditor->Broadcast( aHint );
      60                 :          0 :         pDlgEditor->UpdatePropertyBrowserDelayed();
      61                 :          0 :     }
      62                 :          0 : }
      63                 :            : 
      64                 :            : //----------------------------------------------------------------------------
      65                 :            : 
      66                 :          0 : void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin )
      67                 :            : {
      68                 :            :     // visible area
      69                 :          0 :     MapMode aMap( rWin.GetMapMode() );
      70                 :          0 :     Point aOrg( aMap.GetOrigin() );
      71                 :          0 :     Size aVisSize( rWin.GetOutputSize() );
      72                 :          0 :     Rectangle RectTmp( Point(-aOrg.X(),-aOrg.Y()), aVisSize );
      73                 :          0 :     Rectangle aVisRect( RectTmp );
      74                 :            : 
      75                 :            :     // check, if rectangle is inside visible area
      76                 :          0 :     if ( !aVisRect.IsInside( rRect ) )
      77                 :            :     {
      78                 :            :         // calculate scroll distance; the rectangle must be inside the visible area
      79                 :          0 :         sal_Int32 nScrollX = 0, nScrollY = 0;
      80                 :            : 
      81                 :          0 :         sal_Int32 nVisLeft   = aVisRect.Left();
      82                 :          0 :         sal_Int32 nVisRight  = aVisRect.Right();
      83                 :          0 :         sal_Int32 nVisTop    = aVisRect.Top();
      84                 :          0 :         sal_Int32 nVisBottom = aVisRect.Bottom();
      85                 :            : 
      86                 :          0 :         sal_Int32 nDeltaX = pDlgEditor->GetHScroll()->GetLineSize();
      87                 :          0 :         sal_Int32 nDeltaY = pDlgEditor->GetVScroll()->GetLineSize();
      88                 :            : 
      89                 :          0 :         while ( rRect.Right() > nVisRight + nScrollX )
      90                 :          0 :             nScrollX += nDeltaX;
      91                 :            : 
      92                 :          0 :         while ( rRect.Left() < nVisLeft + nScrollX )
      93                 :          0 :             nScrollX -= nDeltaX;
      94                 :            : 
      95                 :          0 :         while ( rRect.Bottom() > nVisBottom + nScrollY )
      96                 :          0 :             nScrollY += nDeltaY;
      97                 :            : 
      98                 :          0 :         while ( rRect.Top() < nVisTop + nScrollY )
      99                 :          0 :             nScrollY -= nDeltaY;
     100                 :            : 
     101                 :            :         // don't scroll beyond the page size
     102                 :          0 :         Size aPageSize = pDlgEditor->GetPage()->GetSize();
     103                 :          0 :         sal_Int32 nPageWidth  = aPageSize.Width();
     104                 :          0 :         sal_Int32 nPageHeight = aPageSize.Height();
     105                 :            : 
     106                 :          0 :         if ( nVisRight + nScrollX > nPageWidth )
     107                 :          0 :             nScrollX = nPageWidth - nVisRight;
     108                 :            : 
     109                 :          0 :         if ( nVisLeft + nScrollX < 0 )
     110                 :          0 :             nScrollX = -nVisLeft;
     111                 :            : 
     112                 :          0 :         if ( nVisBottom + nScrollY > nPageHeight )
     113                 :          0 :             nScrollY = nPageHeight - nVisBottom;
     114                 :            : 
     115                 :          0 :         if ( nVisTop + nScrollY < 0 )
     116                 :          0 :             nScrollY = -nVisTop;
     117                 :            : 
     118                 :            :         // scroll window
     119                 :          0 :         rWin.Update();
     120                 :          0 :         rWin.Scroll( -nScrollX, -nScrollY );
     121                 :          0 :         aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) );
     122                 :          0 :         rWin.SetMapMode( aMap );
     123                 :          0 :         rWin.Update();
     124                 :          0 :         rWin.Invalidate();
     125                 :            : 
     126                 :            :         // update scroll bars
     127                 :          0 :         if ( pDlgEditor )
     128                 :          0 :             pDlgEditor->UpdateScrollBars();
     129                 :            : 
     130                 :          0 :         DlgEdHint aHint( DLGED_HINT_WINDOWSCROLLED );
     131                 :          0 :         if ( pDlgEditor )
     132                 :          0 :             pDlgEditor->Broadcast( aHint );
     133                 :          0 :     }
     134                 :          0 : }
     135                 :            : 
     136                 :            : //----------------------------------------------------------------------------
     137                 :            : 
     138                 :          0 : SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 nTol)
     139                 :            : {
     140                 :          0 :     DlgEdObj* pDlgEdObj = dynamic_cast< DlgEdObj* >(pRetval);
     141                 :            : 
     142                 :          0 :     if(pDlgEdObj)
     143                 :            :     {
     144                 :          0 :         bool bExcludeInner(false);
     145                 :            : 
     146                 :          0 :         if(0 != dynamic_cast< DlgEdForm* >(pRetval))
     147                 :            :         {
     148                 :            :             // from DlgEdForm::CheckHit; exclude inner for DlgEdForm
     149                 :          0 :             bExcludeInner = true;
     150                 :            :         }
     151                 :          0 :         else if(pDlgEdObj->supportsService("com.sun.star.awt.UnoControlGroupBoxModel"))
     152                 :            :         {
     153                 :            :             // from DlgEdObj::CheckHit; exclude inner for group shapes
     154                 :          0 :             bExcludeInner = true;
     155                 :            :         }
     156                 :            : 
     157                 :          0 :         if(bExcludeInner)
     158                 :            :         {
     159                 :            :             // use direct model data; it's a DlgEdObj, so GetLastBoundRect()
     160                 :            :             // will access aOutRect directly
     161                 :          0 :             const Rectangle aOuterRectangle(pDlgEdObj->GetLastBoundRect());
     162                 :            : 
     163                 :          0 :             if(!aOuterRectangle.IsEmpty()
     164                 :          0 :                 && RECT_EMPTY != aOuterRectangle.Right()
     165                 :          0 :                 && RECT_EMPTY != aOuterRectangle.Bottom())
     166                 :            :             {
     167                 :            :                 basegfx::B2DRange aOuterRange(
     168                 :          0 :                     aOuterRectangle.Left(), aOuterRectangle.Top(),
     169                 :          0 :                     aOuterRectangle.Right(), aOuterRectangle.Bottom());
     170                 :            : 
     171                 :          0 :                 if(nTol)
     172                 :            :                 {
     173                 :          0 :                     aOuterRange.grow(-1.0 * nTol);
     174                 :            :                 }
     175                 :            : 
     176                 :          0 :                 if(aOuterRange.isInside(basegfx::B2DPoint(rPnt.X(), rPnt.Y())))
     177                 :            :                 {
     178                 :          0 :                     pRetval = 0;
     179                 :            :                 }
     180                 :            :             }
     181                 :            :         }
     182                 :            :     }
     183                 :            : 
     184                 :          0 :     return pRetval;
     185                 :            : }
     186                 :            : 
     187                 :          0 : SdrObject* DlgEdView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const
     188                 :            : {
     189                 :            :     // call parent
     190                 :          0 :     SdrObject* pRetval = SdrView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay);
     191                 :            : 
     192                 :          0 :     if(pRetval)
     193                 :            :     {
     194                 :            :         // check hitted object locally
     195                 :          0 :         pRetval = impLocalHitCorrection(pRetval, rPnt, nTol);
     196                 :            :     }
     197                 :            : 
     198                 :          0 :     return pRetval;
     199                 :            : }
     200                 :            : 
     201                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10