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

Generated by: LCOV version 1.10