LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofgroup.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 26 92.3 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 31 60 51.7 %

           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                 :            : 
      21                 :            : #include <svx/sdr/contact/viewobjectcontactofgroup.hxx>
      22                 :            : #include <svx/sdr/contact/displayinfo.hxx>
      23                 :            : #include <svx/sdr/contact/objectcontact.hxx>
      24                 :            : #include <basegfx/numeric/ftools.hxx>
      25                 :            : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
      26                 :            : #include <basegfx/tools/canvastools.hxx>
      27                 :            : #include <svx/sdr/contact/viewcontact.hxx>
      28                 :            : 
      29                 :            : //////////////////////////////////////////////////////////////////////////////
      30                 :            : 
      31                 :            : using namespace com::sun::star;
      32                 :            : 
      33                 :            : //////////////////////////////////////////////////////////////////////////////
      34                 :            : 
      35                 :            : namespace sdr
      36                 :            : {
      37                 :            :     namespace contact
      38                 :            :     {
      39                 :      21565 :         ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
      40                 :      21565 :         :   ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
      41                 :            :         {
      42                 :      21565 :         }
      43                 :            : 
      44                 :      21565 :         ViewObjectContactOfGroup::~ViewObjectContactOfGroup()
      45                 :            :         {
      46         [ -  + ]:      43130 :         }
      47                 :            : 
      48                 :      25854 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
      49                 :            :         {
      50                 :      25854 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
      51                 :            : 
      52                 :            :             // check model-view visibility
      53 [ +  + ][ +  - ]:      25854 :             if(isPrimitiveVisible(rDisplayInfo))
      54                 :            :             {
      55         [ +  - ]:      24876 :                 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
      56                 :            : 
      57         [ +  + ]:      24876 :                 if(nSubHierarchyCount)
      58                 :            :                 {
      59                 :            :                     const sal_Bool bDoGhostedDisplaying(
      60         [ +  - ]:      24808 :                         GetObjectContact().DoVisualizeEnteredGroup()
      61         [ +  - ]:      24808 :                         && !GetObjectContact().isOutputToPrinter()
      62 [ +  - ][ +  - ]:      49616 :                         && GetObjectContact().getActiveViewContact() == &GetViewContact());
         [ +  - ][ -  + ]
      63                 :            : 
      64         [ -  + ]:      24808 :                     if(bDoGhostedDisplaying)
      65                 :            :                     {
      66         [ #  # ]:          0 :                         rDisplayInfo.ClearGhostedDrawMode();
      67                 :            :                     }
      68                 :            : 
      69                 :            :                     // create object hierarchy
      70 [ +  - ][ +  - ]:      24808 :                     xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
                 [ +  - ]
      71                 :            : 
      72         [ +  + ]:      24808 :                     if(xRetval.hasElements())
      73                 :            :                     {
      74                 :            :                         // get ranges
      75                 :      22204 :                         const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
      76         [ +  - ]:      22204 :                         const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
      77         [ +  - ]:      22204 :                         const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
      78                 :            : 
      79                 :            :                         // check geometrical visibility
      80 [ +  - ][ +  + ]:      22204 :                         if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
         [ +  - ][ -  + ]
                 [ -  + ]
      81                 :            :                         {
      82                 :            :                             // not visible, release
      83         [ #  # ]:      22204 :                             xRetval.realloc(0);
      84                 :            :                         }
      85                 :            :                     }
      86                 :            : 
      87         [ -  + ]:      24808 :                     if(bDoGhostedDisplaying)
      88                 :            :                     {
      89         [ #  # ]:          0 :                         rDisplayInfo.SetGhostedDrawMode();
      90                 :            :                     }
      91                 :            :                 }
      92                 :            :                 else
      93                 :            :                 {
      94                 :            :                     // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
      95                 :            :                     // which creates the replacement primitives for an empty group
      96 [ +  - ][ +  - ]:         68 :                     xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
                 [ +  - ]
      97                 :            :                 }
      98                 :            :             }
      99                 :      25854 :             return xRetval;
     100                 :            :         }
     101                 :            :     } // end of namespace contact
     102                 :            : } // end of namespace sdr
     103                 :            : 
     104                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10