LibreOffice Module svx (master)  1
viewobjectcontactofgroup.cxx
Go to the documentation of this file.
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 
28 #include <svx/svdobj.hxx>
29 #include <vcl/outdev.hxx>
30 
31 
32 using namespace com::sun::star;
33 
34 
35 namespace sdr::contact
36 {
37  ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
38  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
39  {
40  }
41 
43  {
44  }
45 
47  {
49 
50  // check model-view visibility
51  if(isPrimitiveVisible(rDisplayInfo))
52  {
53  const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
54 
55  if(nSubHierarchyCount)
56  {
57  const bool bDoGhostedDisplaying(
58  GetObjectContact().DoVisualizeEnteredGroup()
59  && !GetObjectContact().isOutputToPrinter()
60  && GetObjectContact().getActiveViewContact() == &GetViewContact());
61 
62  if(bDoGhostedDisplaying)
63  {
64  rDisplayInfo.ClearGhostedDrawMode();
65  }
66 
67  // create object hierarchy
68  xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
69 
70  if(!xRetval.empty())
71  {
72  // get ranges
73  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
74  const ::basegfx::B2DRange aObjectRange(xRetval.getB2DRange(rViewInformation2D));
75  const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
76 
77  // check geometrical visibility
78  if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
79  {
80  // not visible, release
81  xRetval.clear();
82  }
83  }
84 
85  if(bDoGhostedDisplaying)
86  {
87  rDisplayInfo.SetGhostedDrawMode();
88  }
89  }
90  else
91  {
92  // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
93  // which creates the replacement primitives for an empty group
95  }
96  }
97  return xRetval;
98  }
99 
101  {
102  SdrLayerIDSet aObjectLayers;
104  aObjectLayers &= aLayers;
105  return !aObjectLayers.IsEmpty();
106  }
107 
108 } // end of namespace
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo) const override
const basegfx::B2DRange & getViewport() const
virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet &aLayers) const override
Test whether the primitive is visible on any layer from aLayers.
virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo) const
bool IsEmpty() const
Definition: svdlayer.cxx:27
drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceSubHierarchy(DisplayInfo &rDisplayInfo) const
void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet &rSet) const
Definition: svdobj.cxx:606
ObjectContact & GetObjectContact() const
ViewContact & GetViewContact() const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override