LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofsdrobj.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 34 51 66.7 %
Date: 2014-04-11 Functions: 7 7 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/sdr/contact/objectcontactofpageview.hxx>
      26             : #include <svx/sdrpagewindow.hxx>
      27             : #include <svx/sdrpaintwindow.hxx>
      28             : #include <svx/svdobj.hxx>
      29             : #include <svx/svdoole2.hxx>
      30             : #include <svx/svdview.hxx>
      31             : #include <vcl/outdev.hxx>
      32             : 
      33             : #include "fmobj.hxx"
      34             : 
      35             : 
      36             : 
      37             : namespace sdr
      38             : {
      39             :     namespace contact
      40             :     {
      41       88902 :         const SdrObject& ViewObjectContactOfSdrObj::getSdrObject() const
      42             :         {
      43       88902 :             return static_cast< ViewContactOfSdrObj& >(GetViewContact()).GetSdrObject();
      44             :         }
      45             : 
      46       23605 :         ViewObjectContactOfSdrObj::ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
      47       23605 :         :   ViewObjectContact(rObjectContact, rViewContact)
      48             :         {
      49       23605 :         }
      50             : 
      51       38718 :         ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj()
      52             :         {
      53       38718 :         }
      54             : 
      55       35374 :         bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
      56             :         {
      57       35374 :             return aLayers.IsSet(getSdrObject().GetLayer());
      58             :         }
      59             : 
      60       44444 :         bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
      61             :         {
      62       44444 :             const SdrObject& rObject = getSdrObject();
      63             : 
      64             :             // Test layer visibility
      65       44444 :             if(!isPrimitiveVisibleOnAnyLayer(rDisplayInfo.GetProcessLayers()))
      66             :             {
      67       13516 :                 return false;
      68             :             }
      69             : 
      70       30928 :             if(GetObjectContact().isOutputToPrinter() )
      71             :             {
      72             :                 // Test if print output but not printable
      73           0 :                 if( !rObject.IsPrintable())
      74           0 :                     return false;
      75             :             }
      76             :             else
      77             :             {
      78             :                 // test is object is not visible on screen
      79       30928 :                 if( !rObject.IsVisible() )
      80           0 :                     return false;
      81             :             }
      82             : 
      83             :             // Test for hidden object on MasterPage
      84       30928 :             if(rDisplayInfo.GetSubContentActive() && rObject.IsNotVisibleAsMaster())
      85             :             {
      86         130 :                 return false;
      87             :             }
      88             : 
      89             :             // Test for Calc object hiding (for OLE and Graphic it's extra, see there)
      90       30798 :             const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
      91             : 
      92       30798 :             if(pSdrPageView)
      93             :             {
      94       30084 :                 const SdrView& rSdrView = pSdrPageView->GetView();
      95       30084 :                 const bool bHideOle(rSdrView.getHideOle());
      96       30084 :                 const bool bHideChart(rSdrView.getHideChart());
      97       30084 :                 const bool bHideDraw(rSdrView.getHideDraw());
      98       30084 :                 const bool bHideFormControl(rSdrView.getHideFormControl());
      99             : 
     100       30084 :                 if(bHideOle || bHideChart || bHideDraw || bHideFormControl)
     101             :                 {
     102           0 :                     if(OBJ_OLE2 == rObject.GetObjIdentifier())
     103             :                     {
     104           0 :                         if(((SdrOle2Obj&)rObject).IsChart())
     105             :                         {
     106             :                             // chart
     107           0 :                             if(bHideChart)
     108             :                             {
     109           0 :                                 return false;
     110             :                             }
     111             :                         }
     112             :                         else
     113             :                         {
     114             :                             // OLE
     115           0 :                             if(bHideOle)
     116             :                             {
     117           0 :                                 return false;
     118             :                             }
     119             :                         }
     120             :                     }
     121           0 :                     else if(OBJ_GRAF == rObject.GetObjIdentifier())
     122             :                     {
     123             :                         // graphic handled like OLE
     124           0 :                         if(bHideOle)
     125             :                         {
     126           0 :                             return false;
     127             :                         }
     128             :                     }
     129             :                     else
     130             :                     {
     131           0 :                         const bool bIsFormControl = dynamic_cast< const FmFormObj * >( &rObject ) != 0;
     132           0 :                         if(bIsFormControl && bHideFormControl)
     133             :                         {
     134           0 :                             return false;
     135             :                         }
     136             :                         // any other draw object
     137           0 :                         if(!bIsFormControl && bHideDraw)
     138             :                         {
     139           0 :                             return false;
     140             :                         }
     141             :                     }
     142             :                 }
     143             :             }
     144             : 
     145       30798 :             return true;
     146             :         }
     147             : 
     148        2744 :         boost::optional<const OutputDevice&> ViewObjectContactOfSdrObj::getPageViewOutputDevice() const
     149             :         {
     150        2744 :             ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &GetObjectContact() );
     151        2744 :             if ( pPageViewContact )
     152             :             {
     153             :                 // if the PageWindow has a patched PaintWindow, use the original PaintWindow
     154             :                 // this ensures that our control is _not_ re-created just because somebody
     155             :                 // (temporarily) changed the window to paint onto.
     156             :                 // #i72429# / 2007-02-20 / frank.schoenheit (at) sun.com
     157        2742 :                 SdrPageWindow& rPageWindow( pPageViewContact->GetPageWindow() );
     158        2742 :                 if ( rPageWindow.GetOriginalPaintWindow() )
     159        2420 :                     return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice();
     160             : 
     161         322 :                 return rPageWindow.GetPaintWindow().GetOutputDevice();
     162             :             }
     163           2 :             return boost::optional<const OutputDevice&>();
     164             :         }
     165             :     } // end of namespace contact
     166             : } // end of namespace sdr
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10