fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / sdr / contact / viewobjectcontactofsdrobj.cxx
blob77c97cd431d0a35527384f8e02c95f26bb6536cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
29 #include "fmobj.hxx"
31 //////////////////////////////////////////////////////////////////////////////
33 namespace sdr
35 namespace contact
37 const SdrObject& ViewObjectContactOfSdrObj::getSdrObject() const
39 return static_cast< ViewContactOfSdrObj& >(GetViewContact()).GetSdrObject();
42 ViewObjectContactOfSdrObj::ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
43 : ViewObjectContact(rObjectContact, rViewContact)
47 ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj()
51 bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
53 return aLayers.IsSet(getSdrObject().GetLayer());
56 bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
58 const SdrObject& rObject = getSdrObject();
60 // Test layer visibility
61 if(!isPrimitiveVisibleOnAnyLayer(rDisplayInfo.GetProcessLayers()))
63 return false;
66 if(GetObjectContact().isOutputToPrinter() )
68 // Test if print output but not printable
69 if( !rObject.IsPrintable())
70 return false;
72 else
74 // test is object is not visible on screen
75 if( !rObject.IsVisible() )
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());
94 const bool bHideFormControl(rSdrView.getHideFormControl());
96 if(bHideOle || bHideChart || bHideDraw || bHideFormControl)
98 if(OBJ_OLE2 == rObject.GetObjIdentifier())
100 if(((SdrOle2Obj&)rObject).IsChart())
102 // chart
103 if(bHideChart)
105 return false;
108 else
110 // OLE
111 if(bHideOle)
113 return false;
117 else if(OBJ_GRAF == rObject.GetObjIdentifier())
119 // graphic handled like OLE
120 if(bHideOle)
122 return false;
125 else
127 const bool bIsFormControl = dynamic_cast< const FmFormObj * >( &rObject ) != 0;
128 if(bIsFormControl && bHideFormControl)
130 return false;
132 // any other draw object
133 if(!bIsFormControl && bHideDraw)
135 return false;
141 return true;
143 } // end of namespace contact
144 } // end of namespace sdr
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */