fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / sdr / contact / viewcontactofgroup.cxx
blobce1e92373064acb743f9474d3ca5e0c5b76582bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/sdr/contact/viewcontactofgroup.hxx>
21 #include <svx/svdogrp.hxx>
22 #include <svx/svdpage.hxx>
23 #include <svx/sdr/contact/viewobjectcontact.hxx>
24 #include <svx/sdr/contact/viewobjectcontactofgroup.hxx>
25 #include <basegfx/polygon/b2dpolygon.hxx>
26 #include <basegfx/polygon/b2dpolygontools.hxx>
27 #include <basegfx/color/bcolor.hxx>
28 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
29 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
31 //////////////////////////////////////////////////////////////////////////////
33 namespace sdr
35 namespace contact
37 // Create a Object-Specific ViewObjectContact, set ViewContact and
38 // ObjectContact. Always needs to return something.
39 ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
41 ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this);
42 DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)");
44 return *pRetval;
47 ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup)
48 : ViewContactOfSdrObj(rGroup)
52 ViewContactOfGroup::~ViewContactOfGroup()
56 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const
58 drawinglayer::primitive2d::Primitive2DSequence xRetval;
59 const sal_uInt32 nObjectCount(GetObjectCount());
61 if(nObjectCount)
63 // collect all sub-primitives
64 for(sal_uInt32 a(0); a < nObjectCount; a++)
66 const ViewContact& rCandidate(GetViewContact(a));
67 const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
69 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
72 else
74 // append an invisible outline for the cases where no visible content exists
75 Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect());
76 // Hack for calc, transform position of object according
77 // to current zoom so as objects relative position to grid
78 // appears stable
79 aCurrentBoundRect += GetSdrObjGroup().GetGridOffset();
80 const basegfx::B2DRange aCurrentRange(
81 aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
82 aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
84 const drawinglayer::primitive2d::Primitive2DReference xReference(
85 drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
86 false, aCurrentRange));
88 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
91 return xRetval;
93 } // end of namespace contact
94 } // end of namespace sdr
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */