LCOV - code coverage report
Current view: top level - basctl/source/dlged - dlgedview.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 84 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          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             : namespace basctl
      32             : {
      33             : 
      34           0 : TYPEINIT1( DlgEdView, SdrView );
      35             : 
      36           0 : DlgEdView::DlgEdView (SdrModel& rModel, OutputDevice& rOut, DlgEditor& rEditor) :
      37             :     SdrView(&rModel, &rOut),
      38           0 :     rDlgEditor(rEditor)
      39             : {
      40             :     // #114898#
      41           0 :     SetBufferedOutputAllowed(true);
      42           0 :     SetBufferedOverlayAllowed(true);
      43           0 : }
      44             : 
      45           0 : DlgEdView::~DlgEdView()
      46             : {
      47           0 : }
      48             : 
      49           0 : void DlgEdView::MarkListHasChanged()
      50             : {
      51           0 :     SdrView::MarkListHasChanged();
      52             : 
      53           0 :     DlgEdHint aHint( DlgEdHint::SELECTIONCHANGED );
      54           0 :     rDlgEditor.Broadcast( aHint );
      55           0 :     rDlgEditor.UpdatePropertyBrowserDelayed();
      56           0 : }
      57             : 
      58           0 : void DlgEdView::MakeVisible( const Rectangle& rRect, vcl::Window& rWin )
      59             : {
      60             :     // visible area
      61           0 :     MapMode aMap( rWin.GetMapMode() );
      62           0 :     Point aOrg( aMap.GetOrigin() );
      63           0 :     Size aVisSize( rWin.GetOutputSize() );
      64           0 :     Rectangle RectTmp( Point(-aOrg.X(),-aOrg.Y()), aVisSize );
      65           0 :     Rectangle aVisRect( RectTmp );
      66             : 
      67             :     // check, if rectangle is inside visible area
      68           0 :     if ( !aVisRect.IsInside( rRect ) )
      69             :     {
      70             :         // calculate scroll distance; the rectangle must be inside the visible area
      71           0 :         sal_Int32 nScrollX = 0, nScrollY = 0;
      72             : 
      73           0 :         sal_Int32 nVisLeft   = aVisRect.Left();
      74           0 :         sal_Int32 nVisRight  = aVisRect.Right();
      75           0 :         sal_Int32 nVisTop    = aVisRect.Top();
      76           0 :         sal_Int32 nVisBottom = aVisRect.Bottom();
      77             : 
      78           0 :         sal_Int32 nDeltaX = rDlgEditor.GetHScroll()->GetLineSize();
      79           0 :         sal_Int32 nDeltaY = rDlgEditor.GetVScroll()->GetLineSize();
      80             : 
      81           0 :         while ( rRect.Right() > nVisRight + nScrollX )
      82           0 :             nScrollX += nDeltaX;
      83             : 
      84           0 :         while ( rRect.Left() < nVisLeft + nScrollX )
      85           0 :             nScrollX -= nDeltaX;
      86             : 
      87           0 :         while ( rRect.Bottom() > nVisBottom + nScrollY )
      88           0 :             nScrollY += nDeltaY;
      89             : 
      90           0 :         while ( rRect.Top() < nVisTop + nScrollY )
      91           0 :             nScrollY -= nDeltaY;
      92             : 
      93             :         // don't scroll beyond the page size
      94           0 :         Size aPageSize = rDlgEditor.GetPage().GetSize();
      95           0 :         sal_Int32 nPageWidth  = aPageSize.Width();
      96           0 :         sal_Int32 nPageHeight = aPageSize.Height();
      97             : 
      98           0 :         if ( nVisRight + nScrollX > nPageWidth )
      99           0 :             nScrollX = nPageWidth - nVisRight;
     100             : 
     101           0 :         if ( nVisLeft + nScrollX < 0 )
     102           0 :             nScrollX = -nVisLeft;
     103             : 
     104           0 :         if ( nVisBottom + nScrollY > nPageHeight )
     105           0 :             nScrollY = nPageHeight - nVisBottom;
     106             : 
     107           0 :         if ( nVisTop + nScrollY < 0 )
     108           0 :             nScrollY = -nVisTop;
     109             : 
     110             :         // scroll window
     111           0 :         rWin.Update();
     112           0 :         rWin.Scroll( -nScrollX, -nScrollY );
     113           0 :         aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) );
     114           0 :         rWin.SetMapMode( aMap );
     115           0 :         rWin.Update();
     116           0 :         rWin.Invalidate();
     117             : 
     118             :         // update scroll bars
     119           0 :         rDlgEditor.UpdateScrollBars();
     120             : 
     121           0 :         DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED );
     122           0 :         rDlgEditor.Broadcast( aHint );
     123           0 :     }
     124           0 : }
     125             : 
     126           0 : SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 nTol)
     127             : {
     128           0 :     DlgEdObj* pDlgEdObj = dynamic_cast< DlgEdObj* >(pRetval);
     129             : 
     130           0 :     if(pDlgEdObj)
     131             :     {
     132           0 :         bool bExcludeInner(false);
     133             : 
     134           0 :         if(0 != dynamic_cast< DlgEdForm* >(pRetval))
     135             :         {
     136             :             // from DlgEdForm::CheckHit; exclude inner for DlgEdForm
     137           0 :             bExcludeInner = true;
     138             :         }
     139           0 :         else if(pDlgEdObj->supportsService("com.sun.star.awt.UnoControlGroupBoxModel"))
     140             :         {
     141             :             // from DlgEdObj::CheckHit; exclude inner for group shapes
     142           0 :             bExcludeInner = true;
     143             :         }
     144             : 
     145           0 :         if(bExcludeInner)
     146             :         {
     147             :             // use direct model data; it's a DlgEdObj, so GetLastBoundRect()
     148             :             // will access aOutRect directly
     149           0 :             const Rectangle aOuterRectangle(pDlgEdObj->GetLastBoundRect());
     150             : 
     151           0 :             if(!aOuterRectangle.IsEmpty()
     152           0 :                 && RECT_EMPTY != aOuterRectangle.Right()
     153           0 :                 && RECT_EMPTY != aOuterRectangle.Bottom())
     154             :             {
     155             :                 basegfx::B2DRange aOuterRange(
     156           0 :                     aOuterRectangle.Left(), aOuterRectangle.Top(),
     157           0 :                     aOuterRectangle.Right(), aOuterRectangle.Bottom());
     158             : 
     159           0 :                 if(nTol)
     160             :                 {
     161           0 :                     aOuterRange.grow(-1.0 * nTol);
     162             :                 }
     163             : 
     164           0 :                 if(aOuterRange.isInside(basegfx::B2DPoint(rPnt.X(), rPnt.Y())))
     165             :                 {
     166           0 :                     pRetval = 0;
     167             :                 }
     168             :             }
     169             :         }
     170             :     }
     171             : 
     172           0 :     return pRetval;
     173             : }
     174             : 
     175           0 : SdrObject* DlgEdView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay) const
     176             : {
     177             :     // call parent
     178           0 :     SdrObject* pRetval = SdrView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay);
     179             : 
     180           0 :     if(pRetval)
     181             :     {
     182             :         // check hitted object locally
     183           0 :         pRetval = impLocalHitCorrection(pRetval, rPnt, nTol);
     184             :     }
     185             : 
     186           0 :     return pRetval;
     187             : }
     188             : 
     189           0 : } // namespace basctl
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11