LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/contact - viewobjectcontactofgroup.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 26 80.8 %
Date: 2012-12-27 Functions: 4 4 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 <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           5 :         ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
      40           5 :         :   ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
      41             :         {
      42           5 :         }
      43             : 
      44          10 :         ViewObjectContactOfGroup::~ViewObjectContactOfGroup()
      45             :         {
      46          10 :         }
      47             : 
      48           5 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
      49             :         {
      50           5 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
      51             : 
      52             :             // check model-view visibility
      53           5 :             if(isPrimitiveVisible(rDisplayInfo))
      54             :             {
      55           5 :                 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
      56             : 
      57           5 :                 if(nSubHierarchyCount)
      58             :                 {
      59             :                     const sal_Bool bDoGhostedDisplaying(
      60           5 :                         GetObjectContact().DoVisualizeEnteredGroup()
      61           0 :                         && !GetObjectContact().isOutputToPrinter()
      62           5 :                         && GetObjectContact().getActiveViewContact() == &GetViewContact());
      63             : 
      64           5 :                     if(bDoGhostedDisplaying)
      65             :                     {
      66           0 :                         rDisplayInfo.ClearGhostedDrawMode();
      67             :                     }
      68             : 
      69             :                     // create object hierarchy
      70           5 :                     xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
      71             : 
      72           5 :                     if(xRetval.hasElements())
      73             :                     {
      74             :                         // get ranges
      75           5 :                         const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
      76           5 :                         const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
      77           5 :                         const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
      78             : 
      79             :                         // check geometrical visibility
      80           5 :                         if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
      81             :                         {
      82             :                             // not visible, release
      83           0 :                             xRetval.realloc(0);
      84             :                         }
      85             :                     }
      86             : 
      87           5 :                     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           0 :                     xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
      97             :                 }
      98             :             }
      99           5 :             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