Update ooo320-m1
[ooovba.git] / svx / source / sdr / contact / viewobjectcontactofsdrobj.cxx
blob21b544a91de194f68a663516407ef8d3b9d7008d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewobjectcontactofsdrobj.cxx,v $
11 * $Revision: 1.2 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_svx.hxx"
35 #include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
36 #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
37 #include <svx/sdr/contact/objectcontact.hxx>
38 #include <svx/sdr/contact/displayinfo.hxx>
39 #include <svx/svdobj.hxx>
40 #include <svx/svdoole2.hxx>
41 #include <svx/svdview.hxx>
43 //////////////////////////////////////////////////////////////////////////////
45 namespace sdr
47 namespace contact
49 const SdrObject& ViewObjectContactOfSdrObj::getSdrObject() const
51 return static_cast< ViewContactOfSdrObj& >(GetViewContact()).GetSdrObject();
54 ViewObjectContactOfSdrObj::ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
55 : ViewObjectContact(rObjectContact, rViewContact)
59 ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj()
63 bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
65 const SdrObject& rObject = getSdrObject();
67 // Test layer visibility
68 if(!rDisplayInfo.GetProcessLayers().IsSet(rObject.GetLayer()))
70 return false;
73 // Test if print output but not printable
74 if(GetObjectContact().isOutputToPrinter() && !rObject.IsPrintable())
76 return false;
79 // Test for hidden object on MasterPage
80 if(rDisplayInfo.GetSubContentActive() && rObject.IsNotVisibleAsMaster())
82 return false;
85 // Test for Calc object hiding (for OLE and Graphic it's extra, see there)
86 const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
88 if(pSdrPageView)
90 const SdrView& rSdrView = pSdrPageView->GetView();
91 const bool bHideOle(rSdrView.getHideOle());
92 const bool bHideChart(rSdrView.getHideChart());
93 const bool bHideDraw(rSdrView.getHideDraw());
95 if(bHideOle || bHideChart || bHideDraw)
97 if(OBJ_OLE2 == rObject.GetObjIdentifier())
99 if(((SdrOle2Obj&)rObject).IsChart())
101 // chart
102 if(bHideChart)
104 return false;
107 else
109 // OLE
110 if(bHideOle)
112 return false;
116 else if(OBJ_GRAF == rObject.GetObjIdentifier())
118 // graphic handled like OLE
119 if(bHideOle)
121 return false;
124 else
126 // any other draw object
127 if(bHideDraw)
129 return false;
135 return true;
137 } // end of namespace contact
138 } // end of namespace sdr
140 //////////////////////////////////////////////////////////////////////////////
141 // eof