summaryrefslogtreecommitdiff
path: root/binfilter/bf_svx/source/engine3d
diff options
context:
space:
mode:
Diffstat (limited to 'binfilter/bf_svx/source/engine3d')
-rw-r--r--binfilter/bf_svx/source/engine3d/makefile.mk77
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_camera3d.cxx393
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_class3d.cxx103
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_cube3d.cxx336
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_deflt3d.cxx93
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_dlight3d.cxx190
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_e3dcmpt.cxx61
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_extrud3d.cxx700
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_float3d.cxx62
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_float3d.src110
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_label3d.cxx220
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_lathe3d.cxx954
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_light3d.cxx317
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_obj3d.cxx2969
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_objfac3d.cxx143
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_plight3d.cxx133
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_pntobj3d.cxx174
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_poly3d.cxx1958
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_polygn3d.cxx426
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_polyob3d.cxx666
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_polysc3d.cxx135
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_scene3d.cxx1447
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_sphere3d.cxx703
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_svx3ditems.cxx531
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_view3d.cxx249
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_viewpt3d.cxx565
-rw-r--r--binfilter/bf_svx/source/engine3d/svx_volume3d.cxx152
27 files changed, 13867 insertions, 0 deletions
diff --git a/binfilter/bf_svx/source/engine3d/makefile.mk b/binfilter/bf_svx/source/engine3d/makefile.mk
new file mode 100644
index 000000000000..03b7fcec76c9
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..
+BFPRJ=..$/..
+
+PRJNAME=binfilter
+TARGET=svx_engine3d
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(BFPRJ)$/util$/makefile.pmk
+INC+= -I$(PRJ)$/inc$/bf_svx
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=svx_engine3d
+SRC1FILES=\
+ svx_float3d.src
+
+SLOFILES= \
+ $(SLO)$/svx_svx3ditems.obj \
+ $(SLO)$/svx_deflt3d.obj \
+ $(SLO)$/svx_class3d.obj \
+ $(SLO)$/svx_volume3d.obj \
+ $(SLO)$/svx_viewpt3d.obj \
+ $(SLO)$/svx_camera3d.obj \
+ $(SLO)$/svx_poly3d.obj \
+ $(SLO)$/svx_polygn3d.obj \
+ $(SLO)$/svx_objfac3d.obj \
+ $(SLO)$/svx_obj3d.obj \
+ $(SLO)$/svx_light3d.obj \
+ $(SLO)$/svx_dlight3d.obj \
+ $(SLO)$/svx_plight3d.obj \
+ $(SLO)$/svx_pntobj3d.obj \
+ $(SLO)$/svx_polyob3d.obj \
+ $(SLO)$/svx_scene3d.obj \
+ $(SLO)$/svx_polysc3d.obj \
+ $(SLO)$/svx_cube3d.obj \
+ $(SLO)$/svx_sphere3d.obj \
+ $(SLO)$/svx_extrud3d.obj \
+ $(SLO)$/svx_lathe3d.obj \
+ $(SLO)$/svx_label3d.obj \
+ $(SLO)$/svx_view3d.obj \
+ $(SLO)$/svx_e3dcmpt.obj
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_svx/source/engine3d/svx_camera3d.cxx b/binfilter/bf_svx/source/engine3d/svx_camera3d.cxx
new file mode 100644
index 000000000000..193434037740
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_camera3d.cxx
@@ -0,0 +1,393 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "camera3d.hxx"
+
+
+#include <svdio.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ Camera3D::Camera3D(const Vector3D& rPos, const Vector3D& rLookAt,
+/*N*/ double fFocalLen, double fBankAng) :
+/*N*/ aResetPos(rPos),
+/*N*/ aResetLookAt(rLookAt),
+/*N*/ fResetFocalLength(fFocalLen),
+/*N*/ fResetBankAngle(fBankAng),
+/*N*/ fBankAngle(fBankAng),
+/*N*/ bAutoAdjustProjection(TRUE)
+/*N*/ {
+/*N*/ SetVPD(0);
+/*N*/ SetPosition(rPos);
+/*N*/ SetLookAt(rLookAt);
+/*N*/ SetFocalLength(fFocalLen);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Default-Konstruktor
+|*
+\************************************************************************/
+
+/*?*/ Camera3D::Camera3D()
+/*?*/ {
+/*?*/ Vector3D aVector3D(0,0,1);
+/*?*/ Camera3D(aVector3D, Vector3D());
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::Reset()
+/*N*/ {
+/*N*/ SetVPD(0);
+/*N*/ fBankAngle = fResetBankAngle;
+/*N*/ SetPosition(aResetPos);
+/*N*/ SetLookAt(aResetLookAt);
+/*N*/ SetFocalLength(fResetFocalLength);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Defaultwerte fuer Reset setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetDefaults(const Vector3D& rPos, const Vector3D& rLookAt,
+/*N*/ double fFocalLen, double fBankAng)
+/*N*/ {
+/*N*/ aResetPos = rPos;
+/*N*/ aResetLookAt = rLookAt;
+/*N*/ fResetFocalLength = fFocalLen;
+/*N*/ fResetBankAngle = fBankAng;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ViewWindow setzen und PRP anpassen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetViewWindow(double fX, double fY, double fW, double fH)
+/*N*/ {
+/*N*/ Viewport3D::SetViewWindow(fX, fY, fW, fH);
+/*N*/ if ( bAutoAdjustProjection )
+/*N*/ SetFocalLength(fFocalLength);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Kameraposition setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetPosition(const Vector3D& rNewPos)
+/*N*/ {
+/*N*/ if ( rNewPos != aPosition )
+/*N*/ {
+/*N*/ aPosition = rNewPos;
+/*N*/ SetVRP(aPosition);
+/*N*/ SetVPN(aPosition - aLookAt);
+/*N*/ SetBankAngle(fBankAngle);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Blickpunkt setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetLookAt(const Vector3D& rNewLookAt)
+/*N*/ {
+/*N*/ if ( rNewLookAt != aLookAt )
+/*N*/ {
+/*N*/ aLookAt = rNewLookAt;
+/*N*/ SetVPN(aPosition - aLookAt);
+/*N*/ SetBankAngle(fBankAngle);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Position und Blickpunkt setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetPosAndLookAt(const Vector3D& rNewPos,
+/*N*/ const Vector3D& rNewLookAt)
+/*N*/ {
+/*N*/ if ( rNewPos != aPosition || rNewLookAt != aLookAt )
+/*N*/ {
+/*N*/ aPosition = rNewPos;
+/*N*/ aLookAt = rNewLookAt;
+/*N*/
+/*N*/ SetVRP(aPosition);
+/*N*/ SetVPN(aPosition - aLookAt);
+/*N*/ SetBankAngle(fBankAngle);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* seitlichen Neigungswinkel setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetBankAngle(double fAngle)
+/*N*/ {
+/*N*/ Vector3D aDiff = aPosition - aLookAt;
+/*N*/ Vector3D aPrj = aDiff;
+/*N*/
+/*N*/ fBankAngle = fAngle;
+/*N*/
+/*N*/ if ( aDiff.Y() == 0 )
+/*N*/ aPrj.Y() = -1;
+/*N*/ else
+/*N*/ { // aPrj = Projektion von aDiff auf die XZ-Ebene
+/*N*/ aPrj.Y() = 0;
+/*N*/ if ( aDiff.Y() < 0 )
+/*N*/ aPrj = -aPrj;
+/*N*/ }
+/*N*/ // von aDiff nach oben zeigenden View-Up-Vektor berechnen
+/*N*/ aPrj |= aDiff;
+/*N*/ aPrj |= aDiff;
+/*N*/ aDiff.Normalize();
+/*N*/
+/*N*/ // auf Z-Achse rotieren, dort um BankAngle drehen und zurueck
+/*N*/ Matrix4D aTf;
+/*N*/ double fV = sqrt(aDiff.Y() * aDiff.Y() + aDiff.Z() * aDiff.Z());
+/*N*/
+/*N*/ if ( fV != 0 )
+/*N*/ aTf.RotateX(aDiff.Y() / fV, aDiff.Z() / fV);
+/*N*/ aTf.RotateY(-aDiff.X(), fV);
+/*N*/ aTf.RotateZ(fBankAngle);
+/*N*/ aTf.RotateY(aDiff.X(), fV);
+/*N*/ if ( fV != 0 )
+/*N*/ aTf.RotateX(-aDiff.Y() / fV, aDiff.Z() / fV);
+/*N*/
+/*N*/ SetVUV(aTf * aPrj);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Brennweite setzen
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::SetFocalLength(double fLen)
+/*N*/ {
+/*N*/ if ( fLen < 5 )
+/*N*/ fLen = 5;
+/*N*/ SetPRP(Vector3D(0, 0, fLen / 35.0 * aViewWin.W));
+/*N*/ fFocalLength = fLen;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Um den Blickpunkt drehen, Position wird dabei veraendert
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::RotateAroundLookAt(double fHAngle, double fVAngle)
+/*N*/ {
+/*N*/ Matrix4D aTf;
+/*N*/ Vector3D aDiff = aPosition - aLookAt;
+/*N*/ double fV = sqrt(aDiff.X() * aDiff.X() + aDiff.Z() * aDiff.Z());
+/*N*/
+/*N*/ if ( fV != 0 ) aTf.RotateY(aDiff.Z() / fV, aDiff.X() / fV);
+/*N*/ aTf.RotateZ(fVAngle);
+/*N*/ if ( fV != 0 ) aTf.RotateY(-aDiff.Z() / fV, aDiff.X() / fV);
+/*N*/ aTf.RotateY(fHAngle);
+/*N*/
+/*N*/ aDiff *= aTf;
+/*N*/ SetPosition(aLookAt + aDiff);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Camera3D fuer die Filerevision 3.1
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::WriteData31(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ Viewport3D::WriteData(rOut);
+/*N*/
+/*N*/ rOut << aResetPos;
+/*N*/ rOut << aResetLookAt;
+/*N*/ rOut << fResetFocalLength;
+/*N*/ rOut << fResetBankAngle;
+/*N*/ rOut << aPosition;
+/*N*/ rOut << aLookAt;
+/*N*/ rOut << fFocalLength;
+/*N*/ rOut << fBankAngle;
+/*N*/ rOut << BOOL(bAutoAdjustProjection);
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Camera3D
+|* Zur Version 356 wurde das Fileformat inkompatibel, wenn man das alte
+|* Format schreiben will, muss man die Version am Stream abfragen.
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/
+/*N*/ if (rOut.GetVersion() < 3560) // FG: Ab der Release 356 wurde das Fileformat geaendert
+/*N*/ { // Falls das Format der Version 31 geschrieben werden soll
+/*N*/ WriteData31(rOut); // muss am Stream die Version der 3.1 gesetzt sein.
+/*N*/ return; // Im Prinzip kann man auf diese Art auch Zwischenversionen
+/*N*/ } // erzeugen.
+/*N*/
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("Camera3D");
+/*N*/ #endif
+/*N*/ Viewport3D::WriteData(rOut);
+/*N*/
+/*N*/ rOut << aResetPos; // Alles Vektoren 3*double
+/*N*/ rOut << aResetLookAt;
+/*N*/ rOut << fResetFocalLength;
+/*N*/ rOut << fResetBankAngle;
+/*N*/ rOut << aPosition;
+/*N*/ rOut << aLookAt;
+/*N*/ rOut << fFocalLength;
+/*N*/ rOut << fBankAngle;
+/*N*/ rOut << BOOL(bAutoAdjustProjection);
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Camera3D
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if ( rIn.GetError() != SVSTREAM_OK )
+/*N*/ return;
+/*N*/
+/*N*/ if ((rHead.GetVersion() < 13) || (rIn.GetVersion() < 3560))
+/*N*/ {
+/*N*/ ReadData31(rIn);
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("Camera3D");
+/*N*/ #endif
+/*N*/
+/*N*/ Viewport3D::ReadData(rHead, rIn);
+/*N*/
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ rIn >> aResetPos;
+/*N*/ rIn >> aResetLookAt;
+/*N*/ rIn >> fResetFocalLength;
+/*N*/ rIn >> fResetBankAngle;
+/*N*/ rIn >> aPosition;
+/*N*/ rIn >> aLookAt;
+/*N*/ rIn >> fFocalLength;
+/*N*/ rIn >> fBankAngle;
+/*N*/ rIn >> bTmp; bAutoAdjustProjection = bTmp;
+/*N*/
+/*N*/ SetVPD(0);
+/*N*/ SetPosAndLookAt(aPosition, aLookAt);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Camera3D
+|*
+\************************************************************************/
+
+/*N*/ void Camera3D::ReadData31(SvStream& rIn)
+/*N*/ {
+/*N*/ if ( rIn.GetError() != SVSTREAM_OK )
+/*N*/ return;
+/*N*/
+/*N*/ Viewport3D::ReadData31 (rIn);
+/*N*/
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ rIn >> aResetPos;
+/*N*/ rIn >> aResetLookAt;
+/*N*/ rIn >> fResetFocalLength;
+/*N*/ rIn >> fResetBankAngle;
+/*N*/ rIn >> aPosition;
+/*N*/ rIn >> aLookAt;
+/*N*/ rIn >> fFocalLength;
+/*N*/ rIn >> fBankAngle;
+/*N*/ rIn >> bTmp; bAutoAdjustProjection = bTmp;
+/*N*/
+/*N*/ SetVPD(0);
+/*N*/ SetPosAndLookAt(aPosition, aLookAt);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Camera3D
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator<<(SvStream& rOStream, const Camera3D& rCam)
+/*N*/ {
+/*N*/ rCam.WriteData31(rOStream);
+/*N*/ return rOStream;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Camera3D
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator>>(SvStream& rIStream, Camera3D& rCam)
+/*N*/ {
+/*N*/ rCam.ReadData31(rIStream);
+/*N*/ return rIStream;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_class3d.cxx b/binfilter/bf_svx/source/engine3d/svx_class3d.cxx
new file mode 100644
index 000000000000..28ffed6999bb
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_class3d.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+
+#include "matrix3d.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Cast-Operator auf homogene 4x4 Matrix
+|*
+\************************************************************************/
+
+/*N*/ Old_Matrix3D::operator Matrix4D()
+/*N*/ {
+/*N*/ Matrix4D aNewMat;
+/*N*/
+/*N*/ aNewMat[0] = Point4D(M[0], aTranslation[0]);
+/*N*/ aNewMat[1] = Point4D(M[1], aTranslation[1]);
+/*N*/ aNewMat[2] = Point4D(M[2], aTranslation[2]);
+/*N*/
+/*N*/ return aNewMat;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungs-Operator mit homogener 4x4 Matrix
+|*
+\************************************************************************/
+
+/*N*/ Old_Matrix3D Old_Matrix3D::operator=(const Matrix4D& rMat)
+/*N*/ {
+/*N*/ M[0] = Vector3D(rMat[0][0], rMat[0][1], rMat[0][2]);
+/*N*/ M[1] = Vector3D(rMat[1][0], rMat[1][1], rMat[1][2]);
+/*N*/ M[2] = Vector3D(rMat[2][0], rMat[2][1], rMat[2][2]);
+/*N*/ aTranslation = Vector3D(rMat[0][3], rMat[1][3], rMat[2][3]);
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Matrix3D
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator>>(SvStream& rIStream, Old_Matrix3D& rMatrix3D)
+/*N*/ {
+/*N*/ for (int i = 0; i < 3; i++)
+/*N*/ rIStream >> rMatrix3D.M[i];
+/*N*/
+/*N*/ rIStream >> rMatrix3D.aTranslation;
+/*N*/
+/*N*/ return rIStream;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Matrix3D
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator<<(SvStream& rOStream, const Old_Matrix3D& rMatrix3D)
+/*N*/ {
+/*N*/ for (int i = 0; i < 3; i++)
+/*N*/ rOStream << rMatrix3D.M[i];
+/*N*/
+/*N*/ rOStream << rMatrix3D.aTranslation;
+/*N*/
+/*N*/ return rOStream;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_cube3d.cxx b/binfilter/bf_svx/source/engine3d/svx_cube3d.cxx
new file mode 100644
index 000000000000..4f561cecc2d7
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_cube3d.cxx
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdstr.hrc"
+
+#include "cube3d.hxx"
+
+#include "globl3d.hxx"
+
+
+
+#include "e3dcmpt.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dCubeObj, E3dCompoundObject);
+
+/*N*/ E3dCubeObj::E3dCubeObj()
+/*N*/ : E3dCompoundObject()
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/ }
+
+/*N*/ void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ aCubePos = rDefault.GetDefaultCubePos();
+/*N*/ aCubeSize = rDefault.GetDefaultCubeSize();
+/*N*/ nSideFlags = rDefault.GetDefaultCubeSideFlags();
+/*N*/ bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dCubeObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_CUBEOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
+|*
+\************************************************************************/
+
+/*N*/ SdrObject *E3dCubeObj::DoConvertToPolyObj(BOOL bBezier) const
+/*N*/ {
+/*N*/ return NULL;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dCubeObj::CreateGeometry()
+/*N*/ {
+/*N*/ Vector3D aPos(aCubePos);
+/*N*/ Polygon3D aRect3D(4);
+/*N*/ Polygon3D aNormals3D(4);
+/*N*/ Polygon3D aTexture3D(4);
+/*N*/ short nV1, nV2;
+/*N*/ UINT16 nSideBit = 0x0001;
+/*N*/
+/*N*/ // Start der Geometrieerzeugung ankuendigen
+/*N*/ StartCreateGeometry();
+/*N*/
+/*N*/ if ( bPosIsCenter )
+/*?*/ aCubePos -= aCubeSize / 2;
+/*N*/
+/*N*/ for (nV1 = 0; nV1 < 3; nV1++)
+/*N*/ {
+/*N*/ if ( nV1 == 0 ) nV2 = 2;
+/*N*/ else nV2 = nV1 - 1;
+/*N*/
+/*N*/ // Nur die Flaechen erzeugen, fuer die ein Bit
+/*N*/ if ( nSideFlags & nSideBit )
+/*N*/ { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
+/*N*/ aRect3D[0] = aPos; aPos[nV1] += aCubeSize[nV1];
+/*N*/ aRect3D[1] = aPos; aPos[nV2] += aCubeSize[nV2];
+/*N*/ aRect3D[2] = aPos; aPos[nV1] -= aCubeSize[nV1];
+/*N*/ aRect3D[3] = aPos; aPos[nV2] -= aCubeSize[nV2];
+/*N*/
+/*N*/ if(GetCreateNormals())
+/*N*/ {
+/*N*/ aNormals3D = aRect3D;
+/*N*/ aNormals3D[0].Normalize();
+/*N*/ aNormals3D[1].Normalize();
+/*N*/ aNormals3D[2].Normalize();
+/*N*/ aNormals3D[3].Normalize();
+/*N*/
+/*N*/ if(GetCreateTexture())
+/*N*/ {
+/*N*/ aTexture3D[1].X() = 0.0;
+/*N*/ aTexture3D[1].Y() = 0.0;
+/*N*/
+/*N*/ aTexture3D[0].X() = 1.0;
+/*N*/ aTexture3D[0].Y() = 0.0;
+/*N*/
+/*N*/ aTexture3D[2].X() = 0.0;
+/*N*/ aTexture3D[2].Y() = 1.0;
+/*N*/
+/*N*/ aTexture3D[3].X() = 1.0;
+/*N*/ aTexture3D[3].Y() = 1.0;
+/*N*/
+/*N*/ AddGeometry(aRect3D, aNormals3D, aTexture3D, FALSE);
+/*N*/ }
+/*N*/ else
+/*?*/ AddGeometry(aRect3D, aNormals3D, FALSE);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ AddGeometry(aRect3D, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ nSideBit <<= 1;
+/*N*/ }
+/*N*/ aPos += aCubeSize;
+/*N*/
+/*N*/ for (nV1 = 2; nV1 >= 0; nV1--)
+/*N*/ {
+/*N*/ if ( nV1 == 2 ) nV2 = 0;
+/*N*/ else nV2 = nV1 + 1;
+/*N*/
+/*N*/ if ( nSideFlags & nSideBit )
+/*N*/ { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
+/*N*/ aRect3D[0] = aPos; aPos[nV1] -= aCubeSize[nV1];
+/*N*/ aRect3D[1] = aPos; aPos[nV2] -= aCubeSize[nV2];
+/*N*/ aRect3D[2] = aPos; aPos[nV1] += aCubeSize[nV1];
+/*N*/ aRect3D[3] = aPos; aPos[nV2] += aCubeSize[nV2];
+/*N*/
+/*N*/ if(GetCreateTexture())
+/*N*/ {
+/*N*/ aTexture3D[1].X() = 0.0;
+/*N*/ aTexture3D[1].Y() = 0.0;
+/*N*/
+/*N*/ aTexture3D[0].X() = 1.0;
+/*N*/ aTexture3D[0].Y() = 0.0;
+/*N*/
+/*N*/ aTexture3D[2].X() = 0.0;
+/*N*/ aTexture3D[2].Y() = 1.0;
+/*N*/
+/*N*/ aTexture3D[3].X() = 1.0;
+/*N*/ aTexture3D[3].Y() = 1.0;
+/*N*/ }
+/*N*/
+/*N*/ if(GetCreateNormals())
+/*N*/ {
+/*N*/ aNormals3D = aRect3D;
+/*N*/ aNormals3D[0].Normalize();
+/*N*/ aNormals3D[1].Normalize();
+/*N*/ aNormals3D[2].Normalize();
+/*N*/ aNormals3D[3].Normalize();
+/*N*/
+/*N*/ if(GetCreateTexture())
+/*N*/ AddGeometry(aRect3D, aNormals3D, aTexture3D, FALSE);
+/*N*/ else
+/*?*/ AddGeometry(aRect3D, aNormals3D, FALSE);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ AddGeometry(aRect3D, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ nSideBit <<= 1;
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dCubeObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Alte Geometrie erzeugen, um die E3dPolyObj's zu haben
+/*?*/ ((E3dCompoundObject*)this)->ReCreateGeometry(TRUE);
+/*N*/ }
+/*N*/
+/*N*/ // call parent, schreibt die SubList (alte Geometrie) raus
+/*N*/ E3dCompoundObject::WriteData(rOut);
+/*N*/
+/*N*/ E3dIOCompat aCompat(rOut, STREAM_WRITE, 1);
+/*N*/ rOut << aCubePos;
+/*N*/ rOut << aCubeSize;
+/*N*/ rOut << BOOL(bPosIsCenter);
+/*N*/ rOut << nSideFlags;
+/*N*/
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Geometrie neu erzeugen, um E3dPolyObj's wieder loszuwerden
+/*?*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dCubeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ BOOL bAllDone(FALSE);
+/*N*/ if(AreBytesLeft())
+/*N*/ {
+/*N*/ E3dIOCompat aIoCompat(rIn, STREAM_READ);
+/*N*/ if(aIoCompat.GetVersion() >= 1)
+/*N*/ {
+/*N*/ BOOL bTmp;
+/*N*/ rIn >> aCubePos;
+/*N*/ rIn >> aCubeSize;
+/*N*/ rIn >> bTmp; bPosIsCenter = bTmp;
+/*N*/ rIn >> nSideFlags;
+/*N*/ bAllDone = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if(!bAllDone)
+/*N*/ {
+/*N*/ // Geometrie aus erzeugten PolyObj's rekonstruieren
+/*N*/ const Volume3D& rVolume = GetLocalBoundVolume();
+/*N*/ aCubeSize = rVolume.MaxVec() - rVolume.MinVec();
+/*N*/ aCubePos = rVolume.MinVec();
+/*N*/ bPosIsCenter = FALSE;
+/*N*/ nSideFlags = CUBE_FULL;
+/*N*/ }
+/*N*/
+/*N*/ // Geometrie neu erzeugen, mit oder ohne E3dPolyObj's
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dCubeObj::SetCubePos(const Vector3D& rNew)
+/*N*/ {
+/*N*/ if(aCubePos != rNew)
+/*N*/ {
+/*N*/ aCubePos = rNew;
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCubeObj::SetCubeSize(const Vector3D& rNew)
+/*N*/ {
+/*N*/ if(aCubeSize != rNew)
+/*N*/ {
+/*N*/ aCubeSize = rNew;
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCubeObj::SetPosIsCenter(BOOL bNew)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_deflt3d.cxx b/binfilter/bf_svx/source/engine3d/svx_deflt3d.cxx
new file mode 100644
index 000000000000..13c627925ab2
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_deflt3d.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define ITEMID_COLOR SID_ATTR_3D_LIGHTCOLOR
+
+
+#include "cube3d.hxx"
+
+#include "svxids.hrc"
+
+
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Klasse zum verwalten der 3D-Default Attribute
+|*
+\************************************************************************/
+
+// Konstruktor
+/*N*/ E3dDefaultAttributes::E3dDefaultAttributes()
+/*N*/ {
+/*N*/ Reset();
+/*N*/ }
+
+/*N*/ void E3dDefaultAttributes::Reset()
+/*N*/ {
+/*N*/ // Compound-Objekt
+/*N*/ // aDefaultFrontMaterial;
+/*N*/ // aDefaultBackMaterial;
+/*N*/ bDefaultCreateNormals = TRUE;
+/*N*/ bDefaultCreateTexture = TRUE;
+/*N*/ bDefaultUseDifferentBackMaterial = FALSE;
+/*N*/
+/*N*/ // Cube-Objekt
+/*N*/ aDefaultCubePos = Vector3D(-500.0, -500.0, -500.0);
+/*N*/ aDefaultCubeSize = Vector3D(1000.0, 1000.0, 1000.0);
+/*N*/ nDefaultCubeSideFlags = CUBE_FULL;
+/*N*/ bDefaultCubePosIsCenter = FALSE;
+/*N*/
+/*N*/ // Sphere-Objekt
+/*N*/ aDefaultSphereCenter = Vector3D(0.0, 0.0, 0.0);
+/*N*/ aDefaultSphereSize = Vector3D(1000.0, 1000.0, 1000.0);
+/*N*/
+/*N*/ // Lathe-Objekt
+/*N*/ nDefaultLatheEndAngle = 3600;
+/*N*/ fDefaultLatheScale = 1.0;
+/*N*/ bDefaultLatheSmoothed = TRUE;
+/*N*/ bDefaultLatheSmoothFrontBack = FALSE;
+/*N*/ bDefaultLatheCharacterMode = FALSE;
+/*N*/ bDefaultLatheCloseFront = TRUE;
+/*N*/ bDefaultLatheCloseBack = TRUE;
+/*N*/
+/*N*/ // Extrude-Objekt
+/*N*/ fDefaultExtrudeScale = 1.0;
+/*N*/ bDefaultExtrudeSmoothed = TRUE;
+/*N*/ bDefaultExtrudeSmoothFrontBack = FALSE;
+/*N*/ bDefaultExtrudeCharacterMode = FALSE;
+/*N*/ bDefaultExtrudeCloseFront = TRUE;
+/*N*/ bDefaultExtrudeCloseBack = TRUE;
+/*N*/
+/*N*/ // Scene-Objekt
+/*N*/ // aDefaultLightGroup;
+/*N*/ bDefaultDither = TRUE;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_dlight3d.cxx b/binfilter/bf_svx/source/engine3d/svx_dlight3d.cxx
new file mode 100644
index 000000000000..d243f57e45f0
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_dlight3d.cxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdio.hxx"
+
+#include "globl3d.hxx"
+
+#include "polyob3d.hxx"
+
+#include "dlight3d.hxx"
+
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dDistantLight, E3dLight);
+
+/*************************************************************************
+|*
+|* E3dDistantLight-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dDistantLight::E3dDistantLight(const Vector3D& rPos, const Vector3D& rDir,
+/*N*/ const Color& rColor, double fLightIntensity) :
+/*N*/ E3dLight(rPos, rColor, fLightIntensity)
+/*N*/ {
+/*N*/ SetDirection(rDir);
+/*N*/ CreateLightObj();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* E3dDistantLight-Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dDistantLight::~E3dDistantLight()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dDistantLight::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_DISTLIGHT_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Richtung ZUR Lichtquelle setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dDistantLight::SetDirection(const Vector3D& rNewDir)
+/*N*/ {
+/*N*/ if ( aDirection != rNewDir )
+/*N*/ {
+/*N*/ aDirection = rNewDir;
+/*N*/ aDirection.Normalize();
+/*N*/ CreateLightObj();
+/*N*/ StructureChanged(this);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Lichtstaerke an uebergeben Punkt bestimmen und die akkumulierte
+|* Punktfarbe berechnen
+|*
+\************************************************************************/
+
+/*?*/ FASTBOOL E3dDistantLight::CalcLighting(Color& rNewColor,
+/*?*/ const Vector3D& rPnt,
+/*?*/ const Vector3D& rPntNormal,
+/*?*/ const Color& rPntColor)
+/*?*/ {
+/*?*/ double fR = 0, fG = 0, fB = 0;
+/*?*/
+/*?*/ if ( IsOn() )
+/*?*/ {
+/*?*/ double fLight = rPntNormal.Scalar(aDirection);
+/*?*/
+/*?*/ if ( fLight > 0 )
+/*?*/ {
+/*?*/ fR = fLight * GetRed();
+/*?*/ fG = fLight * GetGreen();
+/*?*/ fB = fLight * GetBlue();
+/*?*/ }
+/*?*/ }
+/*?*/ return ImpCalcLighting(rNewColor, rPntColor, fR, fG, fB);
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Darstellung des Lichtobjekts in der Szene ein-/ausschalten
+|*
+\************************************************************************/
+
+/*N*/ void E3dDistantLight::CreateLightObj()
+/*N*/ {
+/*N*/ pSub->Clear();
+/*N*/
+/*N*/ if ( IsLightObjVisible() )
+/*N*/ {
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() + aDirection, GetPosition()));
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dDistantLight::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ E3dLight::WriteData(rOut);
+/*N*/
+/*N*/ #ifdef E3D_STREAMING
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dDistantLight");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aDirection;
+/*N*/ #endif
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dDistantLight::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dLight::ReadData(rHead, rIn);
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dDistantLight");
+/*N*/ #endif
+/*N*/
+/*N*/ rIn >> aDirection;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_e3dcmpt.cxx b/binfilter/bf_svx/source/engine3d/svx_e3dcmpt.cxx
new file mode 100644
index 000000000000..82834e190ec8
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_e3dcmpt.cxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/debug.hxx>
+
+#include "e3dcmpt.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor, schreibt bzw. liest Versionsnummer
+|*
+\************************************************************************/
+
+/*N*/ E3dIOCompat::E3dIOCompat(SvStream& rNewStream, USHORT nNewMode, UINT16 nVer)
+/*N*/ : SdrDownCompat(rNewStream, nNewMode, TRUE),
+/*N*/ nVersion(nVer)
+/*N*/ {
+/*N*/ if (nNewMode == STREAM_WRITE)
+/*N*/ {
+/*N*/ DBG_ASSERT(nVer != E3DIOCOMPAT_VERSIONDONTKNOW,
+/*N*/ "kann unbekannte Version nicht schreiben");
+/*N*/ rNewStream << nVersion;
+/*N*/ }
+/*N*/ else if (nNewMode == STREAM_READ)
+/*N*/ {
+/*N*/ DBG_ASSERT(nVer == E3DIOCOMPAT_VERSIONDONTKNOW,
+/*N*/ "Lesen mit Angabe der Version ist Quatsch!");
+/*N*/ rNewStream >> nVersion;
+/*N*/ }
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_extrud3d.cxx b/binfilter/bf_svx/source/engine3d/svx_extrud3d.cxx
new file mode 100644
index 000000000000..18f3dc1825a6
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_extrud3d.cxx
@@ -0,0 +1,700 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdstr.hrc"
+
+
+#include "globl3d.hxx"
+
+#include "polyob3d.hxx"
+
+#include "extrud3d.hxx"
+
+#include "e3dcmpt.hxx"
+
+
+
+#include "svxids.hrc"
+
+
+
+
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dExtrudeObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor, erzeugt zwei Deckelflaechen-PolyPolygone und (PointCount-1)
+|* Seitenflaechen-Rechtecke aus dem uebergebenen PolyPolygon
+|*
+\************************************************************************/
+
+/*N*/ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const PolyPolygon& rPP, double fDepth)
+/*N*/ : E3dCompoundObject(rDefault),
+/*N*/ aExtrudePolygon(rPP, rDefault.GetDefaultExtrudeScale())
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ SetDefaultAttributes(rDefault);
+/*N*/
+/*N*/ // set extrude depth
+/*N*/ mpObjectItemSet->Put(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5)));
+/*N*/
+/*N*/ // Geometrie erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* wie voriger Konstruktor, nur mit XPolygon; das XPolygon wird
+|* jedoch nicht Bezier-konvertiert, sondern es werden nur seine
+|* Punktkoordinaten uebernommen
+|*
+\************************************************************************/
+
+/*N*/ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const XPolyPolygon& rXPP, double fDepth)
+/*N*/ : E3dCompoundObject(rDefault),
+/*N*/ aExtrudePolygon(rXPP, rDefault.GetDefaultExtrudeScale())
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ SetDefaultAttributes(rDefault);
+/*N*/
+/*N*/ // set extrude depth
+/*N*/ mpObjectItemSet->Put(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5)));
+/*N*/
+/*N*/ // Geometrie erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*N*/ E3dExtrudeObj::E3dExtrudeObj()
+/*N*/ : E3dCompoundObject()
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/ }
+
+/*N*/ void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ ImpForceItemSet();
+/*N*/
+/*N*/ fExtrudeScale = rDefault.GetDefaultExtrudeScale();
+/*N*/
+/*N*/ // #107245#
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(rDefault.GetDefaultExtrudeSmoothed()));
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(rDefault.GetDefaultExtrudeSmoothFrontBack()));
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(rDefault.GetDefaultExtrudeCharacterMode()));
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(rDefault.GetDefaultExtrudeCloseFront()));
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(rDefault.GetDefaultExtrudeCloseBack()));
+/*N*/
+/*N*/ // Bei extrudes defaultmaessig StdTexture in X und Y
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionXItem(1));
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionYItem(1));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D E3dExtrudeObj::GetFrontSide()
+/*N*/ {
+/*N*/ // Polygon als Grundlage holen
+/*N*/ PolyPolygon3D aPolyPoly3D(aExtrudePolygon);
+/*N*/
+/*N*/ // Ueberfluessige Punkte entfernen, insbesondere doppelte
+/*N*/ // Start- und Endpunkte verhindern
+/*N*/ aPolyPoly3D.RemoveDoublePoints();
+/*N*/
+/*N*/ // Normale holen
+/*N*/ Vector3D aNormal = aPolyPoly3D.GetNormal();
+/*N*/ if((aNormal.Z() > 0.0) != (GetExtrudeDepth() != 0))
+/*N*/ aPolyPoly3D.FlipDirections();
+/*N*/
+/*N*/ // Orientierung evtl. vorhandener Loecher in einen definierten
+/*N*/ // Ausgangszustand bringen
+/*N*/ aPolyPoly3D.SetDirections();
+/*N*/
+/*N*/ return aPolyPoly3D;
+/*N*/ }
+
+/*N*/ PolyPolygon3D E3dExtrudeObj::GetBackSide(const PolyPolygon3D& rFrontSide)
+/*N*/ {
+/*N*/ PolyPolygon3D aBackSide(rFrontSide);
+/*N*/
+/*N*/ if(GetExtrudeDepth() != 0)
+/*N*/ {
+/*N*/ // Extrudevektor bilden
+/*N*/ Vector3D aNormal = aBackSide.GetNormal();
+/*N*/ if(aNormal.Z() < 0.0)
+/*N*/ aNormal.Z() = -aNormal.Z();
+/*N*/ Vector3D aOffset = aNormal * (double)GetExtrudeDepth();
+/*N*/
+/*N*/ // eventuell Skalieren
+/*N*/ if(GetPercentBackScale() != 100)
+/*N*/ ScalePoly(aBackSide, (double)GetPercentBackScale() / 100.0);
+/*N*/
+/*N*/ // Verschieben
+/*N*/ Matrix4D aTrans;
+/*N*/ aTrans.Translate(aOffset);
+/*N*/ aBackSide.Transform(aTrans);
+/*N*/ }
+/*N*/
+/*N*/ return aBackSide;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+
+/*N*/ void E3dExtrudeObj::CreateGeometry()
+/*N*/ {
+/*N*/ // Start der Geometrieerzeugung ankuendigen
+/*N*/ StartCreateGeometry();
+/*N*/
+/*N*/ // #78972# prepare new line geometry creation
+/*N*/ maLinePolyPolygon.Clear();
+/*N*/
+/*N*/ // Polygon als Grundlage holen
+/*N*/ PolyPolygon3D aFrontSide = GetFrontSide();
+/*N*/
+/*N*/ if(GetExtrudeDepth() != 0)
+/*N*/ {
+/*N*/ // Hinteres Polygon erzeugen
+/*N*/ PolyPolygon3D aBackSide = GetBackSide(aFrontSide);
+/*N*/
+/*N*/ // Was muss erzeugt werden?
+/*N*/ if(!aFrontSide.IsClosed())
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE));
+/*N*/
+/*N*/ double fTextureDepth=1.0;
+/*N*/ double fTextureStart=0.0;
+/*N*/
+/*N*/ // Texturen erzeugen?
+/*N*/ if(!GetCreateTexture())
+/*N*/ fTextureStart = fTextureDepth = 0.0;
+/*N*/
+/*N*/ // Falls Texturen erzeugen Randbreite fuer diese bestimmen
+/*N*/ double fSurroundFactor = 1.0;
+/*N*/ if(GetCreateTexture())
+/*N*/ {
+/*N*/ fSurroundFactor = aFrontSide.GetLength() / sqrt(aFrontSide.GetPolyArea());
+/*N*/ fSurroundFactor = (double)((long)(fSurroundFactor - 0.5));
+/*N*/ if(fSurroundFactor == 0.0)
+/*N*/ fSurroundFactor = 1.0;
+/*N*/ }
+/*N*/
+/*N*/ // Segment erzeugen
+/*N*/ ImpCreateSegment(
+/*N*/ aFrontSide,
+/*N*/ aBackSide,
+/*N*/ 0L,
+/*N*/ 0L,
+/*N*/ GetCloseFront(), // #107245# bExtrudeCloseFront,
+/*N*/ GetCloseBack(), // #107245# bExtrudeCloseBack,
+/*N*/ (double)GetPercentDiagonal() / 200.0,
+/*N*/ GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
+/*N*/ GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
+/*N*/ GetSmoothLids(), // #107245# GetExtrudeSmoothFrontBack(),
+/*N*/ fSurroundFactor,
+/*N*/ fTextureStart,
+/*N*/ fTextureDepth,
+/*N*/ GetCreateNormals(),
+/*N*/ GetCreateTexture(),
+/*N*/ GetCharacterMode(), // #107245# bExtrudeCharacterMode,
+/*N*/ FALSE,
+/*N*/ // #78972#
+/*N*/ &maLinePolyPolygon);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // nur ein Polygon erzeugen
+/*?*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE));
+/*?*/
+/*?*/ // Fuer evtl. selbst erzeugte Normalen
+/*?*/ PolyPolygon3D aNormalsFront;
+/*?*/
+/*?*/ // Extrudevektor bilden
+/*?*/ Vector3D aNormal = aFrontSide.GetNormal();
+/*?*/ Vector3D aOffset = aNormal * (double)GetExtrudeDepth();
+/*?*/
+/*?*/ // Normalen und Vorderseite selbst erzeugen
+/*?*/ AddFrontNormals(aFrontSide, aNormalsFront, aOffset);
+/*?*/ CreateFront(aFrontSide, aNormalsFront, GetCreateNormals(), GetCreateTexture());
+/*?*/
+/*?*/ // #78972#
+/*?*/ maLinePolyPolygon.Insert(aFrontSide);
+/*N*/ }
+/*N*/
+/*N*/ // #78972#
+/*N*/ ImpCompleteLinePolygon(maLinePolyPolygon, aFrontSide.Count(), FALSE);
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dExtrudeObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_EXTRUDEOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wireframe erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void E3dExtrudeObj::CreateWireframe(Polygon3D& rWirePoly, const Matrix4D* pTf,
+/*N*/ E3dDragDetail eDetail)
+/*N*/ {
+/*N*/ if ( eDetail == E3DDETAIL_ALLLINES ||
+/*N*/ (eDetail == E3DDETAIL_DEFAULT && GetDragDetail() == E3DDETAIL_ALLLINES) )
+/*N*/ {
+/*N*/ // Detailliert erzeugen
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // call parent
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 E3dObject::CreateWireframe(rWirePoly, pTf, eDetail);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dExtrudeObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Alte Geometrie erzeugen, um die E3dPolyObj's zu haben
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry(TRUE);
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::WriteData(rOut);
+/*N*/
+/*N*/ E3dIOCompat aCompat(rOut, STREAM_WRITE, 1);
+/*N*/ rOut << aExtrudePolygon;
+/*N*/ rOut << fExtrudeScale;
+/*N*/
+/*N*/ rOut << (double)GetExtrudeDepth();
+/*N*/
+/*N*/ rOut << (double)GetPercentBackScale() / 100.0;
+/*N*/
+/*N*/ rOut << (double)GetPercentDiagonal() / 200.0;
+/*N*/
+/*N*/ rOut << GetSmoothNormals(); // #107245# (BOOL)bExtrudeSmoothed;
+/*N*/ rOut << GetSmoothLids(); // #107245# (BOOL)bExtrudeSmoothFrontBack;
+/*N*/ rOut << GetCharacterMode(); // #107245# (BOOL)bExtrudeCharacterMode;
+/*N*/
+/*N*/ // Ab Version 513a (5.2.99): Parameter fuer das
+/*N*/ // Erzeugen der Vorder/Rueckwand
+/*N*/ rOut << GetCloseFront(); // #107245# (BOOL)bExtrudeCloseFront;
+/*N*/ rOut << GetCloseBack(); // #107245# (BOOL)bExtrudeCloseBack;
+/*N*/
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Geometrie neu erzeugen, um E3dPolyObj's wieder loszuwerden
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dExtrudeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ BOOL bAllDone(FALSE);
+/*N*/
+/*N*/ if(AreBytesLeft())
+/*N*/ {
+/*N*/ E3dIOCompat aIoCompat(rIn, STREAM_READ);
+/*N*/ if(aIoCompat.GetVersion() >= 1)
+/*N*/ {
+/*N*/ BOOL bTmp;
+/*N*/ double fTmp;
+/*N*/
+/*N*/ rIn >> aExtrudePolygon;
+/*N*/ rIn >> fExtrudeScale;
+/*N*/
+/*N*/ rIn >> fTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DDepthItem(sal_uInt32(fTmp + 0.5)));
+/*N*/
+/*N*/ rIn >> fTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DBackscaleItem(sal_uInt16(fTmp * 100.0)));
+/*N*/
+/*N*/ rIn >> fTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DPercentDiagonalItem(sal_uInt16(fTmp * 200.0)));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bExtrudeSmoothed = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bExtrudeSmoothFrontBack = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bExtrudeCharacterMode = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(bTmp));
+/*N*/
+/*N*/ bAllDone = TRUE;
+/*N*/
+/*N*/ if(aIoCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 513a (5.2.99): Parameter fuer das
+/*N*/ // Erzeugen der Vorder/Rueckwand
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bExtrudeCloseFront = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bExtrudeCloseBack = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(bTmp));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // #107245# bExtrudeCloseFront = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(sal_True));
+/*N*/
+/*N*/ // #107245# bExtrudeCloseBack = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(sal_True));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if(!bAllDone)
+/*N*/ {
+/*N*/ // Geometrie aus geladenen PolyObj's rekonstruieren
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/ if(pSubList && pSubList->GetObjCount())
+/*N*/ {
+/*N*/ // Vorderseite und Rueckseite sind die ersten
+/*N*/ // PolyObj's in der Liste, hole diese
+/*N*/ E3dPolyObj* pFront = NULL;
+/*N*/ E3dPolyObj* pBack = NULL;
+/*N*/ E3dPolyObj* pOther = NULL;
+/*N*/
+/*N*/ UINT16 a;
+/*N*/ for(a=0;a<pSubList->GetObjCount();a++)
+/*N*/ {
+/*N*/ E3dPolyObj* pCandidate = (E3dPolyObj*)pSubList->GetObj(a);
+/*N*/ if(pCandidate->ISA(E3dPolyObj))
+/*N*/ {
+/*N*/ // Die Nromalen der Vorder/Rueckseiten zeigen in Z-Richtung,
+/*N*/ // nutze dies aus
+/*N*/ const Vector3D& rNormal = pCandidate->GetNormal();
+/*N*/ if(fabs(rNormal.X()) < 0.0000001 && fabs(rNormal.Y()) < 0.0000001)
+/*N*/ {
+/*N*/ if(rNormal.Z() > 0.0)
+/*N*/ {
+/*N*/ // Vorderseite
+/*N*/ pFront = pCandidate;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Rueckseite
+/*N*/ pBack = pCandidate;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(!pOther)
+/*N*/ pOther = pCandidate;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Extrude-Tiefe feststellen
+/*N*/ if(pOther)
+/*N*/ {
+/*N*/ const PolyPolygon3D& rOtherPoly = pOther->GetPolyPolygon3D();
+/*N*/ // Hintereinanderliegende Paare in der alten Version waren
+/*N*/ // 0,1 und 3,2 (0,3 vorne)
+/*N*/ double fVal = (rOtherPoly[0][1] - rOtherPoly[0][0]).GetLength();
+/*N*/ mpObjectItemSet->Put(Svx3DDepthItem(sal_uInt32(fVal + 0.5)));
+/*N*/ }
+/*N*/ else
+/*N*/ // Einen Default vorsehen, kann aber eigentlich nie geschehen
+/*N*/ mpObjectItemSet->Put(Svx3DDepthItem(100));
+/*N*/
+/*N*/ // Polygon fuer Vorderseite holen
+/*N*/ if(pFront)
+/*N*/ {
+/*N*/ aExtrudePolygon = pFront->GetPolyPolygon3D();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(pBack)
+/*N*/ {
+/*N*/ // Rueckseite benutzen und um -fExtrudeDepth in Z
+/*N*/ // verschieben
+/*N*/ aExtrudePolygon = pBack->GetPolyPolygon3D();
+/*N*/ Matrix4D aMat;
+/*N*/ aMat.Translate(Vector3D(0.0, 0.0, -(double)GetExtrudeDepth()));
+/*N*/ aExtrudePolygon.Transform(aMat);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die Polygondaten koennen aus den Vorderkanten
+/*N*/ // der weiteren Polygone (Punkte 0,3) restauriert werden.
+/*N*/ // evtl. spaeter ergaenzen
+/*N*/ aExtrudePolygon.Clear();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Bestimmen, ob die Teilpolygone von aExtrudePolygon
+/*N*/ // geschlossen waren. Sie waren geschlossen, wenn ein
+/*N*/ // entsprechendes PolyObj existiert
+/*N*/ for(a=0;a<aExtrudePolygon.Count();a++)
+/*N*/ {
+/*N*/ Polygon3D &rPoly = aExtrudePolygon[a];
+/*N*/ USHORT nCnt = rPoly.GetPointCount();
+/*N*/
+/*N*/ if(nCnt)
+/*N*/ {
+/*N*/ Vector3D& rFirst = rPoly[0];
+/*N*/ Vector3D& rLast = rPoly[nCnt - 1];
+/*N*/ BOOL bClosePoly(FALSE);
+/*N*/
+/*N*/ for(UINT16 b=0;b<pSubList->GetObjCount();b++)
+/*N*/ {
+/*N*/ E3dPolyObj* pCandidate = (E3dPolyObj*)pSubList->GetObj(b);
+/*N*/ if(pCandidate->ISA(E3dPolyObj)
+/*N*/ && pCandidate != pFront && pCandidate != pBack)
+/*N*/ {
+/*N*/ const PolyPolygon3D& rCandPoly = pCandidate->GetPolyPolygon3D();
+/*N*/ if(rCandPoly[0].GetPointCount() > 2)
+/*N*/ {
+/*N*/ if(rCandPoly[0][0] == rFirst && rCandPoly[0][3] == rLast)
+/*N*/ bClosePoly = TRUE;
+/*N*/ if(rCandPoly[0][3] == rFirst && rCandPoly[0][0] == rLast)
+/*N*/ bClosePoly = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rPoly.SetClosed(bClosePoly);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Setze die weiteren Parameter auf die defaults
+/*N*/ fExtrudeScale = 1.0;
+/*N*/
+/*N*/ mpObjectItemSet->Put(Svx3DBackscaleItem(100));
+/*N*/
+/*N*/ mpObjectItemSet->Put(Svx3DPercentDiagonalItem(10));
+/*N*/
+/*N*/ // #107245# bExtrudeSmoothed = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(sal_True));
+/*N*/
+/*N*/ // #107245# bExtrudeSmoothFrontBack = FALSE;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(sal_False));
+/*N*/
+/*N*/ // #107245# bExtrudeCharacterMode = FALSE;
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(sal_False));
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // correct position of extrude polygon, in case it's not positioned
+/*N*/ // at the Z==0 layer
+/*N*/ if(aExtrudePolygon.Count() && aExtrudePolygon[0].GetPointCount())
+/*N*/ {
+/*N*/ const Vector3D& rFirstPoint = aExtrudePolygon[0][0];
+/*N*/ if(rFirstPoint.Z() != 0.0)
+/*N*/ {
+/*N*/ // change transformation so that source poly lies in Z == 0,
+/*N*/ // so it can be exported as 2D polygon
+/*N*/ //
+/*N*/ // ATTENTION: the translation has to be multiplied from LEFT
+/*N*/ // SIDE since it was executed as the first translate for this
+/*N*/ // 3D object during it's creation.
+/*N*/ double fTransDepth(rFirstPoint.Z());
+/*N*/ Matrix4D aTransMat;
+/*N*/ aTransMat.TranslateZ(fTransDepth);
+/*N*/ NbcSetTransform(aTransMat * GetTransform());
+/*N*/
+/*N*/ // correct polygon itself
+/*N*/ aTransMat.Identity();
+/*N*/ aTransMat.TranslateZ(-fTransDepth);
+/*N*/ aExtrudePolygon.Transform(aTransMat);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dExtrudeObj::SetExtrudePolygon(const PolyPolygon3D &rNew)
+/*N*/ {
+/*N*/ if(aExtrudePolygon != rNew)
+/*N*/ {
+/*N*/ aExtrudePolygon = rNew;
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+
+// #107245#
+// void E3dExtrudeObj::SetExtrudeSmoothed(BOOL bNew)
+// {
+// if(bExtrudeSmoothed != bNew)
+// {
+// bExtrudeSmoothed = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dExtrudeObj::SetExtrudeSmoothFrontBack(BOOL bNew)
+// {
+// if(bExtrudeSmoothFrontBack != bNew)
+// {
+// bExtrudeSmoothFrontBack = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dExtrudeObj::SetExtrudeCharacterMode(BOOL bNew)
+// {
+// if(bExtrudeCharacterMode != bNew)
+// {
+// bExtrudeCharacterMode = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dExtrudeObj::SetExtrudeCloseFront(BOOL bNew)
+// {
+// if(bExtrudeCloseFront != bNew)
+// {
+// bExtrudeCloseFront = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dExtrudeObj::SetExtrudeCloseBack(BOOL bNew)
+// {
+// if(bExtrudeCloseBack != bNew)
+// {
+// bExtrudeCloseBack = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+//////////////////////////////////////////////////////////////////////////////
+// private support routines for ItemSet access
+
+/*N*/ void E3dExtrudeObj::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::PostItemChange(nWhich);
+/*N*/
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_BACKSCALE:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_DEPTH:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Aufbrechen
+|*
+\************************************************************************/
+
+
+
+// EOF
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_float3d.cxx b/binfilter/bf_svx/source/engine3d/svx_float3d.cxx
new file mode 100644
index 000000000000..a6d7b6678e18
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_float3d.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_sfx2/dispatch.hxx>
+
+#include <bf_sfx2/dockwin.hxx>
+
+#include <bf_svx/f3dchild.hxx>
+
+#include "float3d.hrc"
+namespace binfilter {
+
+/*N*/ SFX_IMPL_DOCKINGWINDOW( Svx3DChildWindow, SID_3D_WIN )
+
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Effekte
+|*
+\************************************************************************/
+/*N*/ __EXPORT Svx3DChildWindow::Svx3DChildWindow( Window* pParent,
+/*N*/ USHORT nId,
+/*N*/ SfxBindings* pBindings,
+/*N*/ SfxChildWinInfo* pInfo ) :
+/*N*/ SfxChildWindow( pParent, nId )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Svx3DWin* pWin = new Svx3DWin( pBindings, this, pParent );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_float3d.src b/binfilter/bf_svx/source/engine3d/svx_float3d.src
new file mode 100644
index 000000000000..39c7a7299d0c
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_float3d.src
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define NO_LOCALIZE_EXPORT
+
+#include "dialogs.hrc"
+#include "float3d.hrc"
+#define WIDTH 158
+//#define HEIGHT 197
+#define HEIGHT 209
+#define BORDER 3
+#define BUTTON_WIDTH 13
+#define BUTTON_HEIGHT 13
+#define VT_BUTTON_WIDTH 18
+#define GROUP_Y (BORDER + BUTTON_HEIGHT + 3)
+#define GROUP_HEIGHT 95
+#define GROUP_WIDTH (WIDTH - 2 * BORDER)
+#define GROUP_PREV_X 60
+#define GROUP_PREV_Y (GROUP_Y + GROUP_HEIGHT + 1)
+#define GROUP_PREV_WIDTH (WIDTH - BORDER - GROUP_PREV_X)
+#define GROUP_PREV_HEIGHT (HEIGHT - GROUP_PREV_Y - BORDER)
+#define BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, BUTTON_WIDTH );
+
+#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; };
+
+
+
+
+
+
+
+/*Image RID_SVXIMAGE_LIGHT_ON_SELECTED {
+ ImageBitmap = Bitmap { File = "lightons.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMAGE_LIGHT_OFF_SELECTED {
+ ImageBitmap = Bitmap { File = "lightsel.bmp" ; };
+ MASKCOLOR
+};*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binfilter/bf_svx/source/engine3d/svx_label3d.cxx b/binfilter/bf_svx/source/engine3d/svx_label3d.cxx
new file mode 100644
index 000000000000..7552776d4383
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_label3d.cxx
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdstr.hrc"
+
+#include "svdio.hxx"
+
+#include "globl3d.hxx"
+
+#include "label3d.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dLabelObj, E3dPointObj);
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dLabelObj::~E3dLabelObj()
+/*N*/ {
+/*N*/ // zugehoeriges 2D-SdrObject loeschen
+/*N*/ delete p2DLabelObj;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dLabelObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_LABELOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* virtuelle Methode, die ein 2D-Objekt zurueckgibt, falls moeglich
+|*
+\************************************************************************/
+
+//E3dDisplayObj* E3dLabelObj::MakeViewTransform(Viewport3D& rViewpt,
+// E3dLightList&,
+// E3dDisplayObj* pDispObj)
+//{
+// aViewPos = rViewpt.GetViewTransform() * GetTransPosition();
+//
+// // 2D-Position des Labels bestimmen
+// Point a2DPos = rViewpt.ProjectAndMap(aViewPos);
+// aViewPos -= rViewpt.GetPRP();
+//
+// if ( p2DLabelObj )
+// p2DLabelObj->SetAnchorPos(a2DPos);
+//
+// if ( pDispObj )
+// {
+// pDispObj->Set2DObj(p2DLabelObj);
+// pDispObj->Set3DObj(this);
+// }
+// else
+// pDispObj = new E3dDisplayObj(this, p2DLabelObj);
+//
+// SetDisplayObj(pDispObj);
+//
+// return pDispObj;
+//}
+
+/*************************************************************************
+|*
+|* SdrPage auch an p2DLabelObj setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dLabelObj::SetPage(SdrPage* pNewPage)
+/*N*/ {
+/*N*/ E3dPointObj::SetPage(pNewPage);
+/*N*/ if ( p2DLabelObj )
+/*N*/ p2DLabelObj->SetPage(pNewPage);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SdrModel auch an p2DLabelObj setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dLabelObj::SetModel(SdrModel* pNewModel)
+/*N*/ {
+/*N*/ E3dPointObj::SetModel(pNewModel);
+/*N*/ if ( p2DLabelObj )
+/*N*/ p2DLabelObj->SetModel(pNewModel);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Anzahl der Handles zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Handle-Liste fuellen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* In Stream schreiben
+|*
+\************************************************************************/
+
+/*N*/ void E3dLabelObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ E3dPointObj::WriteData(rOut);
+/*N*/
+/*N*/ #ifdef E3D_STREAMING
+/*N*/
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLabelObj");
+/*N*/ #endif
+/*N*/ DBG_ASSERT(p2DLabelObj, "p2DLabelObj muss vor dem Speichern definiert sein!");
+/*N*/
+/*N*/ rOut << *p2DLabelObj;
+/*N*/ #endif
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLabelObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dPointObj::ReadData(rHead, rIn);
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLabelObj");
+/*N*/ #endif
+/*N*/
+/*N*/ // loeschen, falls schon vorhanden
+/*N*/ delete p2DLabelObj;
+/*N*/ p2DLabelObj = NULL;
+/*N*/
+/*N*/ SdrObjIOHeaderLookAhead aHead(rIn, STREAM_READ);
+/*N*/
+/*N*/ p2DLabelObj = SdrObjFactory::MakeNewObject(aHead.nInventor,
+/*N*/ aHead.nIdentifier, GetPage());
+/*N*/ if ( p2DLabelObj != NULL )
+/*N*/ {
+/*N*/ rIn >> *p2DLabelObj;
+/*N*/ p2DLabelObj->SetModel(GetModel());
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aHead.SkipRecord();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_lathe3d.cxx b/binfilter/bf_svx/source/engine3d/svx_lathe3d.cxx
new file mode 100644
index 000000000000..de3974725482
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_lathe3d.cxx
@@ -0,0 +1,954 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdstr.hrc"
+
+
+
+
+#include "globl3d.hxx"
+
+#include "svdio.hxx"
+
+#include "polyob3d.hxx"
+
+#include "lathe3d.hxx"
+
+
+
+#include "svxids.hrc"
+
+
+
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dLatheObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor aus SV-Polygon, Scale gibt den Umrechnungsfaktor fuer
+|* die Koordinaten an
+|*
+\************************************************************************/
+
+/*N*/ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const PolyPolygon& rPoly)
+/*N*/ : E3dCompoundObject(rDefault),
+/*N*/ aPolyPoly3D (PolyPolygon3D(rPoly, rDefault.GetDefaultLatheScale()))
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ SetDefaultAttributes(rDefault);
+/*N*/
+/*N*/ // Ueberfluessige Punkte entfernen, insbesondere doppelte
+/*N*/ // Start- und Endpunkte verhindern
+/*N*/ aPolyPoly3D.RemoveDoublePoints();
+/*N*/
+/*N*/ const Polygon3D rPoly3D = aPolyPoly3D[0];
+/*N*/ sal_uInt32 nSegCnt((sal_uInt32)rPoly3D.GetPointCount());
+/*N*/ if(nSegCnt && !rPoly3D.IsClosed())
+/*N*/ nSegCnt -= 1;
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nSegCnt));
+/*N*/
+/*N*/ // Geometrie erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dLatheObj::E3dLatheObj()
+/*N*/ : aPolyPoly3D(Polygon3D())
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/ }
+
+/*N*/ void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ ImpForceItemSet();
+/*N*/
+/*N*/ fLatheScale = rDefault.GetDefaultLatheScale();
+/*N*/
+/*N*/ // #107245#
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(rDefault.GetDefaultLatheSmoothed()));
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(rDefault.GetDefaultLatheSmoothFrontBack()));
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(rDefault.GetDefaultLatheCharacterMode()));
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(rDefault.GetDefaultLatheCloseFront()));
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(rDefault.GetDefaultLatheCloseBack()));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Die eigentliche Konstruktionmethode, erzeugt einen Koerper durch
+|* Rotation des uebergebenen Polygons um die senkrechte Y-Achse. Wenn
+|* nEndAngle < 3600 ist, werden ausserdem zwei Deckelflaechen-Polygone
+|* erzeugt, die den Koerper abschliessen. Das Polygon sollte in der
+|* XY-Ebene liegen, mit X-Koordinaten >= 0; wenn die Anfangs- und End-
+|* X-Koordinaten nicht 0 sind, sollte das Polygon geschlossen sein.
+|* Wenn bDblSided TRUE ist, werden die Rotationsflaechen doppelseitig
+|* angelegt und keine Deckelflaechen erzeugt.
+|*
+\************************************************************************/
+
+// Geometrieerzeugung
+/*N*/ void E3dLatheObj::CreateGeometry()
+/*N*/ {
+/*N*/ // Start der Geometrieerzeugung ankuendigen
+/*N*/ StartCreateGeometry();
+/*N*/
+/*N*/ // #78972#
+/*N*/ maLinePolyPolygon.Clear();
+/*N*/
+/*N*/ // Polygon erzeugen
+/*N*/ PolyPolygon3D aLathePoly3D(aPolyPoly3D);
+/*N*/
+/*N*/ // Eventuelle Anpassung der Segmentanzahlen
+/*N*/ aLathePoly3D = CreateLathePolyPoly(aPolyPoly3D, GetVerticalSegments());
+/*N*/
+/*N*/ // Normale holen
+/*N*/ Vector3D aNormal = aLathePoly3D.GetNormal();
+/*N*/ if(aNormal.Z() > 0.0)
+/*N*/ {
+/*N*/ aLathePoly3D.FlipDirections();
+/*N*/ aNormal = aLathePoly3D.GetNormal();
+/*N*/ }
+/*N*/
+/*N*/ // Orientierung evtl. vorhandener Loecher in einen definierten
+/*N*/ // Ausgangszustand bringen
+/*N*/ aLathePoly3D.SetDirections();
+/*N*/
+/*N*/ // Spezialfall Einzelnes Polygon erzeugen
+/*N*/ BOOL bSinglePoly = (GetEndAngle() == 0 || GetHorizontalSegments() == 0);
+/*N*/ if(bSinglePoly)
+/*N*/ {
+/*?*/ // nur ein Polygon erzeugen
+/*?*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE));
+/*?*/
+/*?*/ // Fuer evtl. selbst erzeugte Normalen
+/*?*/ PolyPolygon3D aNormalsFront;
+/*?*/
+/*?*/ // Normalen und Vorderseite selbst erzeugen
+/*?*/ AddFrontNormals(aLathePoly3D, aNormalsFront, aNormal);
+/*?*/ CreateFront(aLathePoly3D, aNormalsFront, GetCreateNormals(), GetCreateTexture());
+/*?*/
+/*?*/ // #78972#
+/*?*/ maLinePolyPolygon.Insert(aLathePoly3D);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Eventuell doppelseitig erzeugen?
+/*N*/ if(!aLathePoly3D.IsClosed())
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE));
+/*N*/
+/*N*/ // Seiten genenrieren?
+/*N*/ BOOL bCreateSides = ((GetEndAngle() < 3600 && !GetDoubleSided())
+/*N*/ || (GetBackScale() != 100));
+/*N*/
+/*N*/ // Polygone vorbereiten
+/*N*/ PolyPolygon3D aPrev, aFront, aBack, aNext;
+/*N*/
+/*N*/ // Rotation vorbereiten
+/*N*/ double fAng = DEG2RAD(double(GetEndAngle()) / 10);
+/*N*/ Matrix4D aRotMat;
+/*N*/
+/*N*/ // Skalierung vorbereiten
+/*N*/ double fScalePerStep;
+/*N*/ if(GetBackScale() != 100)
+/*N*/ fScalePerStep = (((double)GetBackScale() - 100.0) / 100.0) / (double)GetHorizontalSegments();
+/*N*/
+/*N*/ // Texturen erzeugen?
+/*N*/ double fTextureDepth=1.0;
+/*N*/ double fTextureStart=0.0;
+/*N*/ if(!GetCreateTexture())
+/*N*/ fTextureStart = fTextureDepth = 0.0;
+/*N*/
+/*N*/ // aPrev bis aBack ausfuellen als Startvorbereitung
+/*N*/ aRotMat.RotateY(-(fAng / (double)GetHorizontalSegments()));
+/*N*/ aPrev = aLathePoly3D;
+/*N*/ RotatePoly(aPrev, aRotMat);
+/*N*/ if(GetBackScale() != 100)
+/*N*/ {
+/*N*/ ScalePoly(aPrev, 1.0 - fScalePerStep);
+/*N*/ }
+/*N*/ aRotMat.Identity();
+/*N*/ aRotMat.RotateY(fAng / (double)GetHorizontalSegments());
+/*N*/ aFront = aLathePoly3D;
+/*N*/ aBack = aLathePoly3D;
+/*N*/ RotatePoly(aBack, aRotMat);
+/*N*/ if(GetBackScale() != 100)
+/*N*/ {
+/*N*/ ScalePoly(aBack, 1.0 + fScalePerStep);
+/*N*/ }
+/*N*/
+/*N*/ // Werte fuer Textur-Zwischensegmenterzeugung berechnen
+/*N*/ double fTmpStart = 0.0;
+/*N*/ double fTmpLength = fTextureDepth / (double)GetHorizontalSegments();
+/*N*/ sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nUpperBound;a++)
+/*N*/ {
+/*N*/ // Naechstes Polygon vorbereiten
+/*N*/ aNext = aLathePoly3D;
+/*N*/
+/*N*/ // Rotieren
+/*N*/ if(!(a+2 == nUpperBound && GetEndAngle() == 3600))
+/*N*/ {
+/*N*/ aRotMat.Identity();
+/*N*/ aRotMat.RotateY((fAng * (double)(a+2))/ (double)nUpperBound);
+/*N*/ RotatePoly(aNext, aRotMat);
+/*N*/ }
+/*N*/
+/*N*/ // Skalieren
+/*N*/ if(GetBackScale() != 100)
+/*N*/ {
+/*N*/ ScalePoly(aNext, 1.0 + (fScalePerStep * (double)(a+2)));
+/*N*/ }
+/*N*/
+/*N*/ // Jetzt Segment erzeugen
+/*N*/ ImpCreateSegment(
+/*N*/ aFront,
+/*N*/ aBack,
+/*N*/ &aPrev,
+/*N*/ &aNext,
+/*N*/ (a == 0) && bCreateSides && GetCloseFront(), // #107245# bLatheCloseFront,
+/*N*/ (a == nUpperBound-1) && bCreateSides && GetCloseBack(), // #107245# bLatheCloseBack,
+/*N*/ ((double)GetPercentDiagonal() / 200.0)
+/*N*/ * (double(nUpperBound) / 6.0),
+/*N*/ GetSmoothNormals(), // #107245# GetLatheSmoothed(),
+/*N*/ GetSmoothNormals(), // #107245# GetLatheSmoothed(),
+/*N*/ GetSmoothLids(), // #107245# GetLatheSmoothFrontBack(),
+/*N*/ 1.0,
+/*N*/ fTmpStart,
+/*N*/ fTmpLength,
+/*N*/ GetCreateTexture(),
+/*N*/ GetCreateNormals(),
+/*N*/ GetCharacterMode(), // #107245# GetLatheCharacterMode(),
+/*N*/ TRUE,
+/*N*/ // #78972#
+/*N*/ &maLinePolyPolygon);
+/*N*/
+/*N*/ // naechsten Schritt vorbereiten
+/*N*/ fTmpStart += fTmpLength;
+/*N*/ aPrev = aFront;
+/*N*/ aFront = aBack;
+/*N*/ aBack = aNext;
+/*N*/ }
+/*N*/ }
+
+ // #78972#
+/*N*/ BOOL bClosedLines = ((GetEndAngle() == 3600) && (GetBackScale() == 100));
+/*N*/ ImpCompleteLinePolygon(maLinePolyPolygon, aLathePoly3D.Count(), bClosedLines);
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::CreateGeometry();
+/*N*/ }
+
+/*N*/ PolyPolygon3D E3dLatheObj::CreateLathePolyPoly(PolyPolygon3D& rPolyPoly3D, long nVSegs)
+/*N*/ {
+/*N*/ PolyPolygon3D aLathePolyPolygon3D = rPolyPoly3D;
+/*N*/ sal_uInt16 nCnt = aLathePolyPolygon3D.Count();
+/*N*/ sal_uInt16 nOrigSegmentCnt = aPolyPoly3D[0].GetPointCount();
+/*N*/
+/*N*/ if(nOrigSegmentCnt && !aPolyPoly3D[0].IsClosed())
+/*N*/ nOrigSegmentCnt -= 1;
+/*N*/
+/*N*/ if(nVSegs && nVSegs != nOrigSegmentCnt)
+/*N*/ {
+/*N*/ // make sure minimum is not too small, 3 edges for closed
+/*N*/ // and 2 edges for open obects
+/*N*/ sal_Int32 nMinVSegs = aPolyPoly3D[0].IsClosed() ? 3 : 2;
+/*N*/ if(nVSegs <= nMinVSegs)
+/*N*/ nVSegs = nMinVSegs;
+/*N*/
+/*N*/ if(nVSegs != nOrigSegmentCnt)
+/*N*/ {
+/*N*/ // Erstes Polygon anpassen
+/*N*/ aLathePolyPolygon3D[0] = CreateLathePoly(aLathePolyPolygon3D[0], nVSegs);
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nVSegs));
+/*N*/
+/*N*/ // andere Polygone im richtigen Verhaeltnis anpassen,
+/*N*/ // aber nur, wenn Wert fuer erstes angepasst werden musste
+/*N*/ for(UINT16 i = 1; i < nCnt; i++ )
+/*N*/ {
+/*?*/ Polygon3D &rPoly3D = aLathePolyPolygon3D[i];
+/*?*/ sal_uInt16 nSegCnt(rPoly3D.GetPointCount());
+/*?*/ if(nSegCnt && !rPoly3D.IsClosed())
+/*?*/ nSegCnt -= 1;
+/*?*/ long nNewVSegs = (nSegCnt * nVSegs) / nOrigSegmentCnt;
+/*?*/
+/*?*/ // make sure min is not too small for subpolys, too
+/*?*/ if(nNewVSegs <= nMinVSegs)
+/*?*/ nNewVSegs = nMinVSegs;
+/*?*/
+/*?*/ if(nNewVSegs && nNewVSegs != nSegCnt)
+/*?*/ {
+/*?*/ aLathePolyPolygon3D[i] = CreateLathePoly(aLathePolyPolygon3D[i], nNewVSegs);
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return aLathePolyPolygon3D;
+/*N*/ }
+
+/*N*/ Polygon3D E3dLatheObj::CreateLathePoly(Polygon3D& rPoly3D, long nVSegs)
+/*N*/ {
+/*N*/ // attention: Here number of SEGMENTS is given, while GetExpandedPolygon()
+/*N*/ // takes number of points. Calc PntNum first
+/*N*/ long nNumPts = rPoly3D.IsClosed() ? nVSegs : nVSegs + 1;
+/*N*/ if(nNumPts != rPoly3D.GetPointCount())
+/*N*/ return rPoly3D.GetExpandedPolygon(nNumPts);
+/*N*/ return rPoly3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dLatheObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_LATHEOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wireframe erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void E3dLatheObj::CreateWireframe(Polygon3D& rWirePoly, const Matrix4D* pTf,
+/*N*/ E3dDragDetail eDetail)
+/*N*/ {
+/*N*/ // Nur selbst erzeugen, wenn alle Linien angezeigt werden sollen
+/*N*/ if ( eDetail == E3DDETAIL_ALLLINES ||
+/*N*/ (eDetail == E3DDETAIL_DEFAULT && GetDragDetail() == E3DDETAIL_ALLLINES) )
+/*N*/ {
+/*N*/ // Detailliert erzeugen
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // call parent
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 E3dObject::CreateWireframe(rWirePoly, pTf, eDetail);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dLatheObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Alte Geometrie erzeugen, um die E3dPolyObj's zu haben
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry(TRUE);
+/*N*/ }
+/*N*/
+/*N*/ // leider kann das E3dLatheObj nicht auf E3dObject abgestuetzt werden,
+/*N*/ // da neue Member hinzugekommen sind und die Kompatibilitaet erhalten
+/*N*/ // bleiben muss.
+/*N*/ SdrAttrObj::WriteData(rOut);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLatheObj");
+/*N*/ #endif
+/*N*/
+/*N*/ pSub->Save(rOut);
+/*N*/
+/*N*/ // Parameter aus E3dObject speichern
+/*N*/ rOut << aLocalBoundVol;
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ aMat3D = aTfMatrix;
+/*N*/ rOut << aMat3D;
+/*N*/ rOut << nLogicalGroup;
+/*N*/ rOut << nObjTreeLevel;
+/*N*/ rOut << nPartOfParent;
+/*N*/ rOut << UINT16(eDragDetail);
+/*N*/
+/*N*/ // neue Member
+/*N*/ // Alte version schreibt Polygon3D raus, neue Version
+/*N*/ // benutzt dafuer das erste Teilpolygon von PolyPolygon3D
+/*N*/ // rOut << aPolyPoly3D;
+/*N*/ rOut << aPolyPoly3D[0];
+/*N*/
+/*N*/ rOut << GetHorizontalSegments();
+/*N*/
+/*N*/ rOut << GetEndAngle();
+/*N*/
+/*N*/ rOut << ((E3dLatheObj*)this)->GetDoubleSided();
+/*N*/ rOut << fLatheScale;
+/*N*/
+/*N*/ // Ab Version 364f (19.06.97)
+/*N*/
+/*N*/ // #83965# internally the real number of segments (edges) is
+/*N*/ // used, no longer the number of points
+/*N*/ sal_Int32 nVSegs = GetVerticalSegments();
+/*N*/ if(!aPolyPoly3D[0].IsClosed())
+/*N*/ nVSegs += 1;
+/*N*/
+/*N*/ rOut << nVSegs;
+/*N*/
+/*N*/ // Ab Version 374 (15.12.97)
+/*N*/ rOut << aPolyPoly3D;
+/*N*/
+/*N*/ rOut << ((double)GetBackScale() / 100.0);
+/*N*/
+/*N*/ rOut << ((double)GetPercentDiagonal() / 200.0);
+/*N*/
+/*N*/ rOut << GetSmoothNormals(); // #107245# (BOOL)bLatheSmoothed;
+/*N*/ rOut << GetSmoothLids(); // #107245# (BOOL)bLatheSmoothFrontBack;
+/*N*/ rOut << GetCharacterMode(); // #107245# (BOOL)bLatheCharacterMode;
+/*N*/
+/*N*/ // Ab Version 395 (8.6.98): Parameter aus dem Objekt
+/*N*/ // E3dCompoundObject. Da irgendwann mal jemand die Ableitungs-
+/*N*/ // hierarchie beim FileFormat unterbrochen hat, wurden diese Attribute
+/*N*/ // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich
+/*N*/ // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in
+/*N*/ // E3dCompoundObject oder E3dObject aendern.
+/*N*/ rOut << GetDoubleSided();
+/*N*/
+/*N*/ rOut << BOOL(bCreateNormals);
+/*N*/ rOut << BOOL(bCreateTexture);
+/*N*/
+/*N*/ sal_uInt16 nVal = GetNormalsKind();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionX();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionY();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ rOut << BOOL(GetShadow3D());
+/*N*/
+/*N*/ rOut << GetMaterialAmbientColor();
+/*N*/ rOut << GetMaterialColor();
+/*N*/ rOut << GetMaterialSpecular();
+/*N*/ rOut << GetMaterialEmission();
+/*N*/ rOut << GetMaterialSpecularIntensity();
+/*N*/
+/*N*/ aBackMaterial.WriteData(rOut);
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureKind();
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureMode();
+/*N*/
+/*N*/ rOut << BOOL(GetNormalsInvert());
+/*N*/
+/*N*/ // Ab Version 513a (5.2.99): Parameter fuer das
+/*N*/ // Erzeugen der Vorder/Rueckwand
+/*N*/ rOut << GetCloseFront(); // #107245# BOOL(bLatheCloseFront);
+/*N*/ rOut << GetCloseBack(); // #107245# BOOL(bLatheCloseBack);
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ rOut << BOOL(GetTextureFilter());
+/*N*/
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Geometrie neu erzeugen, um E3dPolyObj's wieder loszuwerden
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ // leider kann das E3dLatheObj nicht auf E3dObject abgestuetzt werden,
+/*N*/ // da neue Member hinzugekommen sind und die Kompatibilitaet erhalten
+/*N*/ // bleiben muss.
+/*N*/ SdrAttrObj::ReadData(rHead, rIn);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLatheObj");
+/*N*/ #endif
+/*N*/ // dann die Member
+/*N*/ UINT16 nTmp16;
+/*N*/
+/*N*/ // #106240# Flag if poly was loaded (all versions above 3.0 and 3.1)
+/*N*/ sal_Bool bPolyWasRead(sal_False);
+/*N*/
+/*N*/ pSub->Load(rIn, *pPage);
+/*N*/
+/*N*/ // Parameter aus E3dObject laden
+/*N*/ rIn >> aLocalBoundVol;
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ rIn >> aMat3D;
+/*N*/ aTfMatrix = Matrix4D(aMat3D);
+/*N*/ rIn >> nLogicalGroup;
+/*N*/ rIn >> nObjTreeLevel;
+/*N*/ rIn >> nPartOfParent;
+/*N*/ rIn >> nTmp16; eDragDetail = E3dDragDetail(nTmp16);
+/*N*/
+/*N*/ // BoundVolume muss neu berechnet werden
+/*N*/ bBoundVolValid = FALSE;
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft ())
+/*N*/ {
+/*N*/ // neue Member
+/*N*/ BOOL bTmp;
+/*N*/ sal_Int32 nTmp;
+/*N*/
+/*N*/ // alte Version holt sich nur ein Polygon3D, wird hier durch
+/*N*/ // Eintragen als erstes Teilpolygon geladen
+/*N*/ // rIn >> aPolyPoly3D;
+/*N*/ rIn >> aPolyPoly3D[0];
+/*N*/
+/*N*/ // #106240# OK, this file does have a saved polygon
+/*N*/ bPolyWasRead = sal_True;
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DEndAngleItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp));
+/*N*/
+/*N*/ rIn >> fLatheScale;
+/*N*/ }
+/*N*/
+/*N*/ // #106240# No PolyPolygon as base for the lathe object was saved.
+/*N*/ // Reconstruct it from the objects in the SubList.
+/*N*/ if(!bPolyWasRead)
+/*N*/ {
+/*N*/ // This is really a old 3.0 or 3.1 file, reconstruct
+/*N*/ // the not saved polygon using the SubList.
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/
+/*N*/ if(pSubList && pSubList->GetObjCount())
+/*N*/ {
+/*N*/ sal_uInt16 nHorSegCount = (sal_uInt16)GetHorizontalSegments() / 2;
+/*N*/ sal_uInt16 nVerSegCount = (sal_uInt16)(pSubList->GetObjCount() / nHorSegCount);
+/*N*/ Polygon3D aNewBasePoly;
+/*N*/
+/*N*/ for(sal_uInt16 a(0); a < nVerSegCount; a++)
+/*N*/ {
+/*N*/ E3dPolyObj* pCandidate = (E3dPolyObj*)pSubList->GetObj(a * nHorSegCount);
+/*N*/ if(pCandidate->ISA(E3dPolyObj))
+/*N*/ {
+/*N*/ const PolyPolygon3D& rCandPoly = ((E3dPolyObj*)pCandidate)->GetPolyPolygon3D();
+/*N*/
+/*N*/ if(rCandPoly[0].GetPointCount() > 1)
+/*N*/ {
+/*N*/ aNewBasePoly[a] = rCandPoly[0][1];
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aPolyPoly3D.Clear();
+/*N*/ aNewBasePoly.SetClosed(sal_True);
+/*N*/ aPolyPoly3D.Insert(aNewBasePoly);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 364f (19.06.97)
+/*N*/ sal_Int32 nTmp;
+/*N*/ rIn >> nTmp;
+/*N*/
+/*N*/ // #83965# internally the real number of segments (edges) is
+/*N*/ // used, no longer the number of points
+/*N*/ if(!aPolyPoly3D[0].IsClosed())
+/*N*/ nTmp -= 1;
+/*N*/
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp));
+/*N*/ }
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 374 (15.12.97)
+/*N*/ // Gesamtes PolyPolygon laden
+/*N*/ BOOL bTmp;
+/*N*/ double fTmp;
+/*N*/
+/*N*/ aPolyPoly3D.Clear();
+/*N*/ rIn >> aPolyPoly3D;
+/*N*/
+/*N*/ rIn >> fTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DBackscaleItem((sal_uInt16)(fTmp * 100.0)));
+/*N*/
+/*N*/ rIn >> fTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DPercentDiagonalItem(sal_uInt16(fTmp * 200.0)));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bLatheSmoothed = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bLatheSmoothFrontBack = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bLatheCharacterMode = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(bTmp));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Geometrie aus erzeugten PolyObj's rekonstruieren
+/*N*/ mpObjectItemSet->Put(Svx3DBackscaleItem(100));
+/*N*/
+/*N*/ mpObjectItemSet->Put(Svx3DPercentDiagonalItem(10));
+/*N*/
+/*N*/ // #107245# bLatheSmoothed = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothNormalsItem(sal_True));
+/*N*/
+/*N*/ // #107245# bLatheSmoothFrontBack = FALSE;
+/*N*/ mpObjectItemSet->Put(Svx3DSmoothLidsItem(sal_False));
+/*N*/
+/*N*/ // #107245# bLatheCharacterMode = FALSE;
+/*N*/ mpObjectItemSet->Put(Svx3DCharacterModeItem(sal_False));
+/*N*/ }
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 395 (8.6.98): Parameter aus dem Objekt
+/*N*/ // E3dCompoundObject. Da irgendwann mal jemand die Ableitungs-
+/*N*/ // hierarchie beim FileFormat unterbrochen hat, wurden diese Attribute
+/*N*/ // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich
+/*N*/ // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in
+/*N*/ // E3dCompoundObject oder E3dObject aendern.
+/*N*/ BOOL bTmp, bTmp2;
+/*N*/ sal_uInt16 nTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; bCreateNormals = bTmp;
+/*N*/ rIn >> bTmp; bCreateTexture = bTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp));
+/*N*/
+/*N*/ Color aCol;
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ SetMaterialAmbientColor(aCol);
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ // do NOT use, this is the old 3D-Color(!)
+/*N*/ // SetItem(XFillColorItem(String(), aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp));
+/*N*/
+/*N*/ aBackMaterial.ReadData(rIn);
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp));
+/*N*/ }
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 513a (5.2.99): Parameter fuer das
+/*N*/ // Erzeugen der Vorder/Rueckwand
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bLatheCloseFront = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; // #107245# bLatheCloseBack = bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(bTmp));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // #107245# bLatheCloseFront = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseFrontItem(sal_True));
+/*N*/
+/*N*/ // #107245# bLatheCloseBack = TRUE;
+/*N*/ mpObjectItemSet->Put(Svx3DCloseBackItem(sal_True));
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (BOOL))
+/*N*/ {
+/*N*/ BOOL bTmp;
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp));
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // correct position of extrude polygon, in case it's not positioned
+/*N*/ // at the Z==0 layer
+/*N*/ if(aPolyPoly3D.Count() && aPolyPoly3D[0].GetPointCount())
+/*N*/ {
+/*N*/ const Vector3D& rFirstPoint = aPolyPoly3D[0][0];
+/*N*/ if(rFirstPoint.Z() != 0.0)
+/*N*/ {
+/*N*/ // change transformation so that source poly lies in Z == 0,
+/*N*/ // so it can be exported as 2D polygon
+/*N*/ //
+/*N*/ // ATTENTION: the translation has to be multiplied from LEFT
+/*N*/ // SIDE since it was executed as the first translate for this
+/*N*/ // 3D object during it's creation.
+/*N*/ double fTransDepth(rFirstPoint.Z());
+/*N*/ Matrix4D aTransMat;
+/*N*/ aTransMat.TranslateZ(fTransDepth);
+/*N*/ NbcSetTransform(aTransMat * GetTransform());
+/*N*/
+/*N*/ // correct polygon itself
+/*N*/ aTransMat.Identity();
+/*N*/ aTransMat.TranslateZ(-fTransDepth);
+/*N*/ aPolyPoly3D.Transform(aTransMat);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus n Polygonen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Neue Segmentierung (Beschreibung siehe Header-File)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dLatheObj::SetPolyPoly3D(const PolyPolygon3D& rNew)
+/*N*/ {
+/*N*/ if(aPolyPoly3D != rNew)
+/*N*/ {
+/*N*/ aPolyPoly3D = rNew;
+/*N*/
+/*N*/ // #83965# take care of vertical segments, too.
+/*N*/ sal_Int32 nNumVSegs = aPolyPoly3D[0].GetPointCount();
+/*N*/ if(!aPolyPoly3D[0].IsClosed())
+/*N*/ nNumVSegs -= 1;
+/*N*/ ImpForceItemSet();
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nNumVSegs));
+/*N*/
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+
+// #107245#
+// void E3dLatheObj::SetLatheSmoothed(BOOL bNew)
+// {
+// if(bLatheSmoothed != bNew)
+// {
+// bLatheSmoothed = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dLatheObj::SetLatheSmoothFrontBack(BOOL bNew)
+// {
+// if(bLatheSmoothFrontBack != bNew)
+// {
+// bLatheSmoothFrontBack = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dLatheObj::SetLatheCharacterMode(BOOL bNew)
+// {
+// if(bLatheCharacterMode != bNew)
+// {
+// bLatheCharacterMode = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dLatheObj::SetLatheCloseFront(BOOL bNew)
+// {
+// if(bLatheCloseFront != bNew)
+// {
+// bLatheCloseFront = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+// #107245#
+// void E3dLatheObj::SetLatheCloseBack(BOOL bNew)
+// {
+// if(bLatheCloseBack != bNew)
+// {
+// bLatheCloseBack = bNew;
+// bGeometryValid = FALSE;
+// }
+// }
+
+//////////////////////////////////////////////////////////////////////////////
+// private support routines for ItemSet access
+
+/*N*/ void E3dLatheObj::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::PostItemChange(nWhich);
+/*N*/
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case SDRATTR_3DOBJ_HORZ_SEGS:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_VERT_SEGS:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_BACKSCALE:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_END_ANGLE:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Aufbrechen
+|*
+\************************************************************************/
+
+
+
+// EOF
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_light3d.cxx b/binfilter/bf_svx/source/engine3d/svx_light3d.cxx
new file mode 100644
index 000000000000..e8d4f2dc039d
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_light3d.cxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdio.hxx"
+
+#include "globl3d.hxx"
+
+#include "light3d.hxx"
+
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dLight, E3dPointObj);
+
+/*************************************************************************
+|*
+|* E3dLight-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dLight::E3dLight(const Vector3D& rPos, const Color& rColor,
+/*N*/ double fLightIntensity) :
+/*N*/ E3dPointObj(rPos),
+/*N*/ fIntensity(fLightIntensity),
+/*N*/ bOn(TRUE),
+/*N*/ bVisible(FALSE)
+/*N*/ {
+/*N*/ SetColor(rColor);
+/*N*/ aLocalBoundVol = Volume3D();
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* E3dLight-Konstruktor 2
+|*
+\************************************************************************/
+
+/*N*/ E3dLight::E3dLight() :
+/*N*/ E3dPointObj(Vector3D()),
+/*N*/
+/*N*/ aColor(255, 255, 255),
+/*N*/
+/*N*/ fRed(1.0),
+/*N*/ fGreen(1.0),
+/*N*/ fBlue(1.0),
+/*N*/ fIntensity(1.0),
+/*N*/ bOn(TRUE),
+/*N*/ bVisible(FALSE)
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* protected, daher kein Einfuegen von Objekten von aussen moeglich
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::Insert3DObj(E3dObject* p3DObj)
+/*N*/ {
+/*N*/ // E3dPointObj::Insert3DObj(p3DObj);
+/*N*/ GetSubList()->InsertObject(p3DObj);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dLight::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_LIGHT_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Lichtstaerke an uebergeben Punkt bestimmen und die akkumulierte
+|* Punktfarbe berechnen; Return = TRUE bedeutet, dass die maximale
+|* Farbintensitaet aller Farbanteile erreicht ist.
+|*
+\************************************************************************/
+
+/*N*/ FASTBOOL E3dLight::ImpCalcLighting(Color& rNewColor, const Color& rPntColor,
+/*N*/ double fR, double fG, double fB) const
+/*N*/ {
+/*N*/ ULONG nR(rNewColor.GetRed()),
+/*N*/ nG(rNewColor.GetGreen()),
+/*N*/ nB(rNewColor.GetBlue());
+/*N*/ ULONG nPntR(rPntColor.GetRed()),
+/*N*/ nPntG(rPntColor.GetGreen()),
+/*N*/ nPntB(rPntColor.GetBlue());
+/*N*/
+/*N*/ if ( bOn )
+/*N*/ {
+/*N*/ nR += (ULONG) (fR * nPntR);
+/*N*/ nG += (ULONG) (fG * nPntG);
+/*N*/ nB += (ULONG) (fB * nPntB);
+/*N*/
+/*N*/ nR = Min(nR, nPntR);
+/*N*/ nG = Min(nG, nPntG);
+/*N*/ nB = Min(nB, nPntB);
+/*N*/
+/*N*/ rNewColor.SetRed((USHORT) nR);
+/*N*/ rNewColor.SetGreen((USHORT) nG);
+/*N*/ rNewColor.SetBlue((USHORT) nB);
+/*N*/ }
+/*N*/ return ( nR == nPntR && nG == nPntG && nB == nPntB );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Lichtstaerke an uebergeben Punkt bestimmen und die akkumulierte
+|* Punktfarbe berechnen
+|*
+\************************************************************************/
+
+/*N*/ FASTBOOL E3dLight::CalcLighting(Color& rNewColor,
+/*N*/ const Vector3D& rPnt,
+/*N*/ const Vector3D& rPntNormal,
+/*N*/ const Color& rPntColor)
+/*N*/ {
+/*N*/ return ImpCalcLighting(rNewColor, rPntColor, fRed, fGreen, fBlue);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* neue Position setzen und Aenderung an Parents (Szene) melden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::SetPosition(const Vector3D& rNewPos)
+/*N*/ {
+/*N*/ E3dPointObj::SetPosition(rNewPos);
+/*N*/ CreateLightObj();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* neue Intensitaet setzen und Aenderung an Parents (Szene) melden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::SetIntensity(double fNew)
+/*N*/ {
+/*N*/ if ( fIntensity != fNew )
+/*N*/ {
+/*N*/ fIntensity = fNew;
+/*N*/ StructureChanged(this);
+/*N*/ SetColor(aColor);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* neue Farbe setzen und Aenderung an Parents (Szene) melden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::SetColor(const Color& rNewColor)
+/*N*/ {
+/*N*/ if ( aColor != rNewColor )
+/*N*/ {
+/*N*/ aColor = rNewColor;
+/*N*/ StructureChanged(this);
+/*N*/ }
+/*N*/
+/*N*/ fRed = fIntensity * aColor.GetRed() / 255;
+/*N*/ fGreen = fIntensity * aColor.GetGreen() / 255;
+/*N*/ fBlue = fIntensity * aColor.GetBlue() / 255;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Lichtquelle ein-/ausschalten und Aenderung an Parents (Szene) melden
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Darstellung des Lichtobjekts in der Szene ein-/ausschalten
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Darstellung des Lichtobjekts in der Szene ein-/ausschalten
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::CreateLightObj()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ E3dPointObj::WriteData(rOut);
+/*N*/
+/*N*/ #ifdef E3D_STREAMING
+/*N*/
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLight");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aColor;
+/*N*/ rOut << fIntensity;
+/*N*/ rOut << fRed;
+/*N*/ rOut << fGreen;
+/*N*/ rOut << fBlue;
+/*N*/ rOut << BOOL(bOn);
+/*N*/ rOut << BOOL(bVisible);
+/*N*/ #endif
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dPointObj::ReadData(rHead, rIn);
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dLight");
+/*N*/ #endif
+/*N*/
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ rIn >> aColor;
+/*N*/ rIn >> fIntensity;
+/*N*/ rIn >> fRed;
+/*N*/ rIn >> fGreen;
+/*N*/ rIn >> fBlue;
+/*N*/ rIn >> bTmp; bOn = bTmp;
+/*N*/ rIn >> bTmp; bVisible = bTmp;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dLight::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Attribute abfragen
+|*
+\************************************************************************/
+
+/*N*/ SfxStyleSheet*E3dLight::GetStyleSheet() const
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_obj3d.cxx b/binfilter/bf_svx/source/engine3d/svx_obj3d.cxx
new file mode 100644
index 000000000000..950028c4469a
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_obj3d.cxx
@@ -0,0 +1,2969 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define ITEMID_COLOR SID_ATTR_3D_LIGHTCOLOR
+
+#include "svdstr.hrc"
+
+#include "svdview.hxx"
+
+
+
+
+
+
+#include "globl3d.hxx"
+
+
+
+#include "polyob3d.hxx"
+
+
+#include "polysc3d.hxx"
+
+
+
+
+
+
+#include "xoutx.hxx"
+
+
+
+
+
+
+
+
+
+
+
+#include "xlnwtit.hxx"
+
+
+#include "svdio.hxx"
+
+
+
+#include "svxids.hrc"
+
+
+
+
+
+
+
+
+
+
+
+#include "eeitem.hxx"
+
+
+namespace binfilter {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+/*************************************************************************
+|*
+|* Liste fuer 3D-Objekte
+|*
+\************************************************************************/
+
+/*N*/ TYPEINIT1(E3dObjList, SdrObjList);
+
+/*N*/ E3dObjList::E3dObjList(SdrModel* pNewModel, SdrPage* pNewPage, E3dObjList* pNewUpList)
+/*N*/ : SdrObjList(pNewModel, pNewPage, pNewUpList)
+/*N*/ {
+/*N*/ }
+
+/*?*/ E3dObjList::E3dObjList(const E3dObjList& rSrcList)
+/*?*/ : SdrObjList(rSrcList)
+/*?*/ {
+/*?*/ }
+
+/*N*/ E3dObjList::~E3dObjList()
+/*N*/ {
+/*N*/ }
+
+/*N*/ void E3dObjList::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason)
+/*N*/ {
+/*N*/ // Owner holen
+/*N*/ DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Einfuegen 3DObject in Parent != 3DObject");
+/*N*/
+/*N*/ // Ist es ueberhaupt ein 3D-Objekt?
+/*N*/ if(pObj && pObj->ISA(E3dObject))
+/*N*/ {
+/*N*/ // Normales 3D Objekt, einfuegen mittels
+/*N*/ // call parent
+/*N*/ SdrObjList::NbcInsertObject(pObj, nPos, pReason);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // Kein 3D Objekt, fuege in Seite statt in Szene ein...
+/*?*/ GetOwnerObj()->GetPage()->InsertObject(pObj, nPos);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SdrObject* E3dObjList::RemoveObject(ULONG nObjNum)
+/*N*/ {
+/*N*/ // Owner holen
+/*N*/ DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
+/*N*/ E3dObject* pOwner = (E3dObject*)GetOwnerObj();
+/*N*/
+/*N*/ // call parent
+/*N*/ SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
+/*N*/
+/*N*/ // FitSnapRectToBoundVol vorbereiten
+/*N*/ if(GetOwnerObj() && GetOwnerObj()->ISA(E3dScene))
+/*N*/ ((E3dScene*)GetOwnerObj())->CorrectSceneDimensions();
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ TYPEINIT1(E3dObject, SdrAttrObj);
+
+/*N*/ E3dObject::E3dObject() :
+/*N*/ nLogicalGroup(0),
+/*N*/ nObjTreeLevel(0),
+/*N*/ eDragDetail(E3DDETAIL_ONEBOX),
+/*N*/ nPartOfParent(0),
+/*N*/ bTfHasChanged(TRUE),
+/*N*/ bBoundVolValid(TRUE),
+/*N*/ bIsSelected(FALSE)
+/*N*/ {
+/*N*/ bIs3DObj = TRUE;
+/*N*/ pSub = new E3dObjList(NULL, NULL);
+/*N*/ pSub->SetOwnerObj(this);
+/*N*/ pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+/*N*/ bClosedObj = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dObject::~E3dObject()
+/*N*/ {
+/*N*/ delete pSub;
+/*N*/ pSub = NULL;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Selektions-Flag setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Aufbrechen, default-Implementierungen
+|*
+\************************************************************************/
+
+
+/*N*/ SdrAttrObj* E3dObject::GetBreakObj()
+/*N*/ {
+/*N*/ return 0L;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SetRectsDirty muss ueber die lokale SdrSubList gehen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetRectsDirty(FASTBOOL bNotMyself)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ SdrAttrObj::SetRectsDirty(bNotMyself);
+/*N*/
+/*N*/ // Eigene SubListe AUCH behandeln
+/*N*/ if(pSub && pSub->GetObjCount())
+/*N*/ {
+/*N*/ for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pSub->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/ ((E3dObject*)pObj)->SetRectsDirty(bNotMyself);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Inventor zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT32 E3dObject::GetObjInventor() const
+/*N*/ {
+/*N*/ return E3dInventor;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dObject::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_OBJECT_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Faehigkeiten des Objektes feststellen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Layer abfragen
+|*
+\************************************************************************/
+
+/*N*/ SdrLayerID E3dObject::GetLayer() const
+/*N*/ {
+/*N*/ FASTBOOL bFirst = TRUE;
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/ SdrLayerID nLayer = SdrLayerID(nLayerID);
+/*N*/
+/*N*/ for ( ULONG i = 0; i < nObjCnt; i++ )
+/*N*/ {
+/*N*/ SdrLayerID nObjLayer;
+/*N*/ if(pOL->GetObj(i)->ISA(E3dPolyObj))
+/*N*/ nObjLayer = SdrLayerID(nLayerID);
+/*N*/ else
+/*N*/ nObjLayer = pOL->GetObj(i)->GetLayer();
+/*N*/
+/*N*/ if (bFirst)
+/*N*/ {
+/*N*/ nLayer = nObjLayer;
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*N*/ else if ( nObjLayer != nLayer )
+/*N*/ return 0;
+/*N*/ }
+/*N*/ return nLayer;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::NbcSetLayer(SdrLayerID nLayer)
+/*N*/ {
+/*N*/ SdrAttrObj::NbcSetLayer(nLayer);
+/*N*/
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/ ULONG i;
+/*N*/ for ( i = 0; i < nObjCnt; i++ )
+/*N*/ pOL->GetObj(i)->NbcSetLayer(nLayer);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ObjList auch an SubList setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetObjList(SdrObjList* pNewObjList)
+/*N*/ {
+/*N*/ SdrObject::SetObjList(pNewObjList);
+/*N*/ pSub->SetUpList(pNewObjList);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetPage(SdrPage* pNewPage)
+/*N*/ {
+/*N*/ SdrAttrObj::SetPage(pNewPage);
+/*N*/ pSub->SetPage(pNewPage);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetModel(SdrModel* pNewModel)
+/*N*/ {
+/*N*/ SdrAttrObj::SetModel(pNewModel);
+/*N*/ pSub->SetModel(pNewModel);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* resize object, used from old 2d interfaces, e.g. in Move/Scale dialog
+|* (F4)
+|*
+\************************************************************************/
+/*N*/ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ // SdrAttrObj::NbcResize(rRef, xFact, yFact);
+/*N*/
+/*N*/ // Bewegung in X,Y im Augkoordinatensystem
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/
+/*N*/ if(pScene)
+/*N*/ {
+/*N*/ // pos ermitteln
+/*N*/ B3dTransformationSet& rTransSet = pScene->GetCameraSet();
+/*N*/ Vector3D aScaleCenter((double)rRef.X(), (double)rRef.Y(), 32768.0);
+/*N*/ aScaleCenter = rTransSet.ViewToEyeCoor(aScaleCenter);
+/*N*/
+/*N*/ // scale-faktoren holen
+/*N*/ double fScaleX = xFact;
+/*N*/ double fScaleY = yFact;
+/*N*/
+/*N*/ // build transform
+/*N*/ Matrix4D mFullTransform(GetFullTransform());
+/*N*/ Matrix4D mTrans(mFullTransform);
+/*N*/
+/*N*/ mTrans *= rTransSet.GetOrientation();
+/*N*/ mTrans.Translate(-aScaleCenter);
+/*N*/ mTrans.Scale(fScaleX, fScaleY, 1.0);
+/*N*/ mTrans.Translate(aScaleCenter);
+/*N*/ mTrans *= rTransSet.GetInvOrientation();
+/*N*/ mFullTransform.Invert();
+/*N*/ mTrans *= mFullTransform;
+/*N*/
+/*N*/ // anwenden
+/*N*/ Matrix4D mObjTrans(GetTransform());
+/*N*/ mObjTrans *= mTrans;
+/*N*/ SetTransform(mObjTrans);
+/*N*/
+/*N*/ // force new camera and SnapRect on scene, geometry may have really
+/*N*/ // changed
+/*N*/ pScene->CorrectSceneDimensions();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objekt verschieben in 2D, wird bei Cursortasten benoetigt
+|*
+\************************************************************************/
+
+/*************************************************************************
+|*
+|* liefere die Sublist, aber nur dann, wenn darin Objekte enthalten sind !
+|*
+\************************************************************************/
+
+/*N*/ SdrObjList* E3dObject::GetSubList() const
+/*N*/ {
+/*N*/ return pSub;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Anzahl der Handles zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Handle-Liste fuellen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Paint; wird z.Z. nicht benutzt, da das Paint ueber die
+|* (2D-)Displayliste der Szene laeuft
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objekt als Kontur in das Polygon einfuegen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Schatten fuer 3D-Objekte zeichnen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::RecalcSnapRect()
+/*N*/ {
+/*N*/ maSnapRect = Rectangle();
+/*N*/ if(pSub && pSub->GetObjCount())
+/*N*/ {
+/*N*/ for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pSub->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/ Rectangle aSubRect = ((E3dObject*)pObj)->GetSnapRect();
+/*N*/ maSnapRect.Union(aSubRect);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BoundRect berechnen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::RecalcBoundRect()
+/*N*/ {
+/*N*/ // BoundRect aus SnapRect berechnen
+/*N*/ aOutRect = GetSnapRect();
+/*N*/
+/*N*/ if(pSub && pSub->GetObjCount())
+/*N*/ {
+/*N*/ for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pSub->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/ Rectangle aSubRect = ((E3dObject*)pObj)->GetBoundRect();
+/*N*/ aOutRect.Union(aSubRect);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Einfuegen eines 3D-Objekts an den Parent weitermelden, damit dieser
+|* ggf. eine Sonderbehandlung fuer spezielle Objekte durchfuehren kann
+|* (z.B. Light/Label in E3dScene)
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
+/*N*/ {
+/*N*/ if(GetParentObj())
+/*N*/ GetParentObj()->NewObjectInserted(p3DObj);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Parent ueber Aenderung der Struktur (z.B. durch Transformation)
+|* informieren; dabei wird das Objekt, in welchem die Aenderung
+|* aufgetreten ist, uebergeben
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::StructureChanged(const E3dObject* p3DObj)
+/*N*/ {
+/*N*/ if ( GetParentObj() )
+/*N*/ {
+/*N*/ // Wenn sich im Child das BoundVolume geaendert hat, muessen
+/*N*/ // auch die der Parents angepasst werden
+/*N*/ if ( !p3DObj->bBoundVolValid )
+/*N*/ GetParentObj()->bBoundVolValid = FALSE;
+/*N*/
+/*N*/ GetParentObj()->StructureChanged(p3DObj);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* 3D-Objekt einfuegen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::Insert3DObj(E3dObject* p3DObj)
+/*N*/ {
+/*N*/ DBG_ASSERT(p3DObj, "Insert3DObj mit NULL-Zeiger!");
+/*N*/ p3DObj->SetObjTreeLevel(nObjTreeLevel + 1);
+/*N*/ SdrPage* pPg = pPage;
+/*N*/ pSub->InsertObject(p3DObj);
+/*N*/ pPage = pPg;
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ NewObjectInserted(p3DObj);
+/*N*/ StructureChanged(this);
+/*N*/ }
+
+/*N*/ void E3dObject::Remove3DObj(E3dObject* p3DObj)
+/*N*/ {
+/*N*/ DBG_ASSERT(p3DObj, "Remove3DObj mit NULL-Zeiger!");
+/*N*/
+/*N*/ if(p3DObj->GetParentObj() == this)
+/*N*/ {
+/*N*/ SdrPage* pPg = pPage;
+/*N*/ pSub->RemoveObject(p3DObj->GetOrdNum());
+/*N*/ pPage = pPg;
+/*N*/
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ StructureChanged(this);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Parent holen
+|*
+\************************************************************************/
+
+/*N*/ E3dObject* E3dObject::GetParentObj() const
+/*N*/ {
+/*N*/ E3dObject* pRetval = NULL;
+/*N*/
+/*N*/ if(GetObjList()
+/*N*/ && GetObjList()->GetOwnerObj()
+/*N*/ && GetObjList()->GetOwnerObj()->ISA(E3dObject))
+/*N*/ pRetval = ((E3dObject*)GetObjList()->GetOwnerObj());
+/*N*/ return pRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Uebergeordnetes Szenenobjekt bestimmen
+|*
+\************************************************************************/
+
+/*N*/ E3dScene* E3dObject::GetScene() const
+/*N*/ {
+/*N*/ if(GetParentObj())
+/*N*/ return GetParentObj()->GetScene();
+/*N*/ return NULL;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* umschliessendes Volumen inklusive aller Kindobjekte berechnen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::RecalcBoundVolume()
+/*N*/ {
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/
+/*N*/ if(nObjCnt)
+/*N*/ {
+/*N*/ aBoundVol = Volume3D();
+/*N*/
+/*N*/ for (ULONG i = 0; i < nObjCnt; i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pOL->GetObj(i);
+/*N*/
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/ // Bei den Kindobjekten auch die lokalen Transformationen
+/*N*/ // beruecksichtigen
+/*N*/ E3dObject* p3DObj = (E3dObject*) pObj;
+/*N*/ const Volume3D& rVol = p3DObj->GetBoundVolume();
+/*N*/ const Matrix4D& rTf = p3DObj->GetTransform();
+/*N*/ aBoundVol.Union(rVol.GetTransformVolume(rTf));
+/*N*/ }
+/*N*/
+/*N*/ aLocalBoundVol = aBoundVol;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aBoundVol = aLocalBoundVol;
+/*N*/ }
+/*N*/
+/*N*/ bBoundVolValid = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* umschliessendes Volumen zurueckgeben und ggf. neu berechnen
+|*
+\************************************************************************/
+
+/*N*/ const Volume3D& E3dObject::GetBoundVolume()
+/*N*/ {
+/*N*/ if ( !bBoundVolValid )
+/*N*/ RecalcBoundVolume();
+/*N*/
+/*N*/ if(!aBoundVol.IsValid())
+/*N*/ aBoundVol = Volume3D(Vector3D(), Vector3D());
+/*N*/
+/*N*/ return aBoundVol;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Mittelpunkt liefern
+|*
+\************************************************************************/
+
+/*N*/ Vector3D E3dObject::GetCenter()
+/*N*/ {
+/*N*/ Volume3D aVolume = GetBoundVolume();
+/*N*/ return (aVolume.MaxVec() + aVolume.MinVec()) / 2.0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Aederung des BoundVolumes an alle Kindobjekte weitergeben
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetBoundVolInvalid()
+/*N*/ {
+/*N*/ bBoundVolValid = FALSE;
+/*N*/
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/
+/*N*/ for (ULONG i = 0; i < nObjCnt; i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pOL->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/
+/*N*/ ((E3dObject*) pObj)->SetBoundVolInvalid();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Aederung der Transformation an alle Kindobjekte weitergeben
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetTransformChanged()
+/*N*/ {
+/*N*/ bTfHasChanged = TRUE;
+/*N*/ bBoundVolValid = FALSE;
+/*N*/
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/
+/*N*/ for (ULONG i = 0; i < nObjCnt; i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pOL->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/
+/*N*/ ((E3dObject*) pObj)->SetTransformChanged();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* hierarchische Transformation ueber alle Parents bestimmen und mit
+|* der uebergebenen Matrix verketten
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* hierarchische Transformation ueber alle Parents bestimmen, in
+|* aFullTfMatrix ablegen und diese zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ const Matrix4D& E3dObject::GetFullTransform()
+/*N*/ {
+/*N*/ if ( bTfHasChanged )
+/*N*/ {
+/*N*/ aFullTfMatrix = aTfMatrix;
+/*N*/
+/*N*/ if ( GetParentObj() )
+/*N*/ aFullTfMatrix *= GetParentObj()->GetFullTransform();
+/*N*/
+/*N*/ bTfHasChanged = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ return aFullTfMatrix;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix abfragen
+|*
+\************************************************************************/
+
+/*N*/ const Matrix4D& E3dObject::GetTransform() const
+/*N*/ {
+/*N*/ return aTfMatrix;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::NbcSetTransform(const Matrix4D& rMatrix)
+/*N*/ {
+/*N*/ aTfMatrix = rMatrix;
+/*N*/ SetTransformChanged();
+/*N*/ StructureChanged(this);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix auf Einheitsmatrix zuruecksetzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::NbcResetTransform()
+/*N*/ {
+/*N*/ aTfMatrix.Identity();
+/*N*/ SetTransformChanged();
+/*N*/ StructureChanged(this);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix setzen mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetTransform(const Matrix4D& rMatrix)
+/*N*/ {
+/*N*/ SendRepaintBroadcast();
+/*N*/ NbcSetTransform(rMatrix);
+/*N*/ SetChanged();
+/*N*/ SendRepaintBroadcast();
+/*N*/ if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix zuruecksetzen mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Translation
+|*
+\************************************************************************/
+
+/*************************************************************************
+|*
+|* Translation mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Skalierungen
+|*
+\************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/*************************************************************************
+|*
+|* gleichmaessige Skalierung
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Skalierungen mit mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Rotationen mit Winkel in Radiant
+|*
+\************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Rotationen mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+
+/************************************************************************/
+
+
+/************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objektbaum-Ebene des Objekts und aller Children setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SetObjTreeLevel(USHORT nNewLevel)
+/*N*/ {
+/*N*/ nObjTreeLevel = nNewLevel;
+/*N*/ nNewLevel++;
+/*N*/
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/
+/*N*/ for (ULONG i = 0; i < nObjCnt; i++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pOL->GetObj(i);
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+/*N*/
+/*N*/ ((E3dObject*) pObj)->SetObjTreeLevel(nNewLevel);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* logische Gruppe setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Linien fuer die Wireframe-Darstellung des Objekts dem uebergebenen
+|* Polygon3D hinzufuegen. Als default wird das BoundVolume verwendet.
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Wireframe-XPolyPolygon erzeugen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Drag-Polygon zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+//////////////////////////////////////////////////////////////////////////////
+// ItemSet access
+
+/*N*/ const SfxItemSet& E3dObject::GetItemSet() const
+/*N*/ {
+/*N*/ // include Items of scene this object belongs to
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene && pScene != this)
+/*N*/ {
+/*N*/ SfxItemSet& rSet = (SfxItemSet&)SdrAttrObj::GetItemSet();
+/*N*/ SfxItemSet aSet(*rSet.GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+/*N*/ aSet.Put(pScene->E3dObject::GetItemSet());
+/*N*/ rSet.Put(aSet);
+/*N*/ }
+/*N*/
+/*N*/ return SdrAttrObj::GetItemSet();
+/*N*/ }
+
+/*N*/ SfxItemSet* E3dObject::CreateNewItemSet(SfxItemPool& rPool)
+/*N*/ {
+/*N*/ // include ALL items, 2D and 3D
+/*N*/ return new SfxItemSet(rPool,
+/*N*/ // ranges from SdrAttrObj
+/*N*/ SDRATTR_START, SDRATTRSET_SHADOW,
+/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
+/*N*/
+/*N*/ // ranges for 3D (object and scene)
+/*N*/ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+/*N*/
+/*N*/ // outliner and end
+/*N*/ EE_ITEMS_START, EE_ITEMS_END,
+/*N*/ 0, 0);
+/*N*/ }
+
+// private support routines for ItemSet access. NULL pointer means clear item.
+/*N*/ void E3dObject::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+/*N*/ {
+/*N*/ // propagate item changes to scene
+/*N*/ if(!nWhich || (nWhich >= SDRATTR_3DSCENE_FIRST && nWhich <= SDRATTR_3DSCENE_LAST))
+/*N*/ {
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene && pScene != this)
+/*N*/ pScene->E3dObject::ItemChange(nWhich, pNewItem);
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ SdrAttrObj::ItemChange(nWhich, pNewItem);
+/*N*/ }
+
+// #107770# Like propagating ItemChange to the scene if scene items are changed,
+// do the same with the PostItemChange calls.
+/*N*/ void E3dObject::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // propagate item changes to scene
+/*N*/ if(!nWhich || (nWhich >= SDRATTR_3DSCENE_FIRST && nWhich <= SDRATTR_3DSCENE_LAST))
+/*N*/ {
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene && pScene != this)
+/*N*/ pScene->PostItemChange(nWhich);
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ SdrAttrObj::PostItemChange(nWhich);
+/*N*/ }
+
+/*N*/ void E3dObject::ItemSetChanged( const SfxItemSet& rSet )
+/*N*/ {
+/*N*/ // call parent
+/*N*/ SdrAttrObj::ItemSetChanged( rSet );
+/*N*/
+/*N*/ // local changes
+/*N*/ StructureChanged(this);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* StyleSheet setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet,
+/*N*/ FASTBOOL bDontRemoveHardAttr)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ SdrAttrObj::NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+/*N*/
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/ for ( ULONG i = 0; i < nObjCnt; i++ )
+/*?*/ pOL->GetObj(i)->NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Nur die Member des E3dObjekts in den Stream speichern
+|* Dies wird direkt auch von E3dSphere gerufen um zu verhindern dass die
+|* Subliste weggeschrieben wird. (FG)
+|*
+\************************************************************************/
+
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ void E3dObject::WriteOnlyOwnMembers(SvStream& rOut) const
+/*N*/ {
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dObjectOwnMembers");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ aMat3D = aTfMatrix;
+/*N*/ rOut << aMat3D;
+/*N*/
+/*N*/ rOut << nLogicalGroup;
+/*N*/ rOut << nObjTreeLevel;
+/*N*/ rOut << nPartOfParent;
+/*N*/ rOut << UINT16(eDragDetail);
+/*N*/ }
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long position = rOut.Tell();
+/*N*/ SdrAttrObj::WriteData(rOut);
+/*N*/ position = rOut.Tell();
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dObject");
+/*N*/ #endif
+/*N*/
+/*N*/ position = rOut.Tell();
+/*N*/ pSub->Save(rOut);
+/*N*/ position = rOut.Tell();
+/*N*/
+/*N*/ if (rOut.GetVersion() < 3560)
+/*N*/ {
+/*N*/ rOut << aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ aMat3D = aTfMatrix;
+/*N*/ rOut << aMat3D;
+/*N*/
+/*N*/ rOut << nLogicalGroup;
+/*N*/ rOut << nObjTreeLevel;
+/*N*/ rOut << nPartOfParent;
+/*N*/ rOut << UINT16(eDragDetail);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ WriteOnlyOwnMembers(rOut);
+/*N*/ }
+/*N*/ position = rOut.Tell();
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ long position = rIn.Tell();
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ position = rIn.Tell();
+/*N*/ SdrAttrObj::ReadData(rHead, rIn);
+/*N*/ position = rIn.Tell();
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dObject");
+/*N*/ #endif
+/*N*/ pSub->Load(rIn, *pPage);
+/*N*/
+/*N*/ position = rIn.Tell();
+/*N*/ if ((rIn.GetVersion() < 3560) || (rHead.GetVersion() <= 12))
+/*N*/ {
+/*N*/ UINT16 nTmp16;
+/*N*/
+/*N*/ rIn >> aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ rIn >> aMat3D;
+/*N*/ aTfMatrix = Matrix4D(aMat3D);
+/*N*/
+/*N*/ rIn >> nLogicalGroup;
+/*N*/ rIn >> nObjTreeLevel;
+/*N*/ rIn >> nPartOfParent;
+/*N*/ rIn >> nTmp16; eDragDetail = E3dDragDetail(nTmp16);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ReadOnlyOwnMembers(rHead, rIn);
+/*N*/ }
+/*N*/ position = rIn.Tell();
+/*N*/
+/*N*/ // Wie ein veraendertes Objekt behandeln
+/*N*/ SetTransformChanged();
+/*N*/ StructureChanged(this);
+/*N*/
+/*N*/ // BoundVolume muss neu berechnet werden
+/*N*/ bBoundVolValid = FALSE;
+/*N*/
+/*N*/ // SnapRect auch
+/*N*/ bSnapRectDirty = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Nur die Daten des E3dObject aus Stream laden (nicht der Sublisten und
+|* der Basisklassen). Wird von E3dSphere auch genutzt. (FileFormat-Optimierung)
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::ReadOnlyOwnMembers(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dObjectOwnMembers");
+/*N*/ #endif
+/*N*/ UINT16 nTmp16;
+/*N*/
+/*N*/ rIn >> aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ rIn >> aMat3D;
+/*N*/ aTfMatrix = Matrix4D(aMat3D);
+/*N*/
+/*N*/ rIn >> nLogicalGroup;
+/*N*/ rIn >> nObjTreeLevel;
+/*N*/ rIn >> nPartOfParent;
+/*N*/ rIn >> nTmp16; eDragDetail = E3dDragDetail(nTmp16);
+/*N*/
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* nach dem Laden...
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::AfterRead()
+/*N*/ {
+/*N*/ SdrAttrObj::AfterRead();
+/*N*/ if (pSub)
+/*N*/ pSub->AfterRead();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* erstelle neues GeoData-Objekt
+|*
+\************************************************************************/
+
+/*N*/ SdrObjGeoData *E3dObject::NewGeoData() const
+/*N*/ {
+/*N*/ // Theoretisch duerfen auch nur Szenen ihre GeoDatas erstellen und verwalten !!
+/*N*/ // AW: Dies stimmt nicht mehr, diese Stelle ist mit der neuen Engine OK!
+/*N*/ return new E3DObjGeoData;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* uebergebe aktuelle werte an das GeoData-Objekt
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
+/*N*/ {
+/*N*/ SdrAttrObj::SaveGeoData (rGeo);
+/*N*/
+/*N*/ ((E3DObjGeoData &) rGeo).aLocalBoundVol = aLocalBoundVol;
+/*N*/ ((E3DObjGeoData &) rGeo).aTfMatrix = aTfMatrix;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* uebernehme werte aus dem GeoData-Objekt
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
+/*N*/ {
+/*N*/ aLocalBoundVol = ((E3DObjGeoData &) rGeo).aLocalBoundVol;
+/*N*/ NbcSetTransform (((E3DObjGeoData &) rGeo).aTfMatrix);
+/*N*/
+/*N*/ SdrAttrObj::RestGeoData (rGeo);
+/*N*/ GetScene()->FitSnapRectToBoundVol();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Pruefe, ob die SubRecords ok sind und mit der Factory gelesen werden
+|* koennen.
+|*
+\************************************************************************/
+
+/*N*/ BOOL E3dObject::ImpCheckSubRecords (const SdrObjIOHeader& rHead,
+/*N*/ SvStream& rIn)
+/*N*/ {
+/*N*/ BOOL bDoRead = FALSE;
+/*N*/
+/*N*/ if ( rIn.GetError() == SVSTREAM_OK )
+/*N*/ {
+/*N*/ if (rHead.GetVersion () <= 12)
+/*N*/ {
+/*N*/ ULONG nPos0 = rIn.Tell();
+/*N*/ // Einen SubRecord ueberspringen (SdrObject)
+/*N*/ { SdrDownCompat aCompat(rIn,STREAM_READ); }
+/*N*/ // Nocheinen SubRecord ueberspringen (SdrAttrObj)
+/*N*/ { SdrDownCompat aCompat(rIn,STREAM_READ); }
+/*N*/ // Und nun muesste meiner kommen
+/*N*/ bDoRead = rHead.GetBytesLeft() != 0;
+/*N*/ rIn.Seek (nPos0); // FilePos wieder restaurieren
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bDoRead = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return bDoRead;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Keine DefaultAttr, zu langsam
+|*
+\************************************************************************/
+
+/*N*/ void E3dObject::ForceDefaultAttr()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************/
+
+/*N*/ TYPEINIT1(E3dCompoundObject, E3dObject);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dCompoundObject::E3dCompoundObject() : E3dObject()
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/
+/*N*/ bBytesLeft = FALSE;
+/*N*/ bCreateE3dPolyObj = FALSE;
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+
+/*N*/ E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault) : E3dObject()
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ SetDefaultAttributes(rDefault);
+/*N*/
+/*N*/ bBytesLeft = FALSE;
+/*N*/ bCreateE3dPolyObj = FALSE;
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ aMaterialAmbientColor = rDefault.GetDefaultAmbientColor();
+/*N*/
+//is always default, so it needs not to be set /*N*/ aBackMaterial = rDefault.GetDefaultBackMaterial();
+/*N*/ bCreateNormals = rDefault.GetDefaultCreateNormals();
+/*N*/ bCreateTexture = rDefault.GetDefaultCreateTexture();
+/*N*/ bUseDifferentBackMaterial = rDefault.GetDefaultUseDifferentBackMaterial();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dCompoundObject::~E3dCompoundObject ()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Start der Geometrieerzeugung ankuendigen
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::StartCreateGeometry()
+/*N*/ {
+/*N*/ // Geometriestart mitteilen
+/*N*/ aDisplayGeometry.StartDescription();
+/*N*/
+/*N*/ // Lokales Volumen reset
+/*N*/ aLocalBoundVol = Volume3D();
+/*N*/
+/*N*/ // Geometrie ist ab jetzt gueltig, um ein rekursives weiteres
+/*N*/ // Erzeugen zu verhindern
+/*N*/ bGeometryValid = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dCompoundObject::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_COMPOUNDOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Compounds brauchen Defaults
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::ForceDefaultAttr()
+/*N*/ {
+/*N*/ SdrAttrObj::ForceDefaultAttr();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::RecalcSnapRect()
+/*N*/ {
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene)
+/*N*/ {
+/*N*/ // Objekttransformation uebernehmen
+/*N*/ const Volume3D& rBoundVol = GetBoundVolume();
+/*N*/ maSnapRect = Rectangle();
+/*N*/
+/*N*/ if(rBoundVol.IsValid())
+/*N*/ {
+/*N*/ const Matrix4D& rTrans = GetFullTransform();
+/*N*/ Vol3DPointIterator aIter(rBoundVol, &rTrans);
+/*N*/ Vector3D aTfVec;
+/*N*/ while ( aIter.Next(aTfVec) )
+/*N*/ {
+/*N*/ aTfVec = pScene->GetCameraSet().WorldToViewCoor(aTfVec);
+/*N*/ Point aPoint((long)(aTfVec.X() + 0.5), (long)(aTfVec.Y() + 0.5));
+/*N*/ maSnapRect.Union(Rectangle(aPoint, aPoint));
+/*N*/ }
+/*N*/ }
+/*N*/ bSnapRectDirty = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BoundRect berechnen und evtl. Schatten einbeziehen
+|* Dazu muss ein eventueller Schatten des einzelnen 3D-Objektes
+|* beruecksichtigt werden
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::RecalcBoundRect()
+/*N*/ {
+/*N*/ // BoundRect aus SnapRect berechnen
+/*N*/ aOutRect = GetSnapRect();
+/*N*/
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene)
+/*N*/ {
+/*N*/ // Schatten beruecksichtigen
+/*N*/ if(DoDrawShadow())
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+ // Linienbreite beruecksichtigen
+/*N*/ INT32 nLineWidth = ((const XLineWidthItem&)(GetItem(XATTR_LINEWIDTH))).GetValue();
+/*N*/ if(nLineWidth)
+/*N*/ {
+/*?*/ Rectangle aShadowRect = aOutRect;
+/*?*/ aShadowRect.Left() -= nLineWidth;
+/*?*/ aShadowRect.Right() += nLineWidth;
+/*?*/ aShadowRect.Top() -= nLineWidth;
+/*?*/ aShadowRect.Bottom() += nLineWidth;
+/*?*/ aOutRect.Union(aShadowRect);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BoundVolume holen. Falls die Geometrie ungueltig ist, diese neu
+|* erzeugen und das BoundVol neu berechnen
+|*
+\************************************************************************/
+
+/*N*/ const Volume3D& E3dCompoundObject::GetBoundVolume()
+/*N*/ {
+/*N*/ // Geometrie aktuell?
+/*N*/ if(!bGeometryValid)
+/*N*/ {
+/*N*/ // Neu erzeugen und eine Neubestimmung des BoundVol erzwingen
+/*N*/ ReCreateGeometry();
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ return E3dObject::GetBoundVolume();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Rausschreiben der Datenmember eines E3dCompounds
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ #ifdef E3D_STREAMING
+/*N*/
+/*N*/ if (!aLocalBoundVol.IsValid() && aBoundVol.IsValid())
+/*N*/ {
+/*N*/ // Das aLocalBoundVol wird gespeichert.
+/*N*/ // Ist dieses ungueltig, so wird das aBoundVol genommen
+/*N*/ // (sollten beim E3dCompoundObject sowieso gleich sein)
+/*N*/ ((E3dCompoundObject*) this)->aLocalBoundVol = aBoundVol;
+/*N*/ }
+/*N*/
+/*N*/ E3dObject::WriteData(rOut);
+/*N*/ if (rOut.GetVersion() < 3560)
+/*N*/ {
+/*N*/ // In diesem Fall passiert nichts, da vor der Version 4.0
+/*N*/ // also im Falle der Revision 3.1
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dCompoundObject");
+/*N*/ #endif
+/*N*/ rOut << BOOL(GetDoubleSided());
+/*N*/ #endif
+/*N*/
+/*N*/ // neue Parameter zur Geometrieerzeugung
+/*N*/ rOut << BOOL(bCreateNormals);
+/*N*/ rOut << BOOL(bCreateTexture);
+/*N*/
+/*N*/ sal_uInt16 nVal = GetNormalsKind();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionX();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionY();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ rOut << BOOL(GetShadow3D());
+/*N*/
+/*N*/ // neu al 384:
+/*N*/ rOut << GetMaterialAmbientColor();
+/*N*/ rOut << GetMaterialColor();
+/*N*/ rOut << GetMaterialSpecular();
+/*N*/ rOut << GetMaterialEmission();
+/*N*/ rOut << GetMaterialSpecularIntensity();
+/*N*/
+/*N*/ aBackMaterial.WriteData(rOut);
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureKind();
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureMode();
+/*N*/
+/*N*/ rOut << BOOL(GetNormalsInvert());
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ rOut << BOOL(GetTextureFilter());
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Einlesen der Datenmember eines E3dCompounds
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if ( rIn.GetError() != SVSTREAM_OK )
+/*N*/ return;
+/*N*/
+/*N*/ E3dObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ // Vor der Filerevision 13 wurde das Objekt nie geschrieben.
+/*N*/ // auch kein Kompatibilitaetsrecord.
+/*N*/ if ((rHead.GetVersion() < 13) || (rIn.GetVersion() < 3560))
+/*N*/ {
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dCompoundObject");
+/*N*/ #endif
+/*N*/
+/*N*/ bBytesLeft = FALSE;
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (BOOL))
+/*N*/ {
+/*N*/ BOOL bTmp, bTmp2;
+/*N*/ sal_uInt16 nTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp));
+/*N*/
+/*N*/ // neue Parameter zur Geometrieerzeugung
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (BOOL))
+/*N*/ {
+/*N*/ rIn >> bTmp;
+/*N*/ bCreateNormals = bTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ bCreateTexture = bTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp));
+/*N*/
+/*N*/ // Setze ein Flag fuer den Aufrufer, dass neues Format
+/*N*/ // zu lesen ist
+/*N*/ bBytesLeft = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // neu al 384:
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (B3dMaterial))
+/*N*/ {
+/*N*/ UINT16 nTmp;
+/*N*/
+/*N*/ Color aCol;
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ SetMaterialAmbientColor(aCol);
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ // do NOT use, this is the old 3D-Color(!)
+/*N*/ // SetItem(XFillColorItem(String(), aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp));
+/*N*/
+/*N*/ aBackMaterial.ReadData(rIn);
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp));
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (BOOL))
+/*N*/ {
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Bitmaps fuer 3D-Darstellung von Gradients und Hatches holen
+|*
+\************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::DestroyGeometry()
+/*N*/ {
+/*N*/ // Alle Objekte in der Sub-Liste zerstoeren. Dies sind die
+/*N*/ // zur Visualisierung des Objektes verwendeten Hilfsobjekte
+/*N*/ pSub->Clear();
+/*N*/ delete pSub;
+/*N*/ pSub = new E3dObjList(NULL, NULL);
+/*N*/ pSub->SetOwnerObj(this);
+/*N*/ pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+/*N*/
+/*N*/ // Neue Geometrie zerstoeren
+/*N*/ aDisplayGeometry.Erase();
+/*N*/
+/*N*/ // BoundVols resetten
+/*N*/ aLocalBoundVol = Volume3D();
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ StructureChanged(this);
+/*N*/
+/*N*/ // Geometrie ist ungueltig
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::CreateGeometry()
+/*N*/ {
+/*N*/ // Geometrie ist gueltig, um rekursion zu verhindern
+/*N*/ bGeometryValid = TRUE;
+/*N*/
+/*N*/ // Eventuell entstandene Geometrie noch korrigieren
+/*N*/ // und Default -Normalen oder -Texturkoordinaten erzeugen
+/*N*/ if(bCreateNormals)
+/*N*/ {
+/*N*/ if(GetNormalsKind() > 1)
+/*?*/ GetDisplayGeometry().CreateDefaultNormalsSphere();
+/*N*/ if(GetNormalsInvert())
+/*?*/ GetDisplayGeometry().InvertNormals();
+/*N*/ }
+/*N*/
+/*N*/ if(bCreateTexture)
+/*N*/ {
+/*N*/ GetDisplayGeometry().CreateDefaultTexture(
+/*N*/ ((GetTextureProjectionX() > 0) ? B3D_CREATE_DEFAULT_X : FALSE)
+/*N*/ |((GetTextureProjectionY() > 0) ? B3D_CREATE_DEFAULT_Y : FALSE),
+/*N*/ GetTextureProjectionX() > 1);
+/*N*/ }
+/*N*/
+/*N*/ // Am Ende der Geometrieerzeugung das model an den erzeugten
+/*N*/ // PolyObj's setzen, d.h. beim ueberladen dieser Funktion
+/*N*/ // den parent am Ende rufen.
+/*N*/ if(bCreateE3dPolyObj)
+/*N*/ SetModel(pModel);
+/*N*/
+/*N*/ // Das Ende der Geometrieerzeugung anzeigen
+/*N*/ aDisplayGeometry.EndDescription();
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::ReCreateGeometry(BOOL bCreateOldGeometry)
+/*N*/ {
+/*N*/ // Geometrie zerstoeren
+/*N*/ DestroyGeometry();
+/*N*/
+/*N*/ // Flag fuer Geometrieerzeugung setzen
+/*N*/ bCreateE3dPolyObj = bCreateOldGeometry;
+/*N*/
+/*N*/ // ... und neu erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::AddGeometry(const PolyPolygon3D& rPolyPolygon3D,
+/*N*/ BOOL bHintIsComplex, BOOL bOutline)
+/*N*/ {
+/*N*/ if(rPolyPolygon3D.Count())
+/*N*/ {
+/*N*/ // eventuell alte Geometrie erzeugen (z.B. zum speichern)
+/*N*/ if(bCreateE3dPolyObj)
+/*N*/ {
+/*N*/ E3dPolyObj* pObj = new E3dPolyObj(
+/*N*/ rPolyPolygon3D, GetDoubleSided(), TRUE);
+/*N*/ pObj->SetPartOfParent();
+/*N*/ Insert3DObj(pObj);
+/*N*/ }
+/*N*/
+/*N*/ // neue Geometrie erzeugen
+/*N*/ for(USHORT a = 0; a < rPolyPolygon3D.Count(); a++ )
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3D = rPolyPolygon3D[a];
+/*N*/ aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
+/*N*/ for(USHORT b = 0; b < rPoly3D.GetPointCount(); b++ )
+/*N*/ aDisplayGeometry.AddEdge(rPoly3D[b]);
+/*N*/ }
+/*N*/ aDisplayGeometry.EndObject();
+/*N*/
+/*N*/ // LocalBoundVolume pflegen
+/*N*/ aLocalBoundVol.Union(rPolyPolygon3D.GetPolySize());
+/*N*/
+/*N*/ // Eigenes BoundVol nicht mehr gueltig
+/*N*/ SetBoundVolInvalid();
+/*N*/ SetRectsDirty();
+/*N*/ }
+/*N*/ }
+
+/*?*/ void E3dCompoundObject::AddGeometry(
+/*?*/ const PolyPolygon3D& rPolyPolygon3D,
+/*?*/ const PolyPolygon3D& rPolyNormal3D,
+/*?*/ BOOL bHintIsComplex, BOOL bOutline)
+/*?*/ {
+/*?*/ if(rPolyPolygon3D.Count())
+/*?*/ {
+/*?*/ // eventuell alte Geometrie erzeugen (z.B. zum speichern)
+/*?*/ if(bCreateE3dPolyObj)
+/*?*/ {
+/*?*/ E3dPolyObj* pObj = new E3dPolyObj(
+/*?*/ rPolyPolygon3D, rPolyNormal3D, GetDoubleSided(), TRUE);
+/*?*/ pObj->SetPartOfParent();
+/*?*/ Insert3DObj(pObj);
+/*?*/ }
+/*?*/
+/*?*/ // neue Geometrie erzeugen
+/*?*/ for(USHORT a = 0; a < rPolyPolygon3D.Count(); a++ )
+/*?*/ {
+/*?*/ const Polygon3D& rPoly3D = rPolyPolygon3D[a];
+/*?*/ const Polygon3D& rNormal3D = rPolyNormal3D[a];
+/*?*/ aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
+/*?*/ for(USHORT b = 0; b < rPoly3D.GetPointCount(); b++ )
+/*?*/ aDisplayGeometry.AddEdge(rPoly3D[b], rNormal3D[b]);
+/*?*/ }
+/*?*/ aDisplayGeometry.EndObject();
+/*?*/
+/*?*/ // LocalBoundVolume pflegen
+/*?*/ aLocalBoundVol.Union(rPolyPolygon3D.GetPolySize());
+/*?*/
+/*?*/ // Eigenes BoundVol nicht mehr gueltig
+/*?*/ SetBoundVolInvalid();
+/*?*/ SetRectsDirty();
+/*?*/ }
+/*?*/ }
+
+/*N*/ void E3dCompoundObject::AddGeometry(
+/*N*/ const PolyPolygon3D& rPolyPolygon3D,
+/*N*/ const PolyPolygon3D& rPolyNormal3D,
+/*N*/ const PolyPolygon3D& rPolyTexture3D,
+/*N*/ BOOL bHintIsComplex, BOOL bOutline)
+/*N*/ {
+/*N*/ if(rPolyPolygon3D.Count())
+/*N*/ {
+/*N*/ // eventuell alte Geometrie erzeugen (z.B. zum speichern)
+/*N*/ if(bCreateE3dPolyObj)
+/*N*/ {
+/*N*/ E3dPolyObj* pObj = new E3dPolyObj(
+/*N*/ rPolyPolygon3D, rPolyNormal3D,
+/*N*/ rPolyTexture3D, GetDoubleSided(), TRUE);
+/*N*/ pObj->SetPartOfParent();
+/*N*/ Insert3DObj(pObj);
+/*N*/ }
+/*N*/
+/*N*/ // neue Geometrie erzeugen
+/*N*/ for(USHORT a = 0; a < rPolyPolygon3D.Count(); a++ )
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3D = rPolyPolygon3D[a];
+/*N*/ const Polygon3D& rNormal3D = rPolyNormal3D[a];
+/*N*/ const Polygon3D& rTexture3D = rPolyTexture3D[a];
+/*N*/ aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
+/*N*/ for(USHORT b = 0; b < rPoly3D.GetPointCount(); b++ )
+/*N*/ aDisplayGeometry.AddEdge(rPoly3D[b], rNormal3D[b], rTexture3D[b]);
+/*N*/ }
+/*N*/ aDisplayGeometry.EndObject();
+/*N*/
+/*N*/ // LocalBoundVolume pflegen
+/*N*/ aLocalBoundVol.Union(rPolyPolygon3D.GetPolySize());
+/*N*/
+/*N*/ // Eigenes BoundVol nicht mehr gueltig
+/*N*/ SetBoundVolInvalid();
+/*N*/ SetRectsDirty();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Hilfsfunktionen zur Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::RotatePoly(
+/*N*/ PolyPolygon3D& rPolyPolyRotate,
+/*N*/ Matrix4D& rRotMat)
+/*N*/ {
+/*N*/ USHORT nPolyCnt = rPolyPolyRotate.Count();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ Polygon3D& rPolyRotate = rPolyPolyRotate[a];
+/*N*/ USHORT nPntCnt = rPolyRotate.GetPointCount();
+/*N*/
+/*N*/ for(UINT16 b=0;b<nPntCnt;b++)
+/*N*/ rPolyRotate[b] *= rRotMat;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::GrowPoly(
+/*N*/ PolyPolygon3D& rPolyPolyGrow,
+/*N*/ PolyPolygon3D& rPolyPolyNormals,
+/*N*/ double fFactor)
+/*N*/ {
+/*N*/ USHORT nPolyCnt = rPolyPolyGrow.Count();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ Polygon3D& rPolyGrow = rPolyPolyGrow[a];
+/*N*/ const Polygon3D& rPolyNormals = rPolyPolyNormals[a];
+/*N*/ USHORT nPntCnt = rPolyGrow.GetPointCount();
+/*N*/
+/*N*/ for(UINT16 b=0;b<nPntCnt;b++)
+/*N*/ rPolyGrow[b] += rPolyNormals[b] * fFactor;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void E3dCompoundObject::ScalePoly(
+/*N*/ PolyPolygon3D& rPolyPolyScale,
+/*N*/ double fFactor)
+/*N*/ {
+/*N*/ USHORT nPolyCnt = rPolyPolyScale.Count();
+/*N*/ Vector3D aMiddle = rPolyPolyScale.GetMiddle();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ Polygon3D& rPolyScale = rPolyPolyScale[a];
+/*N*/ USHORT nPntCnt = rPolyScale.GetPointCount();
+/*N*/
+/*N*/ for(UINT16 b=0;b<nPntCnt;b++)
+/*N*/ rPolyScale[b] = ((rPolyScale[b] - aMiddle) * fFactor) + aMiddle;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::CreateFront(
+/*N*/ const PolyPolygon3D& rPolyPoly3D,
+/*N*/ const PolyPolygon3D& rFrontNormals,
+/*N*/ BOOL bCreateNormals,
+/*N*/ BOOL bCreateTexture)
+/*N*/ {
+/*N*/ // Vorderseite
+/*N*/ if(bCreateNormals)
+/*N*/ {
+/*N*/ if(bCreateTexture)
+/*N*/ {
+/*N*/ // Polygon fuer die Textur erzeugen
+/*N*/ PolyPolygon3D aPolyTexture = rPolyPoly3D;
+/*N*/ Volume3D aSize = aPolyTexture.GetPolySize();
+/*N*/ Matrix4D aTrans;
+/*N*/
+/*N*/ aTrans.Identity();
+/*N*/ aTrans.Translate(-aSize.MinVec());
+/*N*/ aPolyTexture.Transform(aTrans);
+/*N*/
+/*N*/ double fFactorX(1.0), fFactorY(1.0), fFactorZ(1.0);
+/*N*/
+/*N*/ if(aSize.GetWidth() != 0.0)
+/*N*/ fFactorX = 1.0 / aSize.GetWidth();
+/*N*/
+/*N*/ if(aSize.GetHeight() != 0.0)
+/*N*/ fFactorY = 1.0 / aSize.GetHeight();
+/*N*/
+/*N*/ if(aSize.GetDepth() != 0.0)
+/*N*/ fFactorZ = 1.0 / aSize.GetDepth();
+/*N*/
+/*N*/ aTrans.Identity();
+/*N*/ aTrans.Scale(fFactorX, -fFactorY, fFactorZ);
+/*N*/ aTrans.Translate(Vector3D(0.0, 1.0, 0.0));
+/*N*/ aPolyTexture.Transform(aTrans);
+/*N*/
+/*N*/ AddGeometry(rPolyPoly3D, rFrontNormals, aPolyTexture, TRUE);
+/*N*/ }
+/*N*/ else
+/*N*/ AddGeometry(rPolyPoly3D, rFrontNormals, TRUE);
+/*N*/ }
+/*N*/ else
+/*N*/ AddGeometry(rPolyPoly3D, TRUE);
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::AddFrontNormals(
+/*N*/ const PolyPolygon3D& rPolyPoly3D,
+/*N*/ PolyPolygon3D& rNormalsFront,
+/*N*/ Vector3D &rOffset)
+/*N*/ {
+/*N*/ Vector3D aFrontNormal = -rOffset;
+/*N*/ aFrontNormal.Normalize();
+/*N*/ USHORT nPolyCnt = rPolyPoly3D.Count();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3D = rPolyPoly3D[a];
+/*N*/ Polygon3D& rNormalPoly = rNormalsFront[a];
+/*N*/ USHORT nPntCnt = rPoly3D.GetPointCount();
+/*N*/
+/*N*/ for(UINT16 b=0;b<nPntCnt;b++)
+/*N*/ {
+/*N*/ rNormalPoly[b] += aFrontNormal;
+/*N*/ rNormalPoly[b].Normalize();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::CreateBack(
+/*N*/ const PolyPolygon3D& rPolyPoly3D,
+/*N*/ const PolyPolygon3D& rBackNormals,
+/*N*/ BOOL bCreateNormals,
+/*N*/ BOOL bCreateTexture)
+/*N*/ {
+/*N*/ // PolyPolygon umdrehen
+/*N*/ PolyPolygon3D aLocalPoly = rPolyPoly3D;
+/*N*/ aLocalPoly.FlipDirections();
+/*N*/
+/*N*/ // Rueckseite
+/*N*/ if(bCreateNormals)
+/*N*/ {
+/*N*/ PolyPolygon3D aLocalNormals = rBackNormals;
+/*N*/ aLocalNormals.FlipDirections();
+/*N*/ if(bCreateTexture)
+/*N*/ {
+/*N*/ // Polygon fuer die Textur erzeugen
+/*N*/ PolyPolygon3D aPolyTexture(aLocalPoly);
+/*N*/ Volume3D aSize = aPolyTexture.GetPolySize();
+/*N*/ Matrix4D aTrans;
+/*N*/
+/*N*/ aTrans.Identity();
+/*N*/ aTrans.Translate(-aSize.MinVec());
+/*N*/ aPolyTexture.Transform(aTrans);
+/*N*/
+/*N*/ double fFactorX(1.0), fFactorY(1.0), fFactorZ(1.0);
+/*N*/
+/*N*/ if(aSize.GetWidth() != 0.0)
+/*N*/ fFactorX = 1.0 / aSize.GetWidth();
+/*N*/
+/*N*/ if(aSize.GetHeight() != 0.0)
+/*N*/ fFactorY = 1.0 / aSize.GetHeight();
+/*N*/
+/*N*/ if(aSize.GetDepth() != 0.0)
+/*N*/ fFactorZ = 1.0 / aSize.GetDepth();
+/*N*/
+/*N*/ aTrans.Identity();
+/*N*/ aTrans.Scale(fFactorX, -fFactorY, fFactorZ);
+/*N*/ aTrans.Translate(Vector3D(0.0, 1.0, 0.0));
+/*N*/ aPolyTexture.Transform(aTrans);
+/*N*/
+/*N*/ AddGeometry(aLocalPoly, aLocalNormals, aPolyTexture, TRUE);
+/*N*/ }
+/*N*/ else
+/*N*/ AddGeometry(aLocalPoly, aLocalNormals, TRUE);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ AddGeometry(aLocalPoly, TRUE);
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::AddBackNormals(
+/*N*/ const PolyPolygon3D& rPolyPoly3D,
+/*N*/ PolyPolygon3D& rNormalsBack,
+/*N*/ Vector3D& rOffset)
+/*N*/ {
+/*N*/ Vector3D aBackNormal = rOffset;
+/*N*/ aBackNormal.Normalize();
+/*N*/ USHORT nPolyCnt = rPolyPoly3D.Count();
+/*N*/
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3D = rPolyPoly3D[a];
+/*N*/ Polygon3D& rNormalPoly = rNormalsBack[a];
+/*N*/ USHORT nPntCnt = rPoly3D.GetPointCount();
+/*N*/
+/*N*/ for(UINT16 b=0;b<nPntCnt;b++)
+/*N*/ {
+/*N*/ rNormalPoly[b] += aBackNormal;
+/*N*/ rNormalPoly[b].Normalize();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::CreateInBetween(
+/*N*/ const PolyPolygon3D& rPolyPolyFront,
+/*N*/ const PolyPolygon3D& rPolyPolyBack,
+/*N*/ const PolyPolygon3D& rFrontNormals,
+/*N*/ const PolyPolygon3D& rBackNormals,
+/*N*/ BOOL bCreateNormals,
+/*N*/ double fSurroundFactor,
+/*N*/ double fTextureStart,
+/*N*/ double fTextureDepth,
+/*N*/ BOOL bRotateTexture90)
+/*N*/ {
+/*N*/ USHORT nPolyCnt = rPolyPolyFront.Count();
+/*N*/ BOOL bCreateTexture = (fTextureDepth == 0.0) ? FALSE : TRUE;
+/*N*/ double fPolyLength, fPolyPos;
+/*N*/ USHORT nLastIndex;
+/*N*/
+/*N*/ // Verbindungsstuecke
+/*N*/ if(bCreateNormals)
+/*N*/ {
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3DFront = rPolyPolyFront[a];
+/*N*/ const Polygon3D& rPoly3DBack = rPolyPolyBack[a];
+/*N*/
+/*N*/ const Polygon3D& rPolyNormalsFront = rFrontNormals[a];
+/*N*/ const Polygon3D& rPolyNormalsBack = rBackNormals[a];
+/*N*/
+/*N*/ Polygon3D aRect3D(4);
+/*N*/ Polygon3D aNormal3D(4);
+/*N*/ Polygon3D aTexture3D(4);
+/*N*/ USHORT nPntCnt = rPoly3DFront.GetPointCount();
+/*N*/ USHORT nPrefillIndex = rPoly3DFront.IsClosed() ? nPntCnt - 1 : 0;
+/*N*/
+/*N*/ aRect3D[3] = rPoly3DFront[nPrefillIndex];
+/*N*/ aRect3D[2] = rPoly3DBack[nPrefillIndex];
+/*N*/ aNormal3D[3] = rPolyNormalsFront[nPrefillIndex];
+/*N*/ aNormal3D[2] = rPolyNormalsBack[nPrefillIndex];
+/*N*/
+/*N*/ if(bCreateTexture)
+/*N*/ {
+/*N*/ fPolyLength = rPoly3DFront.GetLength();
+/*N*/ fPolyPos = 0.0;
+/*N*/ nLastIndex = rPoly3DFront.IsClosed() ? nPntCnt - 1 : 0;
+/*N*/
+/*N*/ if(bRotateTexture90)
+/*N*/ {
+/*N*/ // X,Y vertauschen
+/*N*/ aTexture3D[3].X() = fTextureStart;
+/*N*/ aTexture3D[3].Y() = (1.0 - fPolyPos) * fSurroundFactor;
+/*N*/
+/*N*/ aTexture3D[2].X() = fTextureStart + fTextureDepth;
+/*N*/ aTexture3D[2].Y() = (1.0 - fPolyPos) * fSurroundFactor;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTexture3D[3].X() = fPolyPos * fSurroundFactor;
+/*N*/ aTexture3D[3].Y() = fTextureStart;
+/*N*/
+/*N*/ aTexture3D[2].X() = fPolyPos * fSurroundFactor;
+/*N*/ aTexture3D[2].Y() = fTextureStart + fTextureDepth;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ for (USHORT i = rPoly3DFront.IsClosed() ? 0 : 1; i < nPntCnt; i++)
+/*N*/ {
+/*N*/ aRect3D[0] = aRect3D[3];
+/*N*/ aRect3D[1] = aRect3D[2];
+/*N*/
+/*N*/ aRect3D[3] = rPoly3DFront[i];
+/*N*/ aRect3D[2] = rPoly3DBack[i];
+/*N*/
+/*N*/ aNormal3D[0] = aNormal3D[3];
+/*N*/ aNormal3D[1] = aNormal3D[2];
+/*N*/
+/*N*/ aNormal3D[3] = rPolyNormalsFront[i];
+/*N*/ aNormal3D[2] = rPolyNormalsBack[i];
+/*N*/
+/*N*/ if(bCreateTexture)
+/*N*/ {
+/*N*/ // Texturkoordinaten ermitteln
+/*N*/ Vector3D aPart = rPoly3DFront[i] - rPoly3DFront[nLastIndex];
+/*N*/ fPolyPos += aPart.GetLength() / fPolyLength;
+/*N*/ nLastIndex = i;
+/*N*/
+/*N*/ // Der Abschnitt am Polygon entspricht dem Teil
+/*N*/ // von fPolyPos bis fPolyPos+fPartLength
+/*N*/
+/*N*/ aTexture3D[0] = aTexture3D[3];
+/*N*/ aTexture3D[1] = aTexture3D[2];
+/*N*/
+/*N*/ if(bRotateTexture90)
+/*N*/ {
+/*N*/ // X,Y vertauschen
+/*N*/ aTexture3D[3].X() = fTextureStart;
+/*N*/ aTexture3D[3].Y() = (1.0 - fPolyPos) * fSurroundFactor;
+/*N*/
+/*N*/ aTexture3D[2].X() = fTextureStart + fTextureDepth;
+/*N*/ aTexture3D[2].Y() = (1.0 - fPolyPos) * fSurroundFactor;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTexture3D[3].X() = fPolyPos * fSurroundFactor;
+/*N*/ aTexture3D[3].Y() = fTextureStart;
+/*N*/
+/*N*/ aTexture3D[2].X() = fPolyPos * fSurroundFactor;
+/*N*/ aTexture3D[2].Y() = fTextureStart + fTextureDepth;
+/*N*/ }
+/*N*/
+/*N*/ AddGeometry(aRect3D, aNormal3D, aTexture3D, FALSE);
+/*N*/ }
+/*N*/ else
+/*N*/ AddGeometry(aRect3D, aNormal3D, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3DFront = rPolyPolyFront[a];
+/*N*/ const Polygon3D& rPoly3DBack = rPolyPolyBack[a];
+/*N*/ Polygon3D aRect3D(4);
+/*N*/ USHORT nPntCnt = rPoly3DFront.GetPointCount();
+/*N*/ USHORT nPrefillIndex = rPoly3DFront.IsClosed() ? nPntCnt - 1 : 0;
+/*N*/
+/*N*/ aRect3D[3] = rPoly3DFront[nPrefillIndex];
+/*N*/ aRect3D[2] = rPoly3DBack[nPrefillIndex];
+/*N*/
+/*N*/ for (USHORT i = rPoly3DFront.IsClosed() ? 0 : 1; i < nPntCnt; i++)
+/*N*/ {
+/*N*/ aRect3D[0] = aRect3D[3];
+/*N*/ aRect3D[1] = aRect3D[2];
+/*N*/
+/*N*/ aRect3D[3] = rPoly3DFront[i];
+/*N*/ aRect3D[2] = rPoly3DBack[i];
+/*N*/
+/*N*/ AddGeometry(aRect3D, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dCompoundObject::AddInBetweenNormals(
+/*N*/ const PolyPolygon3D& rPolyPolyFront,
+/*N*/ const PolyPolygon3D& rPolyPolyBack,
+/*N*/ PolyPolygon3D& rNormals,
+/*N*/ BOOL bSmoothed)
+/*N*/ {
+/*N*/ USHORT nPolyCnt = rPolyPolyFront.Count();
+/*N*/
+/*N*/ // Verbindungsstuecke
+/*N*/ for(UINT16 a=0;a<nPolyCnt;a++)
+/*N*/ {
+/*N*/ const Polygon3D& rPoly3DFront = rPolyPolyFront[a];
+/*N*/ const Polygon3D& rPoly3DBack = rPolyPolyBack[a];
+/*N*/ Polygon3D& rNormalPoly = rNormals[a];
+/*N*/ USHORT nPntCnt = rPoly3DFront.GetPointCount();
+/*N*/
+/*N*/ if(rPoly3DBack.IsClosed())
+/*N*/ {
+/*N*/ Vector3D aNormal = (rPoly3DBack[nPntCnt - 1] - rPoly3DFront[nPntCnt - 1])
+/*N*/ |(rPoly3DFront[0] - rPoly3DFront[nPntCnt - 1]);
+/*N*/ aNormal.Normalize();
+/*N*/ for (USHORT i = 0; i < nPntCnt; i++)
+/*N*/ {
+/*N*/ Vector3D aNextNormal = (rPoly3DBack[i] - rPoly3DFront[i])
+/*N*/ |(rPoly3DFront[(i+1 == nPntCnt) ? 0 : i+1] - rPoly3DFront[i]);
+/*N*/ aNextNormal.Normalize();
+/*N*/ if(bSmoothed)
+/*N*/ {
+/*N*/ Vector3D aMidNormal = aNormal + aNextNormal;
+/*N*/ aMidNormal.Normalize();
+/*N*/ rNormalPoly[i] += aMidNormal;
+/*N*/ }
+/*N*/ else
+/*N*/ rNormalPoly[i] += aNormal;
+/*N*/ rNormalPoly[i].Normalize();
+/*N*/ aNormal = aNextNormal;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Vector3D aNormal;
+/*N*/ if(rPoly3DBack[0] == rPoly3DFront[0])
+/*N*/ {
+/*N*/ aNormal = (rPoly3DBack[1] - rPoly3DFront[1])
+/*N*/ |(rPoly3DFront[1] - rPoly3DFront[0]);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aNormal = (rPoly3DBack[0] - rPoly3DFront[0])
+/*N*/ |(rPoly3DFront[1] - rPoly3DFront[0]);
+/*N*/ }
+/*N*/ aNormal.Normalize();
+/*N*/ rNormalPoly[0] += aNormal; rNormalPoly[0].Normalize();
+/*N*/ for (USHORT i = 1; i < nPntCnt; i++)
+/*N*/ {
+/*N*/ Vector3D aNextNormal;
+/*N*/ if(i+1 == nPntCnt)
+/*N*/ {
+/*N*/ aNextNormal = aNormal;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aNextNormal = (rPoly3DBack[i] - rPoly3DFront[i])
+/*N*/ |(rPoly3DFront[i+1] - rPoly3DFront[i]);
+/*N*/ }
+/*N*/ aNextNormal.Normalize();
+/*N*/ if(bSmoothed)
+/*N*/ {
+/*N*/ Vector3D aMidNormal = aNormal + aNextNormal;
+/*N*/ aMidNormal.Normalize();
+/*N*/ rNormalPoly[i] += aMidNormal;
+/*N*/ }
+/*N*/ else
+/*N*/ rNormalPoly[i] += aNormal;
+/*N*/ rNormalPoly[i].Normalize();
+/*N*/ aNormal = aNextNormal;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Copy-Operator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Ausgabeparameter an 3D-Kontext setzen
+|*
+\************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* Hittest fuer 3D-Objekte, wird an Geometrie weitergegeben
+|*
+\************************************************************************/
+
+/*N*/ SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT nTol,
+/*N*/ const SetOfByte* pVisiLayer) const
+/*N*/ {
+/*N*/ E3dPolyScene* pScene = (E3dPolyScene*)GetScene();
+/*N*/ if(pScene)
+/*N*/ {
+/*N*/ // HitLine holen in ObjektKoordinaten
+/*N*/ // ObjectTrans setzen
+/*N*/ Matrix4D mTransform = ((E3dCompoundObject*)this)->GetFullTransform();
+/*N*/ pScene->GetCameraSet().SetObjectTrans(mTransform);
+/*N*/
+/*N*/ // HitPoint Front und Back erzeugen und umrechnen
+/*N*/ Vector3D aFront(rPnt.X(), rPnt.Y(), 0.0);
+/*N*/ Vector3D aBack(rPnt.X(), rPnt.Y(), ZBUFFER_DEPTH_RANGE);
+/*N*/ aFront = pScene->GetCameraSet().ViewToObjectCoor(aFront);
+/*N*/ aBack = pScene->GetCameraSet().ViewToObjectCoor(aBack);
+/*N*/
+/*N*/ const Volume3D& rBoundVol = ((E3dCompoundObject*)this)->GetBoundVolume();
+/*N*/ if(rBoundVol.IsValid())
+/*N*/ {
+/*N*/ double fXMax = aFront.X();
+/*N*/ double fXMin = aBack.X();
+/*N*/
+/*N*/ if(fXMax < fXMin)
+/*N*/ {
+/*N*/ fXMax = aBack.X();
+/*N*/ fXMin = aFront.X();
+/*N*/ }
+/*N*/
+/*N*/ if(rBoundVol.MinVec().X() <= fXMax && rBoundVol.MaxVec().X() >= fXMin)
+/*N*/ {
+/*N*/ double fYMax = aFront.Y();
+/*N*/ double fYMin = aBack.Y();
+/*N*/
+/*N*/ if(fYMax < fYMin)
+/*N*/ {
+/*N*/ fYMax = aBack.Y();
+/*N*/ fYMin = aFront.Y();
+/*N*/ }
+/*N*/
+/*N*/ if(rBoundVol.MinVec().Y() <= fYMax && rBoundVol.MaxVec().Y() >= fYMin)
+/*N*/ {
+/*N*/ double fZMax = aFront.Z();
+/*N*/ double fZMin = aBack.Z();
+/*N*/
+/*N*/ if(fZMax < fZMin)
+/*N*/ {
+/*N*/ fZMax = aBack.Z();
+/*N*/ fZMin = aFront.Z();
+/*N*/ }
+/*N*/
+/*N*/ if(rBoundVol.MinVec().Z() <= fZMax && rBoundVol.MaxVec().Z() >= fZMin)
+/*N*/ {
+/*N*/ // Geometrie herstellen
+/*N*/ if(!bGeometryValid)
+/*?*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/
+/*N*/ // 3D Volumes schneiden sich, teste in der Geometrie
+/*N*/ // auf Basis der Projektion weiter
+/*N*/ if(((E3dCompoundObject*)this)->aDisplayGeometry.CheckHit(aFront, aBack, nTol) != -1L)
+/*?*/ return ((E3dCompoundObject*)this);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return NULL;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Geometrie des Objektes auf angegebenen Punkt zentrieren
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Schattenattribute holen
+|*
+\************************************************************************/
+
+
+
+
+
+
+/*N*/ BOOL E3dCompoundObject::DoDrawShadow()
+/*N*/ {
+/*N*/ const SfxItemSet& rSet = GetItemSet();
+/*N*/ BOOL bRetval(FALSE);
+/*N*/ BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
+/*N*/
+/*N*/ if(bShadOn)
+/*N*/ {
+/*?*/ bRetval = TRUE;
+/*?*/
+/*?*/ if(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue() == XFILL_NONE)
+/*?*/ {
+/*?*/ if(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue() == XLINE_NONE)
+/*?*/ {
+/*?*/ bRetval = FALSE;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ return bRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objekt als WireFrame zeichnen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Create vertical polygons for line polygon
+|*
+\************************************************************************/
+
+// #78972#
+/*N*/ void E3dCompoundObject::ImpCompleteLinePolygon(PolyPolygon3D& rLinePolyPoly,
+/*N*/ sal_uInt16 nPolysPerRun, BOOL bClosed)
+/*N*/ {
+/*N*/ if(rLinePolyPoly.Count() && nPolysPerRun)
+/*N*/ {
+/*N*/ // get number of layers
+/*N*/ sal_uInt16 nLayers(rLinePolyPoly.Count() / nPolysPerRun);
+/*N*/ sal_uInt16 a, b, c;
+/*N*/
+/*N*/ // add vertical Polygons if at least two horizontal ones exist
+/*N*/ if(nLayers > 1)
+/*N*/ {
+/*N*/ for(a = 0; a < nPolysPerRun; a++)
+/*N*/ {
+/*N*/ const sal_uInt16 nPntCnt = rLinePolyPoly[a].GetPointCount();
+/*N*/
+/*N*/ for(b = 0; b < nPntCnt; b++)
+/*N*/ {
+/*N*/ Polygon3D aNewVerPoly(bClosed ? nLayers + 1 : nLayers);
+/*N*/
+/*N*/ for(c = 0; c < nLayers; c++)
+/*N*/ aNewVerPoly[c] = rLinePolyPoly[(c * nPolysPerRun) + a][b];
+/*N*/
+/*N*/ // evtl. set first point again to close polygon
+/*N*/ if(bClosed)
+/*N*/ aNewVerPoly[aNewVerPoly.GetPointCount()] = aNewVerPoly[0];
+/*N*/
+/*N*/ // insert
+/*N*/ rLinePolyPoly.Insert(aNewVerPoly);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // open closed polygons
+/*N*/ for(a = 0; a < rLinePolyPoly.Count(); a++)
+/*N*/ {
+/*N*/ if(rLinePolyPoly[a].IsClosed())
+/*N*/ {
+/*N*/ rLinePolyPoly[a][rLinePolyPoly[a].GetPointCount()] = rLinePolyPoly[a][0];
+/*N*/ rLinePolyPoly[a].SetClosed(FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*************************************************************************
+|*
+|* Ein Segment fuer Extrude oder Lathe erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::ImpCreateSegment(
+/*N*/ const PolyPolygon3D& rFront, // vorderes Polygon
+/*N*/ const PolyPolygon3D& rBack, // hinteres Polygon
+/*N*/ const PolyPolygon3D* pPrev, // smooth uebergang zu Vorgaenger
+/*N*/ const PolyPolygon3D* pNext, // smooth uebergang zu Nachfolger
+/*N*/ BOOL bCreateFront, // vorderen Deckel erzeugen
+/*N*/ BOOL bCreateBack, // hinteren Deckel erzeugen
+/*N*/ double fPercentDiag, // Anteil des Deckels an der Tiefe
+/*N*/ BOOL bSmoothLeft, // Glaetten der umlaufenden Normalen links
+/*N*/ BOOL bSmoothRight, // Glaetten der umlaufenden Normalen rechts
+/*N*/ BOOL bSmoothFrontBack, // Glaetten der Abschlussflaechen
+/*N*/ double fSurroundFactor, // Wertebereich der Texturkoordinaten im Umlauf
+/*N*/ double fTextureStart, // TexCoor ueber Extrude-Tiefe
+/*N*/ double fTextureDepth, // TexCoor ueber Extrude-Tiefe
+/*N*/ BOOL bCreateTexture,
+/*N*/ BOOL bCreateNormals,
+/*N*/ BOOL bCharacterExtrude, // FALSE=exakt, TRUE=ohne Ueberschneidungen
+/*N*/ BOOL bRotateTexture90, // Textur der Seitenflaechen um 90 Grad kippen
+/*N*/ PolyPolygon3D* pLineGeometry // For creation of line geometry
+/*N*/ )
+/*N*/ {
+/*N*/ PolyPolygon3D aNormalsLeft, aNormalsRight;
+/*N*/ AddInBetweenNormals(rFront, rBack, aNormalsLeft, bSmoothLeft);
+/*N*/ AddInBetweenNormals(rFront, rBack, aNormalsRight, bSmoothRight);
+/*N*/ Vector3D aOffset = rBack.GetMiddle() - rFront.GetMiddle();
+/*N*/
+/*N*/ // Ausnahmen: Nicht geschlossen
+/*N*/ if(!rFront.IsClosed())
+/*N*/ {
+/*N*/ bCreateFront = FALSE;
+/*N*/ }
+/*N*/ if(!rBack.IsClosed())
+/*N*/ {
+/*N*/ bCreateBack = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ // Ausnahmen: Einfache Linie
+/*N*/ if(rFront[0].GetPointCount() < 3 || (!bCreateFront && !bCreateBack))
+/*N*/ {
+/*N*/ fPercentDiag = 0.0;
+/*N*/ }
+/*N*/
+/*N*/ if(fPercentDiag == 0.0)
+/*N*/ {
+/*N*/ // Ohne Schraegen, Vorderseite
+/*N*/ if(bCreateFront)
+/*N*/ {
+/*N*/ PolyPolygon3D aNormalsFront;
+/*N*/ AddFrontNormals(rFront, aNormalsFront, aOffset);
+/*N*/
+/*N*/ if(!bSmoothFrontBack)
+/*N*/ CreateFront(rFront, aNormalsFront, bCreateNormals, bCreateTexture);
+/*N*/ if(bSmoothLeft)
+/*N*/ AddFrontNormals(rFront, aNormalsLeft, aOffset);
+/*N*/ if(bSmoothFrontBack)
+/*?*/ CreateFront(rFront, aNormalsLeft, bCreateNormals, bCreateTexture);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(pPrev)
+/*N*/ AddInBetweenNormals(*pPrev, rFront, aNormalsLeft, bSmoothLeft);
+/*N*/ }
+/*N*/
+/*N*/ // Ohne Schraegen, Rueckseite
+/*N*/ if(bCreateBack)
+/*N*/ {
+/*N*/ PolyPolygon3D aNormalsBack;
+/*N*/ AddBackNormals(rBack, aNormalsBack, aOffset);
+/*N*/
+/*N*/ if(!bSmoothFrontBack)
+/*N*/ CreateBack(rBack, aNormalsBack, bCreateNormals, bCreateTexture);
+/*N*/ if(bSmoothRight)
+/*N*/ AddBackNormals(rBack, aNormalsRight, aOffset);
+/*N*/ if(bSmoothFrontBack)
+/*?*/ CreateBack(rBack, aNormalsRight, bCreateNormals, bCreateTexture);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(pNext)
+/*N*/ AddInBetweenNormals(rBack, *pNext, aNormalsRight, bSmoothRight);
+/*N*/ }
+/*N*/
+/*N*/ // eigentliches Zwischenstueck
+/*N*/ CreateInBetween(rFront, rBack,
+/*N*/ aNormalsLeft, aNormalsRight,
+/*N*/ bCreateNormals,
+/*N*/ fSurroundFactor,
+/*N*/ fTextureStart,
+/*N*/ fTextureDepth,
+/*N*/ bRotateTexture90);
+/*N*/
+/*N*/ // #78972#
+/*N*/ if(pLineGeometry)
+/*N*/ {
+/*N*/ pLineGeometry->Insert(rFront);
+/*N*/ if(bCreateBack)
+/*N*/ pLineGeometry->Insert(rBack);
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Mit Scraegen, Vorderseite
+/*N*/ PolyPolygon3D aLocalFront = rFront;
+/*N*/ PolyPolygon3D aLocalBack = rBack;
+/*N*/ double fExtrudeDepth, fDiagLen;
+/*N*/ double fTexMidStart = fTextureStart;
+/*N*/ double fTexMidDepth = fTextureDepth;
+/*N*/
+/*N*/ if(bCreateFront || bCreateBack)
+/*N*/ {
+/*N*/ fExtrudeDepth = aOffset.GetLength();
+/*N*/ fDiagLen = fPercentDiag * fExtrudeDepth;
+/*N*/ }
+/*N*/
+/*N*/ PolyPolygon3D aOuterFront;
+/*N*/ PolyPolygon3D aOuterBack;
+/*N*/
+/*N*/ if(bCreateFront)
+/*N*/ {
+/*N*/ PolyPolygon3D aNormalsOuterFront;
+/*N*/ AddFrontNormals(aLocalFront, aNormalsOuterFront, aOffset);
+/*N*/
+/*N*/ if(bCharacterExtrude)
+/*N*/ {
+/*N*/ // Polygon kopieren
+/*N*/ aOuterFront = aLocalFront;
+/*N*/
+/*N*/ // notwendige Normalen erzeugen
+/*N*/ PolyPolygon3D aGrowDirection;
+/*N*/ AddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothLeft);
+/*N*/
+/*N*/ // Groesse inneres Polygon merken
+/*N*/ Volume3D aOldSize(aLocalFront.GetPolySize());
+/*N*/
+/*N*/ // Inneres Polygon vergroessern
+/*N*/ GrowPoly(aLocalFront, aGrowDirection, fDiagLen);
+/*N*/
+/*N*/ // Inneres Polygon nach innen verschieben
+/*N*/ //GrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
+/*N*/
+/*N*/ // Neue Groesse inneres Polygon feststellen
+/*N*/ Volume3D aNewSize(aLocalFront.GetPolySize());
+/*N*/
+/*N*/ // Skalierung feststellen (nur X,Y)
+/*N*/ Vector3D aScaleVec(
+/*N*/ (aNewSize.GetWidth() != 0.0) ? aOldSize.GetWidth() / aNewSize.GetWidth() : 1.0,
+/*N*/ (aNewSize.GetHeight() != 0.0) ? aOldSize.GetHeight() / aNewSize.GetHeight() : 1.0,
+/*N*/ (aNewSize.GetDepth() != 0.0) ? aOldSize.GetDepth() / aNewSize.GetDepth() : 1.0);
+/*N*/
+/*N*/ // Transformation bilden
+/*N*/ Matrix4D aTransMat;
+/*N*/ aTransMat.Scale(aScaleVec);
+/*N*/
+/*N*/ // aeusseres und inneres Polygon skalieren
+/*N*/ aLocalFront.Transform(aTransMat);
+/*N*/ aOuterFront.Transform(aTransMat);
+/*N*/
+/*N*/ // Neue Groesse aktualisieren
+/*N*/ aNewSize = aLocalFront.GetPolySize();
+/*N*/
+/*N*/ // Translation feststellen
+/*N*/ Vector3D aTransVec(
+/*N*/ aOldSize.MinVec().X() - aNewSize.MinVec().X(),
+/*N*/ aOldSize.MinVec().Y() - aNewSize.MinVec().Y(),
+/*N*/ aOldSize.MinVec().Z() - aNewSize.MinVec().Z());
+/*N*/
+/*N*/ // Transformation bilden
+/*N*/ aTransMat.Identity();
+/*N*/ aTransMat.Translate(aTransVec);
+/*N*/
+/*N*/ // aeusseres und inneres Polygon skalieren
+/*N*/ aLocalFront.Transform(aTransMat);
+/*N*/ aOuterFront.Transform(aTransMat);
+/*N*/
+/*N*/ // move aLocalFront again, scale and translate has moved it back
+/*N*/ GrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Polygon kopieren
+/*N*/ aOuterFront = aLocalFront;
+/*N*/
+/*N*/ // notwendige Normalen erzeugen
+/*N*/ PolyPolygon3D aGrowDirection;
+/*N*/ AddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothLeft);
+/*N*/
+/*N*/ // Aeusseres Polygon verkleinern
+/*N*/ GrowPoly(aOuterFront, aGrowDirection, -fDiagLen);
+/*N*/ aOuterFront.CorrectGrownPoly(aLocalFront);
+/*N*/
+/*N*/ // Inneres Polygon nach innen verschieben
+/*N*/ GrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
+/*N*/ }
+/*N*/
+/*N*/ // eventuell noch glaetten
+/*N*/ if(bSmoothLeft)
+/*N*/ {
+/*N*/ if(bSmoothFrontBack)
+/*?*/ AddInBetweenNormals(aOuterFront, aLocalFront, aNormalsOuterFront, bSmoothLeft);
+/*N*/ AddInBetweenNormals(aOuterFront, aLocalFront, aNormalsLeft, bSmoothLeft);
+/*N*/ }
+/*N*/
+/*N*/ // vordere Zwischenstuecke erzeugen
+/*N*/ CreateInBetween(aOuterFront, aLocalFront,
+/*N*/ aNormalsOuterFront, aNormalsLeft,
+/*N*/ bCreateNormals,
+/*N*/ fSurroundFactor,
+/*N*/ fTextureStart,
+/*N*/ fTextureDepth * fPercentDiag,
+/*N*/ bRotateTexture90);
+/*N*/
+/*N*/ // Vorderseite erzeugen
+/*N*/ CreateFront(aOuterFront, aNormalsOuterFront, bCreateNormals, bCreateTexture);
+/*N*/
+/*N*/ // Weitere Texturwerte setzen
+/*N*/ fTexMidStart += fTextureDepth * fPercentDiag;
+/*N*/ fTexMidDepth -= fTextureDepth * fPercentDiag;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if(pPrev)
+/*?*/ AddInBetweenNormals(*pPrev, rFront, aNormalsLeft, bSmoothLeft);
+/*N*/ }
+/*N*/
+/*N*/ // Mit Scraegen, Rueckseite
+/*N*/ if(bCreateBack)
+/*N*/ {
+/*N*/ PolyPolygon3D aNormalsOuterBack;
+/*N*/ AddBackNormals(aLocalBack, aNormalsOuterBack, aOffset);
+/*N*/
+/*N*/ if(bCharacterExtrude)
+/*N*/ {
+/*N*/ // Polygon kopieren
+/*N*/ aOuterBack = aLocalBack;
+/*N*/
+/*N*/ // notwendige Normalen erzeugen
+/*N*/ PolyPolygon3D aGrowDirection;
+/*N*/ AddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothRight);
+/*N*/
+/*N*/ // Groesse inneres Polygon merken
+/*N*/ Volume3D aOldSize(aLocalBack.GetPolySize());
+/*N*/
+/*N*/ // Inneres Polygon vergroessern
+/*N*/ GrowPoly(aLocalBack, aGrowDirection, fDiagLen);
+/*N*/
+/*N*/ // Inneres Polygon nach innen verschieben
+/*N*/ //GrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
+/*N*/
+/*N*/ // Neue Groesse inneres Polygon feststellen
+/*N*/ Volume3D aNewSize(aLocalBack.GetPolySize());
+/*N*/
+/*N*/ // Skalierung feststellen (nur X,Y)
+/*N*/ Vector3D aScaleVec(
+/*N*/ (aNewSize.GetWidth() != 0.0) ? aOldSize.GetWidth() / aNewSize.GetWidth() : 1.0,
+/*N*/ (aNewSize.GetHeight() != 0.0) ? aOldSize.GetHeight() / aNewSize.GetHeight() : 1.0,
+/*N*/ (aNewSize.GetDepth() != 0.0) ? aOldSize.GetDepth() / aNewSize.GetDepth() : 1.0);
+/*N*/
+/*N*/ // Transformation bilden
+/*N*/ Matrix4D aTransMat;
+/*N*/ aTransMat.Scale(aScaleVec);
+/*N*/
+/*N*/ // aeusseres und inneres Polygon skalieren
+/*N*/ aLocalBack.Transform(aTransMat);
+/*N*/ aOuterBack.Transform(aTransMat);
+/*N*/
+/*N*/ // Neue Groesse aktualisieren
+/*N*/ aNewSize = aLocalBack.GetPolySize();
+/*N*/
+/*N*/ // Translation feststellen
+/*N*/ Vector3D aTransVec(
+/*N*/ aOldSize.MinVec().X() - aNewSize.MinVec().X(),
+/*N*/ aOldSize.MinVec().Y() - aNewSize.MinVec().Y(),
+/*N*/ aOldSize.MinVec().Z() - aNewSize.MinVec().Z());
+/*N*/
+/*N*/ // Transformation bilden
+/*N*/ aTransMat.Identity();
+/*N*/ aTransMat.Translate(aTransVec);
+/*N*/
+/*N*/ // aeusseres und inneres Polygon skalieren
+/*N*/ aLocalBack.Transform(aTransMat);
+/*N*/ aOuterBack.Transform(aTransMat);
+/*N*/
+/*N*/ // move aLocalBack again, scale and translate has moved it back
+/*N*/ GrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Polygon kopieren
+/*N*/ aOuterBack = aLocalBack;
+/*N*/
+/*N*/ // notwendige Normalen erzeugen
+/*N*/ PolyPolygon3D aGrowDirection;
+/*N*/ AddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothRight);
+/*N*/
+/*N*/ // Aeusseres Polygon verkleinern
+/*N*/ GrowPoly(aOuterBack, aGrowDirection, -fDiagLen);
+/*N*/ aOuterBack.CorrectGrownPoly(aLocalBack);
+/*N*/
+/*N*/ // Inneres Polygon nach innen verschieben
+/*N*/ GrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
+/*N*/ }
+/*N*/
+/*N*/ // eventuell noch glaetten
+/*N*/ if(bSmoothRight)
+/*N*/ {
+/*N*/ if(bSmoothFrontBack)
+/*?*/ AddInBetweenNormals(aLocalBack, aOuterBack, aNormalsOuterBack, bSmoothRight);
+/*N*/ AddInBetweenNormals(aLocalBack, aOuterBack, aNormalsRight, bSmoothRight);
+/*N*/ }
+/*N*/
+/*N*/ // vordere Zwischenstuecke erzeugen
+/*N*/ // hintere Zwischenstuecke erzeugen
+/*N*/ CreateInBetween(aLocalBack, aOuterBack,
+/*N*/ aNormalsRight, aNormalsOuterBack,
+/*N*/ bCreateNormals,
+/*N*/ fSurroundFactor,
+/*N*/ fTextureStart + (fTextureDepth * (1.0 - fPercentDiag)),
+/*N*/ fTextureDepth * fPercentDiag,
+/*N*/ bRotateTexture90);
+/*N*/
+/*N*/ // Rueckseite erzeugen
+/*N*/ CreateBack(aOuterBack, aNormalsOuterBack, bCreateNormals, bCreateTexture);
+/*N*/
+/*N*/ // Weitere Texturwerte setzen
+/*N*/ fTexMidDepth -= fTextureDepth * fPercentDiag;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if(pNext)
+/*?*/ AddInBetweenNormals(rBack, *pNext, aNormalsRight, bSmoothRight);
+/*?*/ }
+/*N*/
+/*N*/ // eigentliches Zwischenstueck
+/*N*/ CreateInBetween(aLocalFront, aLocalBack,
+/*N*/ aNormalsLeft, aNormalsRight,
+/*N*/ bCreateNormals,
+/*N*/ fSurroundFactor,
+/*N*/ fTexMidStart,
+/*N*/ fTexMidDepth,
+/*N*/ bRotateTexture90);
+/*N*/
+/*N*/ // #78972#
+/*N*/ if(pLineGeometry)
+/*N*/ {
+/*N*/ if(bCreateFront)
+/*N*/ pLineGeometry->Insert(aOuterFront);
+/*N*/ pLineGeometry->Insert(aLocalFront);
+/*N*/ if(bCreateBack)
+/*N*/ {
+/*N*/ pLineGeometry->Insert(aLocalBack);
+/*N*/ pLineGeometry->Insert(aOuterBack);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Parameter Geometrieerzeugung setzen
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* DisplayGeometry rausruecken
+|*
+\************************************************************************/
+
+/*N*/ B3dGeometry& E3dCompoundObject::GetDisplayGeometry()
+/*N*/ {
+/*N*/ // Geometrie herstellen
+/*N*/ if(!bGeometryValid)
+/*?*/ ReCreateGeometry();
+/*N*/
+/*N*/ return aDisplayGeometry;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Material des Objektes
+|*
+\************************************************************************/
+
+/*N*/ void E3dCompoundObject::SetMaterialAmbientColor(const Color& rColor)
+/*N*/ {
+/*N*/ if(aMaterialAmbientColor != rColor)
+/*N*/ {
+/*?*/ aMaterialAmbientColor = rColor;
+/*N*/ }
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* 3D Ausgabe
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objekt als Kontur in das Polygon einfuegen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Schatten fuer 3D-Objekte zeichnen
+|*
+\************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* convert given PolyPolygon3D to screen coor
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+// private support routines for ItemSet access. NULL pointer means clear item.
+/*N*/ void E3dCompoundObject::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dObject::PostItemChange(nWhich);
+/*N*/
+/*N*/ // handle value change
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case SDRATTR_3DOBJ_DOUBLE_SIDED:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_NORMALS_KIND:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_NORMALS_INVERT:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// EOF
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_objfac3d.cxx b/binfilter/bf_svx/source/engine3d/svx_objfac3d.cxx
new file mode 100644
index 000000000000..1d6cf8689b0a
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_objfac3d.cxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "globl3d.hxx"
+
+#include "polysc3d.hxx"
+
+#include "dlight3d.hxx"
+
+#include "plight3d.hxx"
+
+#include "polyob3d.hxx"
+
+#include "cube3d.hxx"
+
+#include "sphere3d.hxx"
+
+#include "extrud3d.hxx"
+
+#include "lathe3d.hxx"
+
+#include "polygn3d.hxx"
+
+#include "objfac3d.hxx"
+
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dObjFactory::E3dObjFactory()
+/*N*/ {
+/*N*/ SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dObjFactory::~E3dObjFactory()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Chart-interne Objekte erzeugen
+|*
+\************************************************************************/
+
+/*N*/ IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
+/*N*/ {
+/*N*/ if ( pObjFactory->nInventor == E3dInventor )
+/*N*/ {
+/*N*/ switch ( pObjFactory->nIdentifier )
+/*N*/ {
+/*N*/ case E3D_POLYSCENE_ID:
+/*N*/ pObjFactory->pNewObj = new E3dPolyScene();
+/*N*/ break;
+/*N*/ case E3D_LIGHT_ID:
+/*N*/ pObjFactory->pNewObj = new E3dLight();
+/*N*/ break;
+/*N*/ case E3D_DISTLIGHT_ID:
+/*N*/ pObjFactory->pNewObj = new E3dDistantLight();
+/*N*/ break;
+/*N*/ case E3D_POINTLIGHT_ID:
+/*N*/ pObjFactory->pNewObj = new E3dPointLight();
+/*N*/ break;
+/*N*/ case E3D_SPOTLIGHT_ID:
+/*N*/ break;
+/*N*/ case E3D_OBJECT_ID:
+/*N*/ pObjFactory->pNewObj = new E3dObject();
+/*N*/ break;
+/*N*/ case E3D_POLYOBJ_ID :
+/*N*/ pObjFactory->pNewObj = new E3dPolyObj();
+/*N*/ break;
+/*N*/ case E3D_POLYGONOBJ_ID :
+/*N*/ pObjFactory->pNewObj = new E3dPolygonObj();
+/*N*/ break;
+/*N*/ case E3D_CUBEOBJ_ID :
+/*N*/ pObjFactory->pNewObj = new E3dCubeObj();
+/*N*/ break;
+/*N*/ case E3D_SPHEREOBJ_ID:
+/*N*/ // FG: ruft den dummy constructor, da dieser Aufruf nur beim Laden von Dokumenten erfolgt.
+/*N*/ // die wirkliche Anzahkl Segmente wird aber erst nach dem Laden der Member festgelegt.
+/*N*/ // dies hat zur Folge das die erste Kugel gleich wieder zerstoert wird, obwohl sie nie
+/*N*/ // gebraucht worden ist.
+/*N*/ pObjFactory->pNewObj = new E3dSphereObj(123);
+/*N*/ break;
+/*N*/ case E3D_POINTOBJ_ID:
+/*N*/ pObjFactory->pNewObj = new E3dPointObj();
+/*N*/ break;
+/*N*/ case E3D_EXTRUDEOBJ_ID:
+/*N*/ pObjFactory->pNewObj = new E3dExtrudeObj();
+/*N*/ break;
+/*N*/ case E3D_LATHEOBJ_ID:
+/*N*/ pObjFactory->pNewObj = new E3dLatheObj();
+/*N*/ break;
+/*N*/ case E3D_LABELOBJ_ID:
+/*N*/ pObjFactory->pNewObj = new E3dLabelObj();
+/*N*/ break;
+/*N*/ case E3D_COMPOUNDOBJ_ID:
+/*N*/ pObjFactory->pNewObj = new E3dCompoundObject();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_plight3d.cxx b/binfilter/bf_svx/source/engine3d/svx_plight3d.cxx
new file mode 100644
index 000000000000..755c1565578b
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_plight3d.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#include "polyob3d.hxx"
+
+#include "plight3d.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dPointLight, E3dLight);
+
+/*************************************************************************
+|*
+|* E3dPointLight-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPointLight::E3dPointLight(const Vector3D& rPos, const Color& rColor,
+/*N*/ double fLightIntensity) :
+/*N*/ E3dLight(rPos, rColor, fLightIntensity)
+/*N*/ {
+/*N*/ CreateLightObj();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* E3dPointLight-Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPointLight::~E3dPointLight()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Lichtstaerke an uebergeben Punkt bestimmen und die akkumulierte
+|* Punktfarbe berechnen
+|*
+\************************************************************************/
+
+/*N*/ FASTBOOL E3dPointLight::CalcLighting(Color& rNewColor,
+/*N*/ const Vector3D& rPnt,
+/*N*/ const Vector3D& rPntNormal,
+/*N*/ const Color& rPntColor)
+/*N*/ {
+/*N*/ double fR = 0, fG = 0, fB = 0;
+/*N*/
+/*N*/ if ( IsOn() )
+/*N*/ {
+/*N*/ double fLight;
+/*N*/ Vector3D aPntToLight = GetTransPosition() - rPnt;
+/*N*/
+/*N*/ aPntToLight.Normalize();
+/*N*/ fLight = rPntNormal.Scalar(aPntToLight);
+/*N*/
+/*N*/ if ( fLight > 0 )
+/*N*/ {
+/*N*/ fR = fLight * GetRed();
+/*N*/ fG = fLight * GetGreen();
+/*N*/ fB = fLight * GetBlue();
+/*N*/ }
+/*N*/ }
+/*N*/ return ImpCalcLighting(rNewColor, rPntColor, fR, fG, fB);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Darstellung des Lichtobjekts in der Szene ein-/ausschalten
+|*
+\************************************************************************/
+
+/*N*/ void E3dPointLight::CreateLightObj()
+/*N*/ {
+/*N*/ pSub->Clear();
+/*N*/
+/*N*/ if ( IsLightObjVisible() )
+/*N*/ {
+/*N*/ Vector3D aDiff(0.5,0,0);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(0,0.5,0);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(0,0,0.5);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(0.35,0.35,0.35);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(0.35,0.35,-0.35);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(-0.35,0.35,-0.35);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ aDiff = Vector3D(-0.35,0.35,0.35);
+/*N*/ Insert3DObj(new E3dPolyObj(GetPosition() - aDiff, GetPosition() + aDiff));
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_pntobj3d.cxx b/binfilter/bf_svx/source/engine3d/svx_pntobj3d.cxx
new file mode 100644
index 000000000000..0f5651922741
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_pntobj3d.cxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdio.hxx"
+
+
+#include "pntobj3d.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dPointObj, E3dObject);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPointObj::E3dPointObj(const Vector3D& rPos) :
+/*N*/ aPosition(rPos),
+/*N*/ bTransPosValid(FALSE)
+/*N*/ {
+/*N*/ aLocalBoundVol = Volume3D(aPosition, Vector3D(), FALSE);
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPointObj::E3dPointObj() :
+/*N*/ aPosition(Vector3D()),
+/*N*/ bTransPosValid(FALSE)
+/*N*/ {
+/*N*/ aLocalBoundVol = Volume3D(aPosition, Vector3D(), FALSE);
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* bei Aenderung der Transformation
+|*
+\************************************************************************/
+
+/*N*/ void E3dPointObj::SetTransformChanged()
+/*N*/ {
+/*N*/ E3dObject::SetTransformChanged();
+/*N*/ bTransPosValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* neue Position setzen und Aenderung an Parents (Szene) melden
+|*
+\************************************************************************/
+
+/*N*/ void E3dPointObj::SetPosition(const Vector3D& rNewPos)
+/*N*/ {
+/*N*/ if ( aPosition != rNewPos )
+/*N*/ {
+/*N*/ aPosition = rNewPos;
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ bTransPosValid = FALSE;
+/*N*/ StructureChanged(this);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformierte Position zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ const Vector3D& E3dPointObj::GetTransPosition()
+/*N*/ {
+/*N*/ if ( !bTransPosValid )
+/*N*/ {
+/*N*/ aTransPos = GetFullTransform() * aPosition;
+/*N*/ bTransPosValid = TRUE;
+/*N*/ }
+/*N*/ return aTransPos;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dPointObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ E3dObject::WriteData(rOut);
+/*N*/
+/*N*/ #ifdef E3D_STREAMING
+/*N*/
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPointObj");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aPosition;
+/*N*/ #endif
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dPointObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPointObj");
+/*N*/ #endif
+/*N*/
+/*N*/ rIn >> aPosition;
+/*N*/
+/*N*/ bTransPosValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx b/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx
new file mode 100644
index 000000000000..8bf00f12d82d
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx
@@ -0,0 +1,1958 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#ifndef _STRING_H
+#include <string.h>
+#ifndef _STRING_H
+#define _STRING_H
+#endif
+#endif
+
+#include "xpoly.hxx"
+
+#include "poly3d.hxx"
+
+
+#include <tools/poly.hxx>
+
+
+namespace binfilter {
+
+/*N*/ DBG_NAME(Polygon3D)
+/*N*/ DBG_NAME(PolyPolygon3D)
+
+/*************************************************************************
+|*
+|* 3D-PolyPolygon-Implementierung
+|*
+\************************************************************************/
+
+/*N*/ DECLARE_LIST(Polygon3DList, Polygon3D*)//STRIP008 ;
+
+/*N*/ class ImpPolyPolygon3D
+/*N*/ {
+/*N*/ public:
+/*N*/ Polygon3DList aPoly3DList;
+/*N*/ UINT16 nRefCount;
+/*N*/
+/*N*/ ImpPolyPolygon3D(UINT16 nInitSize = 4, UINT16 nResize = 4)
+/*N*/ : aPoly3DList(1024, nInitSize, nResize) { nRefCount = 1; }
+/*N*/ ImpPolyPolygon3D(const ImpPolyPolygon3D& rImpPolyPoly3D);
+/*N*/ ~ImpPolyPolygon3D();
+/*N*/
+/*N*/ BOOL operator==(const ImpPolyPolygon3D& rImpPolyPoly3D) const;
+/*N*/ BOOL operator!=(const ImpPolyPolygon3D& rImpPolyPoly3D) const
+/*N*/ { return !operator==(rImpPolyPoly3D); }
+/*N*/ };
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ ImpPolygon3D::ImpPolygon3D(UINT16 nInitSize, UINT16 nPolyResize)
+/*N*/ {
+/*N*/ pPointAry = NULL;
+/*N*/ bDeleteOldAry = FALSE;
+/*N*/ bClosed = FALSE;
+/*N*/ nSize = 0;
+/*N*/ nResize = nPolyResize;
+/*N*/ nPoints = 0;
+/*N*/ nRefCount = 1;
+/*N*/ Resize(nInitSize);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Copy-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ ImpPolygon3D::ImpPolygon3D(const ImpPolygon3D& rImpPoly3D)
+/*N*/ {
+/*N*/ ((ImpPolygon3D&)rImpPoly3D).CheckPointDelete();
+/*N*/
+/*N*/ pPointAry = NULL;
+/*N*/ bDeleteOldAry = FALSE;
+/*N*/ bClosed = rImpPoly3D.bClosed;
+/*N*/ nSize = 0;
+/*N*/ nResize = rImpPoly3D.nResize;
+/*N*/ nPoints = 0;
+/*N*/ nRefCount = 1;
+/*N*/ Resize(rImpPoly3D.nSize);
+/*N*/
+/*N*/ // Kopieren
+/*N*/ nPoints = rImpPoly3D.nPoints;
+/*N*/ memcpy(pPointAry, rImpPoly3D.pPointAry, nSize*sizeof(Vector3D));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ ImpPolygon3D::~ImpPolygon3D()
+/*N*/ {
+/*N*/ delete[] (char*)pPointAry;
+/*N*/
+/*N*/ if(bDeleteOldAry)
+/*N*/ delete[] (char*)pOldPointAry;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Gibt unter Beachtung eines Flags den Speicher fuer das Polygon frei.
+|*
+\************************************************************************/
+
+/*N*/ void ImpPolygon3D::CheckPointDelete()
+/*N*/ {
+/*N*/ if(bDeleteOldAry)
+/*N*/ {
+/*N*/ delete[] (char*)pOldPointAry;
+/*N*/ bDeleteOldAry = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ImpPolygon3D::Resize()
+|*
+|* !!! Polygongroesse aendern - wenn bDeletePoints FALSE, dann den
+|* Punkt-Array nicht loeschen, sondern in pOldPointAry sichern und
+|* das Flag bDeleteOldAry setzen. Beim naechsten Zugriff wird
+|* das Array dann geloescht.
+|* Damit wird verhindert, dass bei Poly3D[n] = Poly3D[0] durch ein
+|* Resize der fuer den rechten Ausdruck verwendete Vector3D-Array
+|* vorzeitig geloescht wird.
+|*
+\************************************************************************/
+
+/*N*/ void ImpPolygon3D::Resize(UINT16 nNewSize, BOOL bDeletePoints)
+/*N*/ {
+/*N*/ if(nNewSize == nSize)
+/*N*/ return;
+/*N*/
+/*N*/ UINT16 nOldSize = nSize;
+/*N*/
+/*N*/ CheckPointDelete();
+/*N*/ pOldPointAry = pPointAry;
+/*N*/
+/*N*/ // Neue Groesse auf vielfaches von nResize runden, sofern Objekt
+/*N*/ // nicht neu angelegt wurde (nSize != 0)
+/*N*/ if(nSize && nNewSize > nSize)
+/*N*/ {
+/*N*/ DBG_ASSERT(nResize, "Resize-Versuch trotz nResize = 0 !");
+/*N*/ nNewSize = nSize + ((nNewSize-nSize-1) / nResize + 1) * nResize;
+/*N*/ }
+/*N*/
+/*N*/ // Punkt-Array erzeugen
+/*N*/ nSize = nNewSize;
+/*N*/ pPointAry = (Vector3D*)new char[nSize * sizeof(Vector3D)];
+/*N*/ memset(pPointAry, 0, nSize * sizeof(Vector3D));
+/*N*/
+/*N*/ // Eventuell umkopieren
+/*N*/ if(nOldSize)
+/*N*/ {
+/*N*/ if(nOldSize < nSize)
+/*N*/ {
+/*N*/ memcpy(pPointAry, pOldPointAry, nOldSize * sizeof(Vector3D));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ memcpy(pPointAry, pOldPointAry, nSize*sizeof(Vector3D));
+/*N*/
+/*N*/ // Anzahl der gueltigen Punkte anpassen
+/*N*/ if(nPoints > nSize)
+/*N*/ nPoints = nSize;
+/*N*/ }
+/*N*/ if(bDeletePoints)
+/*N*/ delete[] (char*)pOldPointAry;
+/*N*/ else
+/*N*/ bDeleteOldAry = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Vektoren einfuegen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Vektoren entfernen
+|*
+\************************************************************************/
+
+/*N*/ void ImpPolygon3D::Remove(UINT16 nPos, UINT16 nCount)
+/*N*/ {
+/*N*/ CheckPointDelete();
+/*N*/
+/*N*/ if(nPos + nCount <= nPoints)
+/*N*/ {
+/*N*/ UINT16 nMove = nPoints - nPos - nCount;
+/*N*/ if(nMove)
+/*N*/ memmove(&pPointAry[nPos], &pPointAry[nPos+nCount],
+/*N*/ nMove * sizeof(Vector3D));
+/*N*/
+/*N*/ nPoints -= nCount;
+/*N*/ memset(&pPointAry[nPoints], 0, nCount * sizeof(Vector3D));
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D::Polygon3D(UINT16 nSize, UINT16 nResize)
+/*N*/ {
+/*N*/ pImpPolygon3D = new ImpPolygon3D(nSize, nResize);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Copy-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D::Polygon3D(const Polygon3D& rPoly3D)
+/*N*/ {
+/*N*/ pImpPolygon3D = rPoly3D.pImpPolygon3D;
+/*N*/ pImpPolygon3D->nRefCount++;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor aus Standard-Polygon
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D::Polygon3D(const Polygon& rPoly, double fScale)
+/*N*/ {
+/*N*/ UINT16 nSize(rPoly.GetSize());
+/*N*/ pImpPolygon3D = new ImpPolygon3D(nSize);
+/*N*/
+/*N*/ if(fScale != 1.0)
+/*N*/ {
+/*?*/ for(UINT16 a=0; a<nSize; a++)
+/*?*/ {
+/*?*/ pImpPolygon3D->pPointAry[a].X() = rPoly[a].X() * fScale;
+/*?*/ pImpPolygon3D->pPointAry[a].Y() = -rPoly[a].Y() * fScale;
+/*?*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for(UINT16 a=0; a<nSize; a++)
+/*N*/ {
+/*N*/ pImpPolygon3D->pPointAry[a].X() = rPoly[a].X();
+/*N*/ pImpPolygon3D->pPointAry[a].Y() = -rPoly[a].Y();
+/*N*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pImpPolygon3D->nPoints = nSize;
+/*N*/
+/*N*/ CheckClosed();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor aus XPolygon - Achtung! Es werden nur die Punkte
+|* uebernommen, ohne Konvertierung
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D::Polygon3D(const XPolygon& rXPoly, double fScale)
+/*N*/ {
+/*N*/ UINT16 nSize(rXPoly.GetPointCount());
+/*N*/ pImpPolygon3D = new ImpPolygon3D(nSize);
+/*N*/
+/*N*/ if(fScale != 1.0)
+/*N*/ {
+/*?*/ for(UINT16 a=0; a<nSize; a++)
+/*?*/ {
+/*?*/ pImpPolygon3D->pPointAry[a].X() = rXPoly[a].X() * fScale;
+/*?*/ pImpPolygon3D->pPointAry[a].Y() = -rXPoly[a].Y() * fScale;
+/*?*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for(UINT16 a=0; a<nSize; a++)
+/*N*/ {
+/*N*/ pImpPolygon3D->pPointAry[a].X() = rXPoly[a].X();
+/*N*/ pImpPolygon3D->pPointAry[a].Y() = -rXPoly[a].Y();
+/*N*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pImpPolygon3D->nPoints = nSize;
+/*N*/
+/*N*/ CheckClosed();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Closed-Status der Einzelpolygone korrigieren
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::CheckClosed()
+/*N*/ {
+/*N*/ // #97067# Test needs to look for > 1, not for != 0
+/*N*/ if(pImpPolygon3D->nPoints > 1
+/*N*/ && pImpPolygon3D->pPointAry[0] == pImpPolygon3D->pPointAry[pImpPolygon3D->nPoints - 1])
+/*N*/ {
+/*N*/ pImpPolygon3D->bClosed = TRUE;
+/*N*/ pImpPolygon3D->nPoints--;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D::~Polygon3D()
+/*N*/ {
+/*N*/ if( pImpPolygon3D->nRefCount > 1 )
+/*N*/ pImpPolygon3D->nRefCount--;
+/*N*/ else
+/*N*/ delete pImpPolygon3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Closed-Zustand des Polygons testen
+|*
+\************************************************************************/
+
+/*N*/ BOOL Polygon3D::IsClosed() const
+/*N*/ {
+/*N*/ return pImpPolygon3D->bClosed;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Closed-Zustand des Polygons aendern
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::SetClosed(BOOL bNew)
+/*N*/ {
+/*N*/ if(bNew != IsClosed())
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ pImpPolygon3D->bClosed = bNew;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Referenzzaehler desImpPoly3D pruefen und ggf. von diesem abkoppeln
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::CheckReference()
+/*N*/ {
+/*N*/ if(pImpPolygon3D->nRefCount > 1)
+/*N*/ {
+/*N*/ pImpPolygon3D->nRefCount--;
+/*N*/ pImpPolygon3D = new ImpPolygon3D(*pImpPolygon3D);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* neue Groesse setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Groesse zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Laenge der Polygonkante zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ double Polygon3D::GetLength() const
+/*N*/ {
+/*N*/ double fRetval = 0.0;
+/*N*/ Vector3D *pLast = &pImpPolygon3D->pPointAry[
+/*N*/ IsClosed() ? pImpPolygon3D->nPoints - 1 : 0];
+/*N*/
+/*N*/ for(UINT16 a=IsClosed() ? 0 : 1;a<pImpPolygon3D->nPoints;a++)
+/*N*/ {
+/*N*/ Vector3D *pCandidate = &pImpPolygon3D->pPointAry[a];
+/*N*/ Vector3D aVec = *pCandidate - *pLast;
+/*N*/ fRetval += aVec.GetLength();
+/*N*/ pLast = pCandidate;
+/*N*/ }
+/*N*/
+/*N*/ return fRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Anzahl der belegten Punkte setzen
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::SetPointCount(UINT16 nPoints)
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ CheckReference();
+/*N*/
+/*N*/ if(pImpPolygon3D->nSize < nPoints)
+/*?*/ pImpPolygon3D->Resize(nPoints);
+/*N*/
+/*N*/ if(nPoints < pImpPolygon3D->nPoints)
+/*N*/ {
+/*N*/ UINT16 nSize = pImpPolygon3D->nPoints - nPoints;
+/*N*/ memset(&pImpPolygon3D->pPointAry[nPoints], 0, nSize * sizeof(Vector3D));
+/*N*/ }
+/*N*/ pImpPolygon3D->nPoints = nPoints;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Anzahl der belegten Punkte zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 Polygon3D::GetPointCount() const
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ return pImpPolygon3D->nPoints;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Polygonpunkte entfernen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* const-Arrayoperator
+|*
+\************************************************************************/
+
+/*N*/ const Vector3D& Polygon3D::operator[]( UINT16 nPos ) const
+/*N*/ {
+/*N*/ DBG_ASSERT(nPos < pImpPolygon3D->nPoints, "Ungueltiger Index bei const-Arrayzugriff auf Polygon3D");
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ return pImpPolygon3D->pPointAry[nPos];
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Arrayoperator
+|*
+\************************************************************************/
+
+/*N*/ Vector3D& Polygon3D::operator[]( UINT16 nPos )
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ CheckReference();
+/*N*/
+/*N*/ if(nPos >= pImpPolygon3D->nSize)
+/*N*/ {
+/*N*/ DBG_ASSERT(pImpPolygon3D->nResize, "Ungueltiger Index bei Arrayzugriff auf Polygon3D");
+/*N*/ pImpPolygon3D->Resize(nPos + 1, FALSE);
+/*N*/ }
+/*N*/
+/*N*/ if(nPos >= pImpPolygon3D->nPoints)
+/*N*/ pImpPolygon3D->nPoints = nPos + 1;
+/*N*/
+/*N*/ return pImpPolygon3D->pPointAry[nPos];
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D& Polygon3D::operator=(const Polygon3D& rPoly3D)
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/
+/*N*/ rPoly3D.pImpPolygon3D->nRefCount++;
+/*N*/
+/*N*/ if(pImpPolygon3D->nRefCount > 1)
+/*N*/ pImpPolygon3D->nRefCount--;
+/*N*/ else
+/*N*/ delete pImpPolygon3D;
+/*N*/
+/*N*/ pImpPolygon3D = rPoly3D.pImpPolygon3D;
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Vergleichsoperator
+|*
+\************************************************************************/
+
+/*N*/ BOOL Polygon3D::operator==(const Polygon3D& rPoly3D) const
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/
+/*N*/ if(rPoly3D.pImpPolygon3D == pImpPolygon3D)
+/*N*/ return TRUE;
+/*N*/
+/*N*/ if(pImpPolygon3D->nPoints != rPoly3D.pImpPolygon3D->nPoints)
+/*N*/ return FALSE;
+/*N*/
+/*N*/ // point-to point compare necessary
+/*N*/ for(UINT16 a=0;a<pImpPolygon3D->nPoints;a++)
+/*N*/ if(pImpPolygon3D->pPointAry[a] != rPoly3D.pImpPolygon3D->pPointAry[a])
+/*N*/ return FALSE;
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ungleichoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* aus einem Stream lesen
+|*
+*************************************************************************/
+
+/*N*/ SvStream& operator>>(SvStream& rIStream, Polygon3D& rPoly3D)
+/*N*/ {
+/*N*/ DBG_CHKOBJ(&rPoly3D, Polygon3D, NULL);
+/*N*/ UINT16 nPntCnt;
+/*N*/
+/*N*/ rPoly3D.pImpPolygon3D->CheckPointDelete();
+/*N*/
+/*N*/ // Anzahl der Punkte einlesen und Array erzeugen
+/*N*/ rIStream >> nPntCnt;
+/*N*/ rPoly3D.pImpPolygon3D->nPoints = nPntCnt;
+/*N*/
+/*N*/ if(rPoly3D.pImpPolygon3D->nRefCount != 1)
+/*N*/ {
+/*?*/ if(rPoly3D.pImpPolygon3D->nRefCount)
+/*?*/ rPoly3D.pImpPolygon3D->nRefCount--;
+/*?*/ rPoly3D.pImpPolygon3D = new ImpPolygon3D(nPntCnt);
+/*N*/ }
+/*N*/ else
+/*N*/ rPoly3D.pImpPolygon3D->Resize(nPntCnt);
+/*N*/
+/*N*/ Vector3D* pPoint = rPoly3D.pImpPolygon3D->pPointAry;
+/*N*/
+/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
+/*N*/ rIStream >> *pPoint++;
+/*N*/
+/*N*/ // auf geschlossenheit pruefen
+/*N*/ if(*rPoly3D.pImpPolygon3D->pPointAry == *(pPoint-1))
+/*N*/ {
+/*N*/ rPoly3D.pImpPolygon3D->bClosed = TRUE;
+/*N*/ rPoly3D.pImpPolygon3D->nPoints = nPntCnt-1;
+/*N*/ }
+/*N*/
+/*N*/ INT16 nTmp;
+/*N*/ rIStream >> nTmp; // war mal nConvexPoint
+/*N*/ rIStream >> nTmp; // alt: rPoly3D.nOuterPoly;
+/*N*/
+/*N*/ return rIStream;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* in einem Stream speichern
+|*
+*************************************************************************/
+
+/*N*/ SvStream& operator<<(SvStream& rOStream, const Polygon3D& rPoly3D)
+/*N*/ {
+/*N*/ DBG_CHKOBJ(&rPoly3D, Polygon3D, NULL);
+/*N*/
+/*N*/ rPoly3D.pImpPolygon3D->CheckPointDelete();
+/*N*/
+/*N*/ Vector3D* pPoint = rPoly3D.pImpPolygon3D->pPointAry;
+/*N*/ UINT16 nPntCnt = rPoly3D.GetPointCount();
+/*N*/
+/*N*/ if(rPoly3D.pImpPolygon3D->bClosed)
+/*N*/ {
+/*N*/ nPntCnt++;
+/*N*/ rOStream << nPntCnt;
+/*N*/ nPntCnt--;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rOStream << nPntCnt;
+/*N*/ }
+/*N*/
+/*N*/ for (UINT16 i = 0; i < nPntCnt; i++)
+/*N*/ rOStream << *pPoint++;
+/*N*/
+/*N*/ if(rPoly3D.pImpPolygon3D->bClosed)
+/*N*/ {
+/*N*/ // ersten Punkt nochmal, um polygon auf geschlossen zu zwingen
+/*N*/ pPoint = rPoly3D.pImpPolygon3D->pPointAry;
+/*N*/ rOStream << *pPoint;
+/*N*/ }
+/*N*/
+/*N*/ rOStream << (INT16)0; // war mal nConvexPoint
+/*N*/ rOStream << (INT16)-1; // alt: rPoly3D.nOuterPoly;
+/*N*/
+/*N*/ return rOStream;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Laufrichtung des Polygons feststellen
+|*
+\************************************************************************/
+
+/*N*/ BOOL Polygon3D::IsClockwise(const Vector3D &rNormal) const
+/*N*/ {
+/*N*/ double fZValue = rNormal.Scalar(GetNormal());
+/*N*/ return (fZValue >= 0.0);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Eine garantier die Orientierung wiederspiegelnde Ecke des Polygons
+|* liefern
+|*
+\************************************************************************/
+
+/*N*/ UINT16 Polygon3D::GetHighestEdge() const
+/*N*/ {
+/*N*/ UINT16 nRetval = 0;
+/*N*/ Vector3D *pHighest = &pImpPolygon3D->pPointAry[nRetval];
+/*N*/ for(UINT16 a=1;a<pImpPolygon3D->nPoints;a++)
+/*N*/ {
+/*N*/ Vector3D *pCandidate = &pImpPolygon3D->pPointAry[a];
+/*N*/ if(pCandidate->X() <= pHighest->X())
+/*N*/ {
+/*N*/ if(pCandidate->X() < pHighest->X())
+/*N*/ {
+/*N*/ pHighest = pCandidate;
+/*N*/ nRetval = a;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(pCandidate->Y() <= pHighest->Y())
+/*N*/ {
+/*N*/ if(pCandidate->Y() < pHighest->Y())
+/*N*/ {
+/*N*/ pHighest = pCandidate;
+/*N*/ nRetval = a;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(pCandidate->Z() < pHighest->Z())
+/*N*/ {
+/*N*/ pHighest = pCandidate;
+/*N*/ nRetval = a;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Normale des Polygons liefern
+|*
+|* Dabei eine Ecke waehlen, die die spezifische Orientierung des Polygons
+|* besitzt und mit gleichen Punkten rechnen!
+|*
+\************************************************************************/
+
+/*N*/ Vector3D Polygon3D::GetNormal() const
+/*N*/ {
+/*N*/ Vector3D aNormal(0.0, 0.0, -1.0);
+/*N*/
+/*N*/ if(pImpPolygon3D->nPoints > 2)
+/*N*/ {
+/*N*/ // HighestEdge bestimmen
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/ UINT16 nHighest = GetHighestEdge();
+/*N*/ const Vector3D &rHighest = (*this)[nHighest];
+/*N*/
+/*N*/ // Vorgaenger bestimmen
+/*N*/ UINT16 nPrev(nHighest);
+/*N*/ do {
+/*N*/ nPrev = (nPrev == 0) ? nPntCnt-1 : nPrev-1;
+/*N*/ } while((*this)[nPrev] == rHighest && nPrev != nHighest);
+/*N*/ const Vector3D &rPrev = (*this)[nPrev];
+/*N*/
+/*N*/ // Nachfolger bestimmen
+/*N*/ UINT16 nNext(nHighest);
+/*N*/ do {
+/*N*/ nNext = (nNext == nPntCnt-1) ? 0 : nNext+1;
+/*N*/ } while((*this)[nNext] == rHighest && nNext != nHighest);
+/*N*/ const Vector3D &rNext = (*this)[nNext];
+/*N*/
+/*N*/ // Fehlerfaelle abfangen
+/*N*/ if(rHighest == rPrev || rHighest == rNext || rPrev == rNext)
+/*N*/ return aNormal;
+/*N*/
+/*N*/ // Normale bilden
+/*N*/ aNormal = (rPrev - rHighest)|(rNext - rHighest);
+/*N*/
+/*N*/ // get length
+/*N*/ double fLen = aNormal.GetLength();
+/*N*/
+/*N*/ // correct length
+/*N*/ if(fabs(fLen) < SMALL_DVALUE)
+/*N*/ fLen = 0.0;
+/*N*/
+/*N*/ if(0.0 != fLen)
+/*N*/ {
+/*N*/ // use own normalize here since we already know the vector length
+/*N*/ // with square root applied
+/*N*/ // aNormal.Normalize();
+/*N*/ if(1.0 != fLen)
+/*N*/ {
+/*N*/ // normalize
+/*N*/ double fFac = 1.0 / fLen;
+/*N*/ aNormal = Vector3D(aNormal.X() * fFac, aNormal.Y() * fFac, aNormal.Z() * fFac);
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // points are on one line, use default normal
+/*N*/ aNormal = Vector3D(0.0, 0.0, -1.0);
+/*N*/ }
+/*N*/ }
+/*N*/ return aNormal;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Mittelpunkt des Polygons (in Bezug auf die Einzelpunkte) berechnen
+|*
+\************************************************************************/
+
+/*N*/ Vector3D Polygon3D::GetMiddle() const
+/*N*/ {
+/*N*/ Vector3D aMiddle;
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/
+/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
+/*N*/ aMiddle += pImpPolygon3D->pPointAry[i];
+/*N*/
+/*N*/ aMiddle /= (double)nPntCnt;
+/*N*/
+/*N*/ return aMiddle;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Laufrichtung des Polygons umkehren
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::FlipDirection()
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ CheckReference();
+/*N*/
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/ UINT16 nCnt = nPntCnt / 2;
+/*N*/ Vector3D* pBeg = pImpPolygon3D->pPointAry;
+/*N*/ Vector3D* pEnd = pBeg + nPntCnt - 1;
+/*N*/
+/*N*/ for(UINT16 i = 0; i < nCnt; i++)
+/*N*/ {
+/*N*/ Vector3D aTmp = *pBeg;
+/*N*/ *pBeg++ = *pEnd;
+/*N*/ *pEnd-- = aTmp;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Polygonpunkte mit uebergebener Matrix transformieren
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::Transform(const Matrix4D& rTfMatrix)
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ CheckReference();
+/*N*/
+/*N*/ Vector3D* pPoint = pImpPolygon3D->pPointAry;
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/
+/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
+/*N*/ *pPoint++ *= rTfMatrix;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* doppelte aufeinanderfolgende Polygonpunkte entfernen; ein
+|* geschlossenes Polygon wird dabei ggf. "geoeffnet"
+|*
+\************************************************************************/
+
+/*N*/ void Polygon3D::RemoveDoublePoints()
+/*N*/ {
+/*N*/ pImpPolygon3D->CheckPointDelete();
+/*N*/ CheckReference();
+/*N*/
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/
+/*N*/ if(nPntCnt)
+/*N*/ {
+/*N*/ Vector3D* pPoint = pImpPolygon3D->pPointAry;
+/*N*/ Vector3D aP0 = *pPoint;
+/*N*/
+/*N*/ pPoint += nPntCnt;
+/*N*/
+/*N*/ while(*--pPoint == aP0 && nPntCnt > 3)
+/*N*/ {
+/*N*/ nPntCnt--;
+/*N*/ pImpPolygon3D->bClosed = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ for(UINT16 i = nPntCnt-1; i > 0 && nPntCnt > 3; i--)
+/*N*/ {
+/*N*/ if(*pPoint == *(pPoint-1))
+/*N*/ {
+/*N*/ pImpPolygon3D->Remove(i, 1);
+/*N*/ nPntCnt--;
+/*N*/ }
+/*N*/ pPoint--;
+/*N*/ }
+/*N*/
+/*N*/ SetPointCount(nPntCnt);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ DBG_ASSERT(FALSE, "Empty polygon used!");
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ueberlappen sich das aktuelle und das angegebene Polygon ?
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* Existiert ein Schnitt zwischen den Polys?
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Crossings Test for point and whole polygon
+|*
+\************************************************************************/
+
+/*N*/ BOOL Polygon3D::IsInside(const Vector3D& rPnt, BOOL bWithBorder) const
+/*N*/ {
+/*N*/ BOOL bInside(FALSE);
+/*N*/ UINT16 nNumPoint(GetPointCount());
+/*N*/ Vector3D* pPoints = pImpPolygon3D->pPointAry;
+/*N*/
+/*N*/ for(UINT16 a=0;a<nNumPoint;a++)
+/*N*/ {
+/*N*/ if(bWithBorder
+/*N*/ && (fabs(pPoints[a].X() - rPnt.X()) < SMALL_DVALUE)
+/*N*/ && (fabs(pPoints[a].Y() - rPnt.Y()) < SMALL_DVALUE))
+/*N*/ return TRUE;
+/*N*/
+/*N*/ UINT16 nPrev((!a) ? nNumPoint-1 : a-1);
+/*N*/
+/*N*/ if((pPoints[nPrev].Y() - rPnt.Y() > -SMALL_DVALUE) != (pPoints[a].Y() - rPnt.Y() > -SMALL_DVALUE))
+/*N*/ {
+/*N*/ BOOL bXFlagOld(pPoints[nPrev].X() - rPnt.X() > -SMALL_DVALUE);
+/*N*/
+/*N*/ if(bXFlagOld == (pPoints[a].X() - rPnt.X() > -SMALL_DVALUE))
+/*N*/ {
+/*N*/ if(bXFlagOld)
+/*N*/ bInside = !bInside;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ double fCmp =
+/*N*/ pPoints[a].X() - (pPoints[a].Y() - rPnt.Y()) *
+/*N*/ (pPoints[nPrev].X() - pPoints[a].X()) /
+/*N*/ (pPoints[nPrev].Y() - pPoints[a].Y());
+/*N*/
+/*N*/ if((bWithBorder && fCmp > rPnt.X()) || (!bWithBorder && fCmp - rPnt.X() > -SMALL_DVALUE))
+/*N*/ bInside = !bInside;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return bInside;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* FG: Identisch wie oben, das Polygon herausgeben
+|*
+\************************************************************************/
+
+/*N*/ Polygon Polygon3D::GetPolygon() const
+/*N*/ {
+/*N*/ BOOL bClosed = IsClosed();
+/*N*/ UINT16 nSize = pImpPolygon3D->nPoints;
+/*N*/ if(bClosed)
+/*N*/ nSize++;
+/*N*/ Polygon aPolygon(nSize);
+/*N*/ Vector3D* pVec3D = pImpPolygon3D->pPointAry;
+/*N*/
+/*N*/ if (pVec3D)
+/*N*/ {
+/*N*/ UINT16 i;
+/*N*/ for (i = 0; i < pImpPolygon3D->nPoints; i++)
+/*N*/ {
+/*N*/ // X und Y uebernehmen, Z vernachlaessigen
+/*N*/ aPolygon.SetPoint(Point((long) pVec3D[i].X(),
+/*N*/ (long) -pVec3D[i].Y()), i);
+/*N*/ }
+/*N*/ if(bClosed)
+/*N*/ aPolygon.SetPoint(Point((long) pVec3D[0].X(),
+/*N*/ (long) -pVec3D[0].Y()), i);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for (UINT16 i = 0; i < nSize; i++)
+/*N*/ {
+/*?*/ aPolygon.SetPoint(Point(), i);
+/*N*/ }
+/*N*/ }
+/*N*/ aPolygon.SetSize(nSize);
+/*N*/ return(aPolygon);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ausdehnung des Polygons ermitteln
+|*
+\************************************************************************/
+
+/*N*/ Volume3D Polygon3D::GetPolySize() const
+/*N*/ {
+/*N*/ Volume3D aRetval;
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/
+/*N*/ aRetval.Reset();
+/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
+/*N*/ aRetval.Union((*this)[i]);
+/*N*/
+/*N*/ return aRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Flaeche des Polygons ermitteln
+|*
+\************************************************************************/
+
+
+/*N*/ double Polygon3D::GetPolyArea(const Vector3D& rNormal) const
+/*N*/ {
+/*N*/ double fRetval = 0.0;
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/
+/*N*/ if(nPntCnt > 2)
+/*N*/ {
+/*N*/ const Vector3D& rFirst = (*this)[0];
+/*N*/ Vector3D aLastVector = (*this)[1] - rFirst;
+/*N*/
+/*N*/ for (UINT16 i = 2; i < nPntCnt; i++)
+/*N*/ {
+/*N*/ const Vector3D& rPoint = (*this)[i];
+/*N*/ Vector3D aNewVec = rPoint - rFirst;
+/*N*/ Vector3D aArea = aLastVector;
+/*N*/ aArea |= aNewVec;
+/*N*/ fRetval += (rNormal.Scalar(aArea)) / 2.0;
+/*N*/ }
+/*N*/ }
+/*N*/ return fabs(fRetval);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Schnitt zwischen den von den Punkten angegebenen Kanten ermitteln.
+|* Dabei ist der Rueckgabewert != 0.0, wenn der Schnitt innerhalb
+|* der Parameterbereiche der Kanten liegt und gibt den Wert ]0.0, 1.0]
+|* innerhalb der ersten Kante an.
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Diese Version arbeitet mit der Kante nEdge1 aus dem lokalen
+|* Polygon und nEdge2 aus dem uebergebenen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* test if point is on line in range ]0.0..1.0[ without
+|* the points. If so, return TRUE and put the parameter
+|* value in pCut (if provided)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Diese Version nimmt die Startpunkte und Vektoren (relative Angabe
+|* des Endpunktes) zweier Kanten
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Orientierung im Punkt nIndex liefern
+|*
+\************************************************************************/
+
+/*N*/ BOOL Polygon3D::GetPointOrientation(UINT16 nIndex) const
+/*N*/ {
+/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
+/*N*/ BOOL bRetval(TRUE);
+/*N*/
+/*N*/ if(nIndex < nPntCnt)
+/*N*/ {
+/*N*/ const Vector3D& rMid = (*this)[nIndex];
+/*N*/ const Vector3D& rPre = (*this)[(nIndex == 0) ? nPntCnt-1 : nIndex-1];
+/*N*/ const Vector3D& rPos = (*this)[(nIndex == nPntCnt-1) ? 0 : nIndex+1];
+/*N*/
+/*N*/ Vector3D aNormal = (rPre - rMid)|(rPos - rMid);
+/*N*/ bRetval = (aNormal.Z() > 0.0) ? TRUE : FALSE;
+/*N*/ }
+/*N*/
+/*N*/ return bRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* get position on polypos, with clipping to start/end
+|*
+\************************************************************************/
+
+/*N*/ Vector3D Polygon3D::GetPosition(double fPos) const
+/*N*/ {
+/*N*/ Vector3D aRetval((*this)[0]);
+/*N*/
+/*N*/ if(fPos <= 0.0 || pImpPolygon3D->nPoints < 2)
+/*N*/ return aRetval;
+/*N*/
+/*N*/ double fLen = GetLength();
+/*N*/
+/*N*/ if(fPos >= fLen)
+/*N*/ {
+/*N*/ aRetval = (*this)[pImpPolygon3D->nPoints - 1];
+/*N*/ return aRetval;
+/*N*/ }
+/*N*/
+/*N*/ UINT16 nPos(0);
+/*N*/ Vector3D aPart((*this)[0] - (*this)[1]);
+/*N*/ double fPartLen = aPart.GetLength();
+/*N*/
+/*N*/ while(fPos > fPartLen)
+/*N*/ {
+/*N*/ fPos -= fPartLen;
+/*N*/ nPos++;
+/*N*/ aPart = Vector3D((*this)[nPos] - (*this)[nPos+1]);
+/*N*/ fPartLen = aPart.GetLength();
+/*N*/ }
+/*N*/
+/*N*/ aRetval.CalcInBetween((*this)[nPos], (*this)[nPos+1], fPos / fPartLen);
+/*N*/
+/*N*/ return aRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// create a expanded or compresssed poly with exactly nNum Points
+//
+/*N*/ Polygon3D Polygon3D::GetExpandedPolygon(sal_uInt32 nNum)
+/*N*/ {
+/*N*/ if(GetPointCount() && nNum && (sal_uInt32)GetPointCount() != nNum)
+/*N*/ {
+/*N*/ Polygon3D aDestPoly((sal_uInt16)nNum);
+/*N*/
+/*N*/ // length of step in dest poly
+/*N*/ double fStep = GetLength() / (double)(IsClosed() ? nNum : nNum - 1);
+/*N*/
+/*N*/ // actual positions for run
+/*N*/ double fDestPos = 0.0;
+/*N*/ double fSrcPos = 0.0;
+/*N*/
+/*N*/ // actual indices for run
+/*N*/ sal_uInt32 nSrcPos = 0;
+/*N*/ sal_uInt32 nSrcPosNext = (nSrcPos+1 == (sal_uInt32)GetPointCount()) ? 0 : nSrcPos + 1;
+/*N*/
+/*N*/ // length of next source step
+/*N*/ double fNextSrcLen = ((*this)[(sal_uInt16)nSrcPos] - (*this)[(sal_uInt16)nSrcPosNext]).GetLength();
+/*N*/
+/*N*/ for(sal_uInt32 b = 0; b < nNum; b++)
+/*N*/ {
+/*N*/ // calc fDestPos in source
+/*N*/ while(fSrcPos + fNextSrcLen < fDestPos)
+/*N*/ {
+/*N*/ fSrcPos += fNextSrcLen;
+/*N*/ nSrcPos++;
+/*N*/ nSrcPosNext = (nSrcPos+1 == (sal_uInt32)GetPointCount()) ? 0 : nSrcPos + 1;
+/*N*/ fNextSrcLen = ((*this)[(sal_uInt16)nSrcPos] - (*this)[(sal_uInt16)nSrcPosNext]).GetLength();
+/*N*/ }
+/*N*/
+/*N*/ // fDestPos is between fSrcPos and (fSrcPos + fNextSrcLen)
+/*N*/ double fLenA = (fDestPos - fSrcPos) / fNextSrcLen;
+/*N*/ Vector3D aOld1 = (*this)[(sal_uInt16)nSrcPos];
+/*N*/ Vector3D aOld2 = (*this)[(sal_uInt16)nSrcPosNext];
+/*N*/ Vector3D aNewPoint;
+/*N*/ aNewPoint.CalcInBetween(aOld1, aOld2, fLenA);
+/*N*/
+/*N*/ aDestPoly[(sal_uInt16)b] = aNewPoint;
+/*N*/
+/*N*/ // next step
+/*N*/ fDestPos += fStep;
+/*N*/ }
+/*N*/
+/*N*/ if(aDestPoly.GetPointCount() >= 3)
+/*N*/ aDestPoly.SetClosed(IsClosed());
+/*N*/
+/*N*/ return aDestPoly;
+/*N*/ }
+/*N*/ else
+/*N*/ return *this;
+/*N*/ }
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+--------------- ImpPolyPolygon3D -------------------------------------+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/*************************************************************************
+|*
+|* Copy-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ ImpPolyPolygon3D::ImpPolyPolygon3D(const ImpPolyPolygon3D& rImpPolyPoly3D) :
+/*N*/ aPoly3DList(rImpPolyPoly3D.aPoly3DList)
+/*N*/ {
+/*N*/ nRefCount = 1;
+/*N*/ // Einzelne Elemente duplizieren
+/*N*/ Polygon3D* pPoly3D = aPoly3DList.First();
+/*N*/
+/*N*/ while ( pPoly3D )
+/*N*/ {
+/*N*/ aPoly3DList.Replace(new Polygon3D(*(aPoly3DList.GetCurObject())));
+/*N*/ pPoly3D = aPoly3DList.Next();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ ImpPolyPolygon3D::~ImpPolyPolygon3D()
+/*N*/ {
+/*N*/ Polygon3D* pPoly3D = aPoly3DList.First();
+/*N*/
+/*N*/ while( pPoly3D )
+/*N*/ {
+/*N*/ delete pPoly3D;
+/*N*/ pPoly3D = aPoly3DList.Next();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Gleichheitsoperator
+|*
+\************************************************************************/
+
+/*N*/ BOOL ImpPolyPolygon3D::operator==(const ImpPolyPolygon3D& rImpPolyPoly3D) const
+/*N*/ {
+/*N*/ UINT16 nCnt = (UINT16) aPoly3DList.Count();
+/*N*/ const Polygon3DList& rCmpList = rImpPolyPoly3D.aPoly3DList;
+/*N*/
+/*N*/ if ( nCnt != (UINT16) rCmpList.Count() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ BOOL bEqual = TRUE;
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt && bEqual; i++ )
+/*N*/ bEqual = ( *aPoly3DList.GetObject(i) == *rCmpList.GetObject(i) );
+/*N*/
+/*N*/ return bEqual;
+/*N*/ }
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+--------------- PolyPolygon3D ----------------------------------------+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::PolyPolygon3D(UINT16 nInitSize, UINT16 nResize)
+/*N*/ {
+/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D(nInitSize, nResize);
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* Konstruktor mit Polygon3D
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::PolyPolygon3D(const Polygon3D& rPoly3D)
+/*N*/ {
+/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(new Polygon3D(rPoly3D));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor mit PolyPolygon3D
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::PolyPolygon3D(const PolyPolygon3D& rPolyPoly3D)
+/*N*/ {
+/*N*/ DBG_CTOR(PolyPolygon3D,NULL);
+/*N*/ pImpPolyPolygon3D = rPolyPoly3D.pImpPolyPolygon3D;
+/*N*/ pImpPolyPolygon3D->nRefCount++;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor mit SV-PolyPolygon
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::PolyPolygon3D(const PolyPolygon& rPolyPoly, double fScale)
+/*N*/ {
+/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
+/*N*/ UINT16 nCnt = rPolyPoly.Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(
+/*N*/ new Polygon3D(rPolyPoly.GetObject(i), fScale), LIST_APPEND);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor mit XPolyPolygon
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::PolyPolygon3D(const XPolyPolygon& rXPolyPoly, double fScale)
+/*N*/ {
+/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
+/*N*/ UINT16 nCnt = rXPolyPoly.Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(
+/*N*/ new Polygon3D(rXPolyPoly.GetObject(i), fScale), LIST_APPEND);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Closed-Status der Einzelpolygone korrigieren
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D::~PolyPolygon3D()
+/*N*/ {
+/*N*/ DBG_DTOR(PolyPolygon3D, NULL);
+/*N*/
+/*N*/ if( pImpPolyPolygon3D->nRefCount > 1 ) pImpPolyPolygon3D->nRefCount--;
+/*N*/ else delete pImpPolyPolygon3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Feststellen, ob ein Punkt innerhalb liegt
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* Scnittpunkt angegebene Linie mit Polygon
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Referenzzaehler pruefen und ggf. neuen Container erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::CheckReference()
+/*N*/ {
+/*N*/ if( pImpPolyPolygon3D->nRefCount > 1 )
+/*N*/ {
+/*N*/ pImpPolyPolygon3D->nRefCount--;
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D(*pImpPolyPolygon3D);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Polygon in die Liste einfuegen
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::Insert(const Polygon3D& rPoly3D, UINT16 nPos)
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(new Polygon3D(rPoly3D), nPos);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* PolyPolygon in die Liste einfuegen
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::Insert(const PolyPolygon3D& rPolyPoly3D, UINT16 nPos)
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ UINT16 nCnt = rPolyPoly3D.Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++)
+/*N*/ {
+/*N*/ Polygon3D* pPoly3D = new Polygon3D(rPolyPoly3D[i]);
+/*N*/ pImpPolyPolygon3D->aPoly3DList. Insert(pPoly3D, nPos);
+/*N*/
+/*N*/ if ( nPos != POLYPOLY3D_APPEND )
+/*N*/ nPos++;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Polygon aus der Liste entfernen
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* Polygon in der Liste ersetzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Referenz auf Polygon zurueckgeben, ggf. neues Polygon einfuegen
+|*
+\************************************************************************/
+
+/*N*/ const Polygon3D& PolyPolygon3D::GetObject(UINT16 nPos) const
+/*N*/ {
+/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.GetObject(nPos);
+/*N*/
+/*N*/ if ( pPoly3D == NULL )
+/*N*/ { // Wenn noch kein Polygon an der Position vorhanden, neu erzeugen
+/*N*/ pPoly3D = new Polygon3D;
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, nPos);
+/*N*/ }
+/*N*/ return *pPoly3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Liste loeschen
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::Clear()
+/*N*/ {
+/*N*/ if ( pImpPolyPolygon3D->nRefCount > 1 )
+/*N*/ {
+/*?*/ pImpPolyPolygon3D->nRefCount--;
+/*?*/ pImpPolyPolygon3D = new ImpPolyPolygon3D();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.First();
+/*N*/
+/*N*/ while( pPoly3D )
+/*N*/ {
+/*N*/ delete pPoly3D;
+/*N*/ pPoly3D = pImpPolyPolygon3D->aPoly3DList.Next();
+/*N*/ }
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Clear();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Anzahl der Polygone zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 PolyPolygon3D::Count() const
+/*N*/ {
+/*N*/ return (UINT16)(pImpPolyPolygon3D->aPoly3DList.Count());
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Arrayoperator
+|*
+\************************************************************************/
+
+/*N*/ Polygon3D& PolyPolygon3D::operator[](UINT16 nPos)
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.GetObject(nPos);
+/*N*/
+/*N*/ if ( pPoly3D == NULL )
+/*N*/ { // Wenn noch kein Polygon an der Position vorhanden, neu erzeugen
+/*N*/ pPoly3D = new Polygon3D;
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, nPos);
+/*N*/ }
+/*N*/ return *pPoly3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon3D& PolyPolygon3D::operator=(const PolyPolygon3D& rPolyPoly3D)
+/*N*/ {
+/*N*/ rPolyPoly3D.pImpPolyPolygon3D->nRefCount++;
+/*N*/
+/*N*/ if( pImpPolyPolygon3D->nRefCount > 1 ) pImpPolyPolygon3D->nRefCount--;
+/*N*/ else delete pImpPolyPolygon3D;
+/*N*/
+/*N*/ pImpPolyPolygon3D = rPolyPoly3D.pImpPolyPolygon3D;
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Gleichheitsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Ungleichheitsoperator
+|*
+\************************************************************************/
+
+/*N*/ BOOL PolyPolygon3D::operator!=(const PolyPolygon3D& rPolyPoly3D) const
+/*N*/ {
+/*N*/ if ( pImpPolyPolygon3D == rPolyPoly3D.pImpPolyPolygon3D )
+/*N*/ return FALSE;
+/*N*/ else
+/*N*/ return *pImpPolyPolygon3D != *rPolyPoly3D.pImpPolyPolygon3D;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* alle Polygone mit uebergebener Matrix transformieren
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::Transform(const Matrix4D& rTfMatrix)
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ UINT16 nCnt = Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->Transform(rTfMatrix);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Die Umlaufrichtungen ineinanderliegender Polygone so anpassen, dass
+|* sie wechseln; Ausserdem wird ggf. das Polygon mit der geometrisch
+|* betrachtet aeussersten Kontur an den Anfang der Liste verschoben
+|* werden, damit Normalenberechnungen immer anhand des ersten Polygons
+|* ausgefuehrt werden koennen.
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::SetDirections(const Vector3D& rNormal)
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/
+/*N*/ UINT16 nCnt = Count();
+/*N*/ UINT16 nPoly;
+/*N*/ short nFirstPoly = -1;
+/*N*/
+/*N*/ if(nCnt)
+/*N*/ {
+/*N*/ for ( nPoly = 0; nPoly < nCnt; nPoly++ )
+/*N*/ {
+/*N*/ Polygon3D& rPoly3D = *pImpPolyPolygon3D->aPoly3DList.GetObject(nPoly);
+/*N*/ BOOL bFlip = !rPoly3D.IsClockwise(rNormal);
+/*N*/ short nDepth = 0;
+/*N*/ const Vector3D& rPos = rPoly3D[0];
+/*N*/
+/*N*/ // bestimmen, wie tief das aktuelle Polygon in den anderen
+/*N*/ // verschachtelt ist
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ {
+/*N*/ if ( i != nPoly &&
+/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->IsInside(rPos) )
+/*N*/ nDepth++;
+/*N*/ }
+/*N*/ // ungerade nDepth-Werte bedeuten: das Polygon ist ein "Loch"
+/*N*/ // in der aeusseren Kontur
+/*N*/ BOOL bHole = ((nDepth & 0x0001) == 1);
+/*N*/
+/*N*/ if ( (bFlip && !bHole) || (!bFlip && bHole) )
+/*N*/ rPoly3D.FlipDirection();
+/*N*/
+/*N*/ // Den Index des (geometrisch) aeussersten Polygons merken
+/*N*/ if ( nDepth == 0 && nFirstPoly == -1 )
+/*N*/ nFirstPoly = (short) nPoly;
+/*N*/ }
+/*N*/ // liegt das aeussere Polygon nicht am Anfang, wird es dahin verschoben
+/*N*/ if ( nFirstPoly > 0 )
+/*N*/ {
+/*N*/ Polygon3D* pOuter = pImpPolyPolygon3D->aPoly3DList.Remove(nFirstPoly);
+/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pOuter, (ULONG) 0);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* in allen Polygonen doppelte aufeinanderfolgende Polygonpunkte
+|* entfernen; ein geschlossenes Polygon wird dabei ggf. "geoeffnet"
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::RemoveDoublePoints()
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ UINT16 nCnt = Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->RemoveDoublePoints();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ein mittels GrowPoly() geschrumpftes PolyPolygon in eventuell
+|* entstandenen Selbstueberschneidungen in Eckpunkten ohne
+|* Punktreduzierung korrigieren
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::CorrectGrownPoly(const PolyPolygon3D& rPolyOrig)
+/*N*/ {
+/*N*/ if(Count() == rPolyOrig.Count())
+/*N*/ {
+/*N*/ for(UINT16 a=0;a<Count();a++)
+/*N*/ {
+/*N*/ const Polygon3D& rOrig = rPolyOrig[a];
+/*N*/ Polygon3D& rPoly = (*this)[a];
+/*N*/ UINT16 nPntCnt = rOrig.GetPointCount();
+/*N*/
+/*N*/ if(nPntCnt == rPoly.GetPointCount() && nPntCnt > 2)
+/*N*/ {
+/*N*/ UINT16 nNumDiff(0);
+/*N*/ UINT16 nDoneStart(0xffff);
+/*N*/
+/*N*/ // Testen auf Anzahl Aenderungen
+/*N*/ UINT16 b;
+/*N*/ for(b=0;b<nPntCnt;b++)
+/*N*/ {
+/*N*/ if(rOrig.GetPointOrientation(b) != rPoly.GetPointOrientation(b))
+/*N*/ {
+/*N*/ nNumDiff++;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if(nDoneStart == 0xffff)
+/*N*/ {
+/*N*/ // eventuellen Startpunkt auf gleiche Orientierung legen
+/*N*/ nDoneStart = b;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if(nNumDiff == nPntCnt)
+/*N*/ {
+/*N*/ // Komplett umgedreht, alles auf einen Punkt
+/*N*/ Vector3D aMiddle = rPoly.GetMiddle();
+/*N*/
+/*N*/ for(b=0;b<nPntCnt;b++)
+/*N*/ {
+/*N*/ rPoly[b] = aMiddle;
+/*N*/ }
+/*N*/ }
+/*N*/ else if(nNumDiff)
+/*N*/ {
+/*N*/ // es gibt welche, nDoneStart ist gesetzt. Erzeuge (und
+/*N*/ // setze) nDoneEnd
+/*N*/ UINT16 nDoneEnd(nDoneStart);
+/*N*/ UINT16 nStartLoop;
+/*N*/ BOOL bInLoop(FALSE);
+/*N*/
+/*N*/ // einen step mehr in der Schleife, um Loops abzuschliessen
+/*N*/ BOOL bFirstStep(TRUE);
+/*N*/
+/*N*/ while(nDoneEnd != nDoneStart || bFirstStep)
+/*N*/ {
+/*N*/ bFirstStep = FALSE;
+/*N*/
+/*N*/ // nCandidate ist Kandidat fuer Test
+/*N*/ UINT16 nCandidate = (nDoneEnd == nPntCnt-1) ? 0 : nDoneEnd+1;
+/*N*/
+/*N*/ if(rOrig.GetPointOrientation(nCandidate) == rPoly.GetPointOrientation(nCandidate))
+/*N*/ {
+/*N*/ // Orientierung ist gleich
+/*N*/ if(bInLoop)
+/*N*/ {
+/*N*/ // Punkte innerhalb bInLoop auf ihr Zentrum setzen
+/*N*/ Vector3D aMiddle;
+/*N*/ UINT16 nCounter(0);
+/*N*/ UINT16 nStart(nStartLoop);
+/*N*/
+/*N*/ while(nStart != nCandidate)
+/*N*/ {
+/*N*/ aMiddle += rPoly[nStart];
+/*N*/ nCounter++;
+/*N*/ nStart = (nStart == nPntCnt-1) ? 0 : nStart+1;
+/*N*/ }
+/*N*/
+/*N*/ // Mittelwert bilden
+/*N*/ aMiddle /= (double)nCounter;
+/*N*/
+/*N*/ // Punkte umsetzen
+/*N*/ nStart = nStartLoop;
+/*N*/ while(nStart != nCandidate)
+/*N*/ {
+/*N*/ rPoly[nStart] = aMiddle;
+/*N*/ nStart = (nStart == nPntCnt-1) ? 0 : nStart+1;
+/*N*/ }
+/*N*/
+/*N*/ // Loop beenden
+/*N*/ bInLoop = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Orientierung unterschiedlich
+/*N*/ if(!bInLoop)
+/*N*/ {
+/*N*/ // Start eines Loop mit geaenderter Orientierung
+/*N*/ nStartLoop = nCandidate;
+/*N*/ bInLoop = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Weitergehen
+/*N*/ nDoneEnd = nCandidate;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ueberlappen sich das aktuelle und das angegebene PolyPolygon (in X/Y) ?
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* Remove all completely overlapping polygons
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator>>(SvStream& rIStream, PolyPolygon3D& rPolyPoly3D)
+/*N*/ {
+/*N*/ DBG_CHKOBJ(&rPolyPoly3D, PolyPolygon3D, NULL);
+/*N*/
+/*N*/ Polygon3D* pPoly3D;
+/*N*/
+/*N*/ // Anzahl der Polygone einlesen
+/*N*/ UINT16 nPolyCount;
+/*N*/ rIStream >> nPolyCount;
+/*N*/
+/*N*/ BOOL bTruncated = FALSE;
+/*N*/ // Gesamtanzahl der Punkte mitzaehlen
+/*N*/ ULONG nAllPointCount = 0;
+/*N*/
+/*N*/ if ( rPolyPoly3D.pImpPolyPolygon3D->nRefCount > 1 )
+/*?*/ rPolyPoly3D.pImpPolyPolygon3D->nRefCount--;
+/*N*/ else
+/*N*/ delete rPolyPoly3D.pImpPolyPolygon3D;
+/*N*/
+/*N*/ rPolyPoly3D.pImpPolyPolygon3D = new ImpPolyPolygon3D(nPolyCount);
+/*N*/
+/*N*/ while ( nPolyCount > 0 )
+/*N*/ {
+/*N*/ pPoly3D = new Polygon3D;
+/*N*/ rIStream >> *pPoly3D;
+/*N*/ nAllPointCount += pPoly3D->GetPointCount();
+/*N*/
+/*N*/ if ( !bTruncated )
+/*N*/ {
+/*N*/ if ( nAllPointCount > POLY3D_MAXPOINTS )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, LIST_APPEND);
+/*N*/ }
+/*N*/ else
+/*?*/ delete pPoly3D;
+/*N*/
+/*N*/ nPolyCount--;
+/*N*/ }
+/*N*/
+/*N*/ return rIStream;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator<<(SvStream& rOStream, const PolyPolygon3D& rPolyPoly3D)
+/*N*/ {
+/*N*/ DBG_CHKOBJ(&rPolyPoly3D, PolyPolygon3D, NULL);
+/*N*/
+/*N*/ // Anzahl der Polygone rausschreiben
+/*N*/ rOStream << rPolyPoly3D.Count();
+/*N*/
+/*N*/ // Die einzelnen Polygone ausgeben
+/*N*/ Polygon3D* pPoly3D = rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.First();
+/*N*/
+/*N*/ while( pPoly3D )
+/*N*/ {
+/*N*/ rOStream << *pPoly3D;
+/*N*/ pPoly3D = rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.Next();
+/*N*/ }
+/*N*/
+/*N*/ return rOStream;
+/*N*/ }
+
+/*N*/ Vector3D PolyPolygon3D::GetNormal() const
+/*N*/ {
+/*N*/ if(pImpPolyPolygon3D->aPoly3DList.Count())
+/*N*/ return (*this)[0].GetNormal();
+/*N*/ return Vector3D(0.0, 0.0, -1.0);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* die Umlaufrichtung des ersten Polygons umkehren
+|*
+\************************************************************************/
+
+/*N*/ void PolyPolygon3D::FlipDirections()
+/*N*/ {
+/*N*/ CheckReference();
+/*N*/ UINT16 nCnt = Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->FlipDirection();
+/*N*/ }
+
+/*N*/ Vector3D PolyPolygon3D::GetMiddle() const
+/*N*/ {
+/*N*/ if(pImpPolyPolygon3D->aPoly3DList.Count())
+/*N*/ return (*this)[0].GetMiddle();
+/*N*/ return Vector3D();
+/*N*/ }
+
+/*N*/ BOOL PolyPolygon3D::IsClosed() const
+/*N*/ {
+/*N*/ BOOL bClosed = TRUE;
+/*N*/ UINT16 nCnt = Count();
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ if(!pImpPolyPolygon3D->aPoly3DList.GetObject(i)->IsClosed())
+/*N*/ bClosed = FALSE;
+/*N*/ return bClosed;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* export PolyPolygon
+|*
+\************************************************************************/
+
+/*N*/ PolyPolygon PolyPolygon3D::GetPolyPolygon() const
+/*N*/ {
+/*N*/ PolyPolygon aPolyPolygon;
+/*N*/ UINT16 nCnt = Count();
+/*N*/
+/*N*/ for(UINT16 i=0; i<nCnt;i++)
+/*N*/ aPolyPolygon.Insert((*this)[i].GetPolygon());
+/*N*/
+/*N*/ return(aPolyPolygon);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ausdehnung ermitteln
+|*
+\************************************************************************/
+
+/*N*/ Volume3D PolyPolygon3D::GetPolySize() const
+/*N*/ {
+/*N*/ UINT16 nCnt = Count();
+/*N*/ Volume3D aRetval;
+/*N*/ Volume3D aSubVolume;
+/*N*/
+/*N*/ aRetval.Reset();
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ {
+/*N*/ aSubVolume = (*this)[i].GetPolySize();
+/*N*/ aRetval.Union(aSubVolume);
+/*N*/ }
+/*N*/
+/*N*/ return aRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Flaeche des Polygons ermitteln
+|*
+\************************************************************************/
+
+/*N*/ double PolyPolygon3D::GetPolyArea() const
+/*N*/ {
+/*N*/ UINT16 nCnt = Count();
+/*N*/ double fRetval = 0.0;
+/*N*/
+/*N*/ // Einzelflaechen aufsummieren
+/*N*/ Vector3D aNormal = GetNormal();
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ {
+/*N*/ if((*this)[i].IsClockwise(aNormal))
+/*N*/ {
+/*N*/ fRetval += (*this)[i].GetPolyArea(aNormal);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ fRetval -= (*this)[i].GetPolyArea(aNormal);
+/*N*/ }
+/*N*/ }
+/*N*/ return fabs(fRetval);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Laenge des Polygons ermitteln
+|*
+\************************************************************************/
+
+/*N*/ double PolyPolygon3D::GetLength() const
+/*N*/ {
+/*N*/ UINT16 nCnt = Count();
+/*N*/ double fRetval = 0.0;
+/*N*/
+/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
+/*N*/ fRetval += (*this)[i].GetLength();
+/*N*/
+/*N*/ return fRetval;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_polygn3d.cxx b/binfilter/bf_svx/source/engine3d/svx_polygn3d.cxx
new file mode 100644
index 000000000000..a4333abec08f
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_polygn3d.cxx
@@ -0,0 +1,426 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "polygn3d.hxx"
+
+
+#include "globl3d.hxx"
+
+
+#include "e3dcmpt.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dPolygonObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolygonObj::E3dPolygonObj(
+/*N*/ E3dDefaultAttributes& rDefault,
+/*N*/ const PolyPolygon3D& rPolyPoly3D,
+/*N*/ BOOL bLinOnly)
+/*N*/ : E3dCompoundObject(rDefault),
+/*N*/ bLineOnly(bLinOnly)
+/*N*/ {
+/*N*/ // Geometrie setzen
+/*N*/ SetPolyPolygon3D(rPolyPoly3D);
+/*N*/
+/*N*/ // Default-Normals erzeugen
+/*N*/ CreateDefaultNormals();
+/*N*/
+/*N*/ // Default-Texturkoordinaten erzeugen
+/*N*/ CreateDefaultTexture();
+/*N*/
+/*N*/ // Geometrie erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*?*/ E3dPolygonObj::E3dPolygonObj(
+/*?*/ E3dDefaultAttributes& rDefault,
+/*?*/ const PolyPolygon3D& rPolyPoly3D,
+/*?*/ const PolyPolygon3D& rPolyNormals3D,
+/*?*/ BOOL bLinOnly)
+/*?*/ : E3dCompoundObject(rDefault),
+/*?*/ bLineOnly(bLinOnly)
+/*?*/ {
+/*?*/ // Geometrie und Normalen setzen
+/*?*/ SetPolyPolygon3D(rPolyPoly3D);
+/*?*/ SetPolyNormals3D(rPolyNormals3D);
+/*?*/
+/*?*/ // Default-Texturkoordinaten erzeugen
+/*?*/ CreateDefaultTexture();
+/*?*/
+/*?*/ // Geometrie erzeugen
+/*?*/ CreateGeometry();
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Linien-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolygonObj::E3dPolygonObj(
+/*N*/ E3dDefaultAttributes& rDefault,
+/*N*/ const Vector3D& rP1, const Vector3D& rP2,
+/*N*/ BOOL bLinOnly)
+/*N*/ : E3dCompoundObject(rDefault),
+/*N*/ aPolyPoly3D(1),
+/*N*/ bLineOnly(bLinOnly)
+/*N*/ {
+/*N*/ Polygon3D aPoly3D(2);
+/*N*/ aPoly3D[0] = rP1;
+/*N*/ aPoly3D[1] = rP2;
+/*N*/ aPolyPoly3D.Insert(aPoly3D);
+/*N*/
+/*N*/ // Geometrie erzeugen
+/*N*/ CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolygonObj::E3dPolygonObj()
+/*N*/ : E3dCompoundObject()
+/*N*/ {
+/*N*/ // Keine Geometrie erzeugen
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Default-Normalen erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::CreateDefaultNormals()
+/*N*/ {
+/*N*/ PolyPolygon3D aPolyNormals(aPolyPoly3D.Count());
+/*N*/
+/*N*/ // Komplettes PolyPolygon mit den Ebenennormalen anlegen
+/*N*/ for(UINT16 a=0;a<aPolyPoly3D.Count();a++)
+/*N*/ {
+/*N*/ // Quellpolygon finden
+/*N*/ const Polygon3D& rPolygon = aPolyPoly3D[a];
+/*N*/
+/*N*/ // Neues Polygon fuer Normalen anlegen
+/*N*/ Polygon3D aNormals(rPolygon.GetPointCount());
+/*N*/
+/*N*/ // Normale holen (und umdrehen)
+/*N*/ Vector3D aNormal = -rPolygon.GetNormal();
+/*N*/
+/*N*/ // Neues Polygon fuellen
+/*N*/ for(UINT16 b=0;b<rPolygon.GetPointCount();b++)
+/*N*/ aNormals[b] = aNormal;
+/*N*/
+/*N*/ // Neues Polygon in PolyPolygon einfuegen
+/*N*/ aPolyNormals.Insert(aNormals);
+/*N*/ }
+/*N*/
+/*N*/ // Default-Normalen setzen
+/*N*/ SetPolyNormals3D(aPolyNormals);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Default-Texturkoordinaten erzeugen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::CreateDefaultTexture()
+/*N*/ {
+/*N*/ PolyPolygon3D aPolyTexture(aPolyPoly3D.Count());
+/*N*/
+/*N*/ // Komplettes PolyPolygon mit den Texturkoordinaten anlegen
+/*N*/ // Die Texturkoordinaten erstrecken sich ueber X,Y und Z
+/*N*/ // ueber die gesamten Extremwerte im Bereich 0.0 .. 1.0
+/*N*/ for(UINT16 a=0;a<aPolyPoly3D.Count();a++)
+/*N*/ {
+/*N*/ // Quellpolygon finden
+/*N*/ const Polygon3D& rPolygon = aPolyPoly3D[a];
+/*N*/
+/*N*/ // Gesamtgroesse des Objektes feststellen
+/*N*/ Volume3D aVolume = rPolygon.GetPolySize();
+/*N*/
+/*N*/ // Neues Polygon fuer Texturkoordinaten anlegen
+/*N*/ Polygon3D aTexture(rPolygon.GetPointCount());
+/*N*/
+/*N*/ // Normale holen
+/*N*/ Vector3D aNormal = rPolygon.GetNormal();
+/*N*/ aNormal.Abs();
+/*N*/
+/*N*/ // Entscheiden, welche Koordinaten als Source fuer das
+/*N*/ // Mapping benutzt werden sollen
+/*N*/ UINT16 nSourceMode = 0;
+/*N*/
+/*N*/ // Groessten Freiheitsgrad ermitteln
+/*N*/ if(!(aNormal.X() > aNormal.Y() && aNormal.X() > aNormal.Z()))
+/*N*/ {
+/*N*/ if(aNormal.Y() > aNormal.Z())
+/*N*/ {
+/*N*/ // Y ist am groessten, benutze X,Z als mapping
+/*N*/ nSourceMode = 1;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Z ist am groessten, benutze X,Y als mapping
+/*N*/ nSourceMode = 2;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Neues Polygon fuellen
+/*N*/ for(UINT16 b=0;b<rPolygon.GetPointCount();b++)
+/*N*/ {
+/*N*/ Vector3D& aTex = aTexture[b];
+/*N*/ const Vector3D& aPoly = rPolygon[b];
+/*N*/
+/*N*/ switch(nSourceMode)
+/*N*/ {
+/*N*/ case 0: // Quelle ist Y,Z
+/*N*/ if(aVolume.GetHeight())
+/*N*/ aTex.X() = (aPoly.Y() - aVolume.MinVec().Y()) / aVolume.GetHeight();
+/*N*/ else
+/*N*/ aTex.X() = 0.0;
+/*N*/
+/*N*/ if(aVolume.GetDepth())
+/*N*/ aTex.Y() = (aPoly.Z() - aVolume.MinVec().Z()) / aVolume.GetDepth();
+/*N*/ else
+/*N*/ aTex.Y() = 0.0;
+/*N*/ break;
+/*N*/
+/*N*/ case 1: // Quelle ist X,Z
+/*N*/ if(aVolume.GetWidth())
+/*N*/ aTex.X() = (aPoly.X() - aVolume.MinVec().X()) / aVolume.GetWidth();
+/*N*/ else
+/*N*/ aTex.X() = 0.0;
+/*N*/
+/*N*/ if(aVolume.GetDepth())
+/*N*/ aTex.Y() = (aPoly.Z() - aVolume.MinVec().Z()) / aVolume.GetDepth();
+/*N*/ else
+/*N*/ aTex.Y() = 0.0;
+/*N*/ break;
+/*N*/
+/*N*/ case 2: // Quelle ist X,Y
+/*N*/ if(aVolume.GetWidth())
+/*N*/ aTex.X() = (aPoly.X() - aVolume.MinVec().X()) / aVolume.GetWidth();
+/*N*/ else
+/*N*/ aTex.X() = 0.0;
+/*N*/
+/*N*/ if(aVolume.GetHeight())
+/*N*/ aTex.Y() = (aPoly.Y() - aVolume.MinVec().Y()) / aVolume.GetHeight();
+/*N*/ else
+/*N*/ aTex.Y() = 0.0;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Neues Polygon in PolyPolygon einfuegen
+/*N*/ aPolyTexture.Insert(aTexture);
+/*N*/ }
+/*N*/
+/*N*/ // Default-Texturkoordinaten setzen
+/*N*/ SetPolyTexture3D(aPolyTexture);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolygonObj::~E3dPolygonObj()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dPolygonObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_POLYGONOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wireframe erzeugen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Polygon setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::SetPolyPolygon3D(const PolyPolygon3D& rNewPolyPoly3D)
+/*N*/ {
+/*N*/ if ( aPolyPoly3D != rNewPolyPoly3D )
+/*N*/ {
+/*N*/ // Neues PolyPolygon; kopieren
+/*N*/ aPolyPoly3D = rNewPolyPoly3D;
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dPolygonObj::SetPolyNormals3D(const PolyPolygon3D& rNewPolyNormals3D)
+/*N*/ {
+/*N*/ if ( aPolyNormals3D != rNewPolyNormals3D )
+/*N*/ {
+/*N*/ // Neue Normalen; kopieren
+/*N*/ aPolyNormals3D = rNewPolyNormals3D;
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dPolygonObj::SetPolyTexture3D(const PolyPolygon3D& rNewPolyTexture3D)
+/*N*/ {
+/*N*/ if ( aPolyTexture3D != rNewPolyTexture3D )
+/*N*/ {
+/*N*/ // Neue Texturkoordinaten; kopieren
+/*N*/ aPolyTexture3D = rNewPolyTexture3D;
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ bGeometryValid = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Alte Geometrie erzeugen, um die E3dPolyObj's zu haben
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry(TRUE);
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::WriteData(rOut);
+/*N*/
+/*N*/ E3dIOCompat aCompat(rOut, STREAM_WRITE, 1);
+/*N*/ rOut << BOOL(bLineOnly);
+/*N*/
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Geometrie neu erzeugen, um E3dPolyObj's wieder loszuwerden
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ if(AreBytesLeft())
+/*N*/ {
+/*N*/ E3dIOCompat aIoCompat(rIn, STREAM_READ);
+/*N*/ if(aIoCompat.GetVersion() >= 1)
+/*N*/ {
+/*N*/ rIn >> bLineOnly;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Geometrie neu erzeugen, mit oder ohne E3dPolyObj's
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* LineOnly setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolygonObj::SetLineOnly(BOOL bNew)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_polyob3d.cxx b/binfilter/bf_svx/source/engine3d/svx_polyob3d.cxx
new file mode 100644
index 000000000000..32581bcf4886
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_polyob3d.cxx
@@ -0,0 +1,666 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#include "svdstr.hrc"
+
+#ifndef _INC_FLOAT
+#include <float.h>
+#endif
+
+#include "svdopath.hxx"
+
+
+
+
+
+#include "svdio.hxx"
+
+
+// FG: wegen der DEBUG-Ausgabe in Dateien (temporaer)
+#ifndef _INC_STDIO
+#include <stdio.h>
+#endif
+
+#include "globl3d.hxx"
+
+#include "polyob3d.hxx"
+
+#include "polysc3d.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dPolyObj, E3dObject);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolyObj::E3dPolyObj(const PolyPolygon3D& rPolyPoly3D, FASTBOOL bDblSided,
+/*N*/ FASTBOOL bLight) :
+/*N*/ bDoubleSided(bDblSided),
+/*N*/ bBackSideVisible(FALSE),
+/*N*/ bLighted(bLight),
+/*N*/ bOwnAttrs (FALSE),
+/*N*/ bOwnStyle (FALSE),
+/*N*/ nObjectnumber (-1) // FG: 0 waere eine gueltige Objektnummer, naemlich die erste!
+/*N*/ {
+/*N*/ SetPolyPolygon3D(rPolyPoly3D);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*?*/ E3dPolyObj::E3dPolyObj(const PolyPolygon3D& rPolyPoly3D,
+/*?*/ const PolyPolygon3D& rPolyNormals3D, FASTBOOL bDblSided,
+/*?*/ FASTBOOL bLight) :
+/*?*/ bDoubleSided(bDblSided),
+/*?*/ bBackSideVisible(FALSE),
+/*?*/ bLighted(bLight),
+/*?*/ bOwnAttrs (FALSE),
+/*?*/ bOwnStyle (FALSE),
+/*?*/ nObjectnumber (-1) // FG: 0 waere eine gueltige Objektnummer, naemlich die erste!
+/*?*/ {
+/*?*/ SetPolyPolygon3D(rPolyPoly3D);
+/*?*/ SetPolyNormals3D(rPolyNormals3D);
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolyObj::E3dPolyObj(const PolyPolygon3D& rPolyPoly3D,
+/*N*/ const PolyPolygon3D& rPolyNormals3D,
+/*N*/ const PolyPolygon3D& rPolyTexture3D,
+/*N*/ FASTBOOL bDblSided,
+/*N*/ FASTBOOL bLight) :
+/*N*/ bDoubleSided(bDblSided),
+/*N*/ bBackSideVisible(FALSE),
+/*N*/ bLighted(bLight),
+/*N*/ bOwnAttrs (FALSE),
+/*N*/ bOwnStyle (FALSE),
+/*N*/ nObjectnumber (-1) // FG: 0 waere eine gueltige Objektnummer, naemlich die erste!
+/*N*/ {
+/*N*/ SetPolyPolygon3D(rPolyPoly3D);
+/*N*/ SetPolyNormals3D(rPolyNormals3D);
+/*N*/ SetPolyTexture3D(rPolyTexture3D);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Linien-Konstruktor
+|*
+\************************************************************************/
+
+/*?*/ E3dPolyObj::E3dPolyObj(const Vector3D& rP1, const Vector3D& rP2) :
+/*?*/ aPolyPoly3D(1),
+/*?*/ bDoubleSided(TRUE),
+/*?*/ bBackSideVisible(FALSE),
+/*?*/ bLighted(FALSE),
+/*?*/ bOwnAttrs (FALSE),
+/*?*/ bOwnStyle (FALSE),
+/*?*/ nObjectnumber (-1) // FG: 0 waere eine gueltige Objektnummer, naemlich die erste!
+/*?*/ {
+/*?*/ Polygon3D aPoly3D(2);
+/*?*/ aPoly3D[0] = rP1;
+/*?*/ aPoly3D[1] = rP2;
+/*?*/ aPolyPoly3D.Insert(aPoly3D);
+/*?*/ aLocalBoundVol.Union(rP1);
+/*?*/ aLocalBoundVol.Union(rP2);
+/*?*/ RecalcBoundVolume();
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolyObj::E3dPolyObj() :
+/*N*/ bDoubleSided(FALSE),
+/*N*/ bBackSideVisible(FALSE),
+/*N*/ bLighted(FALSE),
+/*N*/ bOwnAttrs (FALSE),
+/*N*/ bOwnStyle (FALSE),
+/*N*/ nObjectnumber (-1) // FG: 0 waere eine gueltige Objektnummer, naemlich die erste!
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dPolyObj::~E3dPolyObj()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dPolyObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_POLYOBJ_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Polygon setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::SetPolyPolygon3D(const PolyPolygon3D& rNewPolyPoly3D)
+/*N*/ {
+/*N*/ if ( aPolyPoly3D != rNewPolyPoly3D )
+/*N*/ {
+/*N*/ // Neues PolyPolygon; kopieren
+/*N*/ aPolyPoly3D = rNewPolyPoly3D;
+/*N*/
+/*N*/ // Normale berechnen und BoundVol fuellen
+/*N*/ aLocalBoundVol = Volume3D();
+/*N*/ aNormal = aPolyPoly3D.GetNormal();
+/*N*/
+/*N*/ // Teilpolygone einbeziehen
+/*N*/ for ( USHORT nPoly = 0; nPoly < aPolyPoly3D.Count(); nPoly++ )
+/*N*/ for ( USHORT i = 0; i < aPolyPoly3D[nPoly].GetPointCount(); i++ )
+/*N*/ aLocalBoundVol.Union(aPolyPoly3D[nPoly][i]);
+/*N*/
+/*N*/ bBoundVolValid = FALSE;
+/*N*/ StructureChanged(this);
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dPolyObj::SetPolyNormals3D(const PolyPolygon3D& rNewPolyNormals3D)
+/*N*/ {
+/*N*/ if ( aPolyNormals3D != rNewPolyNormals3D )
+/*N*/ {
+/*N*/ // Neue Normalen; kopieren
+/*N*/ aPolyNormals3D = rNewPolyNormals3D;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dPolyObj::SetPolyTexture3D(const PolyPolygon3D& rNewPolyTexture3D)
+/*N*/ {
+/*N*/ if ( aPolyTexture3D != rNewPolyTexture3D )
+/*N*/ {
+/*N*/ // Neue Texturkoordinaten; kopieren
+/*N*/ aPolyTexture3D = rNewPolyTexture3D;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get BoundRect of Object
+|*
+\************************************************************************/
+
+/*N*/ const Rectangle& E3dPolyObj::GetBoundRect() const
+/*N*/ {
+/*N*/ return E3dObject::GetBoundRect();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::WriteData31(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ E3dObject::WriteData(rOut);
+/*N*/
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPolyObj");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aPolyPoly3D;
+/*N*/ rOut << aNormal;
+/*N*/ rOut << BOOL(bDoubleSided);
+/*N*/ rOut << BOOL(bBackSideVisible);
+/*N*/ rOut << BOOL(bLighted);
+/*N*/
+/*N*/ rOut << (UINT32) bOwnAttrs;
+/*N*/ rOut << (UINT32) bOwnStyle;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern: zur 356 wurde das Fileformat freigegeben 11.2.1997 FG
+|*
+/*************************************************************************/
+
+/*N*/ void E3dPolyObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ if (rOut.GetVersion() < 3560) // FG: Zu dieser Version erfolgte die Umstellung
+/*N*/ {
+/*N*/ WriteData31(rOut);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPolyObj");
+/*N*/ #endif
+/*N*/ {
+/*N*/ SdrDownCompat aCompat (rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("PolyPolygon3D");
+/*N*/ #endif
+/*N*/ rOut << aPolyPoly3D;
+/*N*/ }
+/*N*/ {
+/*N*/ SdrDownCompat aCompat (rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("PolyPolygon3D");
+/*N*/ #endif
+/*N*/ rOut << aNormal;
+/*N*/ }
+/*N*/ rOut << BOOL(bDoubleSided);
+/*N*/ rOut << BOOL(bBackSideVisible);
+/*N*/ rOut << BOOL(bLighted);
+/*N*/
+/*N*/ rOut << (UINT32) bOwnAttrs;
+/*N*/ rOut << (UINT32) bOwnStyle;
+/*N*/ rOut << (UINT32) nObjectnumber;
+/*N*/ // Falls das Objekt eigene Attribute hat, wird es rausgeschrieben
+/*N*/
+/*N*/ if (OwnAttrs() || OwnStyle())
+/*N*/ {
+/*N*/ E3dObject::WriteData(rOut);
+/*N*/ }
+/*N*/
+/*N*/ // Neue PolyPolygone schreiben fuer Normalen und Textur
+/*N*/ if(aPolyNormals3D.Count())
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("PolyPolygon3D Normals");
+/*N*/ #endif
+/*N*/ rOut << aPolyNormals3D;
+/*N*/ }
+/*N*/ if(aPolyTexture3D.Count())
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("PolyPolygon3D Texturkoordinaten");
+/*N*/ #endif
+/*N*/ rOut << aPolyTexture3D;
+/*N*/ }
+/*N*/ }
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::ReadData31(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dObject::ReadData(rHead, rIn);
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPolyObj");
+/*N*/ #endif
+/*N*/
+/*N*/ BOOL bTmp;
+/*N*/ UINT32 nTmp;
+/*N*/
+/*N*/ // wieviele Bytes werden fuer das Polygon gelesen ?
+/*N*/ long nFilePositionBefore = rIn.Tell ();
+/*N*/ rIn >> aPolyPoly3D;
+/*N*/ long nFilePositionAfter = rIn.Tell ();
+/*N*/
+/*N*/ // wenn anschliessend noch mehr Member gestreamt werden, so muss (!!!!) die
+/*N*/ // folgende Anzahl der Bytes angepasst werden, ansonsten geht das Lesen wieder
+/*N*/ // daneben !
+/*N*/ // Diese Werte werden weiter unten eingelesen.
+/*N*/ long nBytesToRead = sizeof (aNormal) + sizeof (bTmp) * 3 + sizeof (nTmp) * 2;
+/*N*/
+/*N*/ // wieviele Bytes wuerden denn nun gelesen werden ?
+/*N*/ // es kommen noch 4 Bytes hinzu, die vom SdrDownCompat fuer die Laenge belegt werden
+/*N*/ long nWouldRead = nFilePositionAfter - nFilePositionBefore + nBytesToRead + 4;
+/*N*/
+/*N*/ // und um wieviele liegen wir daneben ?
+/*N*/ long nBytesWrong = nWouldRead - aCompat.GetSubRecordSize();
+/*N*/
+/*N*/ // hoffentlich alles ok, sonst korrigiere die Fileposition
+/*N*/ if (nBytesWrong)
+/*N*/ {
+/*N*/ rIn.Seek (nFilePositionAfter - nBytesWrong);
+/*N*/ }
+/*N*/
+/*N*/ // so, jetzt kann der Rest unbeschadet gelesen werden.
+/*N*/ // aus den hier gelesenen Werten muss die Groesse nBytesToRead bestimmt werden.
+/*N*/ rIn >> aNormal;
+/*N*/ rIn >> bTmp; bDoubleSided = bTmp;
+/*N*/ rIn >> bTmp; bBackSideVisible = bTmp;
+/*N*/ rIn >> bTmp; bLighted = bTmp;
+/*N*/
+/*N*/ // Temporaer: Anzahl der Dreiecke aus der Triangulation
+/*N*/ rIn >> nTmp; bOwnAttrs = (BOOL) nTmp;
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft () == sizeof (UINT32)) rIn >> nTmp; bOwnStyle = (BOOL) nTmp;
+/*N*/
+/*N*/ SetPolyPolygon3D(aPolyPoly3D);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if ( rIn.GetError() != SVSTREAM_OK )
+/*N*/ return;
+/*N*/
+/*N*/ if ((rHead.GetVersion() < 13) || (rIn.GetVersion() < 3560))
+/*N*/ {
+/*N*/ ReadData31(rHead, rIn);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bTmp;
+/*N*/ UINT32 nTmp;
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dPolyObj");
+/*N*/ #endif
+/*N*/
+/*N*/ {
+/*N*/ SdrDownCompat aCompatPolyPolygon (rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompatPolyPolygon.SetID("PolyPolygon3D");
+/*N*/ #endif
+/*N*/ rIn >> aPolyPoly3D;
+/*N*/ }
+/*N*/ {
+/*N*/ SdrDownCompat aCompatPolyPolygon (rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompatPolyPolygon.SetID("PolyPolygon3D");
+/*N*/ #endif
+/*N*/ rIn >> aNormal;
+/*N*/ }
+/*N*/
+/*N*/ rIn >> bTmp; bDoubleSided = bTmp;
+/*N*/ rIn >> bTmp; bBackSideVisible = bTmp;
+/*N*/ rIn >> bTmp; bLighted = bTmp;
+/*N*/
+/*N*/ // Temporaer: Anzahl der Dreiecke aus der Triangulation
+/*N*/ rIn >> nTmp; bOwnAttrs = (BOOL) nTmp;
+/*N*/ rIn >> nTmp; bOwnStyle = (BOOL) nTmp;
+/*N*/ rIn >> nObjectnumber;
+/*N*/
+/*N*/ // Nur falls das Objekt eigene Attribute oder einen eigenen
+/*N*/ // Stil besitzt wird es gelesen.
+/*N*/
+/*N*/ if (OwnAttrs() || OwnStyle())
+/*N*/ {
+/*N*/ E3dObject::ReadData(rHead, rIn);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // FG: Achtung fuer jedes 3d-Objekt muss eine Subliste existieren, auch wenn
+/*N*/ // sie keinen Eintrag hat, viele Programmstellen (GetBoundRect) fragen nicht
+/*N*/ // ab ob dieser Pointer NULL ist.
+/*N*/ pSub = new E3dObjList(NULL, NULL);
+/*N*/ pSub->SetOwnerObj(this);
+/*N*/ pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+/*N*/ }
+/*N*/
+/*N*/ if(aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Normalen lesen
+/*N*/ rIn >> aPolyNormals3D;
+/*N*/ SetPolyNormals3D(aPolyNormals3D);
+/*N*/ }
+/*N*/
+/*N*/ if(aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Texturen lesen
+/*N*/ rIn >> aPolyTexture3D;
+/*N*/ SetPolyTexture3D(aPolyTexture3D);
+/*N*/ }
+/*N*/
+/*N*/ SetPolyPolygon3D(aPolyPoly3D);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Wireframe erzeugen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Polygon.
+|* Es ist nur ein Displayobjekt vorhanden, welches ein (!) Polygon darstellt
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* erstelle neues GeoData-Objekt
+|*
+\************************************************************************/
+
+/*N*/ SdrObjGeoData *E3dPolyObj::NewGeoData() const
+/*N*/ {
+/*N*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*N*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*N*/
+/*N*/ if (GetParentObj()->ISA (E3dObject))
+/*N*/ return GetParentObj()->E3dObject::NewGeoData ();
+/*N*/ else
+/*N*/ return E3dObject::NewGeoData ();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* uebergebe aktuelle werte an das GeoData-Objekt
+|*
+\************************************************************************/
+
+/*?*/ void E3dPolyObj::SaveGeoData(SdrObjGeoData& rGeo) const
+/*?*/ {
+/*?*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*?*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*?*/
+/*?*/ if (GetParentObj()->ISA (E3dObject))
+/*?*/ GetParentObj()->E3dObject::SaveGeoData (rGeo);
+/*?*/ else
+/*?*/ E3dObject::SaveGeoData (rGeo);
+/*?*/ }
+
+/*************************************************************************
+|*
+|* uebernehme werte aus dem GeoData-Objekt
+|*
+\************************************************************************/
+
+/*?*/ void E3dPolyObj::RestGeoData(const SdrObjGeoData& rGeo)
+/*?*/ {
+/*?*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*?*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*?*/
+/*?*/ if (GetParentObj()->ISA (E3dObject))
+/*?*/ GetParentObj()->E3dObject::RestGeoData (rGeo);
+/*?*/ else
+/*?*/ E3dObject::RestGeoData (rGeo);
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Page neu setzen. Normalerweise geht die Page an das Oberobjekt, wenn
+|* dieses Objekt von einer Factory erzeugt wurde, existiert noch kein
+|* Parent, also wird die Page selbst gesetzt.
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::SetPage(SdrPage* pNewPage)
+/*N*/ {
+/*N*/ if (GetParentObj())
+/*N*/ {
+/*N*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*N*/
+/*N*/ if (GetParentObj()->ISA (E3dObject))
+/*N*/ GetParentObj()->E3dObject::SetPage (pNewPage);
+/*N*/ SdrAttrObj::SetPage(pNewPage);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pPage = pNewPage;
+/*N*/ if (pPage)
+/*N*/ pModel = pPage->GetModel ();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::SetModel(SdrModel* pNewModel)
+/*N*/ {
+/*N*/ SdrAttrObj::SetModel(pNewModel);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Layer abfragen. Da alle Unterobjekte auf demselben Layer liegen
+|* gibt es keinerlei Probleme
+|*
+\************************************************************************/
+
+/*?*/ SdrLayerID E3dPolyObj::GetLayer() const
+/*?*/ {
+/*?*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*?*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*?*/
+/*?*/ if (GetParentObj()->ISA (E3dObject))
+/*?*/ return GetParentObj()->E3dObject::GetLayer ();
+/*?*/ else
+/*?*/ return SdrLayerID(nLayerID);
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dPolyObj::NbcSetLayer(SdrLayerID nLayer)
+/*N*/ {
+/*N*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*N*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*N*/
+/*N*/ if (GetParentObj()->ISA (E3dObject))
+/*N*/ GetParentObj()->SdrAttrObj::NbcSetLayer (nLayer);
+/*N*/ SdrAttrObj::NbcSetLayer(nLayer);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* StyleSheet abfragen
+|*
+\************************************************************************/
+
+/*N*/ SfxStyleSheet* E3dPolyObj::GetStyleSheet() const
+/*N*/ {
+/*N*/ DBG_ASSERT(GetParentObj(), "3D-Polygone ohne Parent ?");
+/*N*/ DBG_ASSERT(GetParentObj()->ISA(E3dScene) || GetParentObj()->ISA(E3dObject), "Parent eines 3D-Polygons ungültig");
+/*N*/
+/*N*/ if (bOwnStyle)
+/*N*/ return SdrAttrObj::GetStyleSheet();
+/*N*/ else
+/*N*/ return GetParentObj()->E3dObject::GetStyleSheet ();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* StyleSheet setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Bestimme die Anzahl der Punkte
+|*
+\************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_polysc3d.cxx b/binfilter/bf_svx/source/engine3d/svx_polysc3d.cxx
new file mode 100644
index 000000000000..c36e2d1aa8ff
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_polysc3d.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "xdef.hxx"
+
+
+
+
+
+
+
+
+
+
+
+
+#include "globl3d.hxx"
+
+#include "polysc3d.hxx"
+
+
+
+
+
+
+
+
+namespace binfilter {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/*N*/ TYPEINIT1(E3dPolyScene, E3dScene);
+
+/*N*/ E3dPolyScene::E3dPolyScene()
+/*N*/ : E3dScene()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dPolyScene::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return E3D_POLYSCENE_ID;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Die Kontur fuer TextToContour
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Objekt als Kontur in das Polygon einfuegen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Paint
+|*
+\************************************************************************/
+
+/*N*/ FASTBOOL E3dPolyScene::Paint(ExtOutputDevice& rOut,
+/*N*/ const SdrPaintInfoRec& rInfoRec) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* Geometrie zeichnen mit clipping Beruecksichtigung
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Zeichenroutine fuer 3D
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Schatten aller Objekte zeichnen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Verminderte Darstellungsqualitaet, zeichne als WireFrame OHNE renderer
+|*
+\************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_scene3d.cxx b/binfilter/bf_svx/source/engine3d/svx_scene3d.cxx
new file mode 100644
index 000000000000..6bb2090c2ef6
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_scene3d.cxx
@@ -0,0 +1,1447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define ITEMID_COLOR SID_ATTR_3D_LIGHTCOLOR
+
+#include "svdstr.hrc"
+
+#include "svditer.hxx"
+
+#include "svdio.hxx"
+
+#if defined( UNX ) || defined( ICC )
+#include <stdlib.h>
+#endif
+
+#include <bf_svtools/style.hxx>
+
+#include "plight3d.hxx"
+
+#include "dlight3d.hxx"
+
+#include "svdtrans.hxx"
+
+#include "svxids.hrc"
+
+#include <bf_svtools/whiter.hxx>
+
+#include "scene3d.hxx"
+
+namespace binfilter {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+/*N*/ TYPEINIT1(E3dScene, E3dObject);
+
+/*************************************************************************
+|*
+|* E3dScene-Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dScene::E3dScene()
+/*N*/ : E3dObject(),
+/*N*/ aCamera(Vector3D(0,0,4), Vector3D()),
+/*N*/ bDoubleBuffered(FALSE),
+/*N*/ bClipping(FALSE),
+/*N*/ nSaveStatus (0),
+/*N*/ nRestStatus (0),
+/*N*/ bFitInSnapRect(TRUE),
+/*N*/ aPaintTime(),
+/*N*/ nDisplayQuality(255),
+/*N*/ bDrawOnlySelected(FALSE)
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/ }
+
+/*N*/ void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ // Fuer OS/2 die FP-Exceptions abschalten
+/*N*/ #if defined(OS2)
+/*N*/ #define SC_FPEXCEPTIONS_ON() _control87( MCW_EM, 0 )
+/*N*/ #define SC_FPEXCEPTIONS_OFF() _control87( MCW_EM, MCW_EM )
+/*N*/ SC_FPEXCEPTIONS_OFF();
+/*N*/ #endif
+/*N*/
+/*N*/ // Fuer WIN95/NT die FP-Exceptions abschalten
+/*N*/ #if defined(WNT) || defined(WIN)
+/*N*/ #define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
+/*N*/ #define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
+/*N*/ SC_FPEXCEPTIONS_OFF();
+/*N*/ #endif
+/*N*/
+/*N*/ // Defaults setzen
+/*N*/
+/*N*/ // set defaults for LightGroup from ItemPool
+/*N*/ aLightGroup.SetModelTwoSide(GetTwoSidedLighting());
+/*N*/ aLightGroup.SetIntensity( GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0);
+/*N*/ aLightGroup.SetIntensity( GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1);
+/*N*/ aLightGroup.SetIntensity( GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2);
+/*N*/ aLightGroup.SetIntensity( GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3);
+/*N*/ aLightGroup.SetIntensity( GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4);
+/*N*/ aLightGroup.SetIntensity( GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5);
+/*N*/ aLightGroup.SetIntensity( GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6);
+/*N*/ aLightGroup.SetIntensity( GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7);
+/*N*/ aLightGroup.SetGlobalAmbientLight(GetGlobalAmbientColor());
+/*N*/ aLightGroup.Enable( GetLightOnOff1(), Base3DLight0);
+/*N*/ aLightGroup.Enable( GetLightOnOff2(), Base3DLight1);
+/*N*/ aLightGroup.Enable( GetLightOnOff3(), Base3DLight2);
+/*N*/ aLightGroup.Enable( GetLightOnOff4(), Base3DLight3);
+/*N*/ aLightGroup.Enable( GetLightOnOff5(), Base3DLight4);
+/*N*/ aLightGroup.Enable( GetLightOnOff6(), Base3DLight5);
+/*N*/ aLightGroup.Enable( GetLightOnOff7(), Base3DLight6);
+/*N*/ aLightGroup.Enable( GetLightOnOff8(), Base3DLight7);
+/*N*/ aLightGroup.SetDirection( GetLightDirection1(), Base3DLight0);
+/*N*/ aLightGroup.SetDirection( GetLightDirection2(), Base3DLight1);
+/*N*/ aLightGroup.SetDirection( GetLightDirection3(), Base3DLight2);
+/*N*/ aLightGroup.SetDirection( GetLightDirection4(), Base3DLight3);
+/*N*/ aLightGroup.SetDirection( GetLightDirection5(), Base3DLight4);
+/*N*/ aLightGroup.SetDirection( GetLightDirection6(), Base3DLight5);
+/*N*/ aLightGroup.SetDirection( GetLightDirection7(), Base3DLight6);
+/*N*/ aLightGroup.SetDirection( GetLightDirection8(), Base3DLight7);
+/*N*/
+/*N*/ bDither = rDefault.GetDefaultDither();
+/*N*/
+/*N*/ // Alte Werte initialisieren
+/*N*/ aCamera.SetViewWindow(-2, -2, 4, 4);
+/*N*/ aCameraSet.SetDeviceRectangle(-2, 2, -2, 2);
+/*N*/ aCamera.SetDeviceWindow(Rectangle(0, 0, 10, 10));
+/*N*/ Rectangle aRect(0, 0, 10, 10);
+/*N*/ aCameraSet.SetViewportRectangle(aRect);
+/*N*/ nSortingMode = E3D_SORT_FAST_SORTING | E3D_SORT_IN_PARENTS | E3D_SORT_TEST_LENGTH;
+/*N*/
+/*N*/ // set defaults for Camera from ItemPool
+/*N*/ aCamera.SetProjection(GetPerspective());
+/*N*/ Vector3D aActualPosition = aCamera.GetPosition();
+/*N*/ double fNew = GetDistance();
+/*N*/ if(fabs(fNew - aActualPosition.Z()) > 1.0)
+/*N*/ aCamera.SetPosition( Vector3D( aActualPosition.X(), aActualPosition.Y(), fNew) );
+/*N*/ fNew = GetFocalLength() / 100.0;
+/*N*/ aCamera.SetFocalLength(fNew);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dScene::~E3dScene()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SetSnapRect
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::NbcSetSnapRect(const Rectangle& rRect)
+/*N*/ {
+/*N*/ SetRectsDirty();
+/*N*/ E3dObject::NbcSetSnapRect(rRect);
+/*N*/ aCamera.SetDeviceWindow(rRect);
+/*N*/ aCameraSet.SetViewportRectangle((Rectangle&)rRect);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objekt Resizen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::NbcResize(const Point& rRef, const Fraction& rXFact,
+/*N*/ const Fraction& rYFact)
+/*N*/ {
+/*N*/ Rectangle aNewSnapRect = GetSnapRect();
+/*N*/ ResizeRect(aNewSnapRect, rRef, rXFact, rYFact);
+/*N*/ NbcSetSnapRect(aNewSnapRect);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Neue Kamera setzen, und dabei die Szene und ggf. das BoundVolume
+|* als geaendert markieren
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::SetCamera(const Camera3D& rNewCamera)
+/*N*/ {
+/*N*/ // Alte Kamera setzen
+/*N*/ aCamera = rNewCamera;
+/*N*/ ImpSetSceneItemsFromCamera();
+/*N*/ SetRectsDirty();
+/*N*/
+/*N*/ // Neue Kamera aus alter fuellen
+/*N*/ Camera3D& rCam = (Camera3D&)GetCamera();
+/*N*/
+/*N*/ // Ratio abschalten
+/*N*/ if(rCam.GetAspectMapping() == AS_NO_MAPPING)
+/*N*/ GetCameraSet().SetRatio(0.0);
+/*N*/
+/*N*/ // Abbildungsgeometrie setzen
+/*N*/ Vector3D aVRP = rCam.GetViewPoint();
+/*N*/ Vector3D aVPN = aVRP - rCam.GetVRP();
+/*N*/ Vector3D aVUV = rCam.GetVUV();
+/*N*/
+/*N*/ // #91047# use SetViewportValues() to set VRP, VPN and VUV as vectors, too.
+/*N*/ // Else these values would not be exported/imported correctly.
+/*N*/ //GetCameraSet().SetOrientation(aVRP, aVPN, aVUV);
+/*N*/ GetCameraSet().SetViewportValues(aVRP, aVPN, aVUV);
+/*N*/
+/*N*/ // Perspektive setzen
+/*N*/ GetCameraSet().SetPerspective(rCam.GetProjection() == PR_PERSPECTIVE);
+/*N*/ GetCameraSet().SetViewportRectangle((Rectangle&)rCam.GetDeviceWindow());
+/*N*/
+/*N*/ // E3dLabel-Objekte muessen neu an die Projektion angepasst werden
+/*N*/ if ( aLabelList.Count() > 0 )
+/*N*/ {
+/*N*/ SetBoundVolInvalid();
+/*N*/ SetRectsDirty();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* 3D-Objekt einfuegen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
+/*N*/ {
+/*N*/ E3dObject::NewObjectInserted(p3DObj);
+/*N*/
+/*N*/ if ( p3DObj == this )
+/*N*/ return;
+/*N*/
+/*N*/ if ( p3DObj->ISA(E3dLabelObj) )
+/*N*/ {
+/*N*/ aLabelList.Insert((E3dLabelObj*) p3DObj, LIST_APPEND);
+/*N*/ }
+/*N*/
+/*N*/ // falls Unterobjekte vorhanden sind, auch diese pruefen
+/*N*/ if ( p3DObj->IsGroupObject() )
+/*N*/ {
+/*N*/ SdrObjListIter a3DIterator(*p3DObj, IM_DEEPWITHGROUPS);
+/*N*/
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*N*/ SdrObject* pObj = a3DIterator.Next();
+/*N*/
+/*N*/ if ( pObj->ISA(E3dLabelObj) )
+/*N*/ {
+/*N*/ aLabelList.Insert((E3dLabelObj*) pObj, LIST_APPEND);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Parent ueber Aenderung eines Childs informieren
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::StructureChanged(const E3dObject* p3DObj)
+/*N*/ {
+/*N*/ E3dObject::StructureChanged(p3DObj);
+/*N*/ SetRectsDirty();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Einpassen der Projektion aller Szenenobjekte in das
+|* umschliessende Rechteck
+|*
+\************************************************************************/
+
+/*N*/ Volume3D E3dScene::FitInSnapRect()
+/*N*/ {
+/*N*/ // Alter Kram
+/*N*/ Matrix4D aFullTrans = GetFullTransform();
+/*N*/ aCamera.FitViewToVolume(GetBoundVolume(), aFullTrans);
+/*N*/
+/*N*/ // Neuer Kram
+/*N*/ // Maximas holen in Augkoordinaten zwecks Z-Werten
+/*N*/ Volume3D aNewVol;
+/*N*/ Vector3D aTfVec;
+/*N*/ Vol3DPointIterator aIter(GetBoundVolume());
+/*N*/
+/*N*/ GetCameraSet().SetObjectTrans(aFullTrans);
+/*N*/ while ( aIter.Next(aTfVec) )
+/*N*/ {
+/*N*/ aTfVec = GetCameraSet().ObjectToEyeCoor(aTfVec);
+/*N*/ aNewVol.Union(aTfVec);
+/*N*/ }
+/*N*/
+/*N*/ // ... und merken
+/*N*/ double fZMin = -aNewVol.MaxVec().Z();
+/*N*/ double fZMax = -aNewVol.MinVec().Z();
+/*N*/
+/*N*/ // Jetzt XY-Werte projizieren auf Projektionsflaeche
+/*N*/ // in Device-Koordinaten
+/*N*/ Matrix4D aWorldToDevice = GetCameraSet().GetOrientation();
+/*N*/ if(aCamera.GetProjection() == PR_PERSPECTIVE)
+/*N*/ aWorldToDevice.Frustum(-1.0, 1.0, -1.0, 1.0, fZMin, fZMax);
+/*N*/ else
+/*N*/ aWorldToDevice.Ortho(-1.0, 1.0, -1.0, 1.0, fZMin, fZMax);
+/*N*/ aNewVol.Reset();
+/*N*/ aIter.Reset();
+/*N*/ while ( aIter.Next(aTfVec) )
+/*N*/ {
+/*N*/ aTfVec = GetCameraSet().ObjectToWorldCoor(aTfVec);
+/*N*/ aTfVec *= aWorldToDevice;
+/*N*/ aNewVol.Union(aTfVec);
+/*N*/ }
+/*N*/
+/*N*/ // Labels behandeln
+/*N*/ ULONG nLabelCnt = aLabelList.Count();
+/*N*/ if ( nLabelCnt > 0 )
+/*N*/ {
+/*N*/ // Vorlaeufige Projektion bestimmen und Transformation in
+/*N*/ // ViewKoordinaten bestimmen
+/*N*/ Matrix4D aMatWorldToView = GetCameraSet().GetOrientation();
+/*N*/ if(aCamera.GetProjection() == PR_PERSPECTIVE)
+/*N*/ aMatWorldToView.Frustum(aNewVol.MinVec().X(), aNewVol.MaxVec().X(),
+/*N*/ aNewVol.MinVec().Y(), aNewVol.MaxVec().Y(), fZMin, fZMax);
+/*N*/ else
+/*N*/ aMatWorldToView.Ortho(aNewVol.MinVec().X(), aNewVol.MaxVec().X(),
+/*N*/ aNewVol.MinVec().Y(), aNewVol.MaxVec().Y(), fZMin, fZMax);
+/*N*/
+/*N*/ // Logische Abmessungen der Szene holen
+/*N*/ Rectangle aSceneRect = GetSnapRect();
+/*N*/
+/*N*/ // Matrix DeviceToView aufbauen
+/*N*/ Vector3D aTranslate, aScale;
+/*N*/
+/*N*/ aTranslate[0] = (double)aSceneRect.Left() + (aSceneRect.GetWidth() / 2.0);
+/*N*/ aTranslate[1] = (double)aSceneRect.Top() + (aSceneRect.GetHeight() / 2.0);
+/*N*/ aTranslate[2] = ZBUFFER_DEPTH_RANGE / 2.0;
+/*N*/
+/*N*/ // Skalierung
+/*N*/ aScale[0] = (aSceneRect.GetWidth() - 1) / 2.0;
+/*N*/ aScale[1] = (aSceneRect.GetHeight() - 1) / -2.0;
+/*N*/ aScale[2] = ZBUFFER_DEPTH_RANGE / 2.0;
+/*N*/
+/*N*/ aMatWorldToView.Scale(aScale);
+/*N*/ aMatWorldToView.Translate(aTranslate);
+/*N*/
+/*N*/ // Inverse Matrix ViewToDevice aufbauen
+/*N*/ Matrix4D aMatViewToWorld(aMatWorldToView);
+/*N*/ aMatViewToWorld.Invert();
+/*N*/
+/*N*/ for (ULONG i = 0; i < nLabelCnt; i++)
+/*N*/ {
+/*N*/ E3dLabelObj* p3DObj = aLabelList.GetObject(i);
+/*N*/ const SdrObject* pObj = p3DObj->Get2DLabelObj();
+/*N*/
+/*N*/ // View- Abmessungen des Labels holen
+/*N*/ const Rectangle& rObjRect = pObj->GetLogicRect();
+/*N*/
+/*N*/ // Position des Objektes in Weltkoordinaten ermitteln
+/*N*/ Matrix4D aObjTrans = p3DObj->GetFullTransform();
+/*N*/ Vector3D aObjPos = aObjTrans * p3DObj->GetPosition();
+/*N*/
+/*N*/ // View-Position des Objektes feststellen
+/*N*/ // nach ViewKoordinaten
+/*N*/ aObjPos *= aMatWorldToView;
+/*N*/
+/*N*/ // Relative Position des Labels in View-Koordinaten
+/*N*/ Vector3D aRelPosOne(pObj->GetRelativePos(), aObjPos.Z());
+/*N*/ aRelPosOne.X() += aObjPos.X();
+/*N*/ aRelPosOne.Y() += aObjPos.Y();
+/*N*/ Vector3D aRelPosTwo(aRelPosOne);
+/*N*/ aRelPosTwo.X() += rObjRect.GetWidth();
+/*N*/ aRelPosTwo.Y() += rObjRect.GetHeight();
+/*N*/
+/*N*/ // Jetzt Eckpunkte in DeviceKoordinaten bestimmen und
+/*N*/ // den Abmessungen hinzufuegen
+/*N*/ aRelPosOne *= aMatViewToWorld;
+/*N*/ aRelPosOne *= aWorldToDevice;
+/*N*/ aNewVol.Union(aRelPosOne);
+/*N*/
+/*N*/ aRelPosTwo *= aMatViewToWorld;
+/*N*/ aRelPosTwo *= aWorldToDevice;
+/*N*/ aNewVol.Union(aRelPosTwo);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Z-Werte eintragen
+/*N*/ aNewVol.MinVec().Z() = fZMin;
+/*N*/ aNewVol.MaxVec().Z() = fZMax;
+/*N*/
+/*N*/ // Rueckgabewert setzen
+/*N*/ return aNewVol;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Uebergeordnetes Szenenobjekt bestimmen
+|*
+\************************************************************************/
+
+/*N*/ E3dScene* E3dScene::GetScene() const
+/*N*/ {
+/*N*/ if(GetParentObj())
+/*N*/ return GetParentObj()->GetScene();
+/*N*/ else
+/*N*/ return (E3dScene*)this;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* TransformationSet vorbereiten
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::InitTransformationSet()
+/*N*/ {
+/*N*/ Rectangle aBound(GetSnapRect());
+/*N*/
+/*N*/ // GeometricSet reset und mit pBase3D assoziieren
+/*N*/ B3dCamera& rSet = GetCameraSet();
+/*N*/
+/*N*/ // Transformation auf Weltkoordinaten holen
+/*N*/ Matrix4D mTransform = GetFullTransform();
+/*N*/ rSet.SetObjectTrans(mTransform);
+/*N*/
+/*N*/ // 3D Ausgabe vorbereiten, Maximas holen in DeviceKoordinaten
+/*N*/ Volume3D aVolume = FitInSnapRect();
+/*N*/
+/*N*/ // Maximas fuer Abbildung verwenden
+/*N*/ rSet.SetDeviceVolume(aVolume, FALSE);
+/*N*/ rSet.SetViewportRectangle(aBound);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* sichern mit neuer Methode und zukunftskompatibilitaet
+|* Die Zahl 3560 ist die Major-Update-Nummer * 10 zu der die Umstellung
+|* erfolgte. Dies ist leider das korrekte Verhalten, die 3d-Engine hat keine
+|* eigene Versionsnummer sondern ist an die der Drawing-Engine gekoppelt.
+|* Probleme gibt es immer dann wenn einen neue Version ein altes Format
+|* schreiben soll: Hier wird von der Drawing-Engine trotzdem die neue Nummer
+|* verwendet.
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3830)
+/*N*/ {
+/*N*/ // Hier die Lichtobjekte erzeugen, um im alten Format schreiben zu koennen
+/*N*/ ((E3dScene*)(this))->CreateLightObjectsFromLightGroup();
+/*N*/ }
+/*N*/
+/*N*/ // Schreiben
+/*N*/ E3dObject::WriteData(rOut);
+/*N*/
+/*N*/ if(nVersion < 3830)
+/*N*/ {
+/*N*/ // Lichtobjekte wieder wegnehmen
+/*N*/ ((E3dScene*)(this))->RemoveLightObjects();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ #ifdef E3D_STREAMING
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("B3dLightGroup");
+/*N*/ #endif
+/*N*/ // LightGroup schreiben
+/*N*/ aLightGroup.WriteData(rOut);
+/*N*/
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ #ifdef E3D_STREAMING
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dScene");
+/*N*/ #endif
+/*N*/
+/*N*/ DBG_ASSERT (rOut.GetVersion(),"3d-Engine: Keine Version am Stream gesetzt!");
+/*N*/ if (rOut.GetVersion() < 3560) // FG: Das ist der Zeitpunkt der Umstellung
+/*N*/ {
+/*N*/ rOut << aCamera;
+/*N*/ }
+/*N*/ if (rOut.GetVersion() >= 3560)
+/*N*/ {
+/*N*/ aCamera.WriteData(rOut);
+/*N*/ }
+/*N*/
+/*N*/ rOut << BOOL(bDoubleBuffered);
+/*N*/ rOut << BOOL(bClipping);
+/*N*/ rOut << BOOL(bFitInSnapRect);
+/*N*/ rOut << nSortingMode;
+/*N*/
+/*N*/ // neu ab 377:
+/*N*/ Vector3D aPlaneDirection = GetShadowPlaneDirection();
+/*N*/ rOut << aPlaneDirection;
+/*N*/
+/*N*/ // neu ab 383:
+/*N*/ rOut << (BOOL)bDither;
+/*N*/
+/*N*/ // neu ab 384:
+/*N*/ sal_uInt16 nShadeMode = GetShadeMode();
+/*N*/ if(nShadeMode == 0)
+/*N*/ rOut << (sal_uInt16)Base3DFlat;
+/*N*/ else if(nShadeMode == 1)
+/*N*/ rOut << (sal_uInt16)Base3DPhong;
+/*N*/ else
+/*N*/ rOut << (sal_uInt16)Base3DSmooth;
+/*N*/ rOut << (BOOL)(nShadeMode > 2);
+/*N*/
+/*N*/ #endif
+/*N*/ #endif // #ifndef SVX_LIGHT
+/*N*/ }
+
+/*************************************************************************
+|*
+|* laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ E3dObject::ReadData(rHead, rIn);
+/*N*/
+/*N*/ if(CountNumberOfLights())
+/*N*/ {
+/*N*/ // An dieser Stelle die gelesenen Lampen ausmerzen
+/*N*/ // und in die neue Struktur ueberfuehren
+/*N*/ FillLightGroup();
+/*N*/ RemoveLightObjects();
+/*N*/ }
+/*N*/ long nVersion = rIn.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion >= 3830)
+/*N*/ {
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("B3dLightGroup");
+/*N*/ #endif
+/*N*/ if(aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // LightGroup lesen
+/*N*/ aLightGroup.ReadData(rIn);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dScene");
+/*N*/ #endif
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ DBG_ASSERT (rIn.GetVersion(),"3d-Engine: Keine Version am Stream gesetzt!");
+/*N*/
+/*N*/ if ((rIn.GetVersion() < 3560) || (rHead.GetVersion() <= 12))
+/*N*/ {
+/*N*/ rIn >> aCamera;
+/*N*/ }
+/*N*/ if ((rIn.GetVersion() >= 3560) && (rHead.GetVersion() >= 13))
+/*N*/ {
+/*N*/ aCamera.ReadData(rHead, rIn);
+/*N*/ }
+/*N*/
+/*N*/ // Neue Kamera aus alter fuellen
+/*N*/ Camera3D& rCam = (Camera3D&)GetCamera();
+/*N*/
+/*N*/ // Ratio abschalten
+/*N*/ if(rCam.GetAspectMapping() == AS_NO_MAPPING)
+/*N*/ GetCameraSet().SetRatio(0.0);
+/*N*/
+/*N*/ // Abbildungsgeometrie setzen
+/*N*/ Vector3D aVRP = rCam.GetViewPoint();
+/*N*/ Vector3D aVPN = aVRP - rCam.GetVRP();
+/*N*/ Vector3D aVUV = rCam.GetVUV();
+/*N*/ GetCameraSet().SetOrientation(aVRP, aVPN, aVUV);
+/*N*/
+/*N*/ // Perspektive setzen
+/*N*/ GetCameraSet().SetPerspective(rCam.GetProjection() == PR_PERSPECTIVE);
+/*N*/ GetCameraSet().SetViewportRectangle((Rectangle&)rCam.GetDeviceWindow());
+/*N*/
+/*N*/ rIn >> bTmp; bDoubleBuffered = bTmp;
+/*N*/ rIn >> bTmp; bClipping = bTmp;
+/*N*/ rIn >> bTmp; bFitInSnapRect = bTmp;
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft() >= sizeof(UINT32))
+/*N*/ {
+/*N*/ rIn >> nSortingMode;
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 377:
+/*N*/ if (aCompat.GetBytesLeft() >= sizeof(Vector3D))
+/*N*/ {
+/*N*/ Vector3D aShadowVec;
+/*N*/ rIn >> aShadowVec;
+/*N*/ SetShadowPlaneDirection(aShadowVec);
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 383:
+/*N*/ if (aCompat.GetBytesLeft() >= sizeof(BOOL))
+/*N*/ {
+/*N*/ rIn >> bTmp; bDither = bTmp;
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 384:
+/*N*/ if (aCompat.GetBytesLeft() >= sizeof(UINT16))
+/*N*/ {
+/*N*/ UINT16 nTmp;
+/*N*/ rIn >> nTmp;
+/*N*/ if(nTmp == (Base3DShadeModel)Base3DFlat)
+/*N*/ mpObjectItemSet->Put(Svx3DShadeModeItem(0));
+/*N*/ else if(nTmp == (Base3DShadeModel)Base3DPhong)
+/*N*/ mpObjectItemSet->Put(Svx3DShadeModeItem(1));
+/*N*/ else
+/*N*/ mpObjectItemSet->Put(Svx3DShadeModeItem(2));
+/*N*/ }
+/*N*/ if (aCompat.GetBytesLeft() >= sizeof(BOOL))
+/*N*/ {
+/*N*/ rIn >> bTmp;
+/*N*/ if(bTmp)
+/*N*/ mpObjectItemSet->Put(Svx3DShadeModeItem(3));
+/*N*/ }
+/*N*/
+/*N*/ // SnapRects der Objekte ungueltig
+/*N*/ SetRectsDirty();
+/*N*/
+/*N*/ // Transformationen initialisieren, damit bei RecalcSnapRect()
+/*N*/ // richtig gerechnet wird
+/*N*/ InitTransformationSet();
+/*N*/
+/*N*/ RebuildLists();
+/*N*/
+/*N*/ // set items from combined read objects like lightgroup and camera
+/*N*/ ImpSetLightItemsFromLightGroup();
+/*N*/ ImpSetSceneItemsFromCamera();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Einpassen der Objekte in umschliessendes Rechteck aus-/einschalten
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::FitSnapRectToBoundVol()
+/*N*/ {
+/*N*/ Vector3D aTfVec;
+/*N*/ Volume3D aFitVol;
+/*N*/
+/*N*/ SetBoundVolInvalid();
+/*N*/ Matrix4D aTransform = GetFullTransform() * aCamera.GetViewTransform();
+/*N*/ Vol3DPointIterator aIter(GetBoundVolume(), &aTransform);
+/*N*/ Rectangle aRect;
+/*N*/
+/*N*/ while ( aIter.Next(aTfVec) )
+/*N*/ {
+/*N*/ aCamera.DoProjection(aTfVec);
+/*N*/ aFitVol.Union(aTfVec);
+/*N*/ Vector3D aZwi = aCamera.MapToDevice(aTfVec);
+/*N*/ Point aP((long)aZwi.X(), (long)aZwi.Y());
+/*N*/ aRect.Union(Rectangle(aP, aP));
+/*N*/ }
+/*N*/ aCamera.SetViewWindow(aFitVol.MinVec().X(), aFitVol.MinVec().Y(),
+/*N*/ aFitVol.GetWidth(), aFitVol.GetHeight());
+/*N*/ SetSnapRect(aRect);
+/*N*/
+/*N*/ // Die SnapRects aller beteiligten Objekte muessen auf dieser
+/*N*/ // veraenderten Basis aufgebaut werden, invalidiere diese. Das
+/*N*/ // eigene kann auch invalidiert werden, da ein RecalcSnapRect
+/*N*/ // an einer Szene nur aus der Kamera liest
+/*N*/ SetRectsDirty();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Falls die Geometrie einer Szene sich ausgedehnt/vermindert hat,
+|* muss das Volume und das SnapRect angepasst werden
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::CorrectSceneDimensions()
+/*N*/ {
+/*N*/ // SnapRects der Objekte ungueltig
+/*N*/ SetRectsDirty();
+/*N*/
+/*N*/ // SnapRect anpassen, invalidiert auch die SnapRects
+/*N*/ // der enthaltenen Objekte
+/*N*/ FitSnapRectToBoundVol();
+/*N*/
+/*N*/ // Neues BoundVolume der Kamera holen
+/*N*/ Volume3D aVolume = FitInSnapRect();
+/*N*/
+/*N*/ // Neues BoundVolume an der Kamera setzen
+/*N*/ GetCameraSet().SetDeviceVolume(aVolume, FALSE);
+/*N*/
+/*N*/ // Danach noch die SnapRects der enthaltenen Objekte
+/*N*/ // invalidieren, um diese auf der neuen Grundlage berechnen
+/*N*/ // zu lassen (falls diese von FitInSnapRect() berechnet wurden)
+/*N*/ SetRectsDirty();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Licht- und Labelobjektlisten neu aufbauen (nach Laden, Zuweisung)
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::RebuildLists()
+/*N*/ {
+/*N*/ // zuerst loeschen
+/*N*/ aLabelList.Clear();
+/*N*/ SdrLayerID nLayerID = GetLayer();
+/*N*/
+/*N*/ SdrObjListIter a3DIterator(*pSub, IM_FLAT);
+/*N*/
+/*N*/ // dann alle Objekte in der Szene pruefen
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*N*/ E3dObject* p3DObj = (E3dObject*) a3DIterator.Next();
+/*N*/ p3DObj->NbcSetLayer(nLayerID);
+/*N*/ NewObjectInserted(p3DObj);
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*************************************************************************
+|*
+|* erstelle neues GeoData-Objekt
+|*
+\************************************************************************/
+
+/*N*/ SdrObjGeoData *E3dScene::NewGeoData() const
+/*N*/ {
+/*N*/ return new E3DSceneGeoData;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* uebergebe aktuelle werte an das GeoData-Objekt
+|*
+\************************************************************************/
+
+/*?*/ void E3dScene::SaveGeoData(SdrObjGeoData& rGeo) const
+/*?*/ {
+/*?*/ E3dObject::SaveGeoData (rGeo);
+/*?*/
+/*?*/ ((E3DSceneGeoData &) rGeo).aCamera = aCamera;
+/*?*/ ((E3DSceneGeoData &) rGeo).aLabelList = aLabelList;
+/*?*/ }
+
+/*************************************************************************
+|*
+|* uebernehme werte aus dem GeoData-Objekt
+|*
+\************************************************************************/
+
+/*?*/ void E3dScene::RestGeoData(const SdrObjGeoData& rGeo)
+/*?*/ {
+/*?*/ E3dObject::RestGeoData (rGeo);
+/*?*/
+/*?*/ aLabelList = ((E3DSceneGeoData &) rGeo).aLabelList;
+/*?*/ SetCamera (((E3DSceneGeoData &) rGeo).aCamera);
+/*?*/ FitSnapRectToBoundVol();
+/*?*/ }
+
+/*************************************************************************
+|*
+|* Am StyleSheet wurde etwas geaendert, also Scene aendern
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::SFX_NOTIFY(SfxBroadcaster &rBC,
+/*N*/ const TypeId &rBCType,
+/*N*/ const SfxHint &rHint,
+/*N*/ const TypeId &rHintType)
+/*N*/ {
+/*N*/ SetRectsDirty();
+/*N*/ E3dObject::SFX_NOTIFY(rBC, rBCType, rHint, rHintType);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Compounds brauchen Defaults
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::ForceDefaultAttr()
+/*N*/ {
+/*N*/ SdrAttrObj::ForceDefaultAttr();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
+/*N*/ {
+/*N*/ E3dObjList* pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/
+/*N*/ for ( ULONG i = 0; i < nObjCnt; i++ )
+/*?*/ pOL->GetObj(i)->NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+/*N*/
+/*N*/ StructureChanged(this);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Attribute abfragen
+|*
+\************************************************************************/
+
+/*N*/ SfxStyleSheet* E3dScene::GetStyleSheet() const
+/*N*/ {
+/*N*/ E3dObjList *pOL = pSub;
+/*N*/ ULONG nObjCnt = pOL->GetObjCount();
+/*N*/ SfxStyleSheet *pRet = 0;
+/*N*/
+/*N*/ for ( ULONG i = 0; i < nObjCnt; i++ )
+/*N*/ {
+/*N*/ SfxStyleSheet *pSheet = pOL->GetObj(i)->GetStyleSheet();
+/*N*/
+/*N*/ if (!pRet)
+/*N*/ pRet = pSheet;
+/*N*/ else if (pSheet)
+/*N*/ {
+/*N*/ if(!pSheet->GetName().Equals(pRet->GetName()))
+/*N*/ return 0;
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Licht-Objekte rauswerfen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::RemoveLightObjects()
+/*N*/ {
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/ if(pSubList)
+/*N*/ {
+/*N*/ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*N*/ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+/*N*/ if(pObj->ISA(E3dLight))
+/*N*/ {
+/*N*/ // Weg damit
+/*N*/ Remove3DObj(pObj);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Licht-Objekte erzeugen, um kompatibel zur 4.0
+|* speichern zu koennen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::CreateLightObjectsFromLightGroup()
+/*N*/ {
+/*N*/ if(aLightGroup.IsLightingEnabled())
+/*N*/ {
+/*N*/ // Global Ambient Light
+/*N*/ const Color& rAmbient = aLightGroup.GetGlobalAmbientLight();
+/*N*/ if(rAmbient != Color(COL_BLACK))
+/*N*/ Insert3DObj(new E3dLight(Vector3D(), rAmbient, 1.0));
+/*N*/
+/*N*/ // Andere Lichter
+/*N*/ for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
+/*N*/ {
+/*N*/ B3dLight& rLight = aLightGroup.GetLightObject((Base3DLightNumber)(Base3DLight0 + a));
+/*N*/ if(rLight.IsEnabled())
+/*N*/ {
+/*N*/ if(rLight.IsDirectionalSource())
+/*N*/ {
+/*N*/ // erzeuge E3dDistantLight
+/*N*/ Insert3DObj(new E3dDistantLight(Vector3D(),
+/*N*/ rLight.GetPosition(),
+/*N*/ rLight.GetIntensity(Base3DMaterialDiffuse), 1.0));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // erzeuge E3dPointLight
+/*N*/ Insert3DObj(new E3dPointLight(rLight.GetPosition(),
+/*N*/ rLight.GetIntensity(Base3DMaterialDiffuse), 1.0));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Beleuchtung aus dem alten Beleuchtungsmodell uebernehmen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::FillLightGroup()
+/*N*/ {
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/ BOOL bLampFound = FALSE;
+/*N*/
+/*N*/ if(pSubList)
+/*N*/ {
+/*N*/ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+/*N*/ Base3DLightNumber eLight = Base3DLight0;
+/*N*/
+/*N*/ // AmbientLight aus
+/*N*/ aLightGroup.SetGlobalAmbientLight(Color(COL_BLACK));
+/*N*/
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*N*/ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+/*N*/ if(pObj->ISA(E3dLight) && eLight <= Base3DLight7)
+/*N*/ {
+/*N*/ E3dLight* pLight = (E3dLight*)pObj;
+/*N*/ bLampFound = TRUE;
+/*N*/
+/*N*/ // pLight in Base3D Konvention aktivieren
+/*N*/ if(pLight->IsOn())
+/*N*/ {
+/*?*/ if(pLight->ISA(E3dPointLight))
+/*?*/ {
+/*?*/ // ist ein E3dPointLight
+/*?*/ // Position, keine Richtung
+/*?*/ B3dColor aCol(pLight->GetColor().GetColor());
+/*?*/ aCol *= pLight->GetIntensity();
+/*?*/ aLightGroup.SetIntensity(aCol, Base3DMaterialDiffuse, eLight);
+/*?*/ aLightGroup.SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight);
+/*?*/ Vector3D aPos = pLight->GetPosition();
+/*?*/ aLightGroup.SetPosition(aPos, eLight);
+/*?*/
+/*?*/ // Lichtquelle einschalten
+/*?*/ aLightGroup.Enable(TRUE, eLight);
+/*?*/
+/*?*/ // Naechstes Licht in Base3D
+/*?*/ eLight = (Base3DLightNumber)(eLight + 1);
+/*?*/ }
+/*N*/ else if(pLight->ISA(E3dDistantLight))
+/*N*/ {
+/*N*/ // ist ein E3dDistantLight
+/*N*/ // Richtung, keine Position
+/*N*/ B3dColor aCol(pLight->GetColor().GetColor());
+/*N*/ aCol *= pLight->GetIntensity();
+/*N*/ aLightGroup.SetIntensity(aCol, Base3DMaterialDiffuse, eLight);
+/*N*/ aLightGroup.SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight);
+/*N*/ Vector3D aDir = ((E3dDistantLight *)pLight)->GetDirection();
+/*N*/ aLightGroup.SetDirection(aDir, eLight);
+/*N*/
+/*N*/ // Lichtquelle einschalten
+/*N*/ aLightGroup.Enable(TRUE, eLight);
+/*N*/
+/*N*/ // Naechstes Licht in Base3D
+/*N*/ eLight = (Base3DLightNumber)(eLight + 1);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // nur ein E3dLight, gibt ein
+/*N*/ // ambientes licht, auf globales aufaddieren
+/*N*/ B3dColor aCol(pLight->GetColor().GetColor());
+/*N*/ aCol *= pLight->GetIntensity();
+/*N*/ aCol += (const B3dColor &)(aLightGroup.GetGlobalAmbientLight());
+/*N*/ aLightGroup.SetGlobalAmbientLight(aCol);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Alle anderen Lichter ausschalten
+/*N*/ while(eLight <= Base3DLight7)
+/*N*/ {
+/*N*/ aLightGroup.Enable(FALSE, eLight);
+/*N*/ eLight = (Base3DLightNumber)(eLight + 1);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Beleuchtung einschalten, falls Lampen vorhanden
+/*N*/ aLightGroup.EnableLighting(bLampFound);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Lichter zaehlen
+|*
+\************************************************************************/
+
+/*N*/ UINT16 E3dScene::CountNumberOfLights()
+/*N*/ {
+/*N*/ UINT16 nNumLights = 0;
+/*N*/
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/ if(pSubList)
+/*N*/ {
+/*N*/ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*N*/ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+/*N*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+/*N*/ if(pObj->ISA(E3dLight))
+/*N*/ {
+/*N*/ // Zaehlen...
+/*N*/ nNumLights++;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nNumLights;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::RecalcSnapRect()
+/*N*/ {
+/*N*/ E3dScene* pScene = GetScene();
+/*N*/ if(pScene == this)
+/*N*/ {
+/*N*/ // Szene wird als 2D-Objekt benutzt, nimm SnapRect aus der
+/*N*/ // 2D Bildschrimdarstellung
+/*N*/ Camera3D& rCam = (Camera3D&)pScene->GetCamera();
+/*N*/ maSnapRect = rCam.GetDeviceWindow();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Szene ist selbst Mitglied einer anderen Szene, hole das
+/*N*/ // SnapRect als zusammengesetztes Objekt
+/*N*/ E3dObject::RecalcSnapRect();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Attribute abfragen
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::ImpSetLightItemsFromLightGroup()
+/*N*/ {
+/*N*/ ImpForceItemSet();
+/*N*/
+/*N*/ // TwoSidedLighting
+/*N*/ mpObjectItemSet->Put(Svx3DTwoSidedLightingItem(aLightGroup.GetModelTwoSide()));
+/*N*/
+/*N*/ // LightColors
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor1Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight0)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor2Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight1)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor3Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight2)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor4Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight3)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor5Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight4)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor6Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight5)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor7Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight6)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightcolor8Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight7)));
+/*N*/
+/*N*/ // AmbientColor
+/*N*/ mpObjectItemSet->Put(Svx3DAmbientcolorItem(aLightGroup.GetGlobalAmbientLight()));
+/*N*/
+/*N*/ // LightOn
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff1Item(aLightGroup.IsEnabled(Base3DLight0)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff2Item(aLightGroup.IsEnabled(Base3DLight1)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff3Item(aLightGroup.IsEnabled(Base3DLight2)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff4Item(aLightGroup.IsEnabled(Base3DLight3)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff5Item(aLightGroup.IsEnabled(Base3DLight4)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff6Item(aLightGroup.IsEnabled(Base3DLight5)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff7Item(aLightGroup.IsEnabled(Base3DLight6)));
+/*N*/ mpObjectItemSet->Put(Svx3DLightOnOff8Item(aLightGroup.IsEnabled(Base3DLight7)));
+/*N*/
+/*N*/ // LightDirection
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection1Item(aLightGroup.GetDirection( Base3DLight0 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection2Item(aLightGroup.GetDirection( Base3DLight1 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection3Item(aLightGroup.GetDirection( Base3DLight2 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection4Item(aLightGroup.GetDirection( Base3DLight3 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection5Item(aLightGroup.GetDirection( Base3DLight4 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection6Item(aLightGroup.GetDirection( Base3DLight5 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection7Item(aLightGroup.GetDirection( Base3DLight6 )));
+/*N*/ mpObjectItemSet->Put(Svx3DLightDirection8Item(aLightGroup.GetDirection( Base3DLight7 )));
+/*N*/ }
+
+/*N*/ void E3dScene::ImpSetSceneItemsFromCamera()
+/*N*/ {
+/*N*/ ImpForceItemSet();
+/*N*/ Camera3D aSceneCam (GetCamera());
+/*N*/
+/*N*/ // ProjectionType
+/*N*/ mpObjectItemSet->Put(Svx3DPerspectiveItem((UINT16)aSceneCam.GetProjection()));
+/*N*/
+/*N*/ // CamPos
+/*N*/ mpObjectItemSet->Put(Svx3DDistanceItem((UINT32)(aSceneCam.GetPosition().Z() + 0.5)));
+/*N*/
+/*N*/ // FocalLength
+/*N*/ mpObjectItemSet->Put(Svx3DFocalLengthItem((UINT32)((aSceneCam.GetFocalLength() * 100.0) + 0.5)));
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// ItemSet access
+
+/*N*/ const SfxItemSet& E3dScene::GetItemSet() const
+/*N*/ {
+/*N*/ // prepare ItemSet
+/*N*/ if(mpObjectItemSet)
+/*N*/ {
+/*N*/ SfxItemSet aNew(*mpObjectItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+/*N*/ aNew.Put(*mpObjectItemSet);
+/*N*/ mpObjectItemSet->ClearItem();
+/*N*/ mpObjectItemSet->Put(aNew);
+/*N*/ }
+/*N*/ else
+/*N*/ ((E3dScene*)this)->ImpForceItemSet();
+/*N*/
+/*N*/ // collect all ItemSets in mpGroupItemSet
+/*N*/ sal_uInt32 nCount(pSub->GetObjCount());
+/*N*/ for(sal_uInt32 a(0); a < nCount; a++)
+/*N*/ {
+/*N*/ const SfxItemSet& rSet = pSub->GetObj(a)->GetItemSet();
+/*N*/ SfxWhichIter aIter(rSet);
+/*N*/ sal_uInt16 nWhich(aIter.FirstWhich());
+/*N*/
+/*N*/ while(nWhich)
+/*N*/ {
+/*N*/ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, FALSE))
+/*N*/ mpObjectItemSet->InvalidateItem(nWhich);
+/*N*/ else
+/*N*/ mpObjectItemSet->MergeValue(rSet.Get(nWhich), TRUE);
+/*N*/
+/*N*/ nWhich = aIter.NextWhich();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return *mpObjectItemSet;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// private support routines for ItemSet access
+
+/*N*/ void E3dScene::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+/*N*/ {
+/*N*/ // handle local value change
+/*N*/ if(!nWhich || (nWhich >= SDRATTR_3DSCENE_FIRST && nWhich <= SDRATTR_3DSCENE_LAST))
+/*N*/ SdrAttrObj::ItemChange(nWhich, pNewItem);
+/*N*/
+/*N*/ // ItemChange at all contained objects
+/*N*/ List aPostItemChangeList;
+/*N*/ sal_uInt32 nCount(pSub->GetObjCount());
+ sal_uInt32 a;
+/*N*/
+/*N*/ for( a=0; a < nCount; a++)
+/*N*/ {
+/*N*/ SdrObject* pObj = pSub->GetObj(a);
+/*N*/ if(pObj->AllowItemChange(nWhich, pNewItem))
+/*N*/ {
+/*N*/ pObj->ItemChange(nWhich, pNewItem);
+/*N*/ aPostItemChangeList.Insert((void*)pObj, LIST_APPEND);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ for(a = 0; a < aPostItemChangeList.Count(); a++)
+/*N*/ {
+/*N*/ SdrObject* pObj = (SdrObject*)aPostItemChangeList.GetObject(a);
+/*N*/ pObj->PostItemChange(nWhich);
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dScene::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ if(!nWhich || (nWhich >= SDRATTR_3DSCENE_FIRST && nWhich <= SDRATTR_3DSCENE_LAST))
+/*N*/ SdrAttrObj::PostItemChange(nWhich);
+/*N*/
+/*N*/ // local changes
+/*N*/ StructureChanged(this);
+/*N*/
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case SDRATTR_3DSCENE_PERSPECTIVE :
+/*N*/ case SDRATTR_3DSCENE_DISTANCE :
+/*N*/ case SDRATTR_3DSCENE_FOCAL_LENGTH :
+/*N*/ {
+/*N*/ // #83387#, #83391#
+/*N*/ // one common function for the camera attributes
+/*N*/ // since SetCamera() sets all three back to the ItemSet
+/*N*/ Camera3D aSceneCam(GetCamera());
+/*N*/ BOOL bChange(FALSE);
+/*N*/
+/*N*/ // for SDRATTR_3DSCENE_PERSPECTIVE:
+/*N*/ if(aSceneCam.GetProjection() != GetPerspective())
+/*N*/ {
+/*N*/ aSceneCam.SetProjection(GetPerspective());
+/*N*/ bChange = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // for SDRATTR_3DSCENE_DISTANCE:
+/*N*/ Vector3D aActualPosition = aSceneCam.GetPosition();
+/*N*/ double fNew = GetDistance();
+/*N*/ if(fNew != aActualPosition.Z())
+/*N*/ {
+/*N*/ aSceneCam.SetPosition( Vector3D( aActualPosition.X(), aActualPosition.Y(), fNew) );
+/*N*/ bChange = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // for SDRATTR_3DSCENE_FOCAL_LENGTH:
+/*N*/ fNew = GetFocalLength() / 100.0;
+/*N*/ if(aSceneCam.GetFocalLength() != fNew)
+/*N*/ {
+/*N*/ aSceneCam.SetFocalLength(fNew);
+/*N*/ bChange = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // for all
+/*N*/ if(bChange)
+/*N*/ SetCamera(aSceneCam);
+/*N*/
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_TWO_SIDED_LIGHTING :
+/*N*/ {
+/*N*/ aLightGroup.SetModelTwoSide(GetTwoSidedLighting());
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_1 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_2 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_3 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_4 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_5 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_6 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_7 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTCOLOR_8 :
+/*N*/ {
+/*N*/ aLightGroup.SetIntensity( GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_AMBIENTCOLOR :
+/*N*/ {
+/*N*/ aLightGroup.SetGlobalAmbientLight(GetGlobalAmbientColor());
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_1 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff1(), Base3DLight0);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_2 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff2(), Base3DLight1);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_3 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff3(), Base3DLight2);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_4 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff4(), Base3DLight3);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_5 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff5(), Base3DLight4);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_6 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff6(), Base3DLight5);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_7 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff7(), Base3DLight6);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTON_8 :
+/*N*/ {
+/*N*/ aLightGroup.Enable( GetLightOnOff8(), Base3DLight7);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_1 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection1(), Base3DLight0);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_2 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection2(), Base3DLight1);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_3 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection3(), Base3DLight2);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_4 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection4(), Base3DLight3);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_5 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection5(), Base3DLight4);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_6 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection6(), Base3DLight5);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_7 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection7(), Base3DLight6);
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DSCENE_LIGHTDIRECTION_8 :
+/*N*/ {
+/*N*/ aLightGroup.SetDirection( GetLightDirection8(), Base3DLight7);
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ItemSet was changed, maybe user wants to react
+
+/*N*/ void E3dScene::ItemSetChanged( const SfxItemSet& rSet )
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dObject::ItemSetChanged( rSet );
+/*N*/
+/*N*/ // set at all contained objects
+/*N*/ sal_uInt32 nCount(pSub->GetObjCount());
+/*N*/ for(sal_uInt32 a(0); a < nCount; a++)
+/*N*/ pSub->GetObj(a)->ItemSetChanged( rSet );
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+/*N*/ void E3dScene::PreSave()
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dObject::PreSave();
+/*N*/
+/*N*/ // set at all contained objects
+/*N*/ sal_uInt32 nCount(pSub->GetObjCount());
+/*N*/ for(sal_uInt32 a(0); a < nCount; a++)
+/*N*/ pSub->GetObj(a)->PreSave();
+/*N*/ }
+
+/*N*/ void E3dScene::PostSave()
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dObject::PostSave();
+/*N*/
+/*N*/ // set at all contained objects
+/*N*/ sal_uInt32 nCount(pSub->GetObjCount());
+/*N*/ for(sal_uInt32 a(0); a < nCount; a++)
+/*N*/ pSub->GetObj(a)->PostSave();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ItemPool fuer dieses Objekt wechseln
+|*
+\************************************************************************/
+
+/*N*/ void E3dScene::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel )
+/*N*/ {
+/*N*/ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dObject::MigrateItemPool(pSrcPool, pDestPool, pNewModel);
+/*N*/
+/*N*/ // own reaction, but only with outmost scene
+/*N*/ SdrObjList* pSubList = GetSubList();
+/*N*/ if(pSubList && GetScene() == this)
+/*N*/ {
+/*N*/ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+/*N*/ while ( a3DIterator.IsMore() )
+/*N*/ {
+/*?*/ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+/*?*/ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+/*?*/ pObj->MigrateItemPool(pSrcPool, pDestPool, pNewModel);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void E3dScene::SetShadowPlaneDirection(const Vector3D& rVec)
+/*N*/ {
+/*N*/ UINT16 nSceneShadowSlant = (UINT16)((atan2(rVec.Y(), rVec.Z()) / F_PI180) + 0.5);
+/*N*/ ImpForceItemSet();
+/*N*/ mpObjectItemSet->Put(Svx3DShadowSlantItem(nSceneShadowSlant));
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_sphere3d.cxx b/binfilter/bf_svx/source/engine3d/svx_sphere3d.cxx
new file mode 100644
index 000000000000..25b261692555
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_sphere3d.cxx
@@ -0,0 +1,703 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svdstr.hrc"
+
+#include "svdio.hxx"
+
+#include "svditer.hxx"
+
+#include "svdmodel.hxx"
+
+
+
+#include "polyob3d.hxx"
+
+#include "sphere3d.hxx"
+
+
+#include "svxids.hrc"
+
+namespace binfilter {
+
+/*N*/ TYPEINIT1(E3dSphereObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Kugel erzeugen ohne die Polygone darin zu erzeugen
+|*
+\************************************************************************/
+
+// FG: Dieser Aufruf erfolgt von der 3D-Object Factory (objfac3d.cxx) und zwar ausschliesslich beim
+// laden von Dokumenten. Hier braucht man keinen CreateSphere-Aufruf, denn die wirkliche
+// Anzahl Segmente ist ja noch nicht bekannt. Dies war bis zum 10.2.97 ein (kleines)
+// Speicherleck.
+/*N*/ E3dSphereObj::E3dSphereObj(int dummy) // den Parameter braucht es um unterscheiden zu koennen, welcher
+/*N*/ { // der beiden Konstruktoren gemeint ist. Der obige halt per Default
+/*N*/ // Defaults setzen
+/*N*/ E3dDefaultAttributes aDefault;
+/*N*/ SetDefaultAttributes(aDefault);
+/*N*/ }
+
+/*N*/ void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+/*N*/ {
+/*N*/ // Defaults setzen
+/*N*/ aCenter = rDefault.GetDefaultSphereCenter();
+/*N*/ aSize = rDefault.GetDefaultSphereSize();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+/*N*/ {
+/*N*/ // add geometry describing polygons to rLinePolyPolygon
+/*N*/ sal_uInt16 nCntHor = (sal_uInt16)GetHorizontalSegments();
+/*N*/ sal_uInt16 nCntVer = (sal_uInt16)GetVerticalSegments();
+/*N*/ const Vector3D aRadius = aSize / 2;
+/*N*/ const double fHInc = (double)DEG2RAD(360) / nCntHor;
+/*N*/ const double fVInc = (double)DEG2RAD(180) / nCntVer;
+/*N*/ sal_uInt16 nCntHorPoly = nCntVer - 1;
+/*N*/ sal_uInt16 nIndHorPoly = rLinePolyPolygon.Count();
+/*N*/ sal_uInt16 a;
+/*N*/ double fHAng = 0.0;
+/*N*/
+/*N*/ for(a = 0; a < nCntHorPoly; a++)
+/*N*/ {
+/*N*/ Polygon3D aNewHor(nCntHor + 1);
+/*N*/ //aNewHor.SetClosed(TRUE);
+/*N*/ rLinePolyPolygon.Insert(aNewHor);
+/*N*/ }
+/*N*/
+/*N*/ for(sal_uInt16 nH(0); nH < nCntHor; nH++)
+/*N*/ {
+/*N*/ double fHSin = sin(fHAng);
+/*N*/ double fHCos = cos(fHAng);
+/*N*/ fHAng += fHInc;
+/*N*/ double fVAng = DEG2RAD(90);
+/*N*/ Polygon3D aNewVer(nCntVer + 1);
+/*N*/
+/*N*/ for(sal_uInt16 nV(0); nV <= nCntVer; nV++)
+/*N*/ {
+/*N*/ double fVSin = sin(fVAng);
+/*N*/ double fVCos = cos(fVAng);
+/*N*/ fVAng -= fVInc;
+/*N*/
+/*N*/ Vector3D aPos = aCenter;
+/*N*/ double fRx = aRadius.X() * fVCos;
+/*N*/ double fRz = aRadius.Z() * fVCos;
+/*N*/ aPos.X() += fRx * fHCos;
+/*N*/ aPos.Y() += aRadius.Y() * fVSin;
+/*N*/ aPos.Z() += fRz * fHSin;
+/*N*/
+/*N*/ if(nV == 0)
+/*N*/ {
+/*N*/ // top position, only interesting for vertical line
+/*N*/ aNewVer[0] = aPos;
+/*N*/ }
+/*N*/ else if(nV == nCntVer)
+/*N*/ {
+/*N*/ // bottom position, only interesting for vertical line
+/*N*/ aNewVer[nCntVer] = aPos;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // normal position, insert vertical
+/*N*/ aNewVer[nV] = aPos;
+/*N*/
+/*N*/ // insert horizontal
+/*N*/ rLinePolyPolygon[nIndHorPoly + (nV - 1)][nH] = aPos;
+/*N*/ if(!nH)
+/*N*/ rLinePolyPolygon[nIndHorPoly + (nV - 1)][nCntHor] = aPos;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ /// insert new vertical poly
+/*N*/ rLinePolyPolygon.Insert(aNewVer);
+/*N*/ }
+/*N*/
+/*N*/ // don't call parent
+/*N*/ // E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Geometrieerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::CreateGeometry()
+/*N*/ {
+/*N*/ Polygon3D aRect3D(4);
+/*N*/ Polygon3D aNormal3D(4);
+/*N*/ Polygon3D aTexture3D(4);
+/*N*/
+/*N*/ if ( GetHorizontalSegments() < 3 )
+/*N*/ mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(3));
+/*N*/
+/*N*/ if ( GetHorizontalSegments() > 100 )
+/*N*/ mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(100));
+/*N*/
+/*N*/ if ( GetVerticalSegments() < 2 )
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(2));
+/*N*/
+/*N*/ if ( GetVerticalSegments() > 100 )
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(100));
+/*N*/
+/*N*/ // Start der Geometrieerzeugung ankuendigen
+/*N*/ StartCreateGeometry();
+/*N*/
+/*N*/ Vector3D aRadius = aSize / 2;
+/*N*/ double fHSin1, fHSin2, fHCos1, fHCos2;
+/*N*/ double fHAng = 0;
+/*N*/ double fHInc = DEG2RAD(360) / GetHorizontalSegments();
+/*N*/ double fVInc = DEG2RAD(180) / GetVerticalSegments();
+/*N*/
+/*N*/ fHSin2 = 0.0; // sin(0)
+/*N*/ fHCos2 = 1.0; // cos(0)
+/*N*/ sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments();
+/*N*/
+/*N*/ for (USHORT nH = 0; nH < nUpperBound; nH++)
+/*N*/ {
+/*N*/ fHAng += fHInc;
+/*N*/ fHSin1 = fHSin2;
+/*N*/ fHSin2 = sin(fHAng);
+/*N*/ fHCos1 = fHCos2;
+/*N*/ fHCos2 = cos(fHAng);
+/*N*/
+/*N*/ double fRx, fRz;
+/*N*/ double fVAng = DEG2RAD(90);
+/*N*/ double fVSin1, fVSin2, fVCos1, fVCos2;
+/*N*/ fVSin2 = 1.0; // sin(90)
+/*N*/ fVCos2 = 0.0; // cos(90)
+/*N*/ sal_uInt16 nUpperVert = (sal_uInt16)GetVerticalSegments();
+/*N*/
+/*N*/ for (USHORT nV = 0; nV < nUpperVert; nV++)
+/*N*/ {
+/*N*/ Vector3D aPos;
+/*N*/
+/*N*/ fVAng -= fVInc;
+/*N*/ fVSin1 = fVSin2;
+/*N*/ fVSin2 = sin(fVAng);
+/*N*/ fVCos1 = fVCos2;
+/*N*/ fVCos2 = cos(fVAng);
+/*N*/
+/*N*/ aPos = aCenter;
+/*N*/ fRx = aRadius.X() * fVCos1;
+/*N*/ fRz = aRadius.Z() * fVCos1;
+/*N*/ aPos.X() += fRx * fHCos1;
+/*N*/ aPos.Y() += aRadius.Y() * fVSin1;
+/*N*/ aPos.Z() += fRz * fHSin1;
+/*N*/ aRect3D[1] = aPos;
+/*N*/
+/*N*/ aPos.X() = aCenter.X() + fRx * fHCos2;
+/*N*/ aPos.Z() = aCenter.Z() + fRz * fHSin2;
+/*N*/ aRect3D[2] = aPos;
+/*N*/
+/*N*/ aPos = aCenter;
+/*N*/ fRx = aRadius.X() * fVCos2;
+/*N*/ fRz = aRadius.Z() * fVCos2;
+/*N*/ aPos.X() += fRx * fHCos1;
+/*N*/ aPos.Y() += aRadius.Y() * fVSin2;
+/*N*/ aPos.Z() += fRz * fHSin1;
+/*N*/ aRect3D[0] = aPos;
+/*N*/
+/*N*/ aPos.X() = aCenter.X() + fRx * fHCos2;
+/*N*/ aPos.Z() = aCenter.Z() + fRz * fHSin2;
+/*N*/ aRect3D[3] = aPos;
+/*N*/
+/*N*/ if(GetCreateTexture())
+/*N*/ {
+/*N*/ aTexture3D[1].X() =
+/*N*/ (double)(nUpperBound - (nH + 1)) / (double)nUpperBound;
+/*N*/ aTexture3D[1].Y() =
+/*N*/ (double)nV / (double)nUpperVert;
+/*N*/
+/*N*/ aTexture3D[2].X() =
+/*N*/ (double)((nUpperBound - (nH + 1)) - 1) / (double)nUpperBound;
+/*N*/ aTexture3D[2].Y() = aTexture3D[1].Y();
+/*N*/
+/*N*/ aTexture3D[3].X() = aTexture3D[2].X();
+/*N*/ aTexture3D[3].Y() =
+/*N*/ (double)(nV+1) / (double)nUpperVert;
+/*N*/
+/*N*/ aTexture3D[0].X() = aTexture3D[1].X();
+/*N*/ aTexture3D[0].Y() = aTexture3D[3].Y();
+/*N*/ }
+/*N*/
+/*N*/ if(GetCreateNormals())
+/*N*/ {
+/*N*/ aNormal3D = aRect3D;
+/*N*/ aNormal3D[0].Normalize();
+/*N*/ aNormal3D[1].Normalize();
+/*N*/ aNormal3D[2].Normalize();
+/*N*/ aNormal3D[3].Normalize();
+/*N*/
+/*N*/ if(GetCreateTexture())
+/*N*/ AddGeometry(aRect3D, aNormal3D, aTexture3D, FALSE);
+/*N*/ else
+/*N*/ AddGeometry(aRect3D, aNormal3D, FALSE);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ AddGeometry(aRect3D, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::CreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Wireframe erzeugen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus n Polygonen
+|*
+\************************************************************************/
+
+/*N*/ SdrObject *E3dSphereObj::DoConvertToPolyObj(BOOL bBezier) const
+/*N*/ {
+/*N*/ return NULL;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten in Stream speichern
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ long nVersion = rOut.GetVersion(); // Build_Nr * 10 z.B. 3810
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Alte Geometrie erzeugen, um die E3dPolyObj's zu haben
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry(TRUE);
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ SdrAttrObj::WriteData(rOut);
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dSphereObj");
+/*N*/ #endif
+/*N*/
+/*N*/ if (rOut.GetVersion() < 3560) // FG: kleiner als die Final Beta der Version 4.0
+/*N*/ {
+/*N*/ pSub->Save(rOut);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // [FG] Jetzt wird die Kindliste abgeklapptert, allerdings weiss ich im Gegensatz zu
+/*N*/ // Joe dass es nur E3dPolyObj - Kindobjekte sein koennen.
+/*N*/ // Jedes dieser Objekte frage ich ob es eigene Attribute enthaelt. Falls OwnStyle ()
+/*N*/ // true liefert, werde ich das Polygon nicht wegspeichern.
+/*N*/
+/*N*/ SdrObjListIter aIter(*pSub,IM_FLAT);
+/*N*/ while (aIter.IsMore()) {
+/*N*/ E3dPolyObj* pObj=(E3dPolyObj *) aIter.Next();
+/*N*/ if ((!pObj->IsNotPersistent()) && (pObj->OwnAttrs() || pObj->OwnStyle()))
+/*N*/ {
+/*N*/ rOut<<*pObj;
+/*N*/ }
+/*N*/ if (pSub->GetModel()!=NULL) pSub->GetModel()->IncProgress();
+/*N*/ }
+/*N*/ SdrIOHeader(rOut,STREAM_WRITE,SdrIOEndeID); // Endemarke
+/*N*/ }
+/*N*/
+/*N*/ // Daß hier gehört zum E3dObject (ohne Basisklassen);
+/*N*/ if (rOut.GetVersion() < 3560)
+/*N*/ {
+/*N*/ rOut << aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ aMat3D = aTfMatrix;
+/*N*/ rOut << aMat3D;
+/*N*/
+/*N*/ rOut << nLogicalGroup;
+/*N*/ rOut << nObjTreeLevel;
+/*N*/ rOut << nPartOfParent;
+/*N*/ rOut << UINT16(eDragDetail);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ E3dObject::WriteOnlyOwnMembers(rOut);
+/*N*/ }
+/*N*/ // Das gehört zu E3dSphere
+/*N*/ rOut << GetHorizontalSegments();
+/*N*/
+/*N*/ rOut << GetVerticalSegments();
+/*N*/
+/*N*/ rOut << aCenter;
+/*N*/ rOut << aSize;
+/*N*/
+/*N*/ // Das hier ist ein Merkmal eines Compound-Objektes
+/*N*/ rOut << GetDoubleSided();
+/*N*/
+/*N*/ // Ab Version 395 (8.6.98): Parameter aus dem Objekt
+/*N*/ // E3dCompoundObject. Da irgendwann mal jemand die Ableitungs-
+/*N*/ // hierarchie beim FileFormat unterbrochen hat, wurden diese Attribute
+/*N*/ // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich
+/*N*/ // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in
+/*N*/ // E3dCompoundObject oder E3dObject aendern.
+/*N*/ rOut << GetDoubleSided();
+/*N*/
+/*N*/ rOut << BOOL(bCreateNormals);
+/*N*/ rOut << BOOL(bCreateTexture);
+/*N*/
+/*N*/ sal_uInt16 nVal = GetNormalsKind();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionX();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ nVal = GetTextureProjectionY();
+/*N*/ rOut << BOOL(nVal > 0);
+/*N*/ rOut << BOOL(nVal > 1);
+/*N*/
+/*N*/ rOut << BOOL(GetShadow3D());
+/*N*/
+/*N*/ rOut << GetMaterialAmbientColor();
+/*N*/ rOut << GetMaterialColor();
+/*N*/ rOut << GetMaterialSpecular();
+/*N*/ rOut << GetMaterialEmission();
+/*N*/ rOut << GetMaterialSpecularIntensity();
+/*N*/
+/*N*/ aBackMaterial.WriteData(rOut);
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureKind();
+/*N*/
+/*N*/ rOut << (UINT16)GetTextureMode();
+/*N*/
+/*N*/ rOut << BOOL(GetNormalsInvert());
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ rOut << BOOL(GetTextureFilter());
+/*N*/
+/*N*/ if(nVersion < 3800)
+/*N*/ {
+/*N*/ // Geometrie neu erzeugen, um E3dPolyObj's wieder loszuwerden
+/*N*/ ((E3dCompoundObject*)this)->ReCreateGeometry();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::ReadData31(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dSphereObj");
+/*N*/ #endif
+/*N*/ // dann die Member
+/*N*/ UINT16 nTmp16;
+/*N*/ sal_Int32 nTmp32;
+/*N*/
+/*N*/ pSub->Load(rIn, *pPage);
+/*N*/ // FG: Die Daten des 3D-Objektes
+/*N*/ rIn >> aLocalBoundVol;
+/*N*/
+/*N*/ Old_Matrix3D aMat3D;
+/*N*/ rIn >> aMat3D;
+/*N*/ aTfMatrix = Matrix4D(aMat3D);
+/*N*/
+/*N*/ rIn >> nLogicalGroup;
+/*N*/ rIn >> nObjTreeLevel;
+/*N*/ rIn >> nPartOfParent;
+/*N*/ rIn >> nTmp16; eDragDetail = E3dDragDetail(nTmp16);
+/*N*/ // FG: Die Daten der Kugel
+/*N*/
+/*N*/ rIn >> nTmp32;
+/*N*/ mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp32));
+/*N*/
+/*N*/ rIn >> nTmp32;
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp32));
+/*N*/
+/*N*/ rIn >> aCenter;
+/*N*/ rIn >> aSize;
+/*N*/
+/*N*/ bBoundVolValid = FALSE;
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Objektdaten aus Stream laden
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ // FG (10.2.97) Der Pointer ist ein Kunstgriff er wird in der ReadData-Routine erzeugt dort werden
+/*N*/ // die abgespeicherten attributierten Flaechen abgelegt. Danach wird eine Kugel mit Default-Paramtern
+/*N*/ // erzeugt und dann werden die per Default erzeugten einfach, falls noetig mit denen aus dieser Liste
+/*N*/ // ausgetauscht. Am Ende von ReadData wird die Liste wieder zerstoert.
+/*N*/ E3dObjList *pLoadedE3dPolyObjs;
+/*N*/
+/*N*/ if (ImpCheckSubRecords (rHead, rIn))
+/*N*/ {
+/*N*/ // leider kann das E3dLatheObj nicht auf E3dObject abgestuetzt werden,
+/*N*/ // da neue Member hinzugekommen sind und die Kompatibilitaet erhalten
+/*N*/ // bleiben muss.
+/*N*/ SdrAttrObj::ReadData(rHead, rIn);
+/*N*/ if ((rIn.GetVersion() < 3560) || (rHead.GetVersion() <= 12))
+/*N*/ {
+/*N*/ ReadData31(rHead, rIn);
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("E3dSphereObj");
+/*N*/ #endif
+/*N*/ // dann die Member
+/*N*/ BOOL bMyDoubleSided;
+/*N*/
+/*N*/ // [FG]: Es wird erstmal gelesen was da ist, ob es vollstaendig ist zeigt sich bei
+/*N*/ // dem Aufruf von CreateSphere, dort werden die fehlenden Flaechen einfach
+/*N*/ // erzeugt.
+/*N*/ pLoadedE3dPolyObjs = new E3dObjList(NULL, NULL);
+/*N*/ pLoadedE3dPolyObjs->SetOwnerObj(this);
+/*N*/ pLoadedE3dPolyObjs->SetListKind(SDROBJLIST_GROUPOBJ);
+/*N*/ pLoadedE3dPolyObjs->Load(rIn, *pPage);
+/*N*/ E3dObject::ReadOnlyOwnMembers(rHead, rIn);
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft ())
+/*N*/ {
+/*N*/ // neue Member
+/*N*/ sal_Int32 nTmp32;
+/*N*/
+/*N*/ rIn >> nTmp32;
+/*N*/ mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp32));
+/*N*/
+/*N*/ rIn >> nTmp32;
+/*N*/ mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp32));
+/*N*/
+/*N*/ rIn >> aCenter;
+/*N*/ rIn >> aSize;
+/*N*/ if (aCompat.GetBytesLeft ())
+/*N*/ {
+/*N*/ rIn >> bMyDoubleSided;
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(bMyDoubleSided));
+/*N*/ }
+/*N*/
+/*N*/ if (aCompat.GetBytesLeft())
+/*N*/ {
+/*N*/ // Ab Version 395 (8.6.98): Parameter aus dem Objekt
+/*N*/ // E3dCompoundObject. Da irgendwann mal jemand die Ableitungs-
+/*N*/ // hierarchie beim FileFormat unterbrochen hat, wurden diese Attribute
+/*N*/ // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich
+/*N*/ // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in
+/*N*/ // E3dCompoundObject oder E3dObject aendern.
+/*N*/ BOOL bTmp, bTmp2;
+/*N*/ sal_uInt16 nTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp));
+/*N*/
+/*N*/ rIn >> bTmp; bCreateNormals = bTmp;
+/*N*/ rIn >> bTmp; bCreateTexture = bTmp;
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ rIn >> bTmp2;
+/*N*/ if(bTmp == FALSE && bTmp2 == FALSE)
+/*N*/ nTmp = 0;
+/*N*/ else if(bTmp == TRUE && bTmp2 == FALSE)
+/*N*/ nTmp = 1;
+/*N*/ else
+/*N*/ nTmp = 2;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp));
+/*N*/
+/*N*/ Color aCol;
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ SetMaterialAmbientColor(aCol);
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ // do NOT use, this is the old 3D-Color(!)
+/*N*/ // SetItem(XFillColorItem(String(), aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol));
+/*N*/
+/*N*/ rIn >> aCol;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp));
+/*N*/
+/*N*/ aBackMaterial.ReadData(rIn);
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp));
+/*N*/
+/*N*/ rIn >> nTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp));
+/*N*/
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp));
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ // neu ab 534: (hat noch gefehlt)
+/*N*/ if (aCompat.GetBytesLeft () >= sizeof (BOOL))
+/*N*/ {
+/*N*/ BOOL bTmp;
+/*N*/ rIn >> bTmp;
+/*N*/ mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp));
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ DBG_ERROR("AW: Kugel laden: nicht vorgesehener Fall");
+/*N*/ }
+/*N*/ pLoadedE3dPolyObjs->Clear();
+/*N*/ delete pLoadedE3dPolyObjs;
+/*N*/ }
+/*N*/
+/*N*/ // Geometrie neu erzeugen
+/*N*/ ReCreateGeometry();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+/*N*/ void E3dSphereObj::SetCenter(const Vector3D& rNew)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void E3dSphereObj::SetSize(const Vector3D& rNew)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// private support routines for ItemSet access
+
+/*N*/ void E3dSphereObj::PostItemChange(const sal_uInt16 nWhich)
+/*N*/ {
+/*N*/ // call parent
+/*N*/ E3dCompoundObject::PostItemChange(nWhich);
+/*N*/
+/*N*/ // local changes
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case SDRATTR_3DOBJ_HORZ_SEGS:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRATTR_3DOBJ_VERT_SEGS:
+/*N*/ {
+/*N*/ bGeometryValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+
+// EOF
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_svx3ditems.cxx b/binfilter/bf_svx/source/engine3d/svx_svx3ditems.cxx
new file mode 100644
index 000000000000..fb5c44d03631
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_svx3ditems.cxx
@@ -0,0 +1,531 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svx3ditems.hxx"
+
+#include <com/sun/star/drawing/NormalsKind.hpp>
+
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+
+#include <com/sun/star/drawing/TextureKind.hpp>
+
+#include <com/sun/star/drawing/TextureMode.hpp>
+
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+
+#include <com/sun/star/drawing/ShadeMode.hpp>
+
+#include "xdef.hxx"
+
+namespace binfilter {
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+/*N*/ Svx3DPercentDiagonalItem::Svx3DPercentDiagonalItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DBackscaleItem::Svx3DBackscaleItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DDepthItem::Svx3DDepthItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DHorizontalSegmentsItem::Svx3DHorizontalSegmentsItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DVerticalSegmentsItem::Svx3DVerticalSegmentsItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DEndAngleItem::Svx3DEndAngleItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DDoubleSidedItem::Svx3DDoubleSidedItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DNormalsInvertItem::Svx3DNormalsInvertItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DShadow3DItem::Svx3DShadow3DItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DMaterialColorItem::Svx3DMaterialColorItem(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_COLOR)
+/*N*/ {}
+
+/*N*/ Svx3DMaterialEmissionItem::Svx3DMaterialEmissionItem(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION)
+/*N*/ {}
+
+/*N*/ Svx3DMaterialSpecularItem::Svx3DMaterialSpecularItem(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR)
+/*N*/ {}
+
+/*N*/ Svx3DMaterialSpecularIntensityItem::Svx3DMaterialSpecularIntensityItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DTextureFilterItem::Svx3DTextureFilterItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DPerspectiveItem::Svx3DPerspectiveItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DDistanceItem::Svx3DDistanceItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DFocalLengthItem::Svx3DFocalLengthItem(sal_uInt32 nVal)
+/*N*/ : SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DTwoSidedLightingItem::Svx3DTwoSidedLightingItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor1Item::Svx3DLightcolor1Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor2Item::Svx3DLightcolor2Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor3Item::Svx3DLightcolor3Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor4Item::Svx3DLightcolor4Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor5Item::Svx3DLightcolor5Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor6Item::Svx3DLightcolor6Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor7Item::Svx3DLightcolor7Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7)
+/*N*/ {}
+
+/*N*/ Svx3DLightcolor8Item::Svx3DLightcolor8Item(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8)
+/*N*/ {}
+
+/*N*/ Svx3DAmbientcolorItem::Svx3DAmbientcolorItem(const Color& rCol)
+/*N*/ : SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff1Item::Svx3DLightOnOff1Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff2Item::Svx3DLightOnOff2Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff3Item::Svx3DLightOnOff3Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff4Item::Svx3DLightOnOff4Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff5Item::Svx3DLightOnOff5Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff6Item::Svx3DLightOnOff6Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff7Item::Svx3DLightOnOff7Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal)
+/*N*/ {}
+
+/*N*/ Svx3DLightOnOff8Item::Svx3DLightOnOff8Item(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal)
+/*N*/ {}
+/*N*/
+/*N*/ Svx3DLightDirection1Item::Svx3DLightDirection1Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection2Item::Svx3DLightDirection2Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection3Item::Svx3DLightDirection3Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection4Item::Svx3DLightDirection4Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection5Item::Svx3DLightDirection5Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection6Item::Svx3DLightDirection6Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection7Item::Svx3DLightDirection7Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DLightDirection8Item::Svx3DLightDirection8Item(const Vector3D& rVec)
+/*N*/ : SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec)
+/*N*/ {}
+
+/*N*/ Svx3DShadowSlantItem::Svx3DShadowSlantItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal)
+/*N*/ {}
+
+/*N*/ Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal)
+/*N*/ : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal)
+/*N*/ {}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+/*N*/ Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal)
+/*N*/ {}
+
+/*N*/ sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 nFileFormatVersion) const
+/*N*/ {
+/*N*/ return 1;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DSmoothNormalsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+/*N*/ {
+/*N*/ SfxBoolItem* pRetval = new Svx3DSmoothNormalsItem();
+/*N*/
+/*N*/ if(nItemVersion > 0)
+/*N*/ {
+/*?*/ SfxBoolItem aBoolItem(Which(), rIn);
+/*?*/ pRetval->SetValue(aBoolItem.GetValue());
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+/*N*/ Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal)
+/*N*/ {}
+
+/*N*/ sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 nFileFormatVersion) const
+/*N*/ {
+/*N*/ return 1;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DSmoothLidsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+/*N*/ {
+/*N*/ SfxBoolItem* pRetval = new Svx3DSmoothLidsItem();
+/*N*/
+/*N*/ if(nItemVersion > 0)
+/*N*/ {
+/*?*/ SfxBoolItem aBoolItem(Which(), rIn);
+/*?*/ pRetval->SetValue(aBoolItem.GetValue());
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+/*N*/ Svx3DCharacterModeItem::Svx3DCharacterModeItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal)
+/*N*/ {}
+
+/*N*/ sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 nFileFormatVersion) const
+/*N*/ {
+/*N*/ return 1;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DCharacterModeItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+/*N*/ {
+/*N*/ SfxBoolItem* pRetval = new Svx3DCharacterModeItem();
+/*N*/
+/*N*/ if(nItemVersion > 0)
+/*N*/ {
+/*?*/ SfxBoolItem aBoolItem(Which(), rIn);
+/*?*/ pRetval->SetValue(aBoolItem.GetValue());
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+/*N*/ Svx3DCloseFrontItem::Svx3DCloseFrontItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal)
+/*N*/ {}
+
+/*N*/ sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 nFileFormatVersion) const
+/*N*/ {
+/*N*/ return 1;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DCloseFrontItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+/*N*/ {
+/*N*/ SfxBoolItem* pRetval = new Svx3DCloseFrontItem();
+/*N*/
+/*N*/ if(nItemVersion > 0)
+/*N*/ {
+/*?*/ SfxBoolItem aBoolItem(Which(), rIn);
+/*?*/ pRetval->SetValue(aBoolItem.GetValue());
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+/*N*/ Svx3DCloseBackItem::Svx3DCloseBackItem(BOOL bVal)
+/*N*/ : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal)
+/*N*/ {}
+
+/*N*/ sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 nFileFormatVersion) const
+/*N*/ {
+/*N*/ return 1;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DCloseBackItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+/*N*/ {
+/*N*/ SfxBoolItem* pRetval = new Svx3DCloseBackItem();
+/*N*/
+/*N*/ if(nItemVersion > 0)
+/*N*/ {
+/*?*/ SfxBoolItem aBoolItem(Which(), rIn);
+/*?*/ pRetval->SetValue(aBoolItem.GetValue());
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Svx3DNormalsKindItem: use drawing::NormalsKind
+/*N*/ bool Svx3DNormalsKindItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::NormalsKind)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DNormalsKindItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::NormalsKind eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DNormalsKindItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DNormalsKindItem(*this);
+/*N*/ }
+
+// Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode
+/*N*/ bool Svx3DTextureProjectionXItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::TextureProjectionMode)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DTextureProjectionXItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::TextureProjectionMode eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DTextureProjectionXItem(*this);
+/*N*/ }
+
+// Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode
+/*N*/ bool Svx3DTextureProjectionYItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::TextureProjectionMode)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DTextureProjectionYItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::TextureProjectionMode eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DTextureProjectionYItem(*this);
+/*N*/ }
+
+// Svx3DTextureKindItem: use drawing::TextureKind
+/*N*/ bool Svx3DTextureKindItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::TextureKind)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DTextureKindItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::TextureKind eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DTextureKindItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DTextureKindItem(*this);
+/*N*/ }
+
+// Svx3DTextureModeItem: use drawing:TextureMode
+/*N*/ bool Svx3DTextureModeItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::TextureMode)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DTextureModeItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::TextureMode eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DTextureModeItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DTextureModeItem(*this);
+/*N*/ }
+
+// Svx3DPerspectiveItem: use drawing::ProjectionMode
+/*N*/ bool Svx3DPerspectiveItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::ProjectionMode)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DPerspectiveItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::ProjectionMode eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DPerspectiveItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DPerspectiveItem(*this);
+/*N*/ }
+
+// Svx3DShadeModeItem: use drawing::ShadeMode
+/*N*/ bool Svx3DShadeModeItem::QueryValue( uno::Any& rVal, BYTE nMemberId) const
+/*N*/ {
+/*N*/ rVal <<= (drawing::ShadeMode)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool Svx3DShadeModeItem::PutValue( const uno::Any& rVal, BYTE nMemberId)
+/*N*/ {
+/*N*/ drawing::ShadeMode eVar;
+/*N*/ if(!(rVal >>= eVar))
+/*N*/ return false;
+/*N*/ SetValue((sal_Int16)eVar);
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ SfxPoolItem* Svx3DShadeModeItem::Clone(SfxItemPool* pPool) const
+/*N*/ {
+/*N*/ return new Svx3DShadeModeItem(*this);
+/*N*/ }
+
+// EOF
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_view3d.cxx b/binfilter/bf_svx/source/engine3d/svx_view3d.cxx
new file mode 100644
index 000000000000..7187b67b9e40
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_view3d.cxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define ITEMID_COLOR 0
+
+
+
+
+
+
+
+
+
+
+
+#include "xoutx.hxx"
+
+#include <svxids.hrc>
+
+
+#include "xtable.hxx"
+
+
+#include "dialogs.hrc"
+
+
+
+
+
+
+
+
+
+
+#include "polysc3d.hxx"
+
+
+#include "view3d.hxx"
+
+
+
+
+
+
+
+namespace binfilter {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+/*N*/ TYPEINIT1(E3dView, SdrView);
+
+long Scalar (Point aPoint1,
+ Point aPoint2);
+
+Point ScaleVector (Point aPoint,
+ double nScale);
+
+double NormVector (Point aPoint);
+
+BOOL LineCutting (Point aP1,
+ Point aP2,
+ Point aP3,
+ Point aP4);
+
+long Point2Line (Point aP1,
+ Point aP2,
+ Point aP3);
+
+long DistPoint2Line (Point u,
+ Point v1,
+ Point v);
+
+/*************************************************************************
+|*
+|* Konstruktor 1
+|*
+\************************************************************************/
+
+/*N*/ E3dView::E3dView(SdrModel* pModel, OutputDevice* pOut) :
+/*N*/ SdrView(pModel, pOut)
+/*N*/ {
+/*N*/ InitView ();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+/*N*/ E3dView::~E3dView ()
+/*N*/ {
+/*N*/ /*#90353#*/delete [] pMirrorPolygon;
+/*N*/ /*#90353#*/delete [] pMirroredPolygon;
+/*N*/ /*#90353#*/delete [] pMarkedObjs;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Klasse initialisieren
+|*
+\************************************************************************/
+
+/*N*/ void E3dView::InitView ()
+/*N*/ {
+/*N*/ eDragConstraint = E3DDRAG_CONSTR_XYZ;
+/*N*/ eDragDetail = E3DDETAIL_ONEBOX;
+/*N*/ b3dCreationActive = FALSE;
+/*N*/ pMirrorPolygon = 0;
+/*N*/ pMirroredPolygon = 0;
+/*N*/ nPolyCnt = 0;
+/*N*/ pMyPV = 0;
+/*N*/ pMarkedObjs = 0;
+/*N*/ fDefaultScaleX =
+/*N*/ fDefaultScaleY =
+/*N*/ fDefaultScaleZ = 1.0;
+/*N*/ fDefaultRotateX =
+/*N*/ fDefaultRotateY =
+/*N*/ fDefaultRotateZ = 0.0;
+/*N*/ fDefaultExtrusionDeepth = 1000; // old: 2000;
+/*N*/ fDefaultLightIntensity = 0.8; // old: 0.6;
+/*N*/ fDefaultAmbientIntensity = 0.4;
+/*N*/ nHDefaultSegments = 12;
+/*N*/ nVDefaultSegments = 12;
+/*N*/ aDefaultLightColor = RGB_Color(COL_WHITE);
+/*N*/ aDefaultAmbientColor = RGB_Color(COL_BLACK);
+/*N*/ aDefaultLightPos = Vector3D (1, 1, 1); // old: Vector3D (0, 0, 1);
+/*N*/ aDefaultLightPos.Normalize();
+/*N*/ bDoubleSided = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Zeige eine Hilfsfigur
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Verdecke eine Hilfsfigur
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Zeige eine Hilfsfigur
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Koennen die selektierten Objekte aufgebrochen werden?
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Selektierte Lathe-Objekte aufbrechen
+|*
+\************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* Szenen mischen
+|*
+\************************************************************************/
+// Wird bisher noch nirgenswo (weder im Draw oder Chart) aufgerufen
+
+
+/*************************************************************************
+|*
+|* Possibilities, hauptsaechlich gruppieren/ungruppieren
+|*
+\************************************************************************/
+/*N*/ void E3dView::CheckPossibilities()
+/*N*/ {
+/*N*/ // call parent
+/*N*/ SdrView::CheckPossibilities();
+/*N*/
+/*N*/ // Weitere Flags bewerten
+/*N*/ if(bGroupPossible || bUnGroupPossible || bGrpEnterPossible)
+/*N*/ {
+/*?*/ INT32 nMarkCnt = aMark.GetMarkCount();
+/*?*/ BOOL bCoumpound = FALSE;
+/*?*/ BOOL b3DObject = FALSE;
+/*?*/ for(INT32 nObjs = 0L; (nObjs < nMarkCnt) && !bCoumpound; nObjs++)
+/*?*/ {
+/*?*/ SdrObject *pObj = aMark.GetMark(nObjs)->GetObj();
+/*?*/ if(pObj && pObj->ISA(E3dCompoundObject))
+/*?*/ bCoumpound = TRUE;
+/*?*/ if(pObj && pObj->ISA(E3dObject))
+/*?*/ b3DObject = TRUE;
+/*?*/ }
+/*?*/
+/*?*/ // Bisher: Es sind ZWEI oder mehr beliebiger Objekte selektiert.
+/*?*/ // Nachsehen, ob CompoundObjects beteiligt sind. Falls ja,
+/*?*/ // das Gruppieren verbieten.
+/*?*/ if(bGroupPossible && bCoumpound)
+/*?*/ bGroupPossible = FALSE;
+/*?*/
+/*?*/ if(bUnGroupPossible && b3DObject)
+/*?*/ bUnGroupPossible = FALSE;
+/*?*/
+/*?*/ if(bGrpEnterPossible && bCoumpound)
+/*?*/ bGrpEnterPossible = FALSE;
+/*N*/ }
+
+// bGroupPossible
+// bCombinePossible
+// bUnGroupPossible
+// bGrpEnterPossible
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_viewpt3d.cxx b/binfilter/bf_svx/source/engine3d/svx_viewpt3d.cxx
new file mode 100644
index 000000000000..fe2ddfd87b85
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_viewpt3d.cxx
@@ -0,0 +1,565 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "viewpt3d.hxx"
+
+#include "volume3d.hxx"
+
+#include "svdio.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ Viewport3D::Viewport3D() :
+/*N*/ aVRP(0, 0, 5),
+/*N*/ aVPN(0, 0, 1),
+/*N*/ aVUV(0, 1, 1),
+/*N*/ aPRP(0, 0, 2),
+/*N*/ fVPD(-3),
+/*N*/ aViewPoint (0, 0, 5000),
+/*N*/ fNearClipDist (0.0),
+/*N*/ fFarClipDist (0.0),
+/*N*/ fWRatio (1.0),
+/*N*/ fHRatio (1.0),
+/*N*/ eProjection(PR_PERSPECTIVE),
+/*N*/ eAspectMapping(AS_NO_MAPPING),
+/*N*/ bTfValid(0),
+/*N*/ // DeviceRect-Groesse < 0 -> ungueltig
+/*N*/ aDeviceRect(Point(0,0), Size(-1,-1))
+/*N*/ {
+/*N*/ aViewWin.X = -1; aViewWin.Y = -1;
+/*N*/ aViewWin.W = 2; aViewWin.H = 2;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* View-Transformationsmatrix berechnen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::MakeTransform(void)
+/*N*/ {
+/*N*/ if ( !bTfValid )
+/*N*/ {
+/*N*/ double fV, fXupVp, fYupVp;
+/*N*/ aViewPoint = aVRP + aVPN * aPRP.Z();
+/*N*/
+/*N*/ // auf Einheitsmatrix zuruecksetzen
+/*N*/ aViewTf.Identity();
+/*N*/
+/*N*/ // in den Ursprung verschieben
+/*N*/ aViewTf.Translate(-aVRP);
+/*N*/
+/*N*/ // fV = Laenge der Projektion von aVPN auf die yz-Ebene:
+/*N*/ fV = aVPN.GetYZLength();
+/*N*/
+/*N*/ if ( fV != 0 )
+/*N*/ aViewTf.RotateX(aVPN.Y() / fV, aVPN.Z() / fV);
+/*N*/
+/*N*/ aViewTf.RotateY(- aVPN.X(), fV);
+/*N*/ // X- und Y-Koordinaten des View Up Vektors in das (vorlaeufige)
+/*N*/ // View-Koordinatensytem umrechnen
+/*N*/ fXupVp = aViewTf[0][0] * aVUV[0] + aViewTf[0][1] * aVUV[1] + aViewTf[0][2] * aVUV[2];
+/*N*/ fYupVp = aViewTf[1][0] * aVUV[0] + aViewTf[1][1] * aVUV[1] + aViewTf[1][2] * aVUV[2];
+/*N*/ fV = sqrt(fXupVp * fXupVp + fYupVp * fYupVp);
+/*N*/ if ( fV != 0 )
+/*N*/ aViewTf.RotateZ(fXupVp / fV, fYupVp / fV);
+/*N*/
+/*N*/ aViewTf = Matrix4D(aViewTf);
+/*N*/ bTfValid = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ViewWindow (in View-Koordinaten) setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetViewWindow(double fX, double fY, double fW, double fH)
+/*N*/ {
+/*N*/ aViewWin.X = fX;
+/*N*/ aViewWin.Y = fY;
+/*N*/ if ( fW > 0 ) aViewWin.W = fW;
+/*N*/ else aViewWin.W = 1.0;
+/*N*/ if ( fH > 0 ) aViewWin.H = fH;
+/*N*/ else aViewWin.H = 1.0;
+/*N*/
+/*N*/ fWRatio = aDeviceRect.GetWidth() / aViewWin.W;
+/*N*/ fHRatio = aDeviceRect.GetHeight() / aViewWin.H;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ViewWindow zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* View-Window genau um das mit rTransform transformierte Volumen legen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::FitViewToVolume(const Volume3D& rVolume, Matrix4D aTransform)
+/*N*/ {
+/*N*/ Vector3D aTfVec;
+/*N*/ Volume3D aFitVol;
+/*N*/
+/*N*/ aTransform *= GetViewTransform();
+/*N*/ Vol3DPointIterator aIter(rVolume, &aTransform);
+/*N*/
+/*N*/ while ( aIter.Next(aTfVec) )
+/*N*/ {
+/*N*/ DoProjection(aTfVec);
+/*N*/ aFitVol.Union(aTfVec);
+/*N*/ }
+/*N*/ SetViewWindow(aFitVol.MinVec().X(), aFitVol.MinVec().Y(),
+/*N*/ aFitVol.GetWidth(), aFitVol.GetHeight());
+/*N*/ }
+
+/*************************************************************************
+|*
+|* DeviceWindow des Ausgabegeraetes setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetDeviceWindow(const Rectangle& rRect)
+/*N*/ {
+/*N*/ long nNewW = rRect.GetWidth();
+/*N*/ long nNewH = rRect.GetHeight();
+/*N*/ long nOldW = aDeviceRect.GetWidth();
+/*N*/ long nOldH = aDeviceRect.GetHeight();
+/*N*/
+/*N*/ switch ( eAspectMapping )
+/*N*/ {
+/*N*/ double fRatio, fTmp;
+/*N*/
+/*N*/ // Mapping, ohne die reale Groesse der Objekte im Device-Window
+/*N*/ // zu aendern
+/*N*/ case AS_HOLD_SIZE:
+/*N*/ // Wenn Device ungueltig (w, h = -1), zunaechst
+/*N*/ // View mit AsHoldX anpassen
+/*N*/ if ( nOldW > 0 && nOldH > 0 )
+/*N*/ {
+/*N*/ fRatio = (double) nNewW / nOldW;
+/*N*/ aViewWin.X *= fRatio;
+/*N*/ aViewWin.W *= fRatio;
+/*N*/ fRatio = (double) nNewH / nOldH;
+/*N*/ aViewWin.Y *= fRatio;
+/*N*/ aViewWin.H *= fRatio;
+/*N*/ break;
+/*N*/ }
+/*N*/ case AS_HOLD_X:
+/*N*/ // View-Hoehe an -Breite anpassen
+/*N*/ fRatio = (double) nNewH / nNewW;
+/*N*/ fTmp = aViewWin.H;
+/*N*/ aViewWin.H = aViewWin.W * fRatio;
+/*N*/ aViewWin.Y = aViewWin.Y * aViewWin.H / fTmp;
+/*N*/ break;
+/*N*/
+/*N*/ case AS_HOLD_Y:
+/*N*/ // View-Breite an -Hoehe anpassen
+/*N*/ fRatio = (double) nNewW / nNewH;
+/*N*/ fTmp = aViewWin.W;
+/*N*/ aViewWin.W = aViewWin.H * fRatio;
+/*N*/ aViewWin.X = aViewWin.X * aViewWin.W / fTmp;
+/*N*/ break;
+/*N*/ }
+/*N*/ fWRatio = nNewW / aViewWin.W;
+/*N*/ fHRatio = nNewH / aViewWin.H;
+/*N*/
+/*N*/ aDeviceRect = rRect;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Beobachterposition (PRP) in Weltkoordinaten zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ const Vector3D& Viewport3D::GetViewPoint()
+/*N*/ {
+/*N*/ MakeTransform();
+/*N*/
+/*N*/ return aViewPoint;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformationsmatrix zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ const Matrix4D& Viewport3D::GetViewTransform()
+/*N*/ {
+/*N*/ MakeTransform();
+/*N*/
+/*N*/ return aViewTf;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* uebergebenen Punkt transformieren
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* neuen Punkt transformiert zurueckgeben
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* 3D-Punkt auf Viewplane projizieren
+|*
+\************************************************************************/
+
+/*N*/ Vector3D& Viewport3D::DoProjection(Vector3D& rVec) const
+/*N*/ {
+/*N*/ if ( eProjection == PR_PERSPECTIVE )
+/*N*/ {
+/*N*/ double fPrDist = fVPD - aPRP.Z();
+/*N*/
+/*N*/ if ( aPRP.Z() == rVec.Z() )
+/*?*/ rVec.X() = rVec.Y() = 0;
+/*N*/ else
+/*N*/ {
+ // Das ist die Version fuer beliebigen PRP, wird aber
+ // aus Performancegruenden nicht verwendet
+/* double fZDiv = rVec.Z() / fPrDist;
+ double fZSub = 1 - fZDiv;
+ rVec.X() = (rVec.X() - aPRP.X() * fZDiv) / fZSub;
+ rVec.Y() = (rVec.Y() - aPRP.Y() * fZDiv) / fZSub;
+*/
+/*N*/ fPrDist /= rVec.Z() - aPRP.Z();
+/*N*/ rVec.X() *= fPrDist;
+/*N*/ rVec.Y() *= fPrDist;
+/*N*/ }
+/*N*/ }
+/*N*/ return rVec;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* 3D-Punkt auf Geraetekoordinaten mappen
+|*
+\************************************************************************/
+
+/*N*/ Vector3D Viewport3D::MapToDevice(const Vector3D& rVec) const
+/*N*/ {
+/*N*/ Vector3D aRetval;
+/*N*/
+/*N*/ // Y-Koordinate subtrahieren, da die Device-Y-Achse von oben
+/*N*/ // nach unten verlaeuft
+/*N*/ aRetval.X() = (double)aDeviceRect.Left() + ((rVec.X() - aViewWin.X) * fWRatio);
+/*N*/ aRetval.Y() = (double)aDeviceRect.Bottom() - ((rVec.Y() - aViewWin.Y) * fHRatio);
+/*N*/ aRetval.Z() = rVec.Z();
+/*N*/
+/*N*/ return aRetval;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* 3D-Punkt auf Viewplane projizieren und auf Geraetekoordinaten mappen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Device-Werte fuer Breite und Hoehe des Vektors in View-Werte
+|* wandeln, abhaengig von der Projektion
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* View Reference Point setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetVRP(const Vector3D& rNewVRP)
+/*N*/ {
+/*N*/ aVRP = rNewVRP;
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* View Plane Normal setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetVPN(const Vector3D& rNewVPN)
+/*N*/ {
+/*N*/ aVPN = rNewVPN;
+/*N*/ aVPN.Normalize();
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* View Up Vector setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetVUV(const Vector3D& rNewVUV)
+/*N*/ {
+/*N*/ aVUV = rNewVUV;
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Center Of Projection setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetPRP(const Vector3D& rNewPRP)
+/*N*/ {
+/*N*/ aPRP = rNewPRP;
+/*N*/ aPRP.X() = 0;
+/*N*/ aPRP.Y() = 0;
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* View Plane Distance setzen
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::SetVPD(double fNewVPD)
+/*N*/ {
+/*N*/ fVPD = fNewVPD;
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Abstand der vorderen Clippingebene setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Abstand der hinteren Clippingebene setzen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Viewport3D (Version 3.1)
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::WriteData31(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ rOut << aVRP;
+/*N*/ rOut << aVPN;
+/*N*/ rOut << aVUV;
+/*N*/ rOut << aPRP;
+/*N*/ rOut << fVPD;
+/*N*/ rOut << fNearClipDist;
+/*N*/ rOut << fFarClipDist;
+/*N*/ rOut << UINT16(eProjection);
+/*N*/ rOut << UINT16(eAspectMapping);
+/*N*/ rOut << aDeviceRect;
+/*N*/ rOut << aViewWin.X;
+/*N*/ rOut << aViewWin.Y;
+/*N*/ rOut << aViewWin.W;
+/*N*/ rOut << aViewWin.H;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Viewport3D ab File-Revision 13
+|* implementiert zum Hauptupdate 355 am 4.2.97 FG (freigegeben ab 356)
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::WriteData(SvStream& rOut) const
+/*N*/ {
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ if (rOut.GetVersion() < 3560)
+/*N*/ {
+/*N*/ Viewport3D::WriteData31(rOut);
+/*N*/ return;
+/*N*/ }
+/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("Viewport3D");
+/*N*/ #endif
+/*N*/
+/*N*/ rOut << aVRP;
+/*N*/ rOut << aVPN;
+/*N*/ rOut << aVUV;
+/*N*/ rOut << aPRP;
+/*N*/ rOut << fVPD;
+/*N*/ rOut << fNearClipDist;
+/*N*/ rOut << fFarClipDist;
+/*N*/ rOut << UINT16(eProjection);
+/*N*/ rOut << UINT16(eAspectMapping);
+/*N*/ rOut << aDeviceRect;
+/*N*/ rOut << aViewWin.X;
+/*N*/ rOut << aViewWin.Y;
+/*N*/ rOut << aViewWin.W;
+/*N*/ rOut << aViewWin.H;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Viewport3D fuer die Version 3.1
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::ReadData31(SvStream& rIn)
+/*N*/ {
+/*N*/ UINT16 nTmp16;
+/*N*/
+/*N*/ rIn >> aVRP;
+/*N*/ rIn >> aVPN;
+/*N*/ rIn >> aVUV;
+/*N*/ rIn >> aPRP;
+/*N*/ rIn >> fVPD;
+/*N*/ rIn >> fNearClipDist;
+/*N*/ rIn >> fFarClipDist;
+/*N*/ rIn >> nTmp16; eProjection = ProjectionType(nTmp16);
+/*N*/ rIn >> nTmp16; eAspectMapping = AspectMapType(nTmp16);
+/*N*/ rIn >> aDeviceRect;
+/*N*/ rIn >> aViewWin.X;
+/*N*/ rIn >> aViewWin.Y;
+/*N*/ rIn >> aViewWin.W;
+/*N*/ rIn >> aViewWin.H;
+/*N*/
+/*N*/ // es gibt einige Docs mit zweifelhaften werten, daher wird die Dist auf 0 gesetzt
+/*N*/ if ((fNearClipDist <= 1e-100) || (fNearClipDist >= 1e100)) fNearClipDist = 0.0;
+/*N*/ if ((fFarClipDist <= 1e-100) || (fFarClipDist >= 1e100)) fFarClipDist = 0.0;
+/*N*/
+/*N*/ fWRatio = aDeviceRect.GetWidth() / aViewWin.W;
+/*N*/ fHRatio = aDeviceRect.GetHeight() / aViewWin.H;
+/*N*/
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ReadData-Methode fuer Viewport3D, gueltig fuer Filerevisionen ab 13
+|* eingecheckt ab Revision 355 am 4.2.97 (FG) (freigegeben ab 356)
+|*
+\************************************************************************/
+
+/*N*/ void Viewport3D::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
+/*N*/ {
+/*N*/ if ((rHead.GetVersion() < 13) || (rIn.GetVersion() < 3560))
+/*N*/ {
+/*N*/ Viewport3D::ReadData31 (rIn);
+/*N*/ return;
+/*N*/ }
+/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ);
+/*N*/ #ifdef DBG_UTIL
+/*N*/ aCompat.SetID("Viewport3D");
+/*N*/ #endif
+/*N*/
+/*N*/ UINT16 nTmp16;
+/*N*/
+/*N*/ rIn >> aVRP;
+/*N*/ rIn >> aVPN;
+/*N*/ rIn >> aVUV;
+/*N*/ rIn >> aPRP;
+/*N*/ rIn >> fVPD;
+/*N*/ rIn >> fNearClipDist;
+/*N*/ rIn >> fFarClipDist;
+/*N*/ rIn >> nTmp16; eProjection = ProjectionType(nTmp16);
+/*N*/ rIn >> nTmp16; eAspectMapping = AspectMapType(nTmp16);
+/*N*/ rIn >> aDeviceRect;
+/*N*/ rIn >> aViewWin.X;
+/*N*/ rIn >> aViewWin.Y;
+/*N*/ rIn >> aViewWin.W;
+/*N*/ rIn >> aViewWin.H;
+/*N*/
+/*N*/ // es gibt einige Docs mit zweifelhaften werten, daher wird die Dist auf 0 gesetzt
+/*N*/ if ((fNearClipDist <= 1e-100) || (fNearClipDist >= 1e100)) fNearClipDist = 0.0;
+/*N*/ if ((fFarClipDist <= 1e-100) || (fFarClipDist >= 1e100)) fFarClipDist = 0.0;
+/*N*/
+/*N*/ fWRatio = aDeviceRect.GetWidth() / aViewWin.W;
+/*N*/ fHRatio = aDeviceRect.GetHeight() / aViewWin.H;
+/*N*/
+/*N*/ bTfValid = FALSE;
+/*N*/ }
+
+
+// FG: eigentlich sollten die Stream-Funktionen in der 3D-Engine nicht verwendet werden
+// sondern WriteData und ReadData, da man insbesondere bei ReadData einen
+// zusaetzlichen Parameter hat der die File-Revision enthaelt.
+
+/*************************************************************************
+|*
+|* Stream-Out-Operator fuer Viewport3D
+|*
+\************************************************************************/
+
+/*N*/ #ifndef SVX_LIGHT
+/*N*/ SvStream& operator<<(SvStream& rOStream, const Viewport3D& rViewpt)
+/*N*/ {
+/*N*/ rViewpt.WriteData31(rOStream);
+/*N*/ return rOStream;
+/*N*/ }
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* Stream-In-Operator fuer Viewport3D
+|*
+\************************************************************************/
+
+/*N*/ SvStream& operator>>(SvStream& rIStream, Viewport3D& rViewpt)
+/*N*/ {
+/*N*/ rViewpt.ReadData31(rIStream);
+/*N*/ return rIStream;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/engine3d/svx_volume3d.cxx b/binfilter/bf_svx/source/engine3d/svx_volume3d.cxx
new file mode 100644
index 000000000000..a6c4957c1fca
--- /dev/null
+++ b/binfilter/bf_svx/source/engine3d/svx_volume3d.cxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "poly3d.hxx"
+
+
+#include <tools/debug.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor 1: |
+|* rPos: Zentrum oder minimale Koordinate links, unten, hinten |__
+|* (abhaengig von bPosIsCenter) /
+|*
+\************************************************************************/
+
+/*N*/ Volume3D::Volume3D(const Vector3D& rPos, const Vector3D& r3DSize, BOOL bPosIsCenter)
+/*N*/ : B3dVolume(rPos, r3DSize, bPosIsCenter)
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor 2 - leeres Volumen, Werte als ungueltig markieren
+|*
+\************************************************************************/
+
+/*N*/ Volume3D::Volume3D() : B3dVolume()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Transformation des Volumens berechnen und als neues Volumen
+|* zurueckgeben
+|*
+\************************************************************************/
+
+/*N*/ Volume3D Volume3D::GetTransformVolume(const Matrix4D& rTfMatrix) const
+/*N*/ {
+/*N*/ Volume3D aTfVol;
+/*N*/
+/*N*/ if(IsValid())
+/*N*/ {
+/*N*/ Vector3D aTfVec;
+/*N*/ Vol3DPointIterator aIter(*this, &rTfMatrix);
+/*N*/
+/*N*/ while(aIter.Next(aTfVec))
+/*N*/ aTfVol.Union(aTfVec);
+/*N*/ }
+/*N*/ return aTfVol;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Drahtgitter-Linien fuer das Volumen berechnen und in rPoly3D ablegen
+|*
+\************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Konstruktor des Point-Iterators
+|*
+\************************************************************************/
+
+/*N*/ Vol3DPointIterator::Vol3DPointIterator(const Volume3D& rVol, const Matrix4D* pTf)
+/*N*/ : rVolume(rVol),
+/*N*/ pTransform(pTf),
+/*N*/ nIndex(0)
+/*N*/ {
+/*N*/ DBG_ASSERT(rVol.IsValid(), "Vol3DPointIterator-Aufruf mit ungueltigem Volume3D!");
+/*N*/ a3DExtent = rVolume.aMaxVec - rVolume.aMinVec;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Gibt die einzelnen Punkte des (ggf. transformierten) Volumens zurueck
+|*
+|* 4---5 -> Reihenfolge der Punktausgabe (untransformiert)
+|* /| /|
+|* 7---6 |
+|* | 0-|-1
+|* |/ |/
+|* 3---2
+|*
+\************************************************************************/
+
+/*N*/ BOOL Vol3DPointIterator::Next(Vector3D& rVec)
+/*N*/ {
+/*N*/ if(nIndex > 7)
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rVec = rVolume.aMinVec;
+/*N*/
+/*N*/ if(nIndex >= 4)
+/*N*/ rVec.Y() += a3DExtent.Y();
+/*N*/
+/*N*/ switch(nIndex)
+/*N*/ {
+/*N*/ case 6:
+/*N*/ case 2: rVec.Z() += a3DExtent.Z();
+/*N*/ case 5:
+/*N*/ case 1: rVec.X() += a3DExtent.X();
+/*N*/ break;
+/*N*/ case 7:
+/*N*/ case 3: rVec.Z() += a3DExtent.Z();
+/*N*/ break;
+/*N*/ }
+/*N*/ nIndex++;
+/*N*/
+/*N*/ if(pTransform)
+/*N*/ rVec *= *pTransform;
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */