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 <sdr/contact/viewcontactofgroup.hxx>
21 : #include <svx/svdogrp.hxx>
22 : #include <svx/svdpage.hxx>
23 : #include <svx/sdr/contact/viewobjectcontact.hxx>
24 : #include <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 5154 : ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
40 : {
41 5154 : ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this);
42 : DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)");
43 :
44 5154 : return *pRetval;
45 : }
46 :
47 23327 : ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup)
48 23327 : : ViewContactOfSdrObj(rGroup)
49 : {
50 23327 : }
51 :
52 45396 : ViewContactOfGroup::~ViewContactOfGroup()
53 : {
54 45396 : }
55 :
56 7398 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const
57 : {
58 7398 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
59 7398 : const sal_uInt32 nObjectCount(GetObjectCount());
60 :
61 7398 : if(nObjectCount)
62 : {
63 : // collect all sub-primitives
64 25255 : for(sal_uInt32 a(0); a < nObjectCount; a++)
65 : {
66 17931 : const ViewContact& rCandidate(GetViewContact(a));
67 17931 : const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
68 :
69 17931 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
70 17931 : }
71 : }
72 : else
73 : {
74 : // append an invisible outline for the cases where no visible content exists
75 74 : 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 74 : aCurrentBoundRect += GetSdrObjGroup().GetGridOffset();
80 : const basegfx::B2DRange aCurrentRange(
81 148 : aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
82 222 : aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
83 :
84 : const drawinglayer::primitive2d::Primitive2DReference xReference(
85 : drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
86 74 : false, aCurrentRange));
87 :
88 74 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
89 : }
90 :
91 7398 : return xRetval;
92 : }
93 : } // end of namespace contact
94 651 : } // end of namespace sdr
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|