Line data Source code
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 : #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>
30 :
31 : //////////////////////////////////////////////////////////////////////////////
32 :
33 : namespace sdr
34 : {
35 : namespace contact
36 : {
37 : // Create a Object-Specific ViewObjectContact, set ViewContact and
38 : // ObjectContact. Always needs to return something.
39 5 : ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
40 : {
41 5 : ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this);
42 : DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)");
43 :
44 5 : return *pRetval;
45 : }
46 :
47 1291 : ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup)
48 1291 : : ViewContactOfSdrObj(rGroup)
49 : {
50 1291 : }
51 :
52 2576 : ViewContactOfGroup::~ViewContactOfGroup()
53 : {
54 2576 : }
55 :
56 0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const
57 : {
58 0 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
59 0 : const sal_uInt32 nObjectCount(GetObjectCount());
60 :
61 0 : if(nObjectCount)
62 : {
63 : // collect all sub-primitives
64 0 : for(sal_uInt32 a(0); a < nObjectCount; a++)
65 : {
66 0 : const ViewContact& rCandidate(GetViewContact(a));
67 0 : const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
68 :
69 0 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
70 0 : }
71 : }
72 : else
73 : {
74 : // append an invisible outline for the cases where no visible content exists
75 0 : 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 0 : aCurrentBoundRect += GetSdrObjGroup().GetGridOffset();
80 : const basegfx::B2DRange aCurrentRange(
81 0 : aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
82 0 : aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
83 :
84 : const drawinglayer::primitive2d::Primitive2DReference xReference(
85 : drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
86 0 : false, aCurrentRange));
87 :
88 0 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
89 : }
90 :
91 0 : return xRetval;
92 : }
93 : } // end of namespace contact
94 : } // end of namespace sdr
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|