LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofgroup.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 24 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 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             : #include <sdr/contact/viewcontactofgroup.hxx>
      21             : #include <svx/svdogrp.hxx>
      22             : #include <svx/svdpage.hxx>
      23             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      24             : #include <sdr/contact/viewobjectcontactofgroup.hxx>
      25             : #include <basegfx/polygon/b2dpolygon.hxx>
      26             : #include <basegfx/polygon/b2dpolygontools.hxx>
      27             : #include <basegfx/color/bcolor.hxx>
      28             : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      29             : #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
      30             : 
      31             : 
      32             : 
      33             : namespace sdr
      34             : {
      35             :     namespace contact
      36             :     {
      37             :         // Create a Object-Specific ViewObjectContact, set ViewContact and
      38             :         // ObjectContact. Always needs to return something.
      39       17825 :         ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      40             :         {
      41       17825 :             ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this);
      42             :             DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)");
      43             : 
      44       17825 :             return *pRetval;
      45             :         }
      46             : 
      47       35288 :         ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup)
      48       35288 :         :   ViewContactOfSdrObj(rGroup)
      49             :         {
      50       35288 :         }
      51             : 
      52       69824 :         ViewContactOfGroup::~ViewContactOfGroup()
      53             :         {
      54       69824 :         }
      55             : 
      56        5631 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const
      57             :         {
      58        5631 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
      59        5631 :             const sal_uInt32 nObjectCount(GetObjectCount());
      60             : 
      61        5631 :             if(nObjectCount)
      62             :             {
      63             :                 // collect all sub-primitives
      64       19097 :                 for(sal_uInt32 a(0); a < nObjectCount; a++)
      65             :                 {
      66       13553 :                     const ViewContact& rCandidate(GetViewContact(a));
      67       13553 :                     const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
      68             : 
      69       13553 :                     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
      70       13553 :                 }
      71             :             }
      72             :             else
      73             :             {
      74             :                 // append an invisible outline for the cases where no visible content exists
      75          87 :                 Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect());
      76             :                 // Hack for calc, transform position of object according
      77             :                 // to current zoom so as objects relative position to grid
      78             :                 // appears stable
      79          87 :                 aCurrentBoundRect += GetSdrObjGroup().GetGridOffset();
      80             :                 const basegfx::B2DRange aCurrentRange(
      81         174 :                     aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
      82         261 :                     aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
      83             : 
      84             :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
      85             :                     drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
      86          87 :                         false, aCurrentRange));
      87             : 
      88          87 :                 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
      89             :             }
      90             : 
      91        5631 :             return xRetval;
      92             :         }
      93             :     } // end of namespace contact
      94             : } // end of namespace sdr
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11