LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofe3dscene.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 37 73.0 %
Date: 2012-08-25 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 18 60 30.0 %

           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/viewobjectcontactofe3dscene.hxx>
      22                 :            : #include <svx/sdr/contact/displayinfo.hxx>
      23                 :            : #include <svx/sdr/contact/objectcontact.hxx>
      24                 :            : #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
      25                 :            : #include <basegfx/matrix/b3dhommatrix.hxx>
      26                 :            : #include <drawinglayer/primitive3d/transformprimitive3d.hxx>
      27                 :            : #include <basegfx/color/bcolormodifier.hxx>
      28                 :            : #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
      29                 :            : #include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
      30                 :            : #include <basegfx/tools/canvastools.hxx>
      31                 :            : 
      32                 :            : //////////////////////////////////////////////////////////////////////////////
      33                 :            : 
      34                 :            : using namespace com::sun::star;
      35                 :            : 
      36                 :            : //////////////////////////////////////////////////////////////////////////////
      37                 :            : 
      38                 :            : namespace
      39                 :            : {
      40                 :            :     // Helper method to recursively travel the DrawHierarchy for 3D objects contained in
      41                 :            :     // the 2D Scene. This will chreate all VOCs for the currenbt OC which are needed
      42                 :            :     // for ActionChanged() functionality
      43                 :        872 :     void impInternalSubHierarchyTraveller(const sdr::contact::ViewObjectContact& rVOC)
      44                 :            :     {
      45                 :        872 :         const sdr::contact::ViewContact& rVC = rVOC.GetViewContact();
      46                 :        872 :         const sal_uInt32 nSubHierarchyCount(rVC.GetObjectCount());
      47                 :            : 
      48         [ +  + ]:       1729 :         for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
      49                 :            :         {
      50                 :        857 :             const sdr::contact::ViewObjectContact& rCandidate(rVC.GetViewContact(a).GetViewObjectContact(rVOC.GetObjectContact()));
      51                 :        857 :             impInternalSubHierarchyTraveller(rCandidate);
      52                 :            :         }
      53                 :        872 :     }
      54                 :            : } // end of anonymous namespace
      55                 :            : 
      56                 :            : //////////////////////////////////////////////////////////////////////////////
      57                 :            : 
      58                 :            : namespace sdr
      59                 :            : {
      60                 :            :     namespace contact
      61                 :            :     {
      62                 :        335 :         ViewObjectContactOfE3dScene::ViewObjectContactOfE3dScene(ObjectContact& rObjectContact, ViewContact& rViewContact)
      63                 :        335 :         :   ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
      64                 :            :         {
      65                 :        335 :         }
      66                 :            : 
      67                 :        335 :         ViewObjectContactOfE3dScene::~ViewObjectContactOfE3dScene()
      68                 :            :         {
      69         [ -  + ]:        670 :         }
      70                 :            : 
      71                 :         15 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3dScene::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
      72                 :            :         {
      73                 :            :             // handle ghosted, else the whole 3d group will be encapsulated to a ghosted primitive set (see below)
      74 [ +  - ][ +  - ]:         15 :             const bool bHandleGhostedDisplay(GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
                 [ -  + ]
      75 [ -  + ][ #  # ]:         15 :             const bool bIsActiveVC(bHandleGhostedDisplay && GetObjectContact().getActiveViewContact() == &GetViewContact());
      76                 :            : 
      77         [ -  + ]:         15 :             if(bIsActiveVC)
      78                 :            :             {
      79                 :            :                 // switch off ghosted, display contents normal
      80                 :          0 :                 const_cast< DisplayInfo& >(rDisplayInfo).ClearGhostedDrawMode();
      81                 :            :             }
      82                 :            : 
      83                 :            :             // create 2d primitive with content, use layer visibility test
      84                 :            :             // this uses no ghosted mode, so scenes in scenes and entering them will not
      85                 :            :             // support ghosted for now. This is no problem currently but would need to be
      86                 :            :             // added when sub-groups in 3d will be added one day.
      87         [ +  - ]:         15 :             const ViewContactOfE3dScene& rViewContact = dynamic_cast< ViewContactOfE3dScene& >(GetViewContact());
      88                 :         15 :             const SetOfByte& rVisibleLayers = rDisplayInfo.GetProcessLayers();
      89                 :         15 :             drawinglayer::primitive2d::Primitive2DSequence xRetval(rViewContact.createScenePrimitive2DSequence(&rVisibleLayers));
      90                 :            : 
      91         [ +  - ]:         15 :             if(xRetval.hasElements())
      92                 :            :             {
      93                 :            :                 // handle GluePoint
      94 [ +  - ][ +  - ]:         15 :                 if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible())
         [ +  - ][ -  + ]
                 [ -  + ]
      95                 :            :                 {
      96         [ #  # ]:          0 :                     const drawinglayer::primitive2d::Primitive2DSequence xGlue(GetViewContact().createGluePointPrimitive2DSequence());
      97                 :            : 
      98         [ #  # ]:          0 :                     if(xGlue.hasElements())
      99                 :            :                     {
     100         [ #  # ]:          0 :                         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xGlue);
     101         [ #  # ]:          0 :                     }
     102                 :            :                 }
     103                 :            : 
     104                 :            :                 // handle ghosted
     105 [ +  - ][ -  + ]:         15 :                 if(isPrimitiveGhosted(rDisplayInfo))
     106                 :            :                 {
     107                 :          0 :                     const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
     108                 :          0 :                     const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
     109 [ #  # ][ #  # ]:          0 :                     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier));
                 [ #  # ]
     110                 :            : 
     111 [ #  # ][ #  # ]:          0 :                     xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
         [ #  # ][ #  # ]
     112                 :            :                 }
     113                 :            :             }
     114                 :            : 
     115         [ -  + ]:         15 :             if(bIsActiveVC)
     116                 :            :             {
     117                 :            :                 // set back, display ghosted again
     118         [ #  # ]:          0 :                 const_cast< DisplayInfo& >(rDisplayInfo).SetGhostedDrawMode();
     119                 :            :             }
     120                 :            : 
     121                 :         15 :             return xRetval;
     122                 :            :         }
     123                 :            : 
     124                 :         15 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3dScene::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
     125                 :            :         {
     126                 :            :             // To get the VOCs for the contained 3D objects created to get the correct
     127                 :            :             // Draw hierarchy and ActionChanged() working properly, travel the DrawHierarchy
     128                 :            :             // using a local tooling method
     129                 :         15 :             impInternalSubHierarchyTraveller(*this);
     130                 :            : 
     131                 :            :             // call parent
     132                 :         15 :             return ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
     133                 :            :         }
     134                 :            :     } // end of namespace contact
     135                 :            : } // end of namespace sdr
     136                 :            : 
     137                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10