LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofgroup.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 29 32 90.6 %
Date: 2014-11-03 Functions: 7 7 100.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             : 
      21             : #include <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             : #include <svx/svdobj.hxx>
      29             : 
      30             : 
      31             : 
      32             : using namespace com::sun::star;
      33             : 
      34             : 
      35             : 
      36             : namespace sdr
      37             : {
      38             :     namespace contact
      39             :     {
      40        5154 :         ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
      41        5154 :         :   ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
      42             :         {
      43        5154 :         }
      44             : 
      45        9202 :         ViewObjectContactOfGroup::~ViewObjectContactOfGroup()
      46             :         {
      47        9202 :         }
      48             : 
      49        6150 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
      50             :         {
      51        6150 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
      52             : 
      53             :             // check model-view visibility
      54        6150 :             if(isPrimitiveVisible(rDisplayInfo))
      55             :             {
      56        5806 :                 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
      57             : 
      58        5806 :                 if(nSubHierarchyCount)
      59             :                 {
      60             :                     const bool bDoGhostedDisplaying(
      61        5737 :                         GetObjectContact().DoVisualizeEnteredGroup()
      62        5579 :                         && !GetObjectContact().isOutputToPrinter()
      63       11316 :                         && GetObjectContact().getActiveViewContact() == &GetViewContact());
      64             : 
      65        5737 :                     if(bDoGhostedDisplaying)
      66             :                     {
      67           0 :                         rDisplayInfo.ClearGhostedDrawMode();
      68             :                     }
      69             : 
      70             :                     // create object hierarchy
      71        5737 :                     xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
      72             : 
      73        5737 :                     if(xRetval.hasElements())
      74             :                     {
      75             :                         // get ranges
      76        5032 :                         const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
      77        5032 :                         const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
      78        5032 :                         const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
      79             : 
      80             :                         // check geometrical visibility
      81        5032 :                         if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
      82             :                         {
      83             :                             // not visible, release
      84           0 :                             xRetval.realloc(0);
      85             :                         }
      86             :                     }
      87             : 
      88        5737 :                     if(bDoGhostedDisplaying)
      89             :                     {
      90           0 :                         rDisplayInfo.SetGhostedDrawMode();
      91             :                     }
      92             :                 }
      93             :                 else
      94             :                 {
      95             :                     // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
      96             :                     // which creates the replacement primitives for an empty group
      97          69 :                     xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
      98             :                 }
      99             :             }
     100        6150 :             return xRetval;
     101             :         }
     102             : 
     103        6219 :         bool ViewObjectContactOfGroup::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
     104             :         {
     105        6219 :             SetOfByte aObjectLayers;
     106        6219 :             getSdrObject().getMergedHierarchyLayerSet(aObjectLayers);
     107        6219 :             aObjectLayers &= aLayers;
     108        6219 :             return !aObjectLayers.IsEmpty();
     109             :         }
     110             :     } // end of namespace contact
     111         651 : } // end of namespace sdr
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10