LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/sdr/contact - viewobjectcontactofsdrobj.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 44 61.4 %
Date: 2013-07-09 Functions: 8 8 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/viewobjectcontactofsdrobj.hxx>
      22             : #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
      23             : #include <svx/sdr/contact/objectcontact.hxx>
      24             : #include <svx/sdr/contact/displayinfo.hxx>
      25             : #include <svx/svdobj.hxx>
      26             : #include <svx/svdoole2.hxx>
      27             : #include <svx/svdview.hxx>
      28             : 
      29             : #include "fmobj.hxx"
      30             : 
      31             : //////////////////////////////////////////////////////////////////////////////
      32             : 
      33             : namespace sdr
      34             : {
      35             :     namespace contact
      36             :     {
      37       71288 :         const SdrObject& ViewObjectContactOfSdrObj::getSdrObject() const
      38             :         {
      39       71288 :             return static_cast< ViewContactOfSdrObj& >(GetViewContact()).GetSdrObject();
      40             :         }
      41             : 
      42       20444 :         ViewObjectContactOfSdrObj::ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
      43       20444 :         :   ViewObjectContact(rObjectContact, rViewContact)
      44             :         {
      45       20444 :         }
      46             : 
      47       33217 :         ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj()
      48             :         {
      49       33217 :         }
      50             : 
      51       27374 :         bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
      52             :         {
      53       27374 :             return aLayers.IsSet(getSdrObject().GetLayer());
      54             :         }
      55             : 
      56       35637 :         bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
      57             :         {
      58       35637 :             const SdrObject& rObject = getSdrObject();
      59             : 
      60             :             // Test layer visibility
      61       35637 :             if(!isPrimitiveVisibleOnAnyLayer(rDisplayInfo.GetProcessLayers()))
      62             :             {
      63        9325 :                 return false;
      64             :             }
      65             : 
      66       26312 :             if(GetObjectContact().isOutputToPrinter() )
      67             :             {
      68             :                 // Test if print output but not printable
      69           0 :                 if( !rObject.IsPrintable())
      70           0 :                     return false;
      71             :             }
      72             :             else
      73             :             {
      74             :                 // test is object is not visible on screen
      75       26312 :                 if( !rObject.IsVisible() )
      76           0 :                     return false;
      77             :             }
      78             : 
      79             :             // Test for hidden object on MasterPage
      80       26312 :             if(rDisplayInfo.GetSubContentActive() && rObject.IsNotVisibleAsMaster())
      81             :             {
      82         142 :                 return false;
      83             :             }
      84             : 
      85             :             // Test for Calc object hiding (for OLE and Graphic it's extra, see there)
      86       26170 :             const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
      87             : 
      88       26170 :             if(pSdrPageView)
      89             :             {
      90       26111 :                 const SdrView& rSdrView = pSdrPageView->GetView();
      91       26111 :                 const bool bHideOle(rSdrView.getHideOle());
      92       26111 :                 const bool bHideChart(rSdrView.getHideChart());
      93       26111 :                 const bool bHideDraw(rSdrView.getHideDraw());
      94       26111 :                 const bool bHideFormControl(rSdrView.getHideFormControl());
      95             : 
      96       26111 :                 if(bHideOle || bHideChart || bHideDraw || bHideFormControl)
      97             :                 {
      98           0 :                     if(OBJ_OLE2 == rObject.GetObjIdentifier())
      99             :                     {
     100           0 :                         if(((SdrOle2Obj&)rObject).IsChart())
     101             :                         {
     102             :                             // chart
     103           0 :                             if(bHideChart)
     104             :                             {
     105           0 :                                 return false;
     106             :                             }
     107             :                         }
     108             :                         else
     109             :                         {
     110             :                             // OLE
     111           0 :                             if(bHideOle)
     112             :                             {
     113           0 :                                 return false;
     114             :                             }
     115             :                         }
     116             :                     }
     117           0 :                     else if(OBJ_GRAF == rObject.GetObjIdentifier())
     118             :                     {
     119             :                         // graphic handled like OLE
     120           0 :                         if(bHideOle)
     121             :                         {
     122           0 :                             return false;
     123             :                         }
     124             :                     }
     125             :                     else
     126             :                     {
     127           0 :                         const bool bIsFormControl = dynamic_cast< const FmFormObj * >( &rObject ) != 0;
     128           0 :                         if(bIsFormControl && bHideFormControl)
     129             :                         {
     130           0 :                             return false;
     131             :                         }
     132             :                         // any other draw object
     133           0 :                         if(!bIsFormControl && bHideDraw)
     134             :                         {
     135           0 :                             return false;
     136             :                         }
     137             :                     }
     138             :                 }
     139             :             }
     140             : 
     141       26170 :             return true;
     142             :         }
     143             :     } // end of namespace contact
     144         258 : } // end of namespace sdr
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10