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 #include <svx/sdr/contact/viewcontactofgroup.hxx> 27 #include <svx/svdogrp.hxx> 28 #include <svx/svdpage.hxx> 29 #include <svx/sdr/contact/viewobjectcontact.hxx> 30 #include <svx/sdr/contact/viewobjectcontactofgroup.hxx> 31 #include <basegfx/polygon/b2dpolygon.hxx> 32 #include <basegfx/polygon/b2dpolygontools.hxx> 33 #include <basegfx/color/bcolor.hxx> 34 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 35 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> 36 37 ////////////////////////////////////////////////////////////////////////////// 38 39 namespace sdr 40 { 41 namespace contact 42 { 43 // Create a Object-Specific ViewObjectContact, set ViewContact and 44 // ObjectContact. Always needs to return something. 45 ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) 46 { 47 ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this); 48 DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)"); 49 50 return *pRetval; 51 } 52 53 ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup) 54 : ViewContactOfSdrObj(rGroup) 55 { 56 } 57 58 ViewContactOfGroup::~ViewContactOfGroup() 59 { 60 } 61 62 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const 63 { 64 drawinglayer::primitive2d::Primitive2DSequence xRetval; 65 const sal_uInt32 nObjectCount(GetObjectCount()); 66 67 if(nObjectCount) 68 { 69 // collect all sub-primitives 70 for(sal_uInt32 a(0); a < nObjectCount; a++) 71 { 72 const ViewContact& rCandidate(GetViewContact(a)); 73 const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence()); 74 75 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); 76 } 77 } 78 else 79 { 80 // append an invisible outline for the cases where no visible content exists 81 const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); 82 const basegfx::B2DRange aCurrentRange( 83 aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), 84 aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); 85 86 const drawinglayer::primitive2d::Primitive2DReference xReference( 87 drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( 88 false, aCurrentRange)); 89 90 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); 91 } 92 93 return xRetval; 94 } 95 } // end of namespace contact 96 } // end of namespace sdr 97 98 ////////////////////////////////////////////////////////////////////////////// 99 // eof 100