1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 #include <svx/sdr/contact/viewobjectcontactofgroup.hxx> 28 #include <svx/sdr/contact/displayinfo.hxx> 29 #include <svx/sdr/contact/objectcontact.hxx> 30 #include <basegfx/numeric/ftools.hxx> 31 #include <drawinglayer/primitive2d/groupprimitive2d.hxx> 32 #include <basegfx/tools/canvastools.hxx> 33 #include <svx/sdr/contact/viewcontact.hxx> 34 35 ////////////////////////////////////////////////////////////////////////////// 36 37 using namespace com::sun::star; 38 39 ////////////////////////////////////////////////////////////////////////////// 40 41 namespace sdr 42 { 43 namespace contact 44 { ViewObjectContactOfGroup(ObjectContact & rObjectContact,ViewContact & rViewContact)45 ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact) 46 : ViewObjectContactOfSdrObj(rObjectContact, rViewContact) 47 { 48 } 49 ~ViewObjectContactOfGroup()50 ViewObjectContactOfGroup::~ViewObjectContactOfGroup() 51 { 52 } 53 getPrimitive2DSequenceHierarchy(DisplayInfo & rDisplayInfo) const54 drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const 55 { 56 drawinglayer::primitive2d::Primitive2DSequence xRetval; 57 58 // check model-view visibility 59 if(isPrimitiveVisible(rDisplayInfo)) 60 { 61 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); 62 63 if(nSubHierarchyCount) 64 { 65 const sal_Bool bDoGhostedDisplaying( 66 GetObjectContact().DoVisualizeEnteredGroup() 67 && !GetObjectContact().isOutputToPrinter() 68 && GetObjectContact().getActiveViewContact() == &GetViewContact()); 69 70 if(bDoGhostedDisplaying) 71 { 72 rDisplayInfo.ClearGhostedDrawMode(); 73 } 74 75 // create object hierarchy 76 xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo); 77 78 if(xRetval.hasElements()) 79 { 80 // get ranges 81 const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); 82 const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); 83 const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); 84 85 // check geometrical visibility 86 if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) 87 { 88 // not visible, release 89 xRetval.realloc(0); 90 } 91 } 92 93 if(bDoGhostedDisplaying) 94 { 95 rDisplayInfo.SetGhostedDrawMode(); 96 } 97 } 98 else 99 { 100 // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence 101 // which creates the replacement primitives for an empty group 102 xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo); 103 } 104 } 105 return xRetval; 106 } 107 } // end of namespace contact 108 } // end of namespace sdr 109 110 ////////////////////////////////////////////////////////////////////////////// 111 // eof 112