Update ooo320-m1
[ooovba.git] / svx / source / sdr / contact / viewobjectcontactofe3d.cxx
blobc59072c31d68ea0ba8f9a125d6c501b2706a8dd4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewobjectcontactofe3d.cxx,v $
11 * $Revision: 1.2 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_svx.hxx"
35 #include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
36 #include <svx/sdr/contact/viewcontactofe3d.hxx>
37 #include <basegfx/color/bcolor.hxx>
38 #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
39 #include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
40 #include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
41 #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
42 #include <drawinglayer/attribute/sdrattribute3d.hxx>
44 //////////////////////////////////////////////////////////////////////////////
45 // predeclarations
47 //////////////////////////////////////////////////////////////////////////////
49 namespace sdr
51 namespace contact
53 ViewObjectContactOfE3d::ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact)
54 : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
58 ViewObjectContactOfE3d::~ViewObjectContactOfE3d()
62 drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
64 // get the view-independent Primitive from the viewContact
65 const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< const ViewContactOfE3d& >(GetViewContact()));
66 drawinglayer::primitive3d::Primitive3DSequence xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence());
68 // handle ghosted
69 if(isPrimitiveGhosted(rDisplayInfo))
71 const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
72 const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
73 const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::ModifiedColorPrimitive3D(xRetval, aBColorModifier));
74 xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
77 return xRetval;
80 drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
82 const ViewContactOfE3d& rViewContact = static_cast< const ViewContactOfE3d& >(GetViewContact());
84 // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
85 return rViewContact.impCreateWithGivenPrimitive3DSequence(getPrimitive3DSequence(rDisplayInfo));
88 drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::getPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
90 drawinglayer::primitive3d::Primitive3DSequence xNewPrimitive3DSeq(createPrimitive3DSequence(rDisplayInfo));
92 // local up-to-date checks. New list different from local one?
93 if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxPrimitive3DSequence, xNewPrimitive3DSeq))
95 // has changed, copy content
96 const_cast< ViewObjectContactOfE3d* >(this)->mxPrimitive3DSequence = xNewPrimitive3DSeq;
99 // return current Primitive2DSequence
100 return mxPrimitive3DSequence;
102 } // end of namespace contact
103 } // end of namespace sdr
105 //////////////////////////////////////////////////////////////////////////////
106 // eof