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 
25 #include <svx/svdobj.hxx>
26 
27 
28 using namespace com::sun::star;
29 
30 
31 namespace sdr::contact
32 {
33  ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
34  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
35  {
36  }
37 
39  {
40  }
41 
43  {
45 
46  // check model-view visibility
47  if(isPrimitiveVisible(rDisplayInfo))
48  {
49  const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
50 
51  if(nSubHierarchyCount)
52  {
53  const bool bDoGhostedDisplaying(
54  GetObjectContact().DoVisualizeEnteredGroup()
55  && !GetObjectContact().isOutputToPrinter()
56  && GetObjectContact().getActiveViewContact() == &GetViewContact());
57 
58  if(bDoGhostedDisplaying)
59  {
60  rDisplayInfo.ClearGhostedDrawMode();
61  }
62 
63  // create object hierarchy
64  xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
65 
66  if(!xRetval.empty())
67  {
68  // get ranges
69  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
70  const ::basegfx::B2DRange aObjectRange(xRetval.getB2DRange(rViewInformation2D));
71  const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
72 
73  // check geometrical visibility
74  if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
75  {
76  // not visible, release
77  xRetval.clear();
78  }
79  }
80 
81  if(bDoGhostedDisplaying)
82  {
83  rDisplayInfo.SetGhostedDrawMode();
84  }
85  }
86  else
87  {
88  // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
89  // which creates the replacement primitives for an empty group
91  }
92  }
93  return xRetval;
94  }
95 
97  {
98  SdrLayerIDSet aObjectLayers;
100  aObjectLayers &= aLayers;
101  return !aObjectLayers.IsEmpty();
102  }
103 
104 } // end of namespace
105 
106 /* 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:25
drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceSubHierarchy(DisplayInfo &rDisplayInfo) const
void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet &rSet) const
Definition: svdobj.cxx:582
ObjectContact & GetObjectContact() const
ViewContact & GetViewContact() const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override