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
36 {
37  namespace contact
38  {
39  ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
40  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
41  {
42  }
43 
45  {
46  }
47 
49  {
51 
52  // check model-view visibility
53  if(isPrimitiveVisible(rDisplayInfo))
54  {
55  const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
56 
57  if(nSubHierarchyCount)
58  {
59  const bool bDoGhostedDisplaying(
60  GetObjectContact().DoVisualizeEnteredGroup()
61  && !GetObjectContact().isOutputToPrinter()
62  && GetObjectContact().getActiveViewContact() == &GetViewContact());
63 
64  if(bDoGhostedDisplaying)
65  {
66  rDisplayInfo.ClearGhostedDrawMode();
67  }
68 
69  // create object hierarchy
70  xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
71 
72  if(!xRetval.empty())
73  {
74  // get ranges
75  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
76  const ::basegfx::B2DRange aObjectRange(xRetval.getB2DRange(rViewInformation2D));
77  const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
78 
79  // check geometrical visibility
80  if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
81  {
82  // not visible, release
83  xRetval.clear();
84  }
85  }
86 
87  if(bDoGhostedDisplaying)
88  {
89  rDisplayInfo.SetGhostedDrawMode();
90  }
91  }
92  else
93  {
94  // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
95  // which creates the replacement primitives for an empty group
97  }
98  }
99  return xRetval;
100  }
101 
103  {
104  SdrLayerIDSet aObjectLayers;
106  aObjectLayers &= aLayers;
107  return !aObjectLayers.IsEmpty();
108  }
109  } // end of namespace contact
110 } // end of namespace sdr
111 
112 /* 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:609
ObjectContact & GetObjectContact() const
ViewContact & GetViewContact() const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override