summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-10-17 08:40:10 +0000
committerOliver Bolte <obo@openoffice.org>2008-10-17 08:40:10 +0000
commit1ba607ea4c2c9ecc98f7683f04a907deec565f48 (patch)
tree7dbac36954869439e14e642f0059972f9d9fcc0b
parentdb4c719a825e0c5b8d13133a1c8a33d4f3b53753 (diff)
CWS-TOOLING: integrate CWS aw057
-rw-r--r--drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx1
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx83
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx34
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx4
-rw-r--r--drawinglayer/prj/d.lst1
-rw-r--r--drawinglayer/source/attribute/materialattribute3d.cxx2
-rw-r--r--drawinglayer/source/geometry/viewinformation2d.cxx2
-rw-r--r--drawinglayer/source/geometry/viewinformation3d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/animatedprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/controlprimitive2d.cxx63
-rw-r--r--drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx22
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx30
-rw-r--r--drawinglayer/source/primitive3d/hittestprimitive3d.cxx76
-rw-r--r--drawinglayer/source/primitive3d/makefile.mk1
-rw-r--r--drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx172
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx205
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx194
-rw-r--r--drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx34
-rw-r--r--drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx158
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx1150
-rw-r--r--drawinglayer/source/processor2d/helperchartrenderer.cxx99
-rw-r--r--drawinglayer/source/processor2d/helperchartrenderer.hxx63
-rw-r--r--drawinglayer/source/processor2d/helperwrongspellrenderer.cxx100
-rw-r--r--drawinglayer/source/processor2d/helperwrongspellrenderer.hxx73
-rw-r--r--drawinglayer/source/processor2d/makefile.mk3
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx11
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.hxx3
-rw-r--r--drawinglayer/source/processor2d/vclhelpergradient.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx11
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx89
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx39
-rw-r--r--svx/inc/dragmt3d.hxx68
-rw-r--r--svx/inc/svx/cube3d.hxx16
-rw-r--r--svx/inc/svx/def3d.hxx7
-rw-r--r--svx/inc/svx/deflt3d.hxx41
-rw-r--r--svx/inc/svx/dlgctl3d.hxx360
-rw-r--r--svx/inc/svx/e3dsceneupdater.hxx77
-rw-r--r--svx/inc/svx/extrud3d.hxx13
-rw-r--r--svx/inc/svx/float3d.hxx7
-rw-r--r--svx/inc/svx/helperhittest3d.hxx113
-rw-r--r--svx/inc/svx/lathe3d.hxx18
-rw-r--r--svx/inc/svx/obj3d.hxx280
-rw-r--r--svx/inc/svx/polygn3d.hxx8
-rw-r--r--svx/inc/svx/scene3d.hxx115
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3d.hxx19
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx4
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx5
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx6
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx9
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx5
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx15
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx5
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx7
-rw-r--r--svx/inc/svx/sdr/properties/e3dsceneproperties.hxx6
-rw-r--r--svx/inc/svx/sphere3d.hxx10
-rw-r--r--svx/inc/svx/svdoashp.hxx4
-rw-r--r--svx/inc/svx/svdobj.hxx13
-rw-r--r--svx/inc/svx/svdocapt.hxx16
-rw-r--r--svx/inc/svx/svdocirc.hxx14
-rw-r--r--svx/inc/svx/svdoedge.hxx14
-rw-r--r--svx/inc/svx/svdograf.hxx6
-rw-r--r--svx/inc/svx/svdogrp.hxx4
-rw-r--r--svx/inc/svx/svdomeas.hxx14
-rw-r--r--svx/inc/svx/svdopath.hxx4
-rw-r--r--svx/inc/svx/svdorect.hxx14
-rw-r--r--svx/inc/svx/svdotable.hxx4
-rw-r--r--svx/inc/svx/svdotext.hxx4
-rw-r--r--svx/inc/svx/svdovirt.hxx4
-rw-r--r--svx/inc/svx/svx3ditems.hxx44
-rw-r--r--svx/inc/svx/viewpt3d.hxx9
-rw-r--r--svx/inc/svx/volume3d.hxx53
-rw-r--r--svx/prj/d.lst2
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx25
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.hxx6
-rw-r--r--svx/source/dialog/dlgctl3d.cxx1810
-rw-r--r--svx/source/engine3d/cube3d.cxx185
-rw-r--r--svx/source/engine3d/deflt3d.cxx6
-rw-r--r--svx/source/engine3d/dragmt3d.cxx630
-rw-r--r--svx/source/engine3d/e3dsceneupdater.cxx133
-rw-r--r--svx/source/engine3d/e3dundo.cxx25
-rw-r--r--svx/source/engine3d/extrud3d.cxx254
-rw-r--r--svx/source/engine3d/float3d.cxx247
-rw-r--r--svx/source/engine3d/helperhittest3d.cxx443
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.cxx215
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.hxx63
-rw-r--r--svx/source/engine3d/lathe3d.cxx316
-rw-r--r--svx/source/engine3d/makefile.mk5
-rw-r--r--svx/source/engine3d/obj3d.cxx2400
-rw-r--r--svx/source/engine3d/polygn3d.cxx78
-rw-r--r--svx/source/engine3d/polysc3d.cxx4
-rw-r--r--svx/source/engine3d/scene3d.cxx607
-rw-r--r--svx/source/engine3d/sphere3d.cxx252
-rw-r--r--svx/source/engine3d/view3d.cxx479
-rw-r--r--svx/source/engine3d/view3d1.cxx45
-rw-r--r--svx/source/engine3d/viewpt3d.cxx26
-rw-r--r--svx/source/engine3d/volume3d.cxx235
-rw-r--r--svx/source/msfilter/msashape3d.cxx7
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx10
-rw-r--r--svx/source/sdr/contact/objectcontacttools.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofe3d.cxx113
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dcube.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dextrude.cxx9
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx9
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dscene.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dsphere.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx39
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx8
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx18
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontact.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx65
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx254
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx76
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx77
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx16
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx7
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx13
-rw-r--r--svx/source/sdr/properties/e3dcompoundproperties.cxx14
-rw-r--r--svx/source/sdr/properties/e3dextrudeproperties.cxx8
-rw-r--r--svx/source/sdr/properties/e3dlatheproperties.cxx12
-rw-r--r--svx/source/sdr/properties/e3dproperties.cxx4
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx185
-rw-r--r--svx/source/sdr/properties/e3dsphereproperties.cxx6
-rw-r--r--svx/source/svdraw/gradtrns.cxx7
-rw-r--r--svx/source/svdraw/svdcrtv.cxx77
-rw-r--r--svx/source/svdraw/svddrgv.cxx257
-rw-r--r--svx/source/svdraw/svdedtv.cxx72
-rw-r--r--svx/source/svdraw/svdedtv1.cxx105
-rw-r--r--svx/source/svdraw/svdetc.cxx9
-rw-r--r--svx/source/svdraw/svdhdl.cxx167
-rw-r--r--svx/source/svdraw/svdmrkv.cxx8
-rw-r--r--svx/source/svdraw/svdoashp.cxx15
-rw-r--r--svx/source/svdraw/svdoattr.cxx5
-rw-r--r--svx/source/svdraw/svdobj.cxx120
-rw-r--r--svx/source/svdraw/svdocapt.cxx6
-rw-r--r--svx/source/svdraw/svdocirc.cxx4
-rw-r--r--svx/source/svdraw/svdoedge.cxx4
-rw-r--r--svx/source/svdraw/svdograf.cxx14
-rw-r--r--svx/source/svdraw/svdogrp.cxx10
-rw-r--r--svx/source/svdraw/svdomeas.cxx6
-rw-r--r--svx/source/svdraw/svdopath.cxx4
-rw-r--r--svx/source/svdraw/svdorect.cxx4
-rw-r--r--svx/source/svdraw/svdotext.cxx6
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx16
-rw-r--r--svx/source/svdraw/svdovirt.cxx6
-rw-r--r--svx/source/svdraw/svdundo.cxx44
-rw-r--r--svx/source/svdraw/svdview.cxx4
-rw-r--r--svx/source/svdraw/svdxcgv.cxx5
-rw-r--r--svx/source/table/svdotable.cxx6
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx4
-rw-r--r--svx/source/unodraw/unopage.cxx11
-rw-r--r--svx/source/unodraw/unoshap3.cxx12
-rw-r--r--svx/source/unodraw/unoshape.cxx10
166 files changed, 6396 insertions, 8311 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx
index f42e14ed4c..0d226dbd88 100644
--- a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx
+++ b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx
@@ -41,7 +41,7 @@
//////////////////////////////////////////////////////////////////////////////
// predefines
-namespace drawinglayer { namespace {
+namespace drawinglayer { namespace attribute {
class ImpMaterialAttribute3D;
}}
diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
index cf69c34289..3fc837e97c 100644
--- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
+++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
@@ -47,7 +47,7 @@
//////////////////////////////////////////////////////////////////////////////
// predefines
-namespace drawinglayer { namespace {
+namespace drawinglayer { namespace geometry {
class ImpViewInformation2D;
}}
diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
index 5fb66295b7..df26bee592 100644
--- a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
+++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
@@ -46,7 +46,7 @@
//////////////////////////////////////////////////////////////////////////////
// predefines
-namespace drawinglayer { namespace {
+namespace drawinglayer { namespace geometry {
class ImpViewInformation3D;
}}
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx
index 49dc065303..b7e36f822e 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx
@@ -129,7 +129,7 @@ namespace drawinglayer
namespace drawinglayer
{
- namespace
+ namespace primitive2d
{
class BufferedMatrixDecompose
{
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
index 2458433489..ec367665af 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
@@ -63,6 +63,7 @@
#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE3D_ID_HITTESTPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx
new file mode 100644
index 0000000000..3b0b17dc5d
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hittestprimitive3d.hxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a 3D cube without fill attributes. To still be able to use
+ // primitives for HitTest functionality, the 3d decompositions produce
+ // an as much as possible simplified fill geometry encapsulated in this
+ // primtive when there is no fill geometry. Currently, the 3d hit test
+ // uses only areas, so maybe in a further enchanced version this will change
+ // to 'if neither filled nor lines' creation criteria. The whole primitive
+ // decomposes to nothing, so no one not knowing it will be influenced. Only
+ // helper processors for hit test (and maybe BoundRect extractors) will
+ // use it and it's children subcontent.
+ class HitTestPrimitive3D : public GroupPrimitive3D
+ {
+ protected:
+ // local decomposition. Implementation will return empty Primitive3DSequence
+ // since this is no visualisation data
+ virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ HitTestPrimitive3D(const Primitive3DSequence& rChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use invisible replacement geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
index d682a8bc45..55760b13a7 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
@@ -44,6 +44,7 @@
#include <com/sun/star/rendering/RenderState.hpp>
#include <i18npool/lang.h>
#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/mapmod.hxx>
//////////////////////////////////////////////////////////////////////////////
// forward declaration
@@ -58,6 +59,17 @@ namespace com { namespace sun { namespace star { namespace rendering {
class XPolyPolygon2D;
}}}}
+namespace drawinglayer { namespace primitive2d {
+ class MaskPrimitive2D;
+ class MetafilePrimitive2D;
+ class TextSimplePortionPrimitive2D;
+ class BitmapPrimitive2D;
+ class AlphaPrimitive2D;
+ class PolygonStrokePrimitive2D;
+ class FillBitmapPrimitive2D;
+ class UnifiedAlphaPrimitive2D;
+}}
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -67,7 +79,12 @@ namespace drawinglayer
class canvasProcessor2D : public BaseProcessor2D
{
private:
- // the destination canvas
+ // The Pixel renderer resets the original MapMode from the OutputDevice.
+ // For some situations it is necessary to get it again, so it is rescued here
+ MapMode maOriginalMapMode;
+
+ // the (current) destination OutDev and canvas
+ OutputDevice* mpOutputDevice;
com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas;
com::sun::star::rendering::ViewState maViewState;
com::sun::star::rendering::RenderState maRenderState;
@@ -78,7 +95,8 @@ namespace drawinglayer
// SvtOptionsDrawinglayer incarnation to react on diverse settings
const SvtOptionsDrawinglayer maDrawinglayerOpt;
- // the current clipping PolyPolygon from MaskPrimitive2D
+ // the current clipping PolyPolygon from MaskPrimitive2D, always in
+ // object coordinates
basegfx::B2DPolyPolygon maClipPolyPolygon;
// determined LanguageType
@@ -88,10 +106,20 @@ namespace drawinglayer
// virtual render method when the primitive implementation is BasePrimitive2D-based.
virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+ // direct primitive renderer support
+ void impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate);
+ void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
+ void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
+ void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate);
+ void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
+ void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
+ void impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate);
+
public:
canvasProcessor2D(
const geometry::ViewInformation2D& rViewInformation,
- const com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas >& rCanvas);
+ OutputDevice& rOutDev);
virtual ~canvasProcessor2D();
// access to Drawinglayer configuration options
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
index e53078e62d..e38542fa5b 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -59,11 +59,9 @@ namespace drawinglayer { namespace primitive2d {
class MarkerArrayPrimitive2D;
class PointArrayPrimitive2D;
class ModifiedColorPrimitive2D;
- class WrongSpellPrimitive2D;
class PolygonStrokePrimitive2D;
class ControlPrimitive2D;
class PagePreviewPrimitive2D;
- class ChartPrimitive2D;
}}
//////////////////////////////////////////////////////////////////////////////
@@ -110,9 +108,7 @@ namespace drawinglayer
void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate);
void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate);
void RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate);
- void RenderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& rWrongSpellCandidate);
void RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate);
- void RenderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate);
/////////////////////////////////////////////////////////////////////////////
// DrawMode adaption support
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 373bf575f9..3e3055d73c 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -50,6 +50,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d
..\inc\drawinglayer\primitive3d\baseprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\baseprimitive3d.hxx
..\inc\drawinglayer\primitive3d\groupprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\groupprimitive3d.hxx
..\inc\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx
+..\inc\drawinglayer\primitive3d\hittestprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hittestprimitive3d.hxx
..\inc\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx
..\inc\drawinglayer\primitive3d\polygonprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygonprimitive3d.hxx
..\inc\drawinglayer\primitive3d\polygontubeprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygontubeprimitive3d.hxx
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx
index a95b9728d4..b030017780 100644
--- a/drawinglayer/source/attribute/materialattribute3d.cxx
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -43,7 +43,7 @@
namespace drawinglayer
{
- namespace
+ namespace attribute
{
class ImpMaterialAttribute3D
{
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx
index 94e1d0452d..e697540772 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -52,7 +52,7 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace
+ namespace geometry
{
class ImpViewInformation2D
{
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx
index 1530006299..8925fb3bb6 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -51,7 +51,7 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace
+ namespace geometry
{
/** Implementation class for ViewInformation3D
*/
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 6b74b7c3dd..f935f5b5b3 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -176,7 +176,7 @@ namespace drawinglayer
namespace drawinglayer
{
- namespace
+ namespace primitive2d
{
BufferedMatrixDecompose::BufferedMatrixDecompose(const basegfx::B2DHomMatrix& rMatrix)
: maB2DHomMatrix(rMatrix),
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 0fc0d15257..5fc261a79e 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -52,6 +52,8 @@
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <svtools/optionsdrawinglayer.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/window.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -118,13 +120,6 @@ namespace drawinglayer
aScale = basegfx::absolute(aScale);
basegfx::B2DVector aDiscreteSize(rViewInformation.getObjectToViewTransformation() * aScale);
- // calc screen zoom for text display
- basegfx::B2DVector aScreenZoom(
- basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : aDiscreteSize.getX() / aScale.getX(),
- basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : aDiscreteSize.getY() / aScale.getY());
- static double fZoomScale(26.0); // do not ask for this constant factor, but it gets the zoom right
- aScreenZoom *= fZoomScale;
-
// limit to a maximum square size, e.g. 300x150 pixels (45000)
const SvtOptionsDrawinglayer aDrawinglayerOpt;
const double fDiscreteMax(aDrawinglayerOpt.GetQuadraticFormControlRenderLimit());
@@ -137,7 +132,6 @@ namespace drawinglayer
// get factor and adapt to scaled size
fFactor = sqrt(fDiscreteMax / fDiscreteQuadratic);
aDiscreteSize *= fFactor;
- aScreenZoom *= fFactor;
}
// go to integer
@@ -163,8 +157,57 @@ namespace drawinglayer
// link graphics and view
xControlView->setGraphics(xGraphics);
- // set zoom at control view for text scaling
- xControlView->setZoom((float)aScreenZoom.getX(), (float)aScreenZoom.getY());
+ { // #i93162# For painting the control setting a Zoom (using setZoom() at the xControlView)
+ // is needed to define the font size. Normally this is done in
+ // ViewObjectContactOfUnoControl::createPrimitive2DSequence by using positionControlForPaint().
+ // For some reason the difference between MAP_TWIPS and MAP_100TH_MM still plays
+ // a role there so that for Draw/Impress/Calc (the MAP_100TH_MM users) i need to set a zoom
+ // here, too. The factor includes the needed scale, but is calculated by pure comparisons. It
+ // is somehow related to the twips/100thmm relationship.
+ bool bUserIs100thmm(false);
+ const uno::Reference< awt::XControl > xControl(xControlView, uno::UNO_QUERY);
+
+ if(xControl.is())
+ {
+ uno::Reference< awt::XWindowPeer > xWindowPeer(xControl->getPeer());
+
+ if(xWindowPeer.is())
+ {
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation(xWindowPeer);
+
+ if(pVCLXWindow)
+ {
+ Window* pWindow = pVCLXWindow->GetWindow();
+
+ if(pWindow)
+ {
+ pWindow = pWindow->GetParent();
+
+ if(pWindow)
+ {
+ if(MAP_100TH_MM == pWindow->GetMapMode().GetMapUnit())
+ {
+ bUserIs100thmm = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(bUserIs100thmm)
+ {
+ // calc screen zoom for text display. fFactor is already added indirectly in aDiscreteSize
+ basegfx::B2DVector aScreenZoom(
+ basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : aDiscreteSize.getX() / aScale.getX(),
+ basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : aDiscreteSize.getY() / aScale.getY());
+ static double fZoomScale(28.0); // do not ask for this constant factor, but it gets the zoom right
+ aScreenZoom *= fZoomScale;
+
+ // set zoom at control view for text scaling
+ xControlView->setZoom((float)aScreenZoom.getX(), (float)aScreenZoom.getY());
+ }
+ }
try
{
diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
index 9917d7c143..94dc5b464f 100644
--- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
@@ -336,10 +336,11 @@ namespace drawinglayer
{
namespace primitive2d
{
- Primitive2DSequence PolyPolygonGradientPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DSequence PolyPolygonGradientPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
// create SubSequence with FillGradientPrimitive2D
- FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(getB2DRange(rViewInformation), getFillGradient());
+ const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+ FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
const Primitive2DReference xSubRef(pNewGradient);
const Primitive2DSequence aSubSequence(&xSubRef, 1L);
@@ -382,10 +383,11 @@ namespace drawinglayer
{
namespace primitive2d
{
- Primitive2DSequence PolyPolygonHatchPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DSequence PolyPolygonHatchPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
// create SubSequence with FillHatchPrimitive2D
- FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(getB2DRange(rViewInformation), getBColor(), getFillHatch());
+ const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+ FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBColor(), getFillHatch());
const Primitive2DReference xSubRef(pNewHatch);
const Primitive2DSequence aSubSequence(&xSubRef, 1L);
@@ -428,15 +430,15 @@ namespace drawinglayer
{
namespace primitive2d
{
- Primitive2DSequence PolyPolygonBitmapPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DSequence PolyPolygonBitmapPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
// create SubSequence with FillBitmapPrimitive2D
- const basegfx::B2DRange aOwnRange(getB2DRange(rViewInformation));
+ const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
basegfx::B2DHomMatrix aNewObjectTransform;
- aNewObjectTransform.set(0, 0, aOwnRange.getWidth());
- aNewObjectTransform.set(1, 1, aOwnRange.getHeight());
- aNewObjectTransform.set(0, 2, aOwnRange.getMinX());
- aNewObjectTransform.set(1, 2, aOwnRange.getMinY());
+ aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth());
+ aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight());
+ aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX());
+ aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY());
FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap());
const Primitive2DReference xSubRef(pNewBitmap);
const Primitive2DSequence aSubSequence(&xSubRef, 1L);
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 4858a77b0a..27eeeeabde 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -278,12 +278,8 @@ namespace drawinglayer
double fFontScaleX,
double fFontScaleY,
double fFontRotation,
- const OutputDevice& rOutDev)
+ const OutputDevice& /*rOutDev*/)
{
-#ifndef WIN32
- // not used under unix, but reference for warning-free
- (void)rOutDev;
-#endif
sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX)));
sal_uInt32 nHeight(basegfx::fround(fabs(fFontScaleY)));
Font aRetval(
@@ -305,10 +301,26 @@ namespace drawinglayer
#ifdef WIN32
if(nWidth != nHeight)
{
- const FontMetric aFontMetric(rOutDev.GetFontMetric(aRetval));
- const double fCurrentWidth(aFontMetric.GetWidth());
-
- aRetval.SetWidth(basegfx::fround(fCurrentWidth * (nWidth/nHeight)));
+ // #i92757#
+ // Removed the relative calculation with GetFontMetric() usage again. On
+ // the one hand it was wrong (integer division always created zero), OTOH
+ // calculating a scale factor from current to target width and then using
+ // it to actually scale the current width does nothing but set the target
+ // value directly. Maybe more is needed here with WIN version of font
+ // width/height handling, but currently, this works the simple way.
+ //
+ // As can be seen, when this can stay the simple way, the OutputDevice
+ // can be removed from the whole getVclFontFromFontAttributes implementations
+ // again and make it more VCL-independent.
+ //
+ // Adapted nWidth usage to nWidth-1 to be completely compatible with
+ // non-primitive version.
+ //
+ // previous stuff:
+ // const FontMetric aFontMetric(rOutDev.GetFontMetric(aRetval));
+ // const double fCurrentWidth(aFontMetric.GetWidth());
+ // aRetval.SetWidth(basegfx::fround(fCurrentWidth * ((double)nWidth/(double)nHeight)));
+ aRetval.SetWidth(nWidth ? nWidth - 1 : 0);
}
#endif
diff --git a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx
new file mode 100644
index 0000000000..b74d9d01c2
--- /dev/null
+++ b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hittestprimitive3d.cxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ Primitive3DSequence HitTestPrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
+ {
+ // return empty sequence
+ return Primitive3DSequence();
+ }
+
+ HitTestPrimitive3D::HitTestPrimitive3D(
+ const Primitive3DSequence& rChildren)
+ : GroupPrimitive3D(rChildren)
+ {
+ }
+
+ basegfx::B3DRange HitTestPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const
+ {
+ return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation);
+ }
+
+ // provide unique ID
+ ImplPrimitrive3DIDBlock(HitTestPrimitive3D, PRIMITIVE3D_ID_HITTESTPRIMITIVE3D)
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk
index 325155995a..fb160fb9bf 100644
--- a/drawinglayer/source/primitive3d/makefile.mk
+++ b/drawinglayer/source/primitive3d/makefile.mk
@@ -48,6 +48,7 @@ SLOFILES= \
$(SLO)$/baseprimitive3d.obj \
$(SLO)$/groupprimitive3d.obj \
$(SLO)$/hatchtextureprimitive3d.obj \
+ $(SLO)$/hittestprimitive3d.obj \
$(SLO)$/modifiedcolorprimitive3d.obj \
$(SLO)$/polypolygonprimitive3d.obj \
$(SLO)$/polygonprimitive3d.obj \
diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
index 307c61ca74..25c53a8257 100644
--- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
@@ -43,6 +43,8 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -58,107 +60,127 @@ namespace drawinglayer
{
const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
Primitive3DSequence aRetval;
+ basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange));
- // add fill
+ // normal creation
if(getSdrLFSAttribute().getFill())
{
- basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange));
-
- // normal creation
+ if(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()
+ || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
{
- if(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()
- || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
- {
- // create sphere normals
- const basegfx::B3DPoint aCenter(basegfx::tools::getRange(aFill).getCenter());
- aFill = basegfx::tools::applyDefaultNormalsSphere(aFill, aCenter);
- }
-
- if(getSdr3DObjectAttribute().getNormalsInvert())
- {
- // invert normals
- aFill = basegfx::tools::invertNormals(aFill);
- }
+ // create sphere normals
+ const basegfx::B3DPoint aCenter(basegfx::tools::getRange(aFill).getCenter());
+ aFill = basegfx::tools::applyDefaultNormalsSphere(aFill, aCenter);
}
- // texture coordinates
+ if(getSdr3DObjectAttribute().getNormalsInvert())
{
- // handle texture coordinates X
- const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bObjectSpecificX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
+ // invert normals
+ aFill = basegfx::tools::invertNormals(aFill);
+ }
+ }
- // handle texture coordinates Y
- const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bObjectSpecificY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
+ // texture coordinates
+ if(getSdrLFSAttribute().getFill())
+ {
+ // handle texture coordinates X
+ const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bObjectSpecificX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
- if(bParallelX || bParallelY)
- {
- // apply parallel texture coordinates in X and/or Y
- const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
- aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY);
- }
+ // handle texture coordinates Y
+ const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bObjectSpecificY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
- if(bSphereX || bSphereY)
- {
- // apply spherical texture coordinates in X and/or Y
- const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
- const basegfx::B3DPoint aCenter(aRange.getCenter());
- aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, bSphereX, bSphereY);
- }
-
- if(bObjectSpecificX || bObjectSpecificY)
+ if(bParallelX || bParallelY)
+ {
+ // apply parallel texture coordinates in X and/or Y
+ const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
+ aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY);
+ }
+
+ if(bSphereX || bSphereY)
+ {
+ // apply spherical texture coordinates in X and/or Y
+ const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
+ aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, bSphereX, bSphereY);
+ }
+
+ if(bObjectSpecificX || bObjectSpecificY)
+ {
+ // object-specific
+ for(sal_uInt32 a(0L); a < aFill.count(); a++)
{
- // object-specific
- for(sal_uInt32 a(0L); a < aFill.count(); a++)
- {
- basegfx::B3DPolygon aTmpPoly(aFill.getB3DPolygon(a));
+ basegfx::B3DPolygon aTmpPoly(aFill.getB3DPolygon(a));
- if(aTmpPoly.count() >= 4L)
+ if(aTmpPoly.count() >= 4L)
+ {
+ for(sal_uInt32 b(0L); b < 4L; b++)
{
- for(sal_uInt32 b(0L); b < 4L; b++)
+ basegfx::B2DPoint aPoint(aTmpPoly.getTextureCoordinate(b));
+
+ if(bObjectSpecificX)
+ {
+ aPoint.setX((1L == b || 2L == b) ? 1.0 : 0.0);
+ }
+
+ if(bObjectSpecificY)
{
- basegfx::B2DPoint aPoint(aTmpPoly.getTextureCoordinate(b));
-
- if(bObjectSpecificX)
- {
- aPoint.setX((1L == b || 2L == b) ? 1.0 : 0.0);
- }
-
- if(bObjectSpecificY)
- {
- aPoint.setY((2L == b || 3L == b) ? 1.0 : 0.0);
- }
-
- aTmpPoly.setTextureCoordinate(b, aPoint);
+ aPoint.setY((2L == b || 3L == b) ? 1.0 : 0.0);
}
- aFill.setB3DPolygon(a, aTmpPoly);
+ aTmpPoly.setTextureCoordinate(b, aPoint);
}
+
+ aFill.setB3DPolygon(a, aTmpPoly);
}
}
-
- // transform texture coordinates to texture size
- basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
- aFill.transformTextureCoordiantes(aTexMatrix);
}
- // build vector of PolyPolygons
- ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector;
+ // transform texture coordinates to texture size
+ basegfx::B2DHomMatrix aTexMatrix;
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+ aFill.transformTextureCoordiantes(aTexMatrix);
+ }
- for(sal_uInt32 a(0L); a < aFill.count(); a++)
- {
- a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
- }
+ // build vector of PolyPolygons
+ ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector;
- // create single PolyPolygonFill primitives
+ for(sal_uInt32 a(0L); a < aFill.count(); a++)
+ {
+ a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
+ }
+
+ if(getSdrLFSAttribute().getFill())
+ {
+ // add fill
aRetval = create3DPolyPolygonFillPrimitives(
- a3DPolyPolygonVector, getTransform(), getTextureSize(),
- getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ a3DPolyPolygonVector,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
+ else
+ {
+ // create simplified 3d hit test geometry
+ const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0);
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ a3DPolyPolygonVector,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ aSimplifiedFillAttribute,
+ 0);
+
+ // encapsulate in HitTestPrimitive3D and add
+ const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
+ }
// add line
if(getSdrLFSAttribute().getLine())
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index 5403c30846..03e2d8566f 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -44,6 +44,8 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -64,128 +66,149 @@ namespace drawinglayer
if(rSliceVector.size())
{
- // add fill
- if(getSdrLFSAttribute().getFill())
- {
- sal_uInt32 a;
- basegfx::B3DRange aRange;
+ sal_uInt32 a;
+ basegfx::B3DRange aRange;
- // decide what to create
- const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind());
- const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
- double fRelativeTextureWidth(1.0);
- basegfx::B2DHomMatrix aTexTransform;
+ // decide what to create
+ const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind());
+ const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
+ double fRelativeTextureWidth(1.0);
+ basegfx::B2DHomMatrix aTexTransform;
- if(bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)
+ if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY))
+ {
+ const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L));
+ const double fFrontLength(basegfx::tools::getLength(aFirstPolygon));
+ const double fFrontArea(basegfx::tools::getArea(aFirstPolygon));
+ const double fSqrtFrontArea(sqrt(fFrontArea));
+ fRelativeTextureWidth = basegfx::fTools::equalZero(fSqrtFrontArea) ? 1.0 : fFrontLength / fSqrtFrontArea;
+ fRelativeTextureWidth = (double)((sal_uInt32)(fRelativeTextureWidth - 0.5));
+
+ if(fRelativeTextureWidth < 1.0)
{
- const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L));
- const double fFrontLength(basegfx::tools::getLength(aFirstPolygon));
- const double fFrontArea(basegfx::tools::getArea(aFirstPolygon));
- const double fSqrtFrontArea(sqrt(fFrontArea));
- fRelativeTextureWidth = basegfx::fTools::equalZero(fSqrtFrontArea) ? 1.0 : fFrontLength / fSqrtFrontArea;
- fRelativeTextureWidth = (double)((sal_uInt32)(fRelativeTextureWidth - 0.5));
-
- if(fRelativeTextureWidth < 1.0)
- {
- fRelativeTextureWidth = 1.0;
- }
-
- aTexTransform.translate(-0.5, -0.5);
- aTexTransform.scale(-1.0, -1.0);
- aTexTransform.translate(0.5, 0.5);
- aTexTransform.scale(fRelativeTextureWidth, 1.0);
+ fRelativeTextureWidth = 1.0;
}
- // create geometry
- ::std::vector< basegfx::B3DPolyPolygon > aFill;
- extractPlanesFromSlice(aFill, rSliceVector,
- bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), false,
- 0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
+ aTexTransform.translate(-0.5, -0.5);
+ aTexTransform.scale(-1.0, -1.0);
+ aTexTransform.translate(0.5, 0.5);
+ aTexTransform.scale(fRelativeTextureWidth, 1.0);
+ }
- // get full range
- for(a = 0L; a < aFill.size(); a++)
- {
- aRange.expand(basegfx::tools::getRange(aFill[a]));
- }
+ // create geometry
+ ::std::vector< basegfx::B3DPolyPolygon > aFill;
+ extractPlanesFromSlice(aFill, rSliceVector,
+ bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), false,
+ 0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
- // normal creation
+ // get full range
+ for(a = 0L; a < aFill.size(); a++)
+ {
+ aRange.expand(basegfx::tools::getRange(aFill[a]));
+ }
+
+ // normal creation
+ if(getSdrLFSAttribute().getFill())
+ {
+ if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
{
- if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
- {
- // create sphere normals
- const basegfx::B3DPoint aCenter(aRange.getCenter());
+ // create sphere normals
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter);
- }
- }
- else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
+ for(a = 0L; a < aFill.size(); a++)
{
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a].clearNormals();
- }
+ aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter);
}
-
- if(getSdr3DObjectAttribute().getNormalsInvert())
+ }
+ else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
+ {
+ for(a = 0L; a < aFill.size(); a++)
{
- // invert normals
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::invertNormals(aFill[a]);
- }
+ aFill[a].clearNormals();
}
}
- // texture coordinates
+ if(getSdr3DObjectAttribute().getNormalsInvert())
{
- // handle texture coordinates X
- const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
+ // invert normals
+ for(a = 0L; a < aFill.size(); a++)
+ {
+ aFill[a] = basegfx::tools::invertNormals(aFill[a]);
+ }
+ }
+ }
- // handle texture coordinates Y
- const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
+ // texture coordinates
+ if(getSdrLFSAttribute().getFill())
+ {
+ // handle texture coordinates X
+ const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
- if(bParallelX || bParallelY)
- {
- // apply parallel texture coordinates in X and/or Y
+ // handle texture coordinates Y
+ const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY);
- }
- }
+ if(bParallelX || bParallelY)
+ {
+ // apply parallel texture coordinates in X and/or Y
- if(bSphereX || bSphereY)
+ for(a = 0L; a < aFill.size(); a++)
{
- // apply spherical texture coordinates in X and/or Y
- const basegfx::B3DPoint aCenter(aRange.getCenter());
-
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY);
- }
+ aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY);
}
+ }
- // transform texture coordinates to texture size
- basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+ if(bSphereX || bSphereY)
+ {
+ // apply spherical texture coordinates in X and/or Y
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
for(a = 0L; a < aFill.size(); a++)
{
- aFill[a].transformTextureCoordiantes(aTexMatrix);
+ aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY);
}
}
- // create single PolyPolygonFill primitives
+ // transform texture coordinates to texture size
+ basegfx::B2DHomMatrix aTexMatrix;
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+
+ for(a = 0L; a < aFill.size(); a++)
+ {
+ aFill[a].transformTextureCoordiantes(aTexMatrix);
+ }
+ }
+
+ if(getSdrLFSAttribute().getFill())
+ {
+ // add fill
aRetval = create3DPolyPolygonFillPrimitives(
- aFill, getTransform(), getTextureSize(),
- getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
+ else
+ {
+ // create simplified 3d hit test geometry
+ const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0);
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ aSimplifiedFillAttribute,
+ 0);
+
+ // encapsulate in HitTestPrimitive3D and add
+ const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
+ }
// add line
if(getSdrLFSAttribute().getLine())
@@ -200,7 +223,7 @@ namespace drawinglayer
// sort out doubles (front and back planes when no edge rounding is done). Since
// this is a line geometry merged from PolyPolygons, loop over all Polygons
- for(sal_uInt32 a(0); a < nCount; a++)
+ for(a = 0; a < nCount; a++)
{
const sal_uInt32 nReducedCount(aReducedLoops.count());
const basegfx::B3DPolygon aCandidate(aVerLine.getB3DPolygon(a));
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index cc564a715d..b77e4ee8ec 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -44,6 +44,8 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -66,120 +68,140 @@ namespace drawinglayer
{
const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0));
const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI));
+ sal_uInt32 a;
+ basegfx::B3DRange aRange;
- // add fill
- if(getSdrLFSAttribute().getFill())
+ // decide what to create
+ const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind());
+ const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
+ basegfx::B2DHomMatrix aTexTransform;
+
+ if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY))
{
- sal_uInt32 a;
- basegfx::B3DRange aRange;
+ aTexTransform.set(0, 0, 0.0);
+ aTexTransform.set(0, 1, 1.0);
+ aTexTransform.set(1, 0, 1.0);
+ aTexTransform.set(1, 1, 0.0);
+
+ aTexTransform.translate(0.0, -0.5);
+ aTexTransform.scale(1.0, -1.0);
+ aTexTransform.translate(0.0, 0.5);
+ }
- // decide what to create
- const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind());
- const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
- basegfx::B2DHomMatrix aTexTransform;
+ // create geometry
+ ::std::vector< basegfx::B3DPolyPolygon > aFill;
+ extractPlanesFromSlice(aFill, rSliceVector,
+ bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), bClosedRotation,
+ 0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
- if(bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)
- {
- aTexTransform.set(0, 0, 0.0);
- aTexTransform.set(0, 1, 1.0);
- aTexTransform.set(1, 0, 1.0);
- aTexTransform.set(1, 1, 0.0);
-
- aTexTransform.translate(0.0, -0.5);
- aTexTransform.scale(1.0, -1.0);
- aTexTransform.translate(0.0, 0.5);
- }
-
- // create geometry
- ::std::vector< basegfx::B3DPolyPolygon > aFill;
- extractPlanesFromSlice(aFill, rSliceVector,
- bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), bClosedRotation,
- 0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
+ // get full range
+ for(a = 0L; a < aFill.size(); a++)
+ {
+ aRange.expand(basegfx::tools::getRange(aFill[a]));
+ }
- // get full range
- for(a = 0L; a < aFill.size(); a++)
+ // normal creation
+ if(getSdrLFSAttribute().getFill())
+ {
+ if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
{
- aRange.expand(basegfx::tools::getRange(aFill[a]));
- }
+ // create sphere normals
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
- // normal creation
- {
- if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
+ for(a = 0L; a < aFill.size(); a++)
{
- // create sphere normals
- const basegfx::B3DPoint aCenter(aRange.getCenter());
-
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter);
- }
+ aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter);
}
- else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
+ }
+ else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
+ {
+ for(a = 0L; a < aFill.size(); a++)
{
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a].clearNormals();
- }
+ aFill[a].clearNormals();
}
+ }
- if(getSdr3DObjectAttribute().getNormalsInvert())
+ if(getSdr3DObjectAttribute().getNormalsInvert())
+ {
+ // invert normals
+ for(a = 0L; a < aFill.size(); a++)
{
- // invert normals
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::invertNormals(aFill[a]);
- }
+ aFill[a] = basegfx::tools::invertNormals(aFill[a]);
}
}
+ }
- // texture coordinates
- {
- // handle texture coordinates X
- const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
-
- // handle texture coordinates Y
- const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
+ // texture coordinates
+ if(getSdrLFSAttribute().getFill())
+ {
+ // handle texture coordinates X
+ const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
- if(bParallelX || bParallelY)
- {
- // apply parallel texture coordinates in X and/or Y
+ // handle texture coordinates Y
+ const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY);
- }
- }
+ if(bParallelX || bParallelY)
+ {
+ // apply parallel texture coordinates in X and/or Y
- if(bSphereX || bSphereY)
+ for(a = 0L; a < aFill.size(); a++)
{
- // apply spherical texture coordinates in X and/or Y
- const basegfx::B3DPoint aCenter(aRange.getCenter());
-
- for(a = 0L; a < aFill.size(); a++)
- {
- aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY);
- }
+ aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY);
}
+ }
- // transform texture coordinates to texture size
- basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+ if(bSphereX || bSphereY)
+ {
+ // apply spherical texture coordinates in X and/or Y
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
for(a = 0L; a < aFill.size(); a++)
{
- aFill[a].transformTextureCoordiantes(aTexMatrix);
+ aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY);
}
}
- // create single PolyPolygonFill primitives
+ // transform texture coordinates to texture size
+ basegfx::B2DHomMatrix aTexMatrix;
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+
+ for(a = 0L; a < aFill.size(); a++)
+ {
+ aFill[a].transformTextureCoordiantes(aTexMatrix);
+ }
+ }
+
+ if(getSdrLFSAttribute().getFill())
+ {
+ // add fill
aRetval = create3DPolyPolygonFillPrimitives(
- aFill, getTransform(), getTextureSize(),
- getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
+ else
+ {
+ // create simplified 3d hit test geometry
+ const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0);
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ aSimplifiedFillAttribute,
+ 0);
+
+ // encapsulate in HitTestPrimitive3D and add
+ const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
+ }
// add line
if(getSdrLFSAttribute().getLine())
@@ -191,7 +213,7 @@ namespace drawinglayer
const sal_uInt32 nCount(aHorLine.count());
basegfx::B3DPolyPolygon aNewLineGeometry;
- for(sal_uInt32 a(1); a < nCount; a++)
+ for(a = 1; a < nCount; a++)
{
// for each loop pair create the connection edges
createReducedOutlines(
@@ -202,10 +224,10 @@ namespace drawinglayer
aNewLineGeometry);
}
- for(sal_uInt32 b(0); b < nCount; b++)
+ for(a = 0; a < nCount; a++)
{
// filter hor lines for empty loops (those who have their defining point on the Y-Axis)
- basegfx::B3DPolygon aCandidate(aHorLine.getB3DPolygon(b));
+ basegfx::B3DPolygon aCandidate(aHorLine.getB3DPolygon(a));
aCandidate.removeDoublePoints();
if(aCandidate.count())
diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
index 743ef8096f..6dd85df171 100644
--- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
@@ -41,6 +41,7 @@
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <drawinglayer/attribute/sdrattribute.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -58,18 +59,37 @@ namespace drawinglayer
if(getPolyPolygon3D().count())
{
- // add fill
+ ::std::vector< basegfx::B3DPolyPolygon > aFill;
+ aFill.push_back(getPolyPolygon3D());
+
if(getSdrLFSAttribute().getFill())
{
- // create single PolyPolygonFill primitives
- ::std::vector< basegfx::B3DPolyPolygon > aFill;
- aFill.push_back(getPolyPolygon3D());
-
+ // add fill
aRetval = create3DPolyPolygonFillPrimitives(
- aFill, getTransform(), getTextureSize(),
- getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
+ else
+ {
+ // create simplified 3d hit test geometry
+ const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0);
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ aSimplifiedFillAttribute,
+ 0);
+
+ // encapsulate in HitTestPrimitive3D and add
+ const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
+ }
// add line
if(getSdrLFSAttribute().getLine())
diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
index cc32329919..b03fe9801d 100644
--- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
@@ -43,6 +43,8 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -58,94 +60,116 @@ namespace drawinglayer
{
Primitive3DSequence aRetval;
const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
+ const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()
+ || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind());
+
+ // create unit geometry
+ basegfx::B3DPolyPolygon aFill(basegfx::tools::createSphereFillPolyPolygonFromB3DRange(aUnitRange,
+ getHorizontalSegments(), getVerticalSegments(), bCreateNormals));
+
+ // normal inversion
+ if(getSdrLFSAttribute().getFill()
+ && bCreateNormals
+ && getSdr3DObjectAttribute().getNormalsInvert()
+ && aFill.areNormalsUsed())
+ {
+ // invert normals
+ aFill = basegfx::tools::invertNormals(aFill);
+ }
- // add fill
+ // texture coordinates
if(getSdrLFSAttribute().getFill())
{
- const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()
- || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind());
+ // handle texture coordinates X
+ const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bObjectSpecificX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
+ const bool bSphereX(::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX());
- // create unit geometry
- basegfx::B3DPolyPolygon aFill(basegfx::tools::createSphereFillPolyPolygonFromB3DRange(aUnitRange,
- getHorizontalSegments(), getVerticalSegments(), bCreateNormals));
+ // handle texture coordinates Y
+ const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bObjectSpecificY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
+ const bool bSphereY(::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY());
- // normal inversion
- if(bCreateNormals && getSdr3DObjectAttribute().getNormalsInvert() && aFill.areNormalsUsed())
+ if(bParallelX || bParallelY)
{
- // invert normals
- aFill = basegfx::tools::invertNormals(aFill);
+ // apply parallel texture coordinates in X and/or Y
+ const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
+ aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY);
}
- // texture coordinates
+ if(bSphereX || bObjectSpecificX || bSphereY || bObjectSpecificY)
{
- // handle texture coordinates X
- const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bObjectSpecificX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
- const bool bSphereX(::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX());
-
- // handle texture coordinates Y
- const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bObjectSpecificY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
- const bool bSphereY(::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY());
-
- if(bParallelX || bParallelY)
+ double fRelativeAngle(0.0);
+
+ if(bObjectSpecificX)
{
- // apply parallel texture coordinates in X and/or Y
- const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
- aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY);
+ // Since the texture coordinates are (for historical reasons)
+ // different from forced to sphere texture coordinates,
+ // create a old version from it by rotating to old state before applying
+ // the texture coordinates to emulate old behaviour
+ fRelativeAngle = F_2PI * ((double)((getHorizontalSegments() >> 1L) - 1L) / (double)getHorizontalSegments());
+ basegfx::B3DHomMatrix aRot;
+ aRot.rotate(0.0, fRelativeAngle, 0.0);
+ aFill.transform(aRot);
}
- if(bSphereX || bObjectSpecificX || bSphereY || bObjectSpecificY)
+ // apply spherical texture coordinates in X and/or Y
+ const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
+ const basegfx::B3DPoint aCenter(aRange.getCenter());
+ aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter,
+ bSphereX || bObjectSpecificX, bSphereY || bObjectSpecificY);
+
+ if(bObjectSpecificX)
{
- double fRelativeAngle(0.0);
-
- if(bObjectSpecificX)
- {
- // Since the texture coordinates are (for historical reasons)
- // different from forced to sphere texture coordinates,
- // create a old version from it by rotating to old state before applying
- // the texture coordinates to emulate old behaviour
- fRelativeAngle = F_2PI * ((double)((getHorizontalSegments() >> 1L) - 1L) / (double)getHorizontalSegments());
- basegfx::B3DHomMatrix aRot;
- aRot.rotate(0.0, fRelativeAngle, 0.0);
- aFill.transform(aRot);
- }
-
- // apply spherical texture coordinates in X and/or Y
- const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill));
- const basegfx::B3DPoint aCenter(aRange.getCenter());
- aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter,
- bSphereX || bObjectSpecificX, bSphereY || bObjectSpecificY);
-
- if(bObjectSpecificX)
- {
- // rotate back again
- basegfx::B3DHomMatrix aRot;
- aRot.rotate(0.0, -fRelativeAngle, 0.0);
- aFill.transform(aRot);
- }
+ // rotate back again
+ basegfx::B3DHomMatrix aRot;
+ aRot.rotate(0.0, -fRelativeAngle, 0.0);
+ aFill.transform(aRot);
}
-
- // transform texture coordinates to texture size
- basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
- aFill.transformTextureCoordiantes(aTexMatrix);
}
- // build vector of PolyPolygons
- ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector;
+ // transform texture coordinates to texture size
+ basegfx::B2DHomMatrix aTexMatrix;
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
+ aFill.transformTextureCoordiantes(aTexMatrix);
+ }
- for(sal_uInt32 a(0L); a < aFill.count(); a++)
- {
- a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
- }
+ // build vector of PolyPolygons
+ ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector;
- // create single PolyPolygonFill primitives
+ for(sal_uInt32 a(0L); a < aFill.count(); a++)
+ {
+ a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
+ }
+
+ if(getSdrLFSAttribute().getFill())
+ {
+ // add fill
aRetval = create3DPolyPolygonFillPrimitives(
- a3DPolyPolygonVector, getTransform(), getTextureSize(),
- getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ a3DPolyPolygonVector,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
+ else
+ {
+ // create simplified 3d hit test geometry
+ const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0);
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ a3DPolyPolygonVector,
+ getTransform(),
+ getTextureSize(),
+ getSdr3DObjectAttribute(),
+ aSimplifiedFillAttribute,
+ 0);
+
+ // encapsulate in HitTestPrimitive3D and add
+ const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
+ }
// add line
if(getSdrLFSAttribute().getLine())
diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx
index 98b11f9603..68bfad5096 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -65,6 +65,17 @@
#include <basegfx/tuple/b2i64tuple.hxx>
#include <basegfx/range/b2irange.hxx>
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
+#include <com/sun/star/rendering/CompositeOperation.hpp>
+#include <com/sun/star/rendering/StrokeAttributes.hpp>
+#include <com/sun/star/rendering/PathJoinType.hpp>
+#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
+#include <com/sun/star/rendering/TexturingMode.hpp>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <vclhelperbufferdevice.hxx>
+#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
+#include <helperchartrenderer.hxx>
+#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
+#include <helperwrongspellrenderer.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -98,13 +109,13 @@ using namespace com::sun::star;
return aRetval;
}
- Bitmap impModifyBitmap(const ::basegfx::BColorModifier& rModifier, const Bitmap& rSource)
+ Bitmap impModifyBitmap(const basegfx::BColorModifier& rModifier, const Bitmap& rSource)
{
Bitmap aRetval(rSource);
switch(rModifier.getMode())
{
- case ::basegfx::BCOLORMODIFYMODE_REPLACE :
+ case basegfx::BCOLORMODIFYMODE_REPLACE :
{
aRetval = impCreateEmptyBitmapWithPattern(aRetval, Size(1L, 1L));
aRetval.Erase(Color(rModifier.getBColor()));
@@ -122,7 +133,7 @@ using namespace com::sun::star;
for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++)
{
const Color aColor = pContent->GetPixel(y, x);
- const ::basegfx::BColor aBColor(rModifier.getModifiedColor(aColor.getBColor()));
+ const basegfx::BColor aBColor(rModifier.getModifiedColor(aColor.getBColor()));
pContent->SetPixel(y, x, BitmapColor(Color(aBColor)));
}
}
@@ -137,20 +148,20 @@ using namespace com::sun::star;
return aRetval;
}
- Bitmap impModifyBitmap(const ::basegfx::BColorModifierStack& rBColorModifierStack, const Bitmap& rSource)
+ Bitmap impModifyBitmap(const basegfx::BColorModifierStack& rBColorModifierStack, const Bitmap& rSource)
{
Bitmap aRetval(rSource);
for(sal_uInt32 a(rBColorModifierStack.count()); a; )
{
- const ::basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a);
+ const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a);
aRetval = impModifyBitmap(rModifier, aRetval);
}
return aRetval;
}
- sal_uInt32 impCalcGradientSteps(sal_uInt32 nSteps, const ::basegfx::B2DRange& rRange, sal_uInt32 nMaxDist)
+ sal_uInt32 impCalcGradientSteps(sal_uInt32 nSteps, const basegfx::B2DRange& rRange, sal_uInt32 nMaxDist)
{
if(nSteps == 0L)
nSteps = (sal_uInt32)(rRange.getWidth() + rRange.getHeight()) / 8;
@@ -169,10 +180,10 @@ using namespace com::sun::star;
}
void canvasProcessor::impDrawGradientSimple(
- const ::basegfx::B2DPolyPolygon& rTargetForm,
- const ::std::vector< ::basegfx::B2DHomMatrix >& rMatrices,
- const ::std::vector< ::basegfx::BColor >& rColors,
- const ::basegfx::B2DPolygon& rUnitPolygon)
+ const basegfx::B2DPolyPolygon& rTargetForm,
+ const ::std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const ::std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon)
{
uno::Reference< rendering::XPolyPolygon2D > xPoly(
basegfx::unotools::xPolyPolygonFromB2DPolygon(
@@ -186,7 +197,7 @@ using namespace com::sun::star;
for(sal_uInt32 a(0L); a < rColors.size(); a++)
{
// set correct color
- const ::basegfx::BColor aFillColor(rColors[a]);
+ const basegfx::BColor aFillColor(rColors[a]);
maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
mxCanvas->getDevice(),
@@ -211,10 +222,10 @@ using namespace com::sun::star;
}
void canvasProcessor::impDrawGradientComplex(
- const ::basegfx::B2DPolyPolygon& rTargetForm,
- const ::std::vector< ::basegfx::B2DHomMatrix >& rMatrices,
- const ::std::vector< ::basegfx::BColor >& rColors,
- const ::basegfx::B2DPolygon& rUnitPolygon)
+ const basegfx::B2DPolyPolygon& rTargetForm,
+ const ::std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const ::std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon)
{
uno::Reference< rendering::XPolyPolygon2D > xPoly(
basegfx::unotools::xPolyPolygonFromB2DPolygon(
@@ -233,7 +244,7 @@ using namespace com::sun::star;
// set correct color
if(rColors.size() > a)
{
- const ::basegfx::BColor aFillColor(rColors[a]);
+ const basegfx::BColor aFillColor(rColors[a]);
maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
mxCanvas->getDevice(),
@@ -253,19 +264,19 @@ using namespace com::sun::star;
}
void canvasProcessor::impDrawGradient(
- const ::basegfx::B2DPolyPolygon& rTargetForm,
+ const basegfx::B2DPolyPolygon& rTargetForm,
::drawinglayer::primitive::GradientStyle eGradientStyle,
sal_uInt32 nSteps,
- const ::basegfx::BColor& rStart,
- const ::basegfx::BColor& rEnd,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple)
{
fprintf(stderr,"impDrawGradient\n");
- ::basegfx::B2DPolyPolygon aTmp(rTargetForm);
+ basegfx::B2DPolyPolygon aTmp(rTargetForm);
aTmp.transform( maWorldToView );
- const ::basegfx::B2DRange aOutlineRangePixel(::basegfx::tools::getRange(aTmp));
- const ::basegfx::B2DRange aOutlineRange(::basegfx::tools::getRange(rTargetForm));
+ const basegfx::B2DRange aOutlineRangePixel(basegfx::tools::getRange(aTmp));
+ const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm));
fprintf(stderr,"impDrawGradient: #%d\n",nSteps);
@@ -283,7 +294,7 @@ using namespace com::sun::star;
{
fprintf(stderr,"native gradient #1\n");
- ::basegfx::B2DHomMatrix aTextureTransformation;
+ basegfx::B2DHomMatrix aTextureTransformation;
rendering::Texture aTexture;
aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
@@ -385,7 +396,7 @@ using namespace com::sun::star;
// we multiply with that as above for
// nScaleX)
const double nScale(
- ::basegfx::pruneScaleValue(
+ basegfx::pruneScaleValue(
fabs( rBounds.getHeight()*sin(fAngle) ) +
fabs( rBounds.getWidth()*cos(fAngle) )));
@@ -553,7 +564,7 @@ using namespace com::sun::star;
aTextureTransformation.translate( rBounds.getMinX(),
rBounds.getMinY() );
- ::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform,
+ basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform,
aTextureTransformation );
uno::Sequence< rendering::Texture > aSeq(1);
aSeq[0] = aTexture;
@@ -578,20 +589,20 @@ using namespace com::sun::star;
sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5));
- ::std::vector< ::basegfx::B2DHomMatrix > aMatrices;
- ::std::vector< ::basegfx::BColor > aColors;
- ::basegfx::B2DPolygon aUnitPolygon;
+ ::std::vector< basegfx::B2DHomMatrix > aMatrices;
+ ::std::vector< basegfx::BColor > aColors;
+ basegfx::B2DPolygon aUnitPolygon;
if( drawinglayer::primitive::GRADIENTSTYLE_RADIAL == eGradientStyle ||
drawinglayer::primitive::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle)
{
- const ::basegfx::B2DPoint aCircleCenter(0.5, 0.5);
- aUnitPolygon = ::basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
- aUnitPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aUnitPolygon);
+ const basegfx::B2DPoint aCircleCenter(0.5, 0.5);
+ aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
+ aUnitPolygon = basegfx::tools::adaptiveSubdivideByAngle(aUnitPolygon);
}
else
{
- aUnitPolygon = ::basegfx::tools::createPolygonFromRect(
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(
basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
}
@@ -705,7 +716,7 @@ using namespace com::sun::star;
uno::Sequence<double>(&rTextCandidate.getDXArray()[0],
rTextCandidate.getDXArray().size() ));
- const ::basegfx::BColor aRGBColor(
+ const basegfx::BColor aRGBColor(
maBColorModifierStack.getModifiedColor(
rTextCandidate.getFontColor()));
@@ -722,7 +733,7 @@ using namespace com::sun::star;
// direct draw of hairline
void canvasProcessor::impRender_POHL(const polygonHairlinePrimitive& rPolygonCandidate)
{
- const ::basegfx::BColor aRGBColor(
+ const basegfx::BColor aRGBColor(
maBColorModifierStack.getModifiedColor(
rPolygonCandidate.getBColor()));
@@ -815,9 +826,9 @@ using namespace com::sun::star;
void canvasProcessor::impRender_PPLG(const polyPolygonGradientPrimitive& rPolygonCandidate)
{
const fillGradientAttribute& rGradient(rPolygonCandidate.getFillGradient());
- ::basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor()));
- ::basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor()));
- ::basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
+ basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor()));
+ basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor()));
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
if(aStartColor == aEndColor)
{
@@ -847,7 +858,7 @@ using namespace com::sun::star;
// direct draw of PolyPolygon with color
void canvasProcessor::impRender_PPLC(const polyPolygonColorPrimitive& rPolygonCandidate)
{
- const ::basegfx::BColor aRGBColor(
+ const basegfx::BColor aRGBColor(
maBColorModifierStack.getModifiedColor(
rPolygonCandidate.getBColor()));
@@ -872,8 +883,8 @@ using namespace com::sun::star;
// vclprocessor.cxx
if(maBColorModifierStack.count())
{
- const ::basegfx::BColor aRGBBaseColor(0, 0, 0);
- const ::basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
+ const basegfx::BColor aRGBBaseColor(0, 0, 0);
+ const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
}
else
@@ -952,8 +963,8 @@ using namespace com::sun::star;
uno::UNO_QUERY_THROW);
// remember last worldToView and add pixel offset
- ::basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
- ::basegfx::B2DHomMatrix aPixelOffset;
+ basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
+ basegfx::B2DHomMatrix aPixelOffset;
aPixelOffset.translate(aRange.getMinX(),
aRange.getMinY());
setWorldToView(aPixelOffset * maWorldToView);
@@ -994,7 +1005,7 @@ using namespace com::sun::star;
void canvasProcessor::impRender_TRN2(const transformPrimitive& rTransformCandidate)
{
// remember current transformation
- ::basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
+ basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
// create new transformations
setWorldToView(maWorldToView * rTransformCandidate.getTransformation());
@@ -1009,7 +1020,7 @@ using namespace com::sun::star;
// marker
void canvasProcessor::impRender_MARK(const markerPrimitive& rMarkCandidate)
{
- const ::basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rMarkCandidate.getRGBColor()));
+ const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rMarkCandidate.getRGBColor()));
canvas::tools::initRenderState(maMarkerRenderState);
maMarkerRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
@@ -1274,9 +1285,627 @@ namespace drawinglayer
{
namespace processor2d
{
+ //////////////////////////////////////////////////////////////////////////////
+ // single primitive renderers
+
+ void canvasProcessor2D::impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate)
+ {
+ const primitive2d::Primitive2DSequence& rChildren = rMaskCandidate.getChildren();
+ static bool bUseMaskBitmapMethod(true);
+
+ if(rChildren.hasElements())
+ {
+ basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
+
+ if(!aMask.count())
+ {
+ // no mask, no clipping. recursively paint content
+ process(rChildren);
+ }
+ else
+ {
+ // there are principally two methods for implementing the mask primitive. One
+ // is to set a clip polygon at the canvas, the other is to create and use a
+ // alpha-using XBitmap for content and draw the mask as alpha. Both have their
+ // advantages and disadvantages, so here are both with a bool allowing simple
+ // change
+ if(bUseMaskBitmapMethod)
+ {
+ // get logic range of transparent part, clip with ViewRange
+ basegfx::B2DRange aLogicRange(aMask.getB2DRange());
+ aLogicRange.intersect(getViewInformation2D().getViewport());
+
+ if(!aLogicRange.isEmpty())
+ {
+ // get discrete range of transparent part
+ basegfx::B2DRange aDiscreteRange(aLogicRange);
+ aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // expand to next covering discrete values (pixel bounds)
+ aDiscreteRange.expand(basegfx::B2DTuple(floor(aDiscreteRange.getMinX()), floor(aDiscreteRange.getMinY())));
+ aDiscreteRange.expand(basegfx::B2DTuple(ceil(aDiscreteRange.getMaxX()), ceil(aDiscreteRange.getMaxY())));
+
+ // use VCL-based buffer device
+ impBufferDevice aBufferDevice(*mpOutputDevice, aDiscreteRange, false);
+
+ if(aBufferDevice.isVisible())
+ {
+ // remember current OutDev, Canvas and ViewInformation
+ OutputDevice* pLastOutputDevice = mpOutputDevice;
+ uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas);
+ const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
+
+ // prepare discrete offset for XBitmap
+ basegfx::B2DHomMatrix aDiscreteOffset;
+ aDiscreteOffset.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY());
+
+ // create new local ViewInformation2D with new transformation
+ const geometry::ViewInformation2D aViewInformation2D(
+ getViewInformation2D().getObjectTransformation(),
+ aDiscreteOffset * getViewInformation2D().getViewTransformation(),
+ getViewInformation2D().getViewport(),
+ getViewInformation2D().getVisualizedPage(),
+ getViewInformation2D().getViewTime(),
+ getViewInformation2D().getExtendedInformationSequence());
+ updateViewInformation(aViewInformation2D);
+
+ // set OutDev and Canvas to content target
+ mpOutputDevice = &aBufferDevice.getContent();
+ mxCanvas = mpOutputDevice->GetCanvas();
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+
+ // if ViewState transform is changed, the clipping polygon needs to be adapted, too
+ const basegfx::B2DPolyPolygon aOldClipPolyPolygon(maClipPolyPolygon);
+
+ if(maClipPolyPolygon.count())
+ {
+ maClipPolyPolygon.transform(aDiscreteOffset);
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+
+ // paint content
+ process(rChildren);
+
+ // draw mask
+ const basegfx::BColor aBlack(0.0, 0.0, 0.0);
+ maRenderState.DeviceColor = aBlack.colorToDoubleSequence(mxCanvas->getDevice());
+
+ if(getOptionsDrawinglayer().IsAntiAliasing())
+ {
+ // with AA, use 8bit AlphaMask to get nice borders
+ VirtualDevice& rAlpha = aBufferDevice.getAlpha();
+ rAlpha.GetCanvas()->fillPolyPolygon(
+ basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), aMask),
+ maViewState, maRenderState);
+ }
+ else
+ {
+ // No AA, use 1bit mask
+ VirtualDevice& rMask = aBufferDevice.getMask();
+ rMask.GetCanvas()->fillPolyPolygon(
+ basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), aMask),
+ maViewState, maRenderState);
+ }
+
+ // back to old color stack, OutDev, Canvas and ViewTransform
+ mpOutputDevice = pLastOutputDevice;
+ mxCanvas = xLastCanvas;
+ updateViewInformation(aLastViewInformation2D);
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+
+ // restore clipping polygon
+ maClipPolyPolygon = aOldClipPolyPolygon;
+
+ if(maClipPolyPolygon.count())
+ {
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+
+ // dump buffer to outdev
+ aBufferDevice.paint();
+ }
+ }
+ }
+ else
+ {
+ // transform new mask polygon to view coordinates for processing. All masks
+ // are processed in view coordinates and clipped against each other evtl. to
+ // create multi-clips
+ aMask.transform(getViewInformation2D().getObjectTransformation());
+
+ // remember last current clip polygon
+ const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
+
+ if(maClipPolyPolygon.count())
+ {
+ // there is already a clip polygon set; build clipped union of
+ // current mask polygon and new one
+ maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(aMask, maClipPolyPolygon, false, false);
+ }
+ else
+ {
+ // use mask directly
+ maClipPolyPolygon = aMask;
+ }
+
+ // set at ViewState
+ if(maClipPolyPolygon.count())
+ {
+ // set new as clip polygon
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+ else
+ {
+ // empty, reset
+ maViewState.Clip.clear();
+ }
+
+ // paint content
+ process(rChildren);
+
+ // restore local current to rescued clip polygon
+ maClipPolyPolygon = aLastClipPolyPolygon;
+
+ // set at ViewState
+ if(maClipPolyPolygon.count())
+ {
+ // set new as clip polygon
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+ else
+ {
+ // empty, reset
+ maViewState.Clip.clear();
+ }
+ }
+ }
+ }
+ }
+
+ void canvasProcessor2D::impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate)
+ {
+ GDIMetaFile aMetaFile;
+
+ if(maBColorModifierStack.count())
+ {
+ const basegfx::BColor aRGBBaseColor(0, 0, 0);
+ const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
+ aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
+ }
+ else
+ {
+ aMetaFile = rMetaCandidate.getMetaFile();
+ }
+
+ cppcanvas::BitmapCanvasSharedPtr pCanvas(cppcanvas::VCLFactory::getInstance().createCanvas(
+ uno::Reference<rendering::XBitmapCanvas>(mxCanvas, uno::UNO_QUERY_THROW)));
+ cppcanvas::RendererSharedPtr pMtfRenderer(cppcanvas::VCLFactory::getInstance().createRenderer(
+ pCanvas, aMetaFile, cppcanvas::Renderer::Parameters()));
+
+ if(pMtfRenderer)
+ {
+ pCanvas->setTransformation(getViewInformation2D().getObjectToViewTransformation());
+ pMtfRenderer->setTransformation(rMetaCandidate.getTransform());
+ pMtfRenderer->draw();
+ }
+ }
+
+ void canvasProcessor2D::impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate)
+ {
+ if(rTextCandidate.getTextLength())
+ {
+ double fShearX(0.0);
+ {
+ const basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectToViewTransformation() * rTextCandidate.getTextTransform());
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate;
+ aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+ }
+
+ if(!basegfx::fTools::equalZero(fShearX))
+ {
+ // text is sheared. As long as the canvas renderers do not support this,
+ // use the decomposed primitive
+ process(rTextCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ else
+ {
+ const primitive2d::FontAttributes& rFontAttrs(rTextCandidate.getFontAttributes());
+ rendering::FontRequest aFontRequest;
+
+ aFontRequest.FontDescription.FamilyName = rFontAttrs.getFamilyName();
+ aFontRequest.FontDescription.StyleName = rFontAttrs.getStyleName();
+ aFontRequest.FontDescription.IsSymbolFont = rFontAttrs.getSymbol() ? util::TriState_YES : util::TriState_NO;
+ aFontRequest.FontDescription.IsVertical = rFontAttrs.getVertical() ? util::TriState_YES : util::TriState_NO;
+ // TODO(F2): improve vclenum->panose conversion
+ aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttrs.getWeight());
+ aFontRequest.FontDescription.FontDescription.Letterform = rFontAttrs.getItalic() ? 9 : 0;
+
+ // init CellSize to 1.0, else a default font height will be used
+ aFontRequest.CellSize = 1.0;
+ aFontRequest.Locale = rTextCandidate.getLocale();
+
+ // font matrix should only be used for glyph rotations etc.
+ com::sun::star::geometry::Matrix2D aFontMatrix;
+ canvas::tools::setIdentityMatrix2D(aFontMatrix);
+
+ uno::Reference<rendering::XCanvasFont> xFont(mxCanvas->createFont(
+ aFontRequest, uno::Sequence< beans::PropertyValue >(), aFontMatrix));
+
+ if(xFont.is())
+ {
+ // got a font, now try to get a TextLayout
+ const rendering::StringContext aStringContext(
+ rTextCandidate.getText(), rTextCandidate.getTextPosition(), rTextCandidate.getTextLength());
+ uno::Reference<rendering::XTextLayout> xLayout(xFont->createTextLayout(
+ aStringContext, com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 0));
+
+ if(xLayout.is())
+ {
+ // got a text layout, apply DXArray if given
+ const ::std::vector< double >& rDXArray = rTextCandidate.getDXArray();
+ const sal_uInt32 nDXCount(rDXArray.size());
+
+ if(nDXCount)
+ {
+ // DXArray does not need to be adapted to getTextPosition/getTextLength,
+ // it is already provided correctly
+ const uno::Sequence< double > aDXSequence(&rDXArray[0], nDXCount);
+ xLayout->applyLogicalAdvancements(aDXSequence);
+ }
+
+ // set text color
+ const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rTextCandidate.getFontColor()));
+ maRenderState.DeviceColor = aRGBColor.colorToDoubleSequence(mxCanvas->getDevice());
+
+ // set text transformation
+ canvas::tools::setRenderStateTransform(maRenderState,
+ getViewInformation2D().getObjectTransformation() * rTextCandidate.getTextTransform());
+
+ // paint
+ mxCanvas->drawTextLayout(xLayout, maViewState, maRenderState);
+ }
+ }
+ }
+ }
+ }
+
+ void canvasProcessor2D::impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate)
+ {
+ // apply possible color modification to BitmapEx
+ BitmapEx aModifiedBitmapEx(impModifyBitmapEx(maBColorModifierStack, rBitmapCandidate.getBitmapEx()));
+
+ if(aModifiedBitmapEx.IsEmpty())
+ {
+ // replace with color filled polygon
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+
+ maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice());
+ canvas::tools::setRenderStateTransform(maRenderState,
+ getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform());
+
+ mxCanvas->fillPolyPolygon(basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ mxCanvas->getDevice(), basegfx::B2DPolyPolygon(aPolygon)), maViewState, maRenderState);
+ }
+ else
+ {
+ // adapt object's transformation to the correct scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ basegfx::B2DHomMatrix aNewMatrix;
+ const Size aSizePixel(aModifiedBitmapEx.GetSizePixel());
+
+ if(0 != aSizePixel.Width() && 0 != aSizePixel.Height())
+ {
+ rBitmapCandidate.getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+ aNewMatrix.scale(aScale.getX() / aSizePixel.Width(), aScale.getY() / aSizePixel.Height());
+ aNewMatrix.shearX(fShearX);
+ aNewMatrix.rotate(fRotate);
+ aNewMatrix.translate(aTranslate.getX(), aTranslate.getY());
+
+ canvas::tools::setRenderStateTransform(maRenderState,
+ getViewInformation2D().getObjectTransformation() * aNewMatrix);
+
+ mxCanvas->drawBitmap(
+ vcl::unotools::xBitmapFromBitmapEx(mxCanvas->getDevice(), aModifiedBitmapEx),
+ maViewState, maRenderState);
+ }
+ }
+ }
+
+ void canvasProcessor2D::impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate)
+ {
+ const primitive2d::Primitive2DSequence& rChildren = rAlphaCandidate.getChildren();
+ const primitive2d::Primitive2DSequence& rAlpha = rAlphaCandidate.getAlpha();
+
+ if(rChildren.hasElements() && rAlpha.hasElements())
+ {
+ // get logic range of transparent part and clip with ViewRange
+ basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D()));
+ aLogicRange.intersect(getViewInformation2D().getViewport());
+
+ if(!aLogicRange.isEmpty())
+ {
+ // get discrete range of transparent part
+ basegfx::B2DRange aDiscreteRange(aLogicRange);
+ aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
+
+ // expand to next covering discrete values (pixel bounds)
+ aDiscreteRange.expand(basegfx::B2DTuple(floor(aDiscreteRange.getMinX()), floor(aDiscreteRange.getMinY())));
+ aDiscreteRange.expand(basegfx::B2DTuple(ceil(aDiscreteRange.getMaxX()), ceil(aDiscreteRange.getMaxY())));
+
+ // use VCL-based buffer device
+ impBufferDevice aBufferDevice(*mpOutputDevice, aDiscreteRange, false);
+
+ if(aBufferDevice.isVisible())
+ {
+ // remember current OutDev, Canvas and ViewInformation
+ OutputDevice* pLastOutputDevice = mpOutputDevice;
+ uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas);
+ const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
+
+ // prepare discrete offset for XBitmap
+ basegfx::B2DHomMatrix aDiscreteOffset;
+ aDiscreteOffset.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY());
+
+ // create new local ViewInformation2D with new transformation
+ const geometry::ViewInformation2D aViewInformation2D(
+ getViewInformation2D().getObjectTransformation(),
+ aDiscreteOffset * getViewInformation2D().getViewTransformation(),
+ getViewInformation2D().getViewport(),
+ getViewInformation2D().getVisualizedPage(),
+ getViewInformation2D().getViewTime(),
+ getViewInformation2D().getExtendedInformationSequence());
+ updateViewInformation(aViewInformation2D);
+
+ // set OutDev and Canvas to content target
+ mpOutputDevice = &aBufferDevice.getContent();
+ mxCanvas = mpOutputDevice->GetCanvas();
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+
+ // if ViewState transform is changed, the clipping polygon needs to be adapted, too
+ const basegfx::B2DPolyPolygon aOldClipPolyPolygon(maClipPolyPolygon);
+
+ if(maClipPolyPolygon.count())
+ {
+ maClipPolyPolygon.transform(aDiscreteOffset);
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+
+ // paint content
+ process(rChildren);
+
+ // set to mask
+ mpOutputDevice = &aBufferDevice.getAlpha();
+ mxCanvas = mpOutputDevice->GetCanvas();
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+
+ // when painting alpha masks, reset the color stack
+ basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack);
+ maBColorModifierStack = basegfx::BColorModifierStack();
+
+ // paint mask to it (always with alpha intensities, evtl. with AA)
+ process(rAlpha);
+
+ // back to old color stack, OutDev, Canvas and ViewTransform
+ maBColorModifierStack = aLastBColorModifierStack;
+ mpOutputDevice = pLastOutputDevice;
+ mxCanvas = xLastCanvas;
+ updateViewInformation(aLastViewInformation2D);
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+
+ // restore clipping polygon
+ maClipPolyPolygon = aOldClipPolyPolygon;
+
+ if(maClipPolyPolygon.count())
+ {
+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
+ }
+
+ // dump buffer to outdev
+ aBufferDevice.paint();
+ }
+ }
+ }
+ }
+
+ void canvasProcessor2D::impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive)
+ {
+ // support direct fat line geometry. This moves the decomposition to the canvas.
+ // As long as our canvases are used (which also use basegfx tooling) this makes
+ // no difference, but potentially canvases may better support this
+ static bool bSupportFatLineDirectly(true);
+ bool bOutputDone(false);
+
+ if(bSupportFatLineDirectly)
+ {
+ const attribute::LineAttribute& rLineAttribute = rPolygonStrokePrimitive.getLineAttribute();
+ const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokePrimitive.getStrokeAttribute();
+
+ if(0.0 < rLineAttribute.getWidth() || 0 != rStrokeAttribute.getDotDashArray().size())
+ {
+ rendering::StrokeAttributes aStrokeAttribute;
+
+ aStrokeAttribute.StrokeWidth = rLineAttribute.getWidth();
+ aStrokeAttribute.MiterLimit = 15.0; // degrees; maybe here (15.0 * F_PI180) is needed, not clear in the documentation
+ const ::std::vector< double >& rDotDashArray = rStrokeAttribute.getDotDashArray();
+
+ if(rDotDashArray.size())
+ {
+ aStrokeAttribute.DashArray = uno::Sequence< double >(&rDotDashArray[0], rDotDashArray.size());
+ }
+
+ switch(rLineAttribute.getLineJoin())
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
+ aStrokeAttribute.JoinType = rendering::PathJoinType::NONE;
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ aStrokeAttribute.JoinType = rendering::PathJoinType::BEVEL;
+ break;
+ case basegfx::B2DLINEJOIN_MITER:
+ aStrokeAttribute.JoinType = rendering::PathJoinType::MITER;
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ aStrokeAttribute.JoinType = rendering::PathJoinType::ROUND;
+ break;
+ }
+
+ const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
+ maRenderState.DeviceColor = aHairlineColor.colorToDoubleSequence(mxCanvas->getDevice());
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
+
+ mxCanvas->strokePolyPolygon(
+ basegfx::unotools::xPolyPolygonFromB2DPolygon(mxCanvas->getDevice(), rPolygonStrokePrimitive.getB2DPolygon()),
+ maViewState, maRenderState, aStrokeAttribute);
+
+ bOutputDone = true;
+ }
+ }
+
+ if(!bOutputDone)
+ {
+ // process decomposition
+ process(rPolygonStrokePrimitive.get2DDecomposition(getViewInformation2D()));
+ }
+ }
+
+ void canvasProcessor2D::impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D)
+ {
+ // support tiled fills directly when tiling is on
+ static bool bSupportFillBitmapDirectly(true);
+ bool bOutputDone(false);
+
+ if(bSupportFillBitmapDirectly)
+ {
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute = rFillBitmapPrimitive2D.getFillBitmap();
+
+ if(rFillBitmapAttribute.getTiling())
+ {
+ // apply possible color modification to Bitmap
+ const BitmapEx aChangedBitmapEx(impModifyBitmapEx(maBColorModifierStack, BitmapEx(rFillBitmapAttribute.getBitmap())));
+
+ if(aChangedBitmapEx.IsEmpty())
+ {
+ // replace with color filled polygon
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+
+ maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice());
+ canvas::tools::setRenderStateTransform(maRenderState,
+ getViewInformation2D().getObjectTransformation() * rFillBitmapPrimitive2D.getTransformation());
+
+ mxCanvas->fillPolyPolygon(basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ mxCanvas->getDevice(), basegfx::B2DPolyPolygon(aPolygon)), maViewState, maRenderState);
+ }
+ else
+ {
+ const Size aSizePixel(aChangedBitmapEx.GetSizePixel());
+
+ if(0 != aSizePixel.Width() && 0 != aSizePixel.Height())
+ {
+ // create texture matrix from texture to object (where object is unit square here),
+ // so use values directly
+ basegfx::B2DHomMatrix aTextureMatrix;
+ aTextureMatrix.scale(
+ rFillBitmapAttribute.getSize().getX(),
+ rFillBitmapAttribute.getSize().getY());
+ aTextureMatrix.translate(
+ rFillBitmapAttribute.getTopLeft().getX(),
+ rFillBitmapAttribute.getTopLeft().getY());
+
+ // create and fill texture
+ rendering::Texture aTexture;
+
+ basegfx::unotools::affineMatrixFromHomMatrix(aTexture.AffineTransform, aTextureMatrix);
+ aTexture.Alpha = 1.0;
+ aTexture.Bitmap = vcl::unotools::xBitmapFromBitmapEx(mxCanvas->getDevice(), aChangedBitmapEx);
+ aTexture.RepeatModeX = rendering::TexturingMode::REPEAT;
+ aTexture.RepeatModeY = rendering::TexturingMode::REPEAT;
+
+ // canvas needs a polygon to fill, create unit rectangle polygon
+ const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+
+ // set primitive's transformation as render state transform
+ canvas::tools::setRenderStateTransform(maRenderState,
+ getViewInformation2D().getObjectTransformation() * rFillBitmapPrimitive2D.getTransformation());
+
+ // put texture into a uno sequence for handover
+ uno::Sequence< rendering::Texture > aSeq(1);
+ aSeq[0] = aTexture;
+
+ // draw textured rectangle
+ mxCanvas->fillTexturedPolyPolygon(
+ basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), basegfx::B2DPolyPolygon(aOutlineRectangle)),
+ maViewState, maRenderState, aSeq);
+ }
+ }
+
+ bOutputDone = true;
+ }
+ }
+
+ if(!bOutputDone)
+ {
+ // process decomposition
+ process(rFillBitmapPrimitive2D.get2DDecomposition(getViewInformation2D()));
+ }
+ }
+
+ void canvasProcessor2D::impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate)
+ {
+ const primitive2d::Primitive2DSequence rChildren = rUniAlphaCandidate.getChildren();
+
+ if(rChildren.hasElements())
+ {
+ bool bOutputDone(false);
+
+ // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case,
+ // use the fillPolyPolygon method with correctly set alpha. This is a often used
+ // case, so detectiong it is valuable
+ if(1 == rChildren.getLength())
+ {
+ const primitive2d::Primitive2DReference xReference(rChildren[0]);
+ const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get());
+
+ if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitiveID())
+ {
+ // direct draw of PolyPolygon with color and transparence
+ const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor()));
+
+ // add alpha modulation value to DeviceColor
+ uno::Sequence< double > aColor(4);
+
+ aColor[0] = aPolygonColor.getRed();
+ aColor[1] = aPolygonColor.getGreen();
+ aColor[2] = aPolygonColor.getBlue();
+ aColor[3] = 1.0 - rUniAlphaCandidate.getAlpha();
+ maRenderState.DeviceColor = aColor;
+
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
+ mxCanvas->fillPolyPolygon(
+ basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()),
+ maViewState, maRenderState);
+ bOutputDone = true;
+ }
+ }
+
+ if(!bOutputDone)
+ {
+ // process decomposition. This will be decomposed to an AlphaPrimitive2D
+ // with the same child context and a single polygon for alpha context. This could be
+ // directly handled here with known VCL-buffer technology, but would only
+ // make a small difference compared to directly rendering the AlphaPrimitive2D
+ // using impRenderAlphaPrimitive2D above.
+ process(rUniAlphaCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ }
+ }
//////////////////////////////////////////////////////////////////////////////
// internal processing support
+
void canvasProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
{
switch(rCandidate.getPrimitiveID())
@@ -1288,7 +1917,7 @@ namespace drawinglayer
const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
maRenderState.DeviceColor = aHairlineColor.colorToDoubleSequence(mxCanvas->getDevice());
- canvas::tools::setIdentityAffineMatrix2D(maRenderState.AffineTransform);
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
mxCanvas->drawPolyPolygon(
basegfx::unotools::xPolyPolygonFromB2DPolygon(mxCanvas->getDevice(), rPolygonCandidate.getB2DPolygon()),
maViewState, maRenderState);
@@ -1302,7 +1931,7 @@ namespace drawinglayer
const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
maRenderState.DeviceColor = aPolygonColor.colorToDoubleSequence(mxCanvas->getDevice());
- canvas::tools::setIdentityAffineMatrix2D(maRenderState.AffineTransform);
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
mxCanvas->fillPolyPolygon(
basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), rPolygonCandidate.getB2DPolyPolygon()),
maViewState, maRenderState);
@@ -1325,71 +1954,8 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
- // mask group. Special handling for MetaFiles.
- const primitive2d::MaskPrimitive2D& rMaskCandidate = static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate);
-
- if(rMaskCandidate.getChildren().hasElements())
- {
- basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
-
- if(aMask.count())
- {
- // transform new mask polygon to World coordinates for processing. All masks
- // are processed in World coordinates and clipped against each other evtl. to
- // create multi-clips
- aMask.transform(getViewInformation2D().getObjectTransformation());
-
- // remember last current clip polygon
- const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
-
- if(maClipPolyPolygon.count())
- {
- // there is already a clip polygon set; build clipped union of
- // current mask polygon and new one
- maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(aMask, maClipPolyPolygon, false, false);
- }
- else
- {
- // use mask directly
- maClipPolyPolygon = aMask;
- }
-
- // set at ViewState
- if(maClipPolyPolygon.count())
- {
- // set new as clip polygon
- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
- }
- else
- {
- // empty, reset
- maViewState.Clip.clear();
- }
-
- // recursively paint content
- process(rMaskCandidate.getChildren());
-
- // restore local current to rescued clip polygon
- maClipPolyPolygon = aLastClipPolyPolygon;
-
- // set at ViewState
- if(maClipPolyPolygon.count())
- {
- // set new as clip polygon
- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
- }
- else
- {
- // empty, reset
- maViewState.Clip.clear();
- }
- }
- else
- {
- // no mask, no clipping. recursively paint content
- process(rMaskCandidate.getChildren());
- }
- }
+ // mask group
+ impRenderMaskPrimitive2D(static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate));
break;
}
@@ -1410,7 +1976,7 @@ namespace drawinglayer
updateViewInformation(aViewInformation2D);
// set at canvas
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
// proccess content
process(rTransformCandidate.getChildren());
@@ -1419,8 +1985,8 @@ namespace drawinglayer
updateViewInformation(aLastViewInformation2D);
// restore at canvas
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
-
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
+
break;
}
case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D :
@@ -1451,31 +2017,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
{
// MetaFile primitive
- const primitive2d::MetafilePrimitive2D& rMetaCandidate = static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate);
- GDIMetaFile aMetaFile;
-
- if(maBColorModifierStack.count())
- {
- const ::basegfx::BColor aRGBBaseColor(0, 0, 0);
- const ::basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
- aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
- }
- else
- {
- aMetaFile = rMetaCandidate.getMetaFile();
- }
-
- cppcanvas::BitmapCanvasSharedPtr pCanvas(cppcanvas::VCLFactory::getInstance().createCanvas(
- uno::Reference<rendering::XBitmapCanvas>(mxCanvas, uno::UNO_QUERY_THROW)));
- cppcanvas::RendererSharedPtr pMtfRenderer(cppcanvas::VCLFactory::getInstance().createRenderer(
- pCanvas, aMetaFile, cppcanvas::Renderer::Parameters()));
-
- if(pMtfRenderer)
- {
- pCanvas->setTransformation(getViewInformation2D().getObjectToViewTransformation());
- pMtfRenderer->setTransformation(rMetaCandidate.getTransform());
- pMtfRenderer->draw();
- }
+ impRenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
break;
}
@@ -1487,7 +2029,7 @@ namespace drawinglayer
// set point color
const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor()));
maRenderState.DeviceColor = aRGBColor.colorToDoubleSequence(mxCanvas->getDevice());
- canvas::tools::setIdentityAffineMatrix2D(maRenderState.AffineTransform);
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
const std::vector< basegfx::B2DPoint >& rPointVector = rPointArrayCandidate.getPositions();
const sal_uInt32 nPointCount(rPointVector.size());
@@ -1503,259 +2045,90 @@ namespace drawinglayer
case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
{
// TextSimplePortion primitive
- const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate = static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate);
-
- if(rTextCandidate.getTextLength())
- {
- const primitive2d::FontAttributes& rFontAttrs(rTextCandidate.getFontAttributes());
- rendering::FontRequest aFontRequest;
-
- aFontRequest.FontDescription.FamilyName = rFontAttrs.getFamilyName();
- aFontRequest.FontDescription.StyleName = rFontAttrs.getStyleName();
- aFontRequest.FontDescription.IsSymbolFont = rFontAttrs.getSymbol() ? util::TriState_YES : util::TriState_NO;
- aFontRequest.FontDescription.IsVertical = rFontAttrs.getVertical() ? util::TriState_YES : util::TriState_NO;
- // TODO(F2): improve vclenum->panose conversion
- aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttrs.getWeight());
- aFontRequest.FontDescription.FontDescription.Letterform = rFontAttrs.getItalic() ? 9 : 0;
-
- // init CellSize to 1.0, else a default font height will be used
- aFontRequest.CellSize = 1.0;
- aFontRequest.Locale = rTextCandidate.getLocale();
-
- // font matrix should only be used for glyph rotations etc.
- com::sun::star::geometry::Matrix2D aFontMatrix;
- canvas::tools::setIdentityMatrix2D(aFontMatrix);
-
- uno::Reference<rendering::XCanvasFont> xFont(mxCanvas->createFont(
- aFontRequest, uno::Sequence< beans::PropertyValue >(), aFontMatrix));
-
- if(xFont.is())
- {
- // got a font, now try to get a TextLayout
- const rendering::StringContext aStringContext(
- rTextCandidate.getText(), rTextCandidate.getTextPosition(), rTextCandidate.getTextLength());
- uno::Reference<rendering::XTextLayout> xLayout(xFont->createTextLayout(
- aStringContext, com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 0));
-
- if(xLayout.is())
- {
- // got a text layout, apply DXArray if given
- const ::std::vector< double >& rDXArray = rTextCandidate.getDXArray();
- const sal_uInt32 nDXCount(rDXArray.size());
-
- if(nDXCount)
- {
- // DXArray does not need to be adapted to getTextPosition/getTextLength,
- // it is already provided correctly
- const uno::Sequence< double > aDXSequence(&rDXArray[0], nDXCount);
- xLayout->applyLogicalAdvancements(aDXSequence);
- }
-
- // set text color
- const ::basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rTextCandidate.getFontColor()));
- maRenderState.DeviceColor = aRGBColor.colorToDoubleSequence(mxCanvas->getDevice());
-
- // set text transformation
- canvas::tools::setRenderStateTransform(maRenderState, rTextCandidate.getTextTransform());
-
- // paint
- mxCanvas->drawTextLayout(xLayout, maViewState, maRenderState);
- }
- }
- }
+ impRenderTextSimplePortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
{
// Bitmap primitive
- const primitive2d::BitmapPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate);
-
- if(rBitmapCandidate.getBitmapEx().IsEmpty())
- {
- // replace with color filled polygon
- const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
- const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
-
- maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice());
- canvas::tools::setRenderStateTransform(maRenderState, rBitmapCandidate.getTransform());
-
- mxCanvas->fillPolyPolygon(basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
- mxCanvas->getDevice(), basegfx::B2DPolyPolygon(aPolygon)), maViewState, maRenderState);
- }
- else
- {
- // apply possible color modification to BitmapEx
- BitmapEx aBitmapEx(impModifyBitmapEx(maBColorModifierStack, rBitmapCandidate.getBitmapEx()));
-
- // adapt object's transformation to the correct scale
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- basegfx::B2DHomMatrix aNewMatrix;
- const Size aSizePixel(aBitmapEx.GetSizePixel());
- const double fBitmapWidth(aSizePixel.Width() == 0 ? 1.0 : aSizePixel.Width());
- const double fBitmapHeight(aSizePixel.Height() == 0 ? 1.0 : aSizePixel.Height());
-
- rBitmapCandidate.getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
- aNewMatrix.scale(aScale.getX() / fBitmapWidth, aScale.getY() / fBitmapHeight);
- aNewMatrix.shearX(fShearX);
- aNewMatrix.rotate(fRotate);
- aNewMatrix.translate(aTranslate.getX(), aTranslate.getY());
-
- canvas::tools::setRenderStateTransform(maRenderState, aNewMatrix);
-
- mxCanvas->drawBitmap(
- vcl::unotools::xBitmapFromBitmapEx(mxCanvas->getDevice(), aBitmapEx),
- maViewState, maRenderState);
- }
+ impRenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D :
{
// Alpha primitive
- const primitive2d::AlphaPrimitive2D& rAlphaCandidate = static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate);
- const primitive2d::Primitive2DSequence& rChildren = rAlphaCandidate.getChildren();
+ impRenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate));
- if(rChildren.hasElements())
- {
- // get logic and discrete range of transparent part
- basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D()));
- basegfx::B2DRange aDiscreteRange(aLogicRange);
- aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
-
- // expand to next covering discrete values (pixel bounds)
- aDiscreteRange.expand(basegfx::B2DTuple(floor(aDiscreteRange.getMinX()), floor(aDiscreteRange.getMinY())));
- aDiscreteRange.expand(basegfx::B2DTuple(ceil(aDiscreteRange.getMaxX()), ceil(aDiscreteRange.getMaxY())));
-
- // determine integer bitmap size
- const com::sun::star::geometry::IntegerSize2D aIntegerSize2D(
- basegfx::fround(aDiscreteRange.getWidth()),
- basegfx::fround(aDiscreteRange.getHeight()));
-
- // create XBitmap for rendering child context
- uno::Reference< rendering::XCanvas > xChildBitmap(
- mxCanvas->getDevice()->createCompatibleBitmap(aIntegerSize2D),
- uno::UNO_QUERY_THROW);
-
- if(xChildBitmap.is())
- {
- // create and set ViewInformation2D for Sub-Canvas
- const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
-
- // prepare discrete offset for XBitmap
- basegfx::B2DHomMatrix aDiscreteOffset;
- aDiscreteOffset.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY());
-
- // create new local ViewInformation2D with new transformation
- const geometry::ViewInformation2D aViewInformation2D(
- getViewInformation2D().getObjectTransformation(),
- aDiscreteOffset * getViewInformation2D().getViewTransformation(),
- getViewInformation2D().getViewport(),
- getViewInformation2D().getVisualizedPage(),
- getViewInformation2D().getViewTime(),
- getViewInformation2D().getExtendedInformationSequence());
- updateViewInformation(aViewInformation2D);
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
-
- // remember last canvas
- uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas);
-
- // set child bitmap as target and paint child content
- mxCanvas = xChildBitmap;
- process(rChildren);
-
- // check if alpha is simple alpha (just one PolyPolygonColor primitive)
- bool bIsSimpleTransparence(false);
- const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0;
- uno::Reference< rendering::XCanvas > xAlphaBitmap;
- const primitive2d::Primitive2DSequence& rAlpha = rAlphaCandidate.getAlpha();
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D:
+ {
+ // PolygonStrokePrimitive
+ impRenderPolygonStrokePrimitive2D(static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate));
- if(rAlpha.hasElements() && 1 == rAlpha.getLength())
- {
- const primitive2d::Primitive2DReference xReference(rAlpha[0]);
- pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get());
+ break;
+ }
+ case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D :
+ {
+ // FillBitmapPrimitive2D
+ impRenderFillBitmapPrimitive2D(static_cast< const primitive2d::FillBitmapPrimitive2D& >(rCandidate));
- if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitiveID())
- {
- bIsSimpleTransparence = true;
- }
- }
+ break;
+ }
+ case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D :
+ {
+ // UnifiedAlphaPrimitive2D
+ impRenderUnifiedAlphaPrimitive2D(static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate));
- if(!bIsSimpleTransparence)
- {
- // create XBitmap for rendering alpha context
- xAlphaBitmap = uno::Reference< rendering::XCanvas >(
- mxCanvas->getDevice()->createCompatibleBitmap(aIntegerSize2D), uno::UNO_QUERY_THROW);
-
- if(xAlphaBitmap.is())
- {
- // set alpha bitmap as target and paint child content
- mxCanvas = xAlphaBitmap;
- process(rAlpha);
- }
- }
-
- // restore old canvas and ViewInformation
- mxCanvas = xLastCanvas;
- updateViewInformation(aLastViewInformation2D);
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
-
- // prepare bitmap transformation for local painting
- const double fBitmapWidth(std::max(1.0, aDiscreteRange.getWidth()));
- const double fBitmapHeight(std::max(1.0, aDiscreteRange.getHeight()));
- basegfx::B2DHomMatrix aBitmapTransform;
-
- // transform back logic range from discrete range to work on same bounds and
- // to have the correct logic width/Height for bitmap render state due to discrete
- // roundings (pixel alignments)
- aLogicRange = aDiscreteRange;
- aLogicRange.transform(getViewInformation2D().getInverseObjectToViewTransformation());
-
- // LogicRange Width/Height is correct
- aBitmapTransform.scale(aLogicRange.getWidth() / fBitmapWidth, aLogicRange.getHeight() / fBitmapHeight);
- aBitmapTransform.translate(aLogicRange.getMinX(), aLogicRange.getMinY());
- canvas::tools::setRenderStateTransform(maRenderState, aBitmapTransform);
-
- if(bIsSimpleTransparence)
- {
- // it's a simple transparence, draw modulated content XBitmap. The alpha
- // is contained in the fill color of pPoPoColor, all color channels are
- // the same to build a gray value
- const basegfx::BColor& rAlphaFill = pPoPoColor->getBColor();
-
- // add alpha modulation value to DeviceColor
- uno::Sequence< double > aColor(4);
-
- aColor[0] = 1.0;
- aColor[1] = 1.0;
- aColor[2] = 1.0;
- aColor[3] = rAlphaFill.getRed();
- maRenderState.DeviceColor = aColor;
-
- // draw child bitmap
- mxCanvas->drawBitmapModulated(uno::Reference< rendering::XBitmap >(xChildBitmap, uno::UNO_QUERY_THROW),
- maViewState, maRenderState);
- }
- else
- {
- // It's a alpha with various geometry, need to combine child and alpha bitmap to a single
- // BitmapEx. I konow no other way here than to get the VCL Bitmaps and using VCL functionality
- // for this combination. This is very slow and needs to be enchanced ASAP.
- const uno::Reference< rendering::XIntegerReadOnlyBitmap > xReadOnlyChild(xChildBitmap, uno::UNO_QUERY_THROW);
- const uno::Reference< rendering::XIntegerReadOnlyBitmap > xReadOnlyAlpha(xAlphaBitmap, uno::UNO_QUERY_THROW);
- const Bitmap aChildBitmap(vcl::unotools::bitmapExFromXBitmap(xReadOnlyChild).GetBitmap());
- const AlphaMask aAlphaBitmap(vcl::unotools::bitmapExFromXBitmap(xReadOnlyAlpha).GetBitmap());
-
- // draw bitmap
- mxCanvas->drawBitmap(vcl::unotools::xBitmapFromBitmapEx(mxCanvas->getDevice(), BitmapEx(aChildBitmap, aAlphaBitmap)),
- maViewState, maRenderState);
- }
- }
+ break;
+ }
+ case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
+ {
+ // chart primitive in canvas renderer; restore original DrawMode during call
+ // since the evtl. used ChartPrettyPainter will use the MapMode
+ const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
+ mpOutputDevice->Push(PUSH_MAPMODE);
+ mpOutputDevice->SetMapMode(maOriginalMapMode);
+
+ if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
}
+ mpOutputDevice->Pop();
break;
}
+ case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
+ {
+ // wrong spell primitive. Handled directly here using VCL since VCL has a nice and
+ // very direct waveline painting which is needed for this. If VCL is to be avoided,
+ // this can be removed anytime and the decomposition may be used
+ const primitive2d::WrongSpellPrimitive2D& rWrongSpellPrimitive = static_cast< const primitive2d::WrongSpellPrimitive2D& >(rCandidate);
+
+ if(!renderWrongSpellPrimitive2D(
+ rWrongSpellPrimitive,
+ *mpOutputDevice,
+ getViewInformation2D().getObjectToViewTransformation(),
+ maBColorModifierStack))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rWrongSpellPrimitive.get2DDecomposition(getViewInformation2D()));
+ }
+
+ break;
+ }
+
+ // nice to have:
+ //
+ // case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D :
+ // - support FormControls more direct eventually, not sure if this is needed
+ // with the canvas renderer. The decomposition provides a bitmap representation
+ // of the control which will work
+ //
+
default :
{
// process recursively
@@ -1771,9 +2144,11 @@ namespace drawinglayer
canvasProcessor2D::canvasProcessor2D(
const geometry::ViewInformation2D& rViewInformation,
- const uno::Reference< rendering::XCanvas >& rCanvas)
+ OutputDevice& rOutDev)
: BaseProcessor2D(rViewInformation),
- mxCanvas( rCanvas ),
+ maOriginalMapMode(rOutDev.GetMapMode()),
+ mpOutputDevice(&rOutDev),
+ mxCanvas(rOutDev.GetCanvas()),
maViewState(),
maRenderState(),
maBColorModifierStack(),
@@ -1785,8 +2160,10 @@ namespace drawinglayer
canvas::tools::initViewState(maViewState);
canvas::tools::initRenderState(maRenderState);
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
+ // set digit language, derived from SvtCTLOptions to have the correct
+ // number display for arabic/hindi numerals
if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals())
{
meLang = LANGUAGE_ARABIC;
@@ -1799,10 +2176,31 @@ namespace drawinglayer
{
meLang = (LanguageType)Application::GetSettings().GetLanguage();
}
+
+ rOutDev.SetDigitLanguage(meLang);
+
+ // prepare output directly to pixels
+ mpOutputDevice->Push(PUSH_MAPMODE);
+ mpOutputDevice->SetMapMode();
+
+ // react on AntiAliasing settings
+ if(getOptionsDrawinglayer().IsAntiAliasing())
+ {
+ mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW);
+ }
+ else
+ {
+ mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
+ }
}
canvasProcessor2D::~canvasProcessor2D()
{
+ // restore MapMode
+ mpOutputDevice->Pop();
+
+ // restore AntiAliasing
+ mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
}
} // end of namespace processor2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.cxx b/drawinglayer/source/processor2d/helperchartrenderer.cxx
new file mode 100644
index 0000000000..3d1f6a1afe
--- /dev/null
+++ b/drawinglayer/source/processor2d/helperchartrenderer.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperchartrenderer.cxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/24 14:28:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <helperchartrenderer.hxx>
+#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
+#include <svtools/chartprettypainter.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice)
+ {
+ bool bChartRendered(false);
+
+ // code from chart PrettyPrinter
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFact( rChartCandidate.getChartModel(), uno::UNO_QUERY );
+ OSL_ENSURE( xFact.is(), "Chart cannot be painted pretty!\n" );
+
+ if( xFact.is() )
+ {
+ uno::Reference< lang::XUnoTunnel > xChartRenderer( xFact->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ChartRenderer" ) ) ), uno::UNO_QUERY );
+ OSL_ENSURE( xChartRenderer.is(), "Chart cannot be painted pretty!\n" );
+
+ if( xChartRenderer.is() )
+ {
+ ChartPrettyPainter* pPrettyPainter = reinterpret_cast<ChartPrettyPainter*>(
+ xChartRenderer->getSomething( ChartPrettyPainter::getUnoTunnelId() ));
+
+ if( pPrettyPainter )
+ {
+ // create logic object range
+ basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0);
+ aObjectRange.transform(rChartCandidate.getTransformation());
+ const Rectangle aRectangle(
+ (sal_Int32)aObjectRange.getMinX(), (sal_Int32)aObjectRange.getMinY(),
+ (sal_Int32)aObjectRange.getMaxX(), (sal_Int32)aObjectRange.getMaxY());
+
+ bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
+ }
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "Chart cannot be painted pretty!" );
+ }
+
+ return bChartRendered;
+ }
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.hxx b/drawinglayer/source/processor2d/helperchartrenderer.hxx
new file mode 100644
index 0000000000..de13431c79
--- /dev/null
+++ b/drawinglayer/source/processor2d/helperchartrenderer.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperchartrenderer.hxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/24 14:28:43 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class OutputDevice;
+
+namespace drawinglayer { namespace primitive2d {
+ class ChartPrimitive2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// support chart PrettyPrinter usage from primitives
+
+namespace drawinglayer
+{
+ bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice);
+
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
+
+// eof
diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
new file mode 100644
index 0000000000..e95b54f53d
--- /dev/null
+++ b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperwrongspellrenderer.cxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/24 14:28:52 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <helperwrongspellrenderer.hxx>
+#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
+#include <tools/gen.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ bool renderWrongSpellPrimitive2D(
+ const primitive2d::WrongSpellPrimitive2D& rWrongSpellCandidate,
+ OutputDevice& rOutputDevice,
+ const basegfx::B2DHomMatrix& rObjectToViewTransformation,
+ const basegfx::BColorModifierStack& rBColorModifierStack)
+ {
+ const basegfx::B2DHomMatrix aLocalTransform(rObjectToViewTransformation * rWrongSpellCandidate.getTransformation());
+ const basegfx::B2DVector aFontVectorPixel(aLocalTransform * basegfx::B2DVector(0.0, 1.0));
+ const sal_uInt32 nFontPixelHeight(basegfx::fround(aFontVectorPixel.getLength()));
+
+ static const sal_uInt32 nMinimumFontHeight(5); // #define WRONG_SHOW_MIN 5
+ static const sal_uInt32 nSmallFontHeight(11); // #define WRONG_SHOW_SMALL 11
+ static const sal_uInt32 nMediumFontHeight(15); // #define WRONG_SHOW_MEDIUM 15
+
+ if(nFontPixelHeight > nMinimumFontHeight)
+ {
+ const basegfx::B2DPoint aStart(aLocalTransform * basegfx::B2DPoint(rWrongSpellCandidate.getStart(), 0.0));
+ const basegfx::B2DPoint aStop(aLocalTransform * basegfx::B2DPoint(rWrongSpellCandidate.getStop(), 0.0));
+ const Point aVclStart(basegfx::fround(aStart.getX()), basegfx::fround(aStart.getY()));
+ const Point aVclStop(basegfx::fround(aStop.getX()), basegfx::fround(aStop.getY()));
+ sal_uInt16 nWaveStyle(WAVE_FLAT);
+
+ if(nFontPixelHeight > nMediumFontHeight)
+ {
+ nWaveStyle = WAVE_NORMAL;
+ }
+ else if(nFontPixelHeight > nSmallFontHeight)
+ {
+ nWaveStyle = WAVE_SMALL;
+ }
+
+ const basegfx::BColor aProcessedColor(rBColorModifierStack.getModifiedColor(rWrongSpellCandidate.getColor()));
+ const bool bMapModeEnabledState(rOutputDevice.IsMapModeEnabled());
+
+ rOutputDevice.EnableMapMode(false);
+ rOutputDevice.SetLineColor(Color(aProcessedColor));
+ rOutputDevice.SetFillColor();
+ rOutputDevice.DrawWaveLine(aVclStart, aVclStop, nWaveStyle);
+ rOutputDevice.EnableMapMode(bMapModeEnabledState);
+ }
+
+ // cannot really go wrong
+ return true;
+ }
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx b/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx
new file mode 100644
index 0000000000..b6c2303fff
--- /dev/null
+++ b/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperwrongspellrenderer.hxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: aw $ $Date: 2008/09/24 14:29:02 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERWRONGSPELLRENDER_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERWRONGSPELLRENDER_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class OutputDevice;
+
+namespace drawinglayer { namespace primitive2d {
+ class WrongSpellPrimitive2D;
+}}
+
+namespace basegfx {
+ class B2DHomMatrix;
+ class BColorModifierStack;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// support WrongSpell rendreing using VCL from primitives due to VCLs nice
+// and fast solution with wavelines
+
+namespace drawinglayer
+{
+ bool renderWrongSpellPrimitive2D(
+ const primitive2d::WrongSpellPrimitive2D& rWrongSpellCandidate,
+ OutputDevice& rOutputDevice,
+ const basegfx::B2DHomMatrix& rObjectToViewTransformation,
+ const basegfx::BColorModifierStack& rBColorModifierStack);
+
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERWRONGSPELLRENDER_HXX
+
+// eof
diff --git a/drawinglayer/source/processor2d/makefile.mk b/drawinglayer/source/processor2d/makefile.mk
index 1ca3aad2e4..38dcb42cd4 100644
--- a/drawinglayer/source/processor2d/makefile.mk
+++ b/drawinglayer/source/processor2d/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES= \
$(SLO)$/vclhelperbitmaprender.obj \
$(SLO)$/vclhelperbufferdevice.obj \
$(SLO)$/vclprocessor2d.obj \
- $(SLO)$/vclchartprocessor2d.obj \
+ $(SLO)$/helperchartrenderer.obj \
+ $(SLO)$/helperwrongspellrenderer.obj \
$(SLO)$/vclpixelprocessor2d.obj \
$(SLO)$/vclmetafileprocessor2d.obj \
$(SLO)$/contourextractor2d.obj \
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 7482e352f3..faffb6095f 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -48,7 +48,8 @@ namespace drawinglayer
{
impBufferDevice::impBufferDevice(
OutputDevice& rOutDev,
- const basegfx::B2DRange& rRange)
+ const basegfx::B2DRange& rRange,
+ bool bAddOffsetToMapping)
: mrOutDev(rOutDev),
maContent(rOutDev),
mpMask(0L),
@@ -73,8 +74,12 @@ namespace drawinglayer
rOutDev.EnableMapMode(bWasEnabledSrc);
MapMode aNewMapMode(rOutDev.GetMapMode());
- const Point aLogicTopLeft(rOutDev.PixelToLogic(maDestPixel.TopLeft()));
- aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y()));
+
+ if(bAddOffsetToMapping)
+ {
+ const Point aLogicTopLeft(rOutDev.PixelToLogic(maDestPixel.TopLeft()));
+ aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y()));
+ }
maContent.SetMapMode(aNewMapMode);
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index f9e42ca361..4ffca76e4c 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -59,7 +59,8 @@ namespace drawinglayer
public:
impBufferDevice(
OutputDevice& rOutDev,
- const basegfx::B2DRange& rRange);
+ const basegfx::B2DRange& rRange,
+ bool bAddOffsetToMapping);
~impBufferDevice();
void paint(double fTrans = 0.0);
diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx
index 552afb7efa..c02845e9c6 100644
--- a/drawinglayer/source/processor2d/vclhelpergradient.cxx
+++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx
@@ -89,7 +89,7 @@ namespace drawinglayer
if(a)
{
- if(a - 1L < rMatrices.size())
+ if(a - 1L < static_cast< sal_uInt32 >(rMatrices.size()))
{
basegfx::B2DPolygon aNewPoly(rUnitPolygon);
aNewPoly.transform(rMatrices[a - 1L]);
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 629dee75ad..a5d8345ed0 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -72,6 +72,7 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
+#include <helperchartrenderer.hxx>
//////////////////////////////////////////////////////////////////////////////
// for PDFExtOutDevData Graphic support
@@ -1606,8 +1607,14 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
{
- // point array
- RenderChartPrimitive2D(static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate));
+ // ChartPrimitive2D
+ const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
+
+ if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
+ }
break;
}
case PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D :
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 82eed97601..b679a2c4bf 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -57,6 +57,11 @@
#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
+#include <helperchartrenderer.hxx>
+#include <helperwrongspellrenderer.hxx>
+#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vcl/hatch.hxx>
#include <cstdio>
//////////////////////////////////////////////////////////////////////////////
@@ -107,7 +112,17 @@ namespace drawinglayer
if(bHandleWrongSpellDirectly)
{
- RenderWrongSpellPrimitive2D(static_cast< const primitive2d::WrongSpellPrimitive2D& >(rCandidate));
+ const primitive2d::WrongSpellPrimitive2D& rWrongSpellPrimitive = static_cast< const primitive2d::WrongSpellPrimitive2D& >(rCandidate);
+
+ if(!renderWrongSpellPrimitive2D(
+ rWrongSpellPrimitive,
+ *mpOutputDevice,
+ maCurrentTransformation,
+ maBColorModifierStack))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rWrongSpellPrimitive.get2DDecomposition(getViewInformation2D()));
+ }
}
else
{
@@ -372,10 +387,78 @@ namespace drawinglayer
{
// chart primitive in pixel renderer; restore original DrawMode during call
// since the evtl. used ChartPrettyPainter will use the MapMode
+ const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
mpOutputDevice->Push(PUSH_MAPMODE);
mpOutputDevice->SetMapMode(maOriginalMapMode);
- RenderChartPrimitive2D(static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate));
- mpOutputDevice->Pop();
+
+ if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
+ }
+
+ mpOutputDevice->Pop();
+ break;
+ }
+ case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
+ {
+ static bool bForceIgnoreHatchSmoothing(false);
+
+ if(bForceIgnoreHatchSmoothing || getOptionsDrawinglayer().IsAntiAliasing())
+ {
+ // if AA is used (or ignore smoothing is on), there is no need to smooth
+ // hatch painting, use decomposition
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ else
+ {
+ // without AA, use VCL to draw the hatch. It snaps hatch distances to the next pixel
+ // and forces hatch distance to be >= 3 pixels to make the hatch display look smoother.
+ // This is wrong in principle, but looks nicer. This could also be done here directly
+ // without VCL usage if needed
+ const primitive2d::FillHatchPrimitive2D& rFillHatchPrimitive = static_cast< const primitive2d::FillHatchPrimitive2D& >(rCandidate);
+
+ // create hatch polygon in range size and discrete coordinates
+ basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getObjectRange());
+ aHatchRange.transform(maCurrentTransformation);
+ const basegfx::B2DPolygon aHatchPolygon(basegfx::tools::createPolygonFromRect(aHatchRange));
+
+ // set hatch line color
+ const basegfx::BColor aHatchColor(maBColorModifierStack.getModifiedColor(rFillHatchPrimitive.getBColor()));
+ mpOutputDevice->SetFillColor();
+ mpOutputDevice->SetLineColor(Color(aHatchColor));
+
+ // get hatch style
+ const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
+ HatchStyle eHatchStyle(HATCH_SINGLE);
+
+ switch(rFillHatchAttributes.getStyle())
+ {
+ default : // HATCHSTYLE_SINGLE
+ {
+ break;
+ }
+ case attribute::HATCHSTYLE_DOUBLE :
+ {
+ eHatchStyle = HATCH_DOUBLE;
+ break;
+ }
+ case attribute::HATCHSTYLE_TRIPLE :
+ {
+ eHatchStyle = HATCH_TRIPLE;
+ break;
+ }
+ }
+
+ // create hatch
+ const basegfx::B2DVector aDiscreteDistance(maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0));
+ const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getX()));
+ const sal_uInt16 nAngle10((sal_uInt16)basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800));
+ ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10);
+
+ // draw hatch using VCL
+ mpOutputDevice->DrawHatch(PolyPolygon(Polygon(aHatchPolygon)), aVCLHatch);
+ }
break;
}
default :
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 0980a8d708..2c2b09b660 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -659,7 +659,7 @@ namespace drawinglayer
{
aMask.transform(maCurrentTransformation);
const basegfx::B2DRange aRange(basegfx::tools::getRange(aMask));
- impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+ impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
if(aBufferDevice.isVisible())
{
@@ -719,7 +719,7 @@ namespace drawinglayer
{
basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D()));
aRange.transform(maCurrentTransformation);
- impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+ impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
if(aBufferDevice.isVisible())
{
@@ -895,41 +895,6 @@ namespace drawinglayer
}
}
- // wrong spell primitive
- void VclProcessor2D::RenderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& rWrongSpellCandidate)
- {
- const basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rWrongSpellCandidate.getTransformation());
- const basegfx::B2DVector aFontVectorPixel(aLocalTransform * basegfx::B2DVector(0.0, 1.0));
- const sal_uInt32 nFontPixelHeight(basegfx::fround(aFontVectorPixel.getLength()));
-
- static const sal_uInt32 nMinimumFontHeight(5); // #define WRONG_SHOW_MIN 5
- static const sal_uInt32 nSmallFontHeight(11); // #define WRONG_SHOW_SMALL 11
- static const sal_uInt32 nMediumFontHeight(15); // #define WRONG_SHOW_MEDIUM 15
-
- if(nFontPixelHeight > nMinimumFontHeight)
- {
- const basegfx::B2DPoint aStart(aLocalTransform * basegfx::B2DPoint(rWrongSpellCandidate.getStart(), 0.0));
- const basegfx::B2DPoint aStop(aLocalTransform * basegfx::B2DPoint(rWrongSpellCandidate.getStop(), 0.0));
- const Point aVclStart(basegfx::fround(aStart.getX()), basegfx::fround(aStart.getY()));
- const Point aVclStop(basegfx::fround(aStop.getX()), basegfx::fround(aStop.getY()));
- sal_uInt16 nWaveStyle(WAVE_FLAT);
-
- if(nFontPixelHeight > nMediumFontHeight)
- {
- nWaveStyle = WAVE_NORMAL;
- }
- else if(nFontPixelHeight > nSmallFontHeight)
- {
- nWaveStyle = WAVE_SMALL;
- }
-
- const basegfx::BColor aProcessedColor(maBColorModifierStack.getModifiedColor(rWrongSpellCandidate.getColor()));
- mpOutputDevice->SetLineColor(Color(aProcessedColor));
- mpOutputDevice->SetFillColor();
- mpOutputDevice->DrawWaveLine(aVclStart, aVclStop, nWaveStyle);
- }
- }
-
void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate)
{
const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute();
diff --git a/svx/inc/dragmt3d.hxx b/svx/inc/dragmt3d.hxx
index f0dc7b46f8..b61e10e275 100644
--- a/svx/inc/dragmt3d.hxx
+++ b/svx/inc/dragmt3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dragmt3d.hxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,8 +33,9 @@
#include <svx/svddrgmt.hxx>
#include <svx/view3d.hxx>
-#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
#include <vcl/timer.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
class E3dScene;
@@ -43,35 +44,32 @@ class E3dScene;
|* Parameter fuer Interaktion eines 3D-Objektes
|*
\************************************************************************/
-
class E3dDragMethodUnit
{
public:
- E3dObject* p3DObj;
- basegfx::B3DPolygon aWireframePoly;
- basegfx::B3DHomMatrix aDisplayTransform;
- basegfx::B3DHomMatrix aInvDisplayTransform;
- basegfx::B3DHomMatrix aInitTransform;
- basegfx::B3DHomMatrix aTransform;
- INT32 nStartAngle;
- INT32 nLastAngle;
-
- // TimingVars
- UINT8 nOrigQuality;
-
- E3dDragMethodUnit() {}
+ E3dObject* mp3DObj;
+ basegfx::B3DPolyPolygon maWireframePoly;
+ basegfx::B3DHomMatrix maDisplayTransform;
+ basegfx::B3DHomMatrix maInvDisplayTransform;
+ basegfx::B3DHomMatrix maInitTransform;
+ basegfx::B3DHomMatrix maTransform;
+ sal_Int32 mnStartAngle;
+ sal_Int32 mnLastAngle;
+
+ E3dDragMethodUnit()
+ : mp3DObj(0),
+ maWireframePoly(),
+ maDisplayTransform(),
+ maInvDisplayTransform(),
+ maInitTransform(),
+ maTransform(),
+ mnStartAngle(0),
+ mnLastAngle(0)
+ {}
};
/*************************************************************************
|*
-|* Parameter fuer Interaktion eines 3D-Objektes
-|*
-\************************************************************************/
-
-SV_DECL_PTRARR_DEL(E3dDragMethodUnitGroup, E3dDragMethodUnit*, 1, 3)
-
-/*************************************************************************
-|*
|* Ableitung von SdrDragMethod fuer 3D-Objekte
|*
\************************************************************************/
@@ -79,13 +77,12 @@ SV_DECL_PTRARR_DEL(E3dDragMethodUnitGroup, E3dDragMethodUnit*, 1, 3)
class E3dDragMethod : public SdrDragMethod
{
protected:
- E3dDragMethodUnitGroup aGrp;
- E3dDragConstraint eConstraint;
- Point aLastPos;
- Rectangle aFullBound;
- BOOL bMoveFull;
- BOOL bMovedAtAll;
- Timer aCallbackTimer;
+ ::std::vector< E3dDragMethodUnit > maGrp;
+ E3dDragConstraint meConstraint;
+ Point maLastPos;
+ Rectangle maFullBound;
+ bool mbMoveFull;
+ bool mbMovedAtAll;
public:
TYPEINFO();
@@ -95,7 +92,6 @@ public:
BOOL bFull=FALSE);
virtual void TakeComment(String& rStr) const;
-
virtual FASTBOOL Beg();
virtual void Mov(const Point& rPnt);
virtual void Brk();
@@ -103,8 +99,6 @@ public:
E3dView& Get3DView() { return (E3dView&)rView; }
- DECL_LINK(TimerInterruptHdl, void*);
-
// for migration from XOR to overlay
virtual void CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager, ::sdr::overlay::OverlayObjectList& rOverlayList);
};
@@ -118,7 +112,7 @@ public:
class E3dDragRotate : public E3dDragMethod
{
- basegfx::B3DPoint aGlobalCenter;
+ basegfx::B3DPoint maGlobalCenter;
public:
TYPEINFO();
@@ -140,8 +134,8 @@ public:
class E3dDragMove : public E3dDragMethod
{
- SdrHdlKind eWhatDragHdl;
- Point aScaleFixPos;
+ SdrHdlKind meWhatDragHdl;
+ Point maScaleFixPos;
public:
TYPEINFO();
diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx
index 3c32d9f870..b280128fc8 100644
--- a/svx/inc/svx/cube3d.hxx
+++ b/svx/inc/svx/cube3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cube3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -60,12 +60,12 @@ private:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
// Parameter
- basegfx::B3DPoint aCubePos;
- basegfx::B3DVector aCubeSize;
- UINT16 nSideFlags;
+ basegfx::B3DPoint aCubePos;
+ basegfx::B3DVector aCubeSize;
+ UINT16 nSideFlags;
// BOOLeans
- unsigned bPosIsCenter : 1;
+ unsigned bPosIsCenter : 1;
protected:
void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
@@ -80,12 +80,6 @@ public:
virtual void operator=(const SdrObject&);
- // Geometrieerzeugung
- virtual void CreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// Lokale Parameter setzen mit Geometrieneuerzeugung
void SetCubePos(const basegfx::B3DPoint& rNew);
const basegfx::B3DPoint& GetCubePos() { return aCubePos; }
diff --git a/svx/inc/svx/def3d.hxx b/svx/inc/svx/def3d.hxx
index 1c167a87be..76f28b5782 100644
--- a/svx/inc/svx/def3d.hxx
+++ b/svx/inc/svx/def3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: def3d.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,8 +31,6 @@
#ifndef _SVX_DEF3D_HXX
#define _SVX_DEF3D_HXX
-class Vector3D;
-
#ifndef _INC_MATH
#include <math.h>
#endif
@@ -47,9 +45,6 @@ const double EPSILON = 1e-06;
//+++ 3D-Hilfsfunktionen +++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-FASTBOOL Do3DEdgesIntersect(const Vector3D& rV1a, const Vector3D& rV1b,
- const Vector3D& rV2a, const Vector3D& rV2b);
-
enum E3dDragConstraint { E3DDRAG_CONSTR_X = 0x0001,
E3DDRAG_CONSTR_Y = 0x0002,
E3DDRAG_CONSTR_Z = 0x0004,
diff --git a/svx/inc/svx/deflt3d.hxx b/svx/inc/svx/deflt3d.hxx
index 3b3e90c601..244eb81381 100644
--- a/svx/inc/svx/deflt3d.hxx
+++ b/svx/inc/svx/deflt3d.hxx
@@ -31,10 +31,10 @@
#ifndef _E3D_DEFLT3D_HXX
#define _E3D_DEFLT3D_HXX
-#include <goodies/matril3d.hxx>
#include <basegfx/point/b3dpoint.hxx>
#include <basegfx/vector/b3dvector.hxx>
#include "svx/svxdllapi.h"
+#include <tools/color.hxx>
/*************************************************************************
|*
@@ -47,39 +47,34 @@ class SVX_DLLPUBLIC E3dDefaultAttributes
private:
// Compound-Objekt
Color aDefaultAmbientColor;
- B3dMaterial aDefaultBackMaterial;
- BOOL bDefaultCreateNormals ;
- BOOL bDefaultCreateTexture ;
- BOOL bDefaultUseDifferentBackMaterial ;
+ BOOL bDefaultCreateNormals;
+ BOOL bDefaultCreateTexture;
// Cube-Objekt
- basegfx::B3DPoint aDefaultCubePos;
- basegfx::B3DVector aDefaultCubeSize;
+ basegfx::B3DPoint aDefaultCubePos;
+ basegfx::B3DVector aDefaultCubeSize;
UINT16 nDefaultCubeSideFlags;
- BOOL bDefaultCubePosIsCenter ;
+ BOOL bDefaultCubePosIsCenter;
// Sphere-Objekt
- basegfx::B3DPoint aDefaultSphereCenter;
- basegfx::B3DVector aDefaultSphereSize;
+ basegfx::B3DPoint aDefaultSphereCenter;
+ basegfx::B3DVector aDefaultSphereSize;
// Lathe-Objekt
long nDefaultLatheEndAngle;
- BOOL bDefaultLatheSmoothed ;
- BOOL bDefaultLatheSmoothFrontBack ;
- BOOL bDefaultLatheCharacterMode ;
+ BOOL bDefaultLatheSmoothed;
+ BOOL bDefaultLatheSmoothFrontBack;
+ BOOL bDefaultLatheCharacterMode;
BOOL bDefaultLatheCloseFront;
BOOL bDefaultLatheCloseBack;
// Extrude-Objekt
- BOOL bDefaultExtrudeSmoothed ;
- BOOL bDefaultExtrudeSmoothFrontBack ;
- BOOL bDefaultExtrudeCharacterMode ;
+ BOOL bDefaultExtrudeSmoothed;
+ BOOL bDefaultExtrudeSmoothFrontBack;
+ BOOL bDefaultExtrudeCharacterMode;
BOOL bDefaultExtrudeCloseFront;
BOOL bDefaultExtrudeCloseBack;
- // Scene-Objekt
- BOOL bDefaultDither ;
-
public:
// Konstruktor
E3dDefaultAttributes();
@@ -92,14 +87,10 @@ public:
const Color& GetDefaultAmbientColor() { return aDefaultAmbientColor; }
void SetDefaultAmbientColor(const Color& rNew) { aDefaultAmbientColor = rNew; }
- const B3dMaterial& GetDefaultBackMaterial() { return aDefaultBackMaterial; }
- void SetDefaultBackMaterial(const B3dMaterial& rNew) { aDefaultBackMaterial = rNew; }
BOOL GetDefaultCreateNormals() const { return bDefaultCreateNormals; }
void SetDefaultCreateNormals(const BOOL bNew) { bDefaultCreateNormals = bNew; }
BOOL GetDefaultCreateTexture() const { return bDefaultCreateTexture; }
void SetDefaultCreateTexture(const BOOL bNew) { bDefaultCreateTexture = bNew; }
- BOOL GetDefaultUseDifferentBackMaterial() const { return bDefaultUseDifferentBackMaterial; }
- void SetDefaultUseDifferentBackMaterial(const BOOL bNew) { bDefaultUseDifferentBackMaterial = bNew; }
// Cube-Objekt
const basegfx::B3DPoint& GetDefaultCubePos() { return aDefaultCubePos; }
@@ -142,10 +133,6 @@ public:
void SetDefaultExtrudeCloseFront(const BOOL bNew) { bDefaultExtrudeCloseFront = bNew; }
BOOL GetDefaultExtrudeCloseBack() const { return bDefaultExtrudeCloseBack; }
void SetDefaultExtrudeCloseBack(const BOOL bNew) { bDefaultExtrudeCloseBack = bNew; }
-
- // Scene-Objekt
- BOOL GetDefaultDither() const { return bDefaultDither; }
- void SetDefaultDither(const BOOL bNew) { bDefaultDither = bNew; }
};
#endif // _E3D_DEFLT3D_HXX
diff --git a/svx/inc/svx/dlgctl3d.hxx b/svx/inc/svx/dlgctl3d.hxx
index 3b19bab4f4..8b70601dc8 100644
--- a/svx/inc/svx/dlgctl3d.hxx
+++ b/svx/inc/svx/dlgctl3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dlgctl3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,320 +31,169 @@
#ifndef _SVX_DLGCTL3D_HXX
#define _SVX_DLGCTL3D_HXX
-// includes --------------------------------------------------------------
-
-#include <tools/poly.hxx>
#include <vcl/ctrl.hxx>
-#include <goodies/b3dgeom.hxx>
-#include <goodies/b3dtrans.hxx>
-#include <goodies/matril3d.hxx>
-#include <goodies/b3dlight.hxx>
#include <vcl/scrbar.hxx>
-
-#ifndef _SV_BUTTON_HXX
#include <vcl/button.hxx>
-#endif
#include <svtools/itemset.hxx>
+#include "svx/svxdllapi.h"
+#include <basegfx/vector/b3dvector.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
class FmFormModel;
class FmFormPage;
class E3dView;
class E3dPolyScene;
class E3dObject;
-class Base3D;
-/*************************************************************************
-|*
-|* Control zur Darstellung einer 3D-Scene
-|*
-\************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
#define PREVIEW_OBJECTTYPE_SPHERE 0x0000
#define PREVIEW_OBJECTTYPE_CUBE 0x0001
-class Svx3DPreviewControl : public Control
-{
-protected:
- FmFormModel* pModel;
- FmFormPage* pFmPage;
- E3dView* p3DView;
- E3dPolyScene* pScene;
- E3dObject* p3DObj;
- UINT16 nObjectType;
-
- void Construct();
-
-public:
- Svx3DPreviewControl( Window* pParent, const ResId& rResId );
- Svx3DPreviewControl( Window* pParent, WinBits nStyle = 0 );
- ~Svx3DPreviewControl();
-
- virtual void Paint( const Rectangle& rRect );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Resize();
-
- void Reset();
-
- void SetObjectType( UINT16 nType );
- UINT16 GetObjectType() const { return( nObjectType ); }
+//////////////////////////////////////////////////////////////////////////////
- SfxItemSet Get3DAttributes() const;
- void Set3DAttributes( const SfxItemSet& rAttr );
-
- void Set3DObject( const E3dObject* pObj );
-};
-
-/*************************************************************************
-|*
-|* 3D Preview Control
-|*
-\************************************************************************/
-
-// Defines fuer NormalMode
-#define PREVIEW_NORMAL_MODE_OBJECT 0x0000
-#define PREVIEW_NORMAL_MODE_FLAT 0x0001
-#define PREVIEW_NORMAL_MODE_SPHERE 0x0002
-
-// Defines fuer ShadeMode
-#define PREVIEW_SHADEMODE_FLAT 0x0000
-#define PREVIEW_SHADEMODE_PHONG 0x0001
-#define PREVIEW_SHADEMODE_GOURAUD 0x0002
-#define PREVIEW_SHADEMODE_DRAFT 0x0003
-
-class SvxPreviewCtl3D : public Control
+class SVX_DLLPUBLIC Svx3DPreviewControl : public Control
{
protected:
- // Geometrie des Objektes
- B3dGeometry aGeometry;
+ FmFormModel* mpModel;
+ FmFormPage* mpFmPage;
+ E3dView* mp3DView;
+ E3dPolyScene* mpScene;
+ E3dObject* mp3DObj;
+ sal_uInt16 mnObjectType;
- // Kameraset
- B3dCamera aCameraSet;
- double fDistance;
- double fDeviceSize;
-
- // Rotation der Geometrie (bei Cube)
- double fRotateX;
- double fRotateY;
- double fRotateZ;
-
- // Farben des Objektes
- B3dMaterial aObjectMaterial;
-
- // Lichtquellen
- B3dLightGroup aLights;
-
- // Segmentierung, wird bei Kugel verwendet
- UINT16 nHorSegs;
- UINT16 nVerSegs;
-
- // Modus fuer Normalen
- UINT16 nNormalMode;
-
- // Zeichenmodus
- UINT16 nShadeMode;
-
- // Art der Geometrie, Cube oder Sphere
- BOOL bGeometryCube;
+ void Construct();
public:
- SvxPreviewCtl3D( Window* pParent, const ResId& rResId);
- SvxPreviewCtl3D( Window* pParent, WinBits nStyle = 0);
- ~SvxPreviewCtl3D();
+ Svx3DPreviewControl(Window* pParent, const ResId& rResId);
+ Svx3DPreviewControl(Window* pParent, WinBits nStyle = 0);
+ ~Svx3DPreviewControl();
- // Zeichenmethode
virtual void Paint( const Rectangle& rRect );
- void DrawGeometryClip(Base3D* pBase3D);
- virtual void DrawGeometry(Base3D* pBase3D);
-
- // Art der Geometrie setzen
- void SetGeometry(BOOL bGeomCube);
-
- // Rotation setzen
- void SetRotation(double fRotX, double fRotY, double fRotZ);
- void GetRotation(double& rRotX, double& rRotY, double& rRotZ);
-
- // Zugriffsfunktionen Materialien
- void SetMaterial(Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient);
- Color GetMaterial(Base3DMaterialValue=Base3DMaterialAmbient);
- void SetShininess(UINT16 nNew);
- UINT16 GetShininess();
-
- // Lichtquellen setzen
- void SetLightGroup(B3dLightGroup* pNew=0L);
- B3dLightGroup* GetLightGroup() { return &aLights; }
-
- // View-Einstellungen
- void SetUserDistance(double fNew);
- double GetUserDistance() { return fDistance; }
- void SetDeviceSize(double fNew);
- double GetDeviceSize() { return fDeviceSize; }
-
- // Zugriffsfunktionen Segmentierung
- UINT16 GetHorizontalSegments() { return nHorSegs; }
- UINT16 GetVerticalSegments() { return nVerSegs; }
- void SetHorizontalSegments(UINT16 nNew);
- void SetVerticalSegments(UINT16 nNew);
- void SetSegments(UINT16 nNewHor, UINT16 nNewVer);
-
- // Zugriff Normalenmodus
- UINT16 GetNormalMode() { return nNormalMode; }
- void SetNormalMode(UINT16 nNew);
-
- // Zugriff auf ShadeMode
- UINT16 GetShadeMode() { return nShadeMode; }
- void SetShadeMode(UINT16 nNew);
-
-protected:
-
- // Geometrieerzeugung
- void CreateGeometry();
-
- // Lokale Parameter Initialisieren
- void Init();
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Resize();
+
+ void Reset();
+ virtual void SetObjectType(sal_uInt16 nType);
+ sal_uInt16 GetObjectType() const { return( mnObjectType ); }
+ SfxItemSet Get3DAttributes() const;
+ virtual void Set3DAttributes(const SfxItemSet& rAttr);
};
-/*************************************************************************
-|*
-|* 3D Light Preview Control
-|*
-\************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
-class SVX_DLLPUBLIC SvxLightPrevievCtl3D : public SvxPreviewCtl3D
+class SVX_DLLPUBLIC Svx3DLightControl : public Svx3DPreviewControl
{
-private:
- // Geometrie eines Lichtobjektes
- B3dGeometry aLightGeometry;
-
- Base3DLightNumber eSelectedLight;
-
- // Werte fuer Rendering
- double fObjectRadius;
- double fDistanceToObject;
- double fScaleSizeSelected;
- double fLampSize;
-
- // Callback bei interaktiven Aenderungen
- Link aChangeCallback;
- Link aSelectionChangeCallback;
-
- // Sichern der Interaktion
- double fSaveActionStartHor;
- double fSaveActionStartVer;
- double fSaveActionStartRotZ;
- Point aActionStartPoint;
-
- // Mindestentfernung fuer Interaktionsstart
- INT32 nInteractionStartDistance;
-
- // Maus-Status
- unsigned bMouseMoved : 1;
- unsigned bGeometrySelected : 1;
+ // Callback for interactive changes
+ Link maUserInteractiveChangeCallback;
+ Link maUserSelectionChangeCallback;
+ Link maChangeCallback;
+ Link maSelectionChangeCallback;
+
+ // lights
+ sal_uInt32 maSelectedLight;
+
+ // extra objects for light control
+ E3dObject* mpExpansionObject;
+ E3dObject* mpLampBottomObject;
+ E3dObject* mpLampShaftObject;
+ std::vector< E3dObject* > maLightObjects;
+
+ // 3d rotations of object
+ double mfRotateX;
+ double mfRotateY;
+ double mfRotateZ;
+
+ // interaction parameters
+ Point maActionStartPoint;
+ sal_Int32 mnInteractionStartDistance;
+ double mfSaveActionStartHor;
+ double mfSaveActionStartVer;
+ double mfSaveActionStartRotZ;
+
+ // bitfield
+ unsigned mbMouseMoved : 1;
+ unsigned mbGeometrySelected : 1;
+
+ void Construct2();
+ void ConstructLightObjects();
+ void AdaptToSelectedLight();
+ void TrySelection(Point aPosPixel);
public:
- SvxLightPrevievCtl3D( Window* pParent, const ResId& rResId);
- SvxLightPrevievCtl3D( Window* pParent, WinBits nStyle = 0);
- ~SvxLightPrevievCtl3D();
-
- void SelectLight(Base3DLightNumber=Base3DLightNone);
- Base3DLightNumber GetSelectedLight() { return eSelectedLight; }
-
- void SelectGeometry();
- BOOL IsGeometrySelected() { return bGeometrySelected; }
-
- void SetObjectRadius(double fNew);
- double GetObjectRadius() { return fObjectRadius; }
-
- void SetDistanceToObject(double fNew);
- double GetDistanceToObject() { return fDistanceToObject; }
+ Svx3DLightControl(Window* pParent, const ResId& rResId);
+ Svx3DLightControl(Window* pParent, WinBits nStyle = 0);
+ ~Svx3DLightControl();
- void SetScaleSizeSelected(double fNew);
- double GetScaleSizeSelected() { return fScaleSizeSelected; }
+ virtual void Paint(const Rectangle& rRect);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Resize();
- void SetLampSize(double fNew);
- double GetLampSize() { return fLampSize; }
+ virtual void SetObjectType(sal_uInt16 nType);
- // Zeichenmethode
- virtual void DrawGeometry(Base3D* pBase3D);
- void DrawLightGeometry(Base3DLightNumber eLightNum, Base3D* pBase3D);
+ // User Callback eintragen
+ void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
+ void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
+ void SetChangeCallback(Link aNew) { maChangeCallback = aNew; }
+ void SetSelectionChangeCallback(Link aNew) { maSelectionChangeCallback = aNew; }
- // Selektion gueltig
- BOOL IsSelectionValid();
+ // selection checks
+ bool IsSelectionValid();
+ bool IsGeometrySelected() { return mbGeometrySelected; }
- // Selektierte Lampe Position in Polarkoordinaten holen/setzen
- // dabei geht Hor:[0..360.0[ und Ver:[-90..90] Grad
+ // get/set position of selected lamp in polar coordinates, Hor:[0..360.0[ and Ver:[-90..90] degrees
void GetPosition(double& rHor, double& rVer);
void SetPosition(double fHor, double fVer);
- // Callback eintragen
- void SetChangeCallback(Link aNew) { aChangeCallback = aNew; }
- void SetSelectionChangeCallback(Link aNew) { aSelectionChangeCallback = aNew; }
-
- // Interaktion
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Tracking( const TrackingEvent& rTEvt );
-
-protected:
-
- // Geometrieerzeugung Lampe
- void CreateLightGeometry();
+ // get/set rotation of 3D object
+ void SetRotation(double fRotX, double fRotY, double fRotZ);
+ void GetRotation(double& rRotX, double& rRotY, double& rRotZ);
- // Selektion einer Lampe
- void TrySelection(Point aPosPixel);
+ void SelectLight(sal_uInt32 nLightNumber);
+ virtual void Set3DAttributes(const SfxItemSet& rAttr);
+ sal_uInt32 GetSelectedLight() { return maSelectedLight; }
- // Lokale Parameter Initialisieren
- void Init();
+ // light data access
+ bool GetLightOnOff(sal_uInt32 nNum) const;
+ Color GetLightColor(sal_uInt32 nNum) const;
+ basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const;
};
-/*************************************************************************
-|*
-|* 3D Light Control
-|*
-\************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
class SVX_DLLPUBLIC SvxLightCtl3D : public Control
{
private:
- // Lokale Controls
- SvxLightPrevievCtl3D aLightControl;
- ScrollBar aHorScroller;
- ScrollBar aVerScroller;
- PushButton aSwitcher;
- basegfx::B3DVector aVector;
-
-// Callback bei interaktiven Aenderungen
- Link aUserInteractiveChangeCallback;
- Link aUserSelectionChangeCallback;
+ // local controls
+ Svx3DLightControl maLightControl;
+ ScrollBar maHorScroller;
+ ScrollBar maVerScroller;
+ PushButton maSwitcher;
- // Flags
- unsigned bVectorValid : 1;
- unsigned bSphereUsed : 1;
+ // Callback bei interaktiven Aenderungen
+ Link maUserInteractiveChangeCallback;
+ Link maUserSelectionChangeCallback;
public:
SvxLightCtl3D( Window* pParent, const ResId& rResId);
SvxLightCtl3D( Window* pParent, WinBits nStyle = 0);
~SvxLightCtl3D();
- // Altes Interface
- void SetVector(const basegfx::B3DVector& rNew);
- const basegfx::B3DVector& GetVector();
- BOOL GetVectorValid() { return bVectorValid; }
-
// Reagiere auf Groessenaenderungen
- virtual void Resize();
+ virtual void Resize();
void NewLayout();
// Selektion auf Gueltigkeit pruefen
void CheckSelection();
// Um weitere Einstellungen nach Aussen zu bringen...
- SvxLightPrevievCtl3D& GetPreviewControl() { return aLightControl; }
+ Svx3DLightControl& GetSvx3DLightControl() { return maLightControl; }
// User Callback eintragen
- void SetUserInteractiveChangeCallback(Link aNew)
- { aUserInteractiveChangeCallback = aNew; }
- void SetUserSelectionChangeCallback(Link aNew)
- { aUserSelectionChangeCallback = aNew; }
+ void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
+ void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void GetFocus();
@@ -363,6 +212,7 @@ protected:
void move( double fDeltaHor, double fDeltaVer );
};
-
#endif // _SCH_DLGCTL3D_HXX
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/e3dsceneupdater.hxx b/svx/inc/svx/e3dsceneupdater.hxx
new file mode 100644
index 0000000000..ecc413a47e
--- /dev/null
+++ b/svx/inc/svx/e3dsceneupdater.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: e3dsceneupdater.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_SCENEUPDATER_HXX
+#define _E3D_SCENEUPDATER_HXX
+
+#include <svx/svxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObject;
+class E3dScene;
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// This class is a helper to encapsulate 3D object changes which shall change the
+// scene's 2D geometry. E.g. when moving one 3D object in a scene, the visualisation
+// would not change since the scene's 2D attributes are defined by it's 2D object
+// transformation and the changed content would be projected to the same 2D bounds
+// as before. To reflect the fact that the 2D positions may 'change' for the user's
+// imagination, it is necessary to calculate a new 2D object transformation of the scene
+// (the SnapRect) using the old 3D transformation stack and the eventually changed
+// 3D content and tu use it. This is only wanted if changes to the scene's
+// content are intended to change the scene's 2D geometry attributes
+
+class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater
+{
+ // the scene which may be changed. This gets set to the outmost scene
+ // of the to-be-changed 3D object when the scene has a 3d transformation
+ // stack at construction time. In all other cases it's set to zero and
+ // no action needs to be taken
+ E3dScene* mpScene;
+
+ // the 3d transformation stack at the time of construction, valid when
+ // mpScene is not zero
+ drawinglayer::geometry::ViewInformation3D* mpViewInformation3D;
+
+public:
+ // the constructor evaluates and sets the members at construction time
+ E3DModifySceneSnapRectUpdater(const SdrObject* pObject);
+
+ // the destructor will take action if mpScene is not zero and modify the
+ // 2D geomeztry of the target scene
+ ~E3DModifySceneSnapRectUpdater();
+};
+
+#endif // _E3D_SCENEUPDATER_HXX
diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx
index 41f91fc5ad..4d5d62e145 100644
--- a/svx/inc/svx/extrud3d.hxx
+++ b/svx/inc/svx/extrud3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: extrud3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -54,13 +54,8 @@ private:
// Geometrie, die dieses Objekt bestimmt
basegfx::B2DPolyPolygon maExtrudePolygon;
- // #78972#
- basegfx::B3DPolyPolygon maLinePolyPolygon;
-
protected:
void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
- basegfx::B3DPolyPolygon GetFrontSide();
- basegfx::B3DPolyPolygon GetBackSide(const basegfx::B3DPolyPolygon& rFrontSide);
public:
TYPEINFO();
@@ -108,12 +103,6 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- // Geometrieerzeugung
- virtual void CreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// Lokale Parameter setzen/lesen mit Geometrieneuerzeugung
void SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew);
const basegfx::B2DPolyPolygon &GetExtrudePolygon() { return maExtrudePolygon; }
diff --git a/svx/inc/svx/float3d.hxx b/svx/inc/svx/float3d.hxx
index 99941f4303..bf7d49545f 100644
--- a/svx/inc/svx/float3d.hxx
+++ b/svx/inc/svx/float3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: float3d.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -61,8 +61,6 @@ enum ViewType3D
};
class SdrModel;
-class B3dLightGroup;
-
class FmFormModel;
class FmFormPage;
class VirtualDevice;
@@ -201,10 +199,9 @@ private:
ImageButton aBtnLatheObject;
ImageButton aBtnPerspective;
Svx3DPreviewControl aCtlPreview;
- SvxLightCtl3D aCtlLightPreview; // <-- Probleme mit Select/Change-Hdl, wenn ueberladen
+ SvxLightCtl3D aCtlLightPreview;
// der Rest ...
- B3dLightGroup* pLightGroup;
Image aImgLightOn;
Image aImgLightOff;
BOOL bUpdate;
diff --git a/svx/inc/svx/helperhittest3d.hxx b/svx/inc/svx/helperhittest3d.hxx
new file mode 100644
index 0000000000..8561618d57
--- /dev/null
+++ b/svx/inc/svx/helperhittest3d.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperhittest3d.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_HELPERHITTEST_HXX
+#define INCLUDED_SVX_HELPERHITTEST_HXX
+
+#include "svx/svxdllapi.h"
+#include <sal/types.h>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPoint;
+}
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+class E3dCompoundObject;
+class E3dScene;
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** support for getting a ViewInformation3D for a given CompoudObject3D
+ with correct ObjectTransformation filled out
+
+ @param o_rViewInformation3D
+ The ViewInformation3D created which will be overwritten
+
+ @param rCandidate
+ The E3dCompoundObject for which the ViewInformation3D shall be
+ prepared
+
+ @return
+ A pointer to the found and used root scene. This is also a hint
+ if the operation succeeded or not, since when object has no root
+ scene (is not inserted to a model), an empty ViewInformation3D
+ will be used
+*/
+E3dScene* fillViewInformation3DForCompoundObject(
+ drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D,
+ const E3dCompoundObject& rCandidate);
+
+/** support for getting all from a 2d position hit objects in a 3d scene
+ in a depth sorted array
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rScene
+ The 3D Scene for HitTest
+
+ @param o_rResult
+ Output parameter which contains all hit 3D objects inside rScene. This
+ vector will be changed in any case. If it's empty, no hit exists. If it's
+ not empty, the first object is the object closest to the viewer
+
+*/
+SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult);
+
+/** support for checking if the single given 3d object is hit at position
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rCandidate
+ The 3D Object which needs checking
+
+ @return
+ true if hit, false if not
+*/
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_HELPERHITTEST_HXX
+
+// eof
diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx
index 0a445aa01a..c87e6f1983 100644
--- a/svx/inc/svx/lathe3d.hxx
+++ b/svx/inc/svx/lathe3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: lathe3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -32,10 +32,6 @@
#define _E3D_LATHE3D_HXX
#include <svx/obj3d.hxx>
-
-//#ifndef _E3D_POLY3D_HXX
-//#include <svx/poly3d.hxx>
-//#endif
#include "svx/svxdllapi.h"
/*************************************************************************
@@ -60,15 +56,9 @@ private:
enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 };
basegfx::B2DPolyPolygon maPolyPoly2D;
- // #78972#
- basegfx::B3DPolyPolygon maLinePolyPolygon;
-
protected:
void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
- basegfx::B2DPolyPolygon CreateLathePolyPoly(const basegfx::B2DPolyPolygon& rPolyPoly2D, sal_uInt32 nVSegs);
- basegfx::B2DPolygon CreateLathePoly(const basegfx::B2DPolygon& rPoly2D, sal_uInt32 nVSegs);
-
public:
TYPEINFO();
E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon rPoly2D);
@@ -121,12 +111,6 @@ private:
virtual SdrObject* DoConvertToPolyObj(BOOL bBezier) const;
- // Geometrieerzeugung
- virtual void CreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx
index 119e29518a..20727b0d87 100644
--- a/svx/inc/svx/obj3d.hxx
+++ b/svx/inc/svx/obj3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: obj3d.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -34,18 +34,10 @@
#include <svx/svdoattr.hxx>
#include <svx/svdobj.hxx>
#include <svx/volume3d.hxx>
-
-#ifndef _DEF3D_HXX
#include <svx/def3d.hxx>
-#endif
#include <svx/svdpage.hxx>
#include <svx/deflt3d.hxx>
#include <vcl/bitmap.hxx>
-#include <goodies/b3dgeom.hxx>
-#include <goodies/matril3d.hxx>
-#include <goodies/b3dtex.hxx>
-#include <goodies/b3dlight.hxx>
-#include <goodies/base3d.hxx>
#include <svx/svx3ditems.hxx>
#include <svx/xflclit.hxx>
#include <svtools/itemset.hxx>
@@ -63,21 +55,16 @@ class SfxPoolItem;
class Viewport3D;
class E3dScene;
class E3dPolyScene;
-class Base3D;
-namespace basegfx { class B3DPolyPolygon; }
-namespace sdr
-{
- namespace properties
- {
- class BaseProperties;
- class E3dProperties;
- class E3dCompoundProperties;
- class E3dExtrudeProperties;
- class E3dLatheProperties;
- class E3dSphereProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace basegfx { class B3DPolyPolygon; }
+namespace sdr { namespace properties {
+ class BaseProperties;
+ class E3dProperties;
+ class E3dCompoundProperties;
+ class E3dExtrudeProperties;
+ class E3dLatheProperties;
+ class E3dSphereProperties;
+}}
/*************************************************************************
|*
@@ -88,8 +75,8 @@ namespace sdr
class E3DObjGeoData : public SdrObjGeoData
{
public:
- Volume3D aLocalBoundVol; // umschliessendes Volumen des Objekts
- basegfx::B3DHomMatrix aTfMatrix; // lokale Transformation
+ basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts
+ basegfx::B3DHomMatrix maTransformation; // lokale Transformation
E3DObjGeoData() {}
};
@@ -104,12 +91,12 @@ class E3dObjList : public SdrObjList
{
public:
TYPEINFO();
- E3dObjList(SdrModel* pNewModel, SdrPage* pNewPage, E3dObjList* pNewUpList=NULL);
+ E3dObjList(SdrModel* pNewModel = 0, SdrPage* pNewPage = 0, E3dObjList* pNewUpList = 0);
E3dObjList(const E3dObjList& rSrcList);
virtual ~E3dObjList();
- virtual void NbcInsertObject(SdrObject* pObj, ULONG nPos=CONTAINER_APPEND,
- const SdrInsertReason* pReason=NULL);
+ virtual void NbcInsertObject(SdrObject* pObj, ULONG nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL);
+ virtual void InsertObject(SdrObject* pObj, ULONG nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL);
virtual SdrObject* NbcRemoveObject(ULONG nObjNum);
virtual SdrObject* RemoveObject(ULONG nObjNum);
};
@@ -132,28 +119,24 @@ class SVX_DLLPUBLIC E3dObject : public SdrAttrObj
friend class E3dDragMethod;
protected:
- E3dObjList* pSub; // Subliste (Childobjekte)
+ E3dObjList maSubList; // Subliste (Childobjekte)
- Volume3D aBoundVol; // umschliessendes Volumen mit allen Childs
- Volume3D aLocalBoundVol; // umschliessendes Volumen des Objekts
- basegfx::B3DHomMatrix aTfMatrix; // lokale Transformation
- basegfx::B3DHomMatrix aFullTfMatrix; // globale Transformation (inkl. Parents)
+ basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung)
+ basegfx::B3DHomMatrix maTransformation; // lokale Transformation
+ basegfx::B3DHomMatrix maFullTransform; // globale Transformation (inkl. Parents)
// Flags
- unsigned bTfHasChanged : 1;
- unsigned bBoundVolValid : 1;
- unsigned bIsSelected : 1;
+ unsigned mbTfHasChanged : 1;
+ unsigned mbIsSelected : 1;
public:
- virtual void SetBoundVolInvalid();
+ void SetBoundVolInvalid();
protected:
- virtual void SetTransformChanged();
+ void SetTransformChanged();
virtual void NewObjectInserted(const E3dObject* p3DObj);
- virtual void StructureChanged(const E3dObject* p3DObj);
- virtual void RecalcBoundVolume();
-
- basegfx::B2DPolyPolygon ImpCreateWireframePoly() const;
+ virtual void StructureChanged();
+ basegfx::B3DRange RecalcBoundVolume() const;
protected:
// E3dObject is only a helper class (for E3DScene and E3DCompoundObject)
@@ -181,14 +164,8 @@ public:
virtual void SetModel(SdrModel* pNewModel);
virtual void NbcMove(const Size& rSize);
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
-
virtual SdrObjList* GetSubList() const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
- virtual sal_uInt32 GetHdlCount() const;
- virtual void AddToHdlList(SdrHdlList& rHdlList) const;
- virtual FASTBOOL HasSpecialDrag() const;
-
// 3D-Objekt in die Gruppe einfuegen; Eigentumsuebergang!
virtual void Insert3DObj(E3dObject* p3DObj);
void Remove3DObj(E3dObject* p3DObj);
@@ -196,56 +173,24 @@ public:
E3dObject* GetParentObj() const;
virtual E3dScene* GetScene() const;
- const Volume3D& GetLocalBoundVolume() { return aLocalBoundVol; }
- virtual const Volume3D& GetBoundVolume() const;
- basegfx::B3DPoint GetCenter();
+ const basegfx::B3DRange& GetBoundVolume() const;
+ void InvalidateBoundVolume();
// komplette Transformation inklusive aller Parents berechnen
const basegfx::B3DHomMatrix& GetFullTransform() const;
// Transformationsmatrix abfragen bzw. (zurueck)setzen
- virtual const basegfx::B3DHomMatrix& GetTransform() const;
+ const basegfx::B3DHomMatrix& GetTransform() const;
virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix);
- virtual void NbcResetTransform();
virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix);
- virtual void ResetTransform();
-
- // Translation
- virtual void NbcTranslate(const basegfx::B3DVector& rTrans);
- virtual void Translate(const basegfx::B3DVector& rTrans);
- // Skalierung
- virtual void NbcScaleX (double fSx);
- virtual void NbcScaleY (double fSy);
- virtual void NbcScaleZ (double fSz);
- virtual void NbcScale (double fSx, double fSy, double fSz);
- virtual void NbcScale (double fS);
-
- virtual void ScaleX (double fSx);
- virtual void ScaleY (double fSy);
- virtual void ScaleZ (double fSz);
- virtual void Scale (double fSx, double fSy, double fSz);
- virtual void Scale (double fS);
-
- // Rotation mit Winkel in Radiant
- virtual void NbcRotateX(double fAng);
- virtual void NbcRotateY(double fAng);
- virtual void NbcRotateZ(double fAng);
-
- virtual void RotateX(double fAng);
- virtual void RotateY(double fAng);
- virtual void RotateZ(double fAng);
// [FG] 2D-Rotationen, werden hier als Rotationen um die Z-Achse, die in den Bildschirm zeigt,
// implementiert plus eine Verschiebung der Scene. Dies bedeutet auch die Scene (E3dScene)
// muss diese Routine in der Klasse als virtual definieren.
virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
- // Transformation auf die Koordinaten (nicht auf die lokale Matrix)
- // eines Objekts und seiner Childs anwenden; Objekte, die eigene
- // Koordinaten speichern, muessen diese Methode implementieren
- // Wireframe-Darstellung des Objekts erzeugen und die Linien als
- // Punkt-Paare in rPoly3D ablegen
- void CreateWireframe(basegfx::B3DPolygon& rWirePoly, const basegfx::B3DHomMatrix* pTf = 0L) const;
+ // get wireframe polygon for local object. No transform is applied.
+ basegfx::B3DPolyPolygon CreateWireframe() const;
// TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
virtual void TakeObjNameSingul(String& rName) const;
@@ -258,8 +203,8 @@ public:
virtual void RestGeoData(const SdrObjGeoData& rGeo);
// Selektion Setzen/Lesen
- BOOL GetSelected() const { return bIsSelected; }
- void SetSelected(BOOL bNew);
+ bool GetSelected() const { return mbIsSelected; }
+ void SetSelected(bool bNew);
// Aufbrechen
virtual BOOL IsBreakObjPossible();
@@ -286,129 +231,15 @@ class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject
friend class sdr::properties::E3dLatheProperties;
friend class sdr::properties::E3dSphereProperties;
- // for access from E3dCompoundProperties only
- void InvalidateGeometry() { bGeometryValid = sal_False; }
-
protected:
- // Die Darstellungsgeometrie dieses Objektes
- B3dGeometry aDisplayGeometry;
-
// Material des Objektes
Color aMaterialAmbientColor;
- B3dMaterial aBackMaterial;
// Attribute zur Geometrieerzeugung
unsigned bCreateNormals : 1;
unsigned bCreateTexture : 1;
- // Wird zwischen Vorder- und Hintergrundmaterial unterschieden
- unsigned bUseDifferentBackMaterial : 1;
-
- // Geometrie gueltig?
- unsigned bGeometryValid : 1;
-
- // THB: Temporary fix for SJ's flipping problem
- // TODO: Clarify with AW
- unsigned bFullTfIsPositive : 1;
-
protected:
- // Hilfsfunktionen zur Geometrieerzeugung
- basegfx::B3DPolyPolygon ImpGrowPoly(
- const basegfx::B3DPolyPolygon& rPolyPolyGrow,
- const basegfx::B3DPolyPolygon& rPolyPolyNormals,
- double fFactor);
- basegfx::B2VectorOrientation ImpGetOrientationInPoint(
- const basegfx::B3DPolygon& rPolygon,
- sal_uInt32 nIndex);
- basegfx::B3DPolyPolygon ImpCorrectGrownPoly(
- const basegfx::B3DPolyPolygon& aToBeCorrected,
- const basegfx::B3DPolyPolygon& aOriginal);
-
- basegfx::B3DPolyPolygon ImpScalePoly(
- const basegfx::B3DPolyPolygon& rPolyPolyScale,
- double fFactor);
-
- void ImpCreateFront(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- BOOL bCreateNormals = TRUE,
- BOOL bCreateTexture = TRUE);
- void ImpCreateBack(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bCreateNormals = TRUE,
- BOOL bCreateTexture = TRUE);
-
- basegfx::B3DPolyPolygon ImpCreateByPattern(const basegfx::B3DPolyPolygon& rPattern);
- basegfx::B3DPolyPolygon ImpAddFrontNormals(
- const basegfx::B3DPolyPolygon& rNormalsFront,
- const basegfx::B3DPoint& rOffset);
- basegfx::B3DPolyPolygon ImpAddBackNormals(
- const basegfx::B3DPolyPolygon& rNormalsBack,
- const basegfx::B3DPoint& rOffset);
-
- basegfx::B3DPolyPolygon ImpAddInBetweenNormals(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rNormals,
- BOOL bSmoothed = TRUE);
- void ImpCreateInBetween(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bCreateNormals = TRUE,
- double fSurroundFactor=1.0,
- double fTextureStart=0.0,
- double fTextureDepth=1.0,
- BOOL bRotateTexture90=FALSE);
-
- // Geometrieerzeugung
- void AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- BOOL bHintIsComplex=TRUE,
- BOOL bOutline=FALSE);
- void AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- BOOL bHintIsComplex=TRUE,
- BOOL bOutline=FALSE);
- void AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- const basegfx::B2DPolyPolygon& rPolyPolygonTexture,
- BOOL bHintIsComplex=TRUE,
- BOOL bOutline=FALSE);
- void StartCreateGeometry();
-
- // Segmenterzeugung
- void ImpCreateSegment(
- const basegfx::B3DPolyPolygon& rFront, // vorderes Polygon
- const basegfx::B3DPolyPolygon& rBack, // hinteres Polygon
- const basegfx::B3DPolyPolygon* pPrev = 0L, // smooth uebergang zu Vorgaenger
- const basegfx::B3DPolyPolygon* pNext = 0L, // smooth uebergang zu Nachfolger
- BOOL bCreateFront = TRUE, // vorderen Deckel erzeugen
- BOOL bCreateBack = TRUE, // hinteren Deckel erzeugen
- double fPercentDiag = 0.05, // Anteil des Deckels an der Tiefe
- BOOL bSmoothLeft = TRUE, // Glaetten der umlaufenden Normalen links
- BOOL bSmoothRight = TRUE, // Glaetten der umlaufenden Normalen rechts
- BOOL bSmoothFrontBack = FALSE, // Glaetten der Abschlussflaechen
- double fSurroundFactor = 1.0, // Wertebereich der Texturkoordinaten im Umlauf
- double fTextureStart = 0.0, // TexCoor ueber Extrude-Tiefe
- double fTextureDepth = 1.0, // TexCoor ueber Extrude-Tiefe
- BOOL bCreateTexture = TRUE,
- BOOL bCreateNormals = TRUE,
- BOOL bCharacterExtrude = FALSE, // FALSE=exakt, TRUE=ohne Ueberschneidungen
- BOOL bRotateTexture90 = FALSE, // Textur der Seitenflaechen um 90 Grad kippen
- // #i28528#
- basegfx::B3DPolyPolygon* pLineGeometryFront = 0L, // For creation of line geometry front parts
- basegfx::B3DPolyPolygon* pLineGeometryBack = 0L, // For creation of line geometry back parts
- basegfx::B3DPolyPolygon* pLineGeometry = 0L // For creation of line geometry in-betweens
- );
-
- // #i28528#
- basegfx::B3DPolyPolygon ImpCompleteLinePolygon(const basegfx::B3DPolyPolygon& rLinePolyPoly, sal_uInt32 nPolysPerRun, sal_Bool bClosed);
-
void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
// convert given basegfx::B3DPolyPolygon to screen coor
@@ -421,6 +252,11 @@ public :
E3dCompoundObject(E3dDefaultAttributes& rDefault);
virtual ~E3dCompoundObject();
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+ virtual FASTBOOL HasSpecialDrag() const;
+
// DoubleSided: TRUE/FALSE
BOOL GetDoubleSided() const
{ return ((const Svx3DDoubleSidedItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue(); }
@@ -461,14 +297,6 @@ public :
sal_uInt16 GetMaterialSpecularIntensity() const
{ return ((const Svx3DMaterialSpecularIntensityItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue(); }
- // TextureKind: 1 == Base3DTextureLuminance, 2 == Base3DTextureIntensity, 3 == Base3DTextureColor
- Base3DTextureKind GetTextureKind() const
- { return (Base3DTextureKind)((const Svx3DTextureKindItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue(); }
-
- // TextureMode: 1 == Base3DTextureReplace, 2 == Base3DTextureModulate, 3 == Base3DTextureBlend
- Base3DTextureMode GetTextureMode() const
- { return (Base3DTextureMode)((const Svx3DTextureModeItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue(); }
-
// TextureFilter: TRUE/FALSE
BOOL GetTextureFilter() const
{ return ((const Svx3DTextureFilterItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue(); }
@@ -480,23 +308,10 @@ public :
virtual UINT16 GetObjIdentifier() const;
virtual void RecalcSnapRect();
- virtual const Volume3D& GetBoundVolume() const;
// Hittest, wird an Geometrie weitergegeben
virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
- // #110988# test if given hit candidate point is inside bound volume of object. Used
- // from CheckHit.
- sal_Bool ImpIsInsideBoundVolume(const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, const Point& rPnt) const;
-
- // Geometrieerzeugung
- void DestroyGeometry();
- virtual void CreateGeometry();
- void ReCreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// Parameter Geometrieerzeugung setzen/lesen
BOOL GetCreateNormals() const { return bCreateNormals; }
void SetCreateNormals(BOOL bNew);
@@ -507,32 +322,11 @@ public :
// Copy-Operator
virtual void operator=(const SdrObject&);
- // DisplayGeometry rausruecken
- const B3dGeometry& GetDisplayGeometry() const;
-
- // Schattenattribute holen
- Color GetShadowColor() const;
- BOOL DrawShadowAsOutline() const;
- INT32 GetShadowXDistance() const;
- INT32 GetShadowYDistance() const;
- BOOL DoDrawShadow();
-
- // Nromalen invertiert benutzen
-private:
- SVX_DLLPRIVATE void SetInvertNormals(BOOL bNew);
-public:
-
// Material des Objektes
const Color& GetMaterialAmbientColor() const { return aMaterialAmbientColor; }
void SetMaterialAmbientColor(const Color& rColor);
- const B3dMaterial& GetBackMaterial() const { return aBackMaterial; }
- void SetBackMaterial(const B3dMaterial& rNew);
- BOOL GetUseDifferentBackMaterial() const { return bUseDifferentBackMaterial; }
- void SetUseDifferentBackMaterial(BOOL bNew);
-
// #110988#
- double GetMinimalDepthInViewCoor(E3dScene& rScene) const;
sal_Bool IsAOrdNumRemapCandidate(E3dScene*& prScene) const;
};
diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx
index 9087ab2d7f..63ceee30cc 100644
--- a/svx/inc/svx/polygn3d.hxx
+++ b/svx/inc/svx/polygn3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: polygn3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -84,12 +84,6 @@ public:
virtual void operator=(const SdrObject&);
- // Geometrieerzeugung
- virtual void CreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// LineOnly?
BOOL GetLineOnly() { return bLineOnly; }
void SetLineOnly(BOOL bNew);
diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx
index c995ed40d2..ccccf1ded4 100644
--- a/svx/inc/svx/scene3d.hxx
+++ b/svx/inc/svx/scene3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: scene3d.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -32,20 +32,19 @@
#define _E3D_SCENE3D_HXX
#include <svx/camera3d.hxx>
-#include <goodies/base3d.hxx>
#include <goodies/b3dtrans.hxx>
#include <tools/time.hxx>
#include <svx/svxdllapi.h>
#include <svx/obj3d.hxx>
-namespace sdr
-{
- namespace properties
- {
- class BaseProperties;
- class E3dSceneProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class BaseProperties;
+ class E3dSceneProperties;
+}}
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
/*************************************************************************
|*
@@ -85,38 +84,16 @@ private:
protected:
// Transformationen
B3dCamera aCameraSet;
-
- // Beleuchtung
- B3dLightGroup aLightGroup;
-
Camera3D aCamera;
- // Zeit, die der letzte Paint() benoetigte
- Time aPaintTime;
-
- // Darstellungsqualitaet, wird in Base3D verwendet
- UINT8 nDisplayQuality;
-
// #110988#
Imp3DDepthRemapper* mp3DDepthRemapper;
- // BOOLean Flags
- unsigned bDoubleBuffered : 1;
- unsigned bClipping : 1;
- unsigned bFitInSnapRect : 1;
- unsigned bDither : 1;
-
- // Merker, ob die Szene urspruenglich selektiert war
- unsigned bWasSelectedWhenCopy : 1;
-
// Flag to determine if only selected objects should be drawn
unsigned bDrawOnlySelected : 1;
- // #i71618#
- double mfPolygonOffset;
-
virtual void NewObjectInserted(const E3dObject* p3DObj);
- virtual void StructureChanged(const E3dObject* p3DObj);
+ virtual void StructureChanged();
void RebuildLists();
@@ -134,21 +111,10 @@ public:
E3dScene(E3dDefaultAttributes& rDefault);
virtual ~E3dScene();
- // #i71618#
- // support for value for PolygonOffset. Value is relative to Z-Buffer depth. Used
- // for 3d rendering. See Base3D for more info
- void setPolygonOffset(double fNew)
- {
- if(fNew != mfPolygonOffset)
- {
- mfPolygonOffset = fNew;
- }
- }
-
- double getPolygonOffset() const
- {
- return mfPolygonOffset;
- }
+ // access to cleanup of depth mapper
+ void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); }
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
// #110988#
sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
@@ -237,16 +203,9 @@ public:
// set flag to draw only selected
void SetDrawOnlySelected(BOOL bNew) { bDrawOnlySelected = bNew; }
- BOOL DoDrawOnlySelected() const { return bDrawOnlySelected; }
-
- virtual basegfx::B3DRange FitInSnapRect();
-
+ bool GetDrawOnlySelected() const { return bDrawOnlySelected; }
virtual UINT16 GetObjIdentifier() const;
- virtual sal_uInt32 GetHdlCount() const;
- virtual void AddToHdlList(SdrHdlList& rHdlList) const;
- virtual FASTBOOL HasSpecialDrag() const;
-
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual void NbcMove(const Size& rSize);
virtual void NbcResize(const Point& rRef, const Fraction& rXFact,
@@ -254,38 +213,19 @@ public:
virtual void RecalcSnapRect();
virtual E3dScene* GetScene() const;
-
- // TransformationSet vorbereiten
- void InitTransformationSet();
-
- Time GetLastPaintTime() { return aPaintTime; }
-
- // Darstellungsqualitaet
- void SetDisplayQuality(UINT8 nNew) { nDisplayQuality = nNew; }
- UINT8 GetDisplayQuality() { return nDisplayQuality; }
-
void SetCamera(const Camera3D& rNewCamera);
const Camera3D& GetCamera() const { return aCamera; }
+ void removeAllNonSelectedObjects();
- void SetDoubleBuffered(FASTBOOL bBuff = TRUE);
- FASTBOOL IsDoubleBuffered() const { return bDoubleBuffered; }
-
- // Clipping auf umschliessendes Rechteck der Szene
- // (Double Buffering ist immer geclipt!)
- void SetClipping(FASTBOOL bClip = TRUE);
- FASTBOOL IsClipping() const { return bClipping; }
-
- void SetFitInSnapRect(FASTBOOL bFit = TRUE);
- void CorrectSceneDimensions();
- FASTBOOL IsFitInSnapRect() const { return bFitInSnapRect; }
-
- void FitSnapRectToBoundVol();
virtual void operator=(const SdrObject&);
virtual SdrObjGeoData *NewGeoData() const;
virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
virtual void RestGeoData(const SdrObjGeoData& rGeo);
+ virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix);
+ virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix);
+
virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
void RotateScene(const Point& rRef, long nWink, double sn, double cs);
@@ -296,29 +236,12 @@ public:
// Transformationen rausgeben
B3dCamera& GetCameraSet() { return aCameraSet; }
- // Beleuchtung rausgeben
- B3dLightGroup& GetLightGroup() { return aLightGroup; }
-
- // Dithering
- BOOL GetDither() { return bDither; }
- void SetDither(BOOL bNew) { bDither = bNew; }
-
- // Marker fuer WasSelectedWhenCopy
- BOOL GetWasSelectedWhenCopy() { return bWasSelectedWhenCopy; }
- void SetWasSelectedWhenCopy(BOOL bNew) { bWasSelectedWhenCopy = bNew; }
-
// Aufbrechen
virtual BOOL IsBreakObjPossible();
basegfx::B3DVector GetShadowPlaneDirection() const;
void SetShadowPlaneDirection(const basegfx::B3DVector& rVec);
- // #115662#
- // For new chart, calculate the number of hit contained 3D objects at given point,
- // give back the count and a depth-sorted list of SdrObjects (a Vector). The vector will be
- // changed, at least cleared.
- sal_uInt32 HitTest(const Point& rHitTestPosition, ::std::vector< SdrObject* >& o_rResult);
-
// Polygon das waehrend des Erzeugens aufgezogen wird
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx
index a3d1c54e87..ad92d5afd5 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -48,6 +48,7 @@ namespace drawinglayer { namespace attribute {
namespace basegfx {
class BColor;
+ class B3DHomMatrix;
}
class E3dObject;
@@ -79,19 +80,19 @@ namespace sdr
// public helpers
drawinglayer::primitive2d::Primitive2DSequence impCreateWithGivenPrimitive3DSequence(
const drawinglayer::primitive3d::Primitive3DSequence& rxContent3D) const;
- const ViewContactOfE3dScene* tryToFindVCOfE3DScene() const;
//////////////////////////////////////////////////////////////////////////////
// primitive stuff
protected:
- // Primitive2DSequence of the ViewContact. This contains all necessary information
+ // Primitive3DSequence of the ViewContact. This contains all necessary information
// for the graphical visualisation and needs to be supported by all 3D VCs which
- // can be visualized.
+ // can be visualized. It does NOT contain the object transformation to be able to
+ // buffer for all possible usages
drawinglayer::primitive3d::Primitive3DSequence mxViewIndependentPrimitive3DSequence;
// This method is responsible for creating the graphical visualisation data which is
- // stored in mxViewIndependentPrimitive3DSequence
+ // stored in mxViewIndependentPrimitive3DSequence, but without object transformation
virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const = 0;
// This method is responsible for creating the graphical visualisation data derived ONLY from
@@ -103,8 +104,14 @@ namespace sdr
drawinglayer::attribute::SdrLineAttribute* impCreateFallbackLineAttribute(const basegfx::BColor& rBColor) const;
public:
+ // access to the local primitive without the object's local 3D transform. This is e.g. needed
+ // to get the not-yet transformed BoundVolume for e.g. interactions
+ drawinglayer::primitive3d::Primitive3DSequence getVIP3DSWithoutObjectTransform() const;
+
// access to the local primitive. This will ensure that the list is
- // current in comparing the local list content with a fresh created incarnation
+ // current in comparing the local list content with a fresh created incarnation. It will
+ // use getVIP3DSWithoutObjectTransform and embed to 3d transform primitive when object's
+ // local 3d transform is used
drawinglayer::primitive3d::Primitive3DSequence getViewIndependentPrimitive3DSequence() const;
};
} // end of namespace contact
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx
index 8f2d47f5b4..aec9d8df54 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofe3dscene.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -59,7 +59,7 @@ namespace sdr
{
namespace contact
{
- class ViewContactOfE3dScene : public ViewContactOfSdrObj
+ class SVX_DLLPUBLIC ViewContactOfE3dScene : public ViewContactOfSdrObj
{
protected:
// Create a Object-Specific ViewObjectContact, set ViewContact and
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx
index f6d5a20dc5..84c7c35d4c 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewobjectcontactofgraphic.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -60,7 +60,8 @@ namespace sdr
// async graphics loading helpers. Only to be used internally or from the
// event helper class (in .cxx file)
- bool impPrepareForPaint();
+ bool impPrepareGraphicWithAsynchroniousLoading();
+ bool impPrepareGraphicWithSynchroniousLoading();
void doAsynchGraphicLoading();
void forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent* pEvent);
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx
index ba9c63aa57..444820cc5c 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewobjectcontactofpageobj.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -37,9 +37,9 @@
//////////////////////////////////////////////////////////////////////////////
// predeclarations
-namespace {
+namespace sdr { namespace contact {
class PagePrimitiveExtractor;
-}
+}}
class SdrPage;
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
index f665a0e2a2..505bc25791 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewobjectcontactofsdrmediaobj.hxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -66,13 +66,6 @@ namespace sdr
::sdr::contact::SdrMediaWindow* mpMediaWindow;
- //////////////////////////////////////////////////////////////////////////////
- // primitive stuff
- public:
- // process this primitive: ask for isPrimitiveVisible() and take necessary actions
- // to give useful data to the processor in DisplayInfo. Eventually also
- // recursively travel a existing hierarchy, e.g. for group objects
- virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
};
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
index bff9814426..3f60816060 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrattributecreator.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -38,7 +38,6 @@
// predefines
class SfxItemSet;
class SdrText;
-class B3dLightGroup;
namespace drawinglayer { namespace attribute {
class SdrLineAttribute;
@@ -80,7 +79,7 @@ namespace drawinglayer
attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText);
attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill);
attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet);
- attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet, const B3dLightGroup& rLightGroup);
+ attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet);
attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(const SfxItemSet& rSet, const SdrText* pSdrText);
// helpers
diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
index 4714b3394e..00d98e9dcf 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrcustomshapeprimitive2d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -50,7 +50,12 @@ namespace drawinglayer
private:
attribute::SdrShadowTextAttribute maSdrSTAttribute;
Primitive2DSequence maSubPrimitives;
- ::basegfx::B2DHomMatrix maTextBox;
+ basegfx::B2DHomMatrix maTextBox;
+
+ // bitfield
+ // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means
+ // that the text needs to be block formatted
+ unsigned mbWordWrap : 1;
protected:
// local decomposition.
@@ -60,12 +65,14 @@ namespace drawinglayer
SdrCustomShapePrimitive2D(
const attribute::SdrShadowTextAttribute& rSdrSTAttribute,
const Primitive2DSequence& rSubPrimitives,
- const ::basegfx::B2DHomMatrix& rTextBox);
+ const basegfx::B2DHomMatrix& rTextBox,
+ bool bWordWrap);
// data access
const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; }
const Primitive2DSequence& getSubPrimitives() const { return maSubPrimitives; }
- const ::basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; }
+ const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; }
+ bool getWordWrap() const { return mbWordWrap; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
index 9bdaf31da4..118c368ab6 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrdecompositiontools.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -74,7 +74,8 @@ namespace drawinglayer
const ::basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrTextAttribute& rText,
const attribute::SdrLineAttribute* pStroke,
- bool bCellText);
+ bool bCellText,
+ bool bWordWrap);
Primitive2DReference createShadowPrimitive(
const Primitive2DSequence& rSource,
diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
index b8b21f0ff5..e277dea965 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrtextprimitive2d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -182,6 +182,7 @@ namespace drawinglayer
// bitfield
unsigned mbUnlimitedPage : 1; // force layout with no text break
unsigned mbCellText : 1; // this is a cell text as block text
+ unsigned mbWordWrap : 1; // for CustomShapes text layout
protected:
// local decomposition.
@@ -192,12 +193,14 @@ namespace drawinglayer
const SdrText& rSdrText,
const ::basegfx::B2DHomMatrix& rTextRangeTransform,
bool bUnlimitedPage,
- bool bCellText);
+ bool bCellText,
+ bool bWordWrap);
// get data
const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
bool getUnlimitedPage() const { return mbUnlimitedPage; }
bool getCellText() const { return mbCellText; }
+ bool getWordWrap() const { return mbWordWrap; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx b/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx
index 77824c0659..c5fdbdb581 100644
--- a/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx
+++ b/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dsceneproperties.hxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,9 +33,6 @@
#include <svx/sdr/properties/e3dproperties.hxx>
-// predeclarations
-class B3dLightGroup;
-
//////////////////////////////////////////////////////////////////////////////
namespace sdr
@@ -90,7 +87,6 @@ namespace sdr
virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
// Special for scene:
- void SetLightItemsFromLightGroup(B3dLightGroup& rLightGroup);
void SetSceneItemsFromCamera();
};
} // end of namespace properties
diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx
index 6bdeddde20..38f78eca52 100644
--- a/svx/inc/svx/sphere3d.hxx
+++ b/svx/inc/svx/sphere3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sphere3d.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -49,7 +49,7 @@ private:
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
- basegfx::B3DPoint aCenter;
+ basegfx::B3DPoint aCenter;
basegfx::B3DVector aSize;
protected:
@@ -82,12 +82,6 @@ public:
const basegfx::B3DPoint& Center() const { return aCenter; }
const basegfx::B3DVector& Size() const { return aSize; }
- // Geometrieerzeugung
- virtual void CreateGeometry();
-
- // Give out simple line geometry
- virtual basegfx::B3DPolyPolygon Get3DLineGeometry() const;
-
// Lokale Parameter setzen mit Geometrieneuerzeugung
void SetCenter(const basegfx::B3DPoint& rNew);
void SetSize(const basegfx::B3DVector& rNew);
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 1d196924bf..c52da4226f 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -32,9 +32,7 @@
#define _SVDOASHP_HXX
#include <svx/svdobj.hxx>
-#ifndef _SVDOATTR_HXX
#include <svx/svdotext.hxx>
-#endif
#include <svx/svdhdl.hxx>
#include <vector>
#include <com/sun/star/uno/Reference.h>
@@ -236,7 +234,7 @@ public:
virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual basegfx::B2DPolyPolygon TakeContour() const;
virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index 2fe7cc1c84..71a6d866b4 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdobj.hxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.16.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,10 +33,7 @@
#include <memory>
#include <cppuhelper/weakref.hxx>
-
-#ifndef _MAPMOD_HXX //autogen
#include <vcl/mapmod.hxx>
-#endif
#include <tools/weakbase.hxx>
#include <svtools/lstner.hxx>
#include <vcl/timer.hxx>
@@ -45,13 +42,7 @@
#include <svx/svdglue.hxx> // Klebepunkte
#include <svx/xdash.hxx>
#include <svx/xpoly.hxx>
-
-//#ifndef _POLY3D_HXX
-//#include <svx/poly3d.hxx>
-//#endif
#include <svx/xenum.hxx>
-
-// #111096#
#include <vcl/bitmapex.hxx>
#include <svx/sdrobjectuser.hxx>
#include "svx/svxdllapi.h"
@@ -712,7 +703,7 @@ public:
// Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt.
// Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert.
// Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen.
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
// Die Kontur fuer TextToContour
virtual basegfx::B2DPolyPolygon TakeContour() const;
diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx
index 73691d17d4..e294151fc0 100644
--- a/svx/inc/svx/svdocapt.hxx
+++ b/svx/inc/svx/svdocapt.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdocapt.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -40,13 +40,9 @@
class ImpCaptParams;
-namespace sdr
-{
- namespace properties
- {
- class CaptionProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class CaptionProperties;
+}}
#define SDRSETITEM_CAPTION_ATTR SDRSETITEM_ATTR_COUNT
@@ -83,7 +79,7 @@ private:
Polygon aTailPoly; // das ganze Polygon des Schwanzes
sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE
- Point maFixedTailPos; // for calc note box fixed tail position.
+ Point maFixedTailPos; // for calc note box fixed tail position.
private:
SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
@@ -116,7 +112,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual void SetModel(SdrModel* pNewModel);
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx
index c40906ed95..138448abb9 100644
--- a/svx/inc/svx/svdocirc.hxx
+++ b/svx/inc/svx/svdocirc.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdocirc.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -38,13 +38,9 @@
// Vorausdeklarationen
//************************************************************
-namespace sdr
-{
- namespace properties
- {
- class CircleProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class CircleProperties;
+}}
//************************************************************
// Hilfsklasse SdrCircObjGeoData
@@ -125,7 +121,7 @@ public:
virtual void operator=(const SdrObject& rObj);
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual sal_uInt32 GetSnapPointCount() const;
virtual Point GetSnapPoint(sal_uInt32 i) const;
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
index e84cc1c5b8..d40773c3f5 100644
--- a/svx/inc/svx/svdoedge.hxx
+++ b/svx/inc/svx/svdoedge.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdoedge.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -42,13 +42,9 @@
class SdrDragMethod;
class SdrPageView;
-namespace sdr
-{
- namespace properties
- {
- class ConnectorProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class ConnectorProperties;
+}}
//************************************************************
// Hilfsklasse SdrObjConnection
@@ -264,7 +260,7 @@ public:
void SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly );
basegfx::B2DPolyPolygon GetEdgeTrackPath() const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual sal_uInt32 GetHdlCount() const;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 5d912c1f7a..dac8273bb3 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdograf.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -142,7 +142,7 @@ public:
virtual ~SdrGrafObj();
void SetGraphicObject( const GraphicObject& rGrfObj );
- const GraphicObject& GetGraphicObject() const;
+ const GraphicObject& GetGraphicObject( bool bForceSwapIn = false) const;
void SetGraphic(const Graphic& rGrf);
const Graphic& GetGraphic() const;
@@ -186,7 +186,7 @@ public:
virtual void TakeObjNamePlural(String& rName) const;
// #i25616#
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual void operator=(const SdrObject& rObj);
virtual FASTBOOL HasSpecialDrag() const;
diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx
index cc9a0bb2ae..4d6a49377c 100644
--- a/svx/inc/svx/svdogrp.hxx
+++ b/svx/inc/svx/svdogrp.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdogrp.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -91,7 +91,7 @@ public:
virtual void TakeObjNamePlural(String& rName) const;
virtual void RecalcSnapRect();
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual FASTBOOL BegDrag(SdrDragStat& rDrag) const;
virtual FASTBOOL BegCreate(SdrDragStat& rStat);
diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx
index 5e06ac6533..b3c521e741 100644
--- a/svx/inc/svx/svdomeas.hxx
+++ b/svx/inc/svx/svdomeas.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdomeas.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -42,13 +42,9 @@ class SdrOutliner;
struct ImpMeasureRec;
struct ImpMeasurePoly;
-namespace sdr
-{
- namespace properties
- {
- class MeasureProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class MeasureProperties;
+}}
//************************************************************
// Hilfsklasse SdrMeasureObjGeoData
@@ -115,7 +111,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual sal_uInt32 GetHdlCount() const;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
virtual FASTBOOL HasSpecialDrag() const;
diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx
index ce96d1457a..b3cd9ee839 100644
--- a/svx/inc/svx/svdopath.hxx
+++ b/svx/inc/svx/svdopath.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdopath.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -104,7 +104,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual sal_uInt32 GetHdlCount() const;
diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index dcf685fda3..d70cef1c55 100644
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdorect.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -40,13 +40,9 @@
class XPolygon;
-namespace sdr
-{
- namespace properties
- {
- class RectangleProperties;
- } // end of namespace properties
-} // end of namespace sdr
+namespace sdr { namespace properties {
+ class RectangleProperties;
+}}
//************************************************************
// SdrRectObj
@@ -116,7 +112,7 @@ public:
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual void NbcSetLogicRect(const Rectangle& rRect);
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual sal_uInt32 GetHdlCount() const;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx
index 6f9aef4eb5..b91c42ae9c 100644
--- a/svx/inc/svx/svdotable.hxx
+++ b/svx/inc/svx/svdotable.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdotable.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -230,7 +230,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
virtual void operator=(const SdrObject& rObj);
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual basegfx::B2DPolyPolygon TakeContour() const;
virtual void RecalcSnapRect();
virtual const Rectangle& GetSnapRect() const;
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index 3c40f588ae..88430005c3 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdotext.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -434,7 +434,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
virtual void operator=(const SdrObject& rObj);
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual basegfx::B2DPolyPolygon TakeContour() const;
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx
index 79ab364d70..b351ff90b3 100644
--- a/svx/inc/svx/svdovirt.hxx
+++ b/svx/inc/svx/svdovirt.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdovirt.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -90,7 +90,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual basegfx::B2DPolyPolygon TakeXorPoly(sal_Bool bDetail) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual sal_uInt32 GetHdlCount() const;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
diff --git a/svx/inc/svx/svx3ditems.hxx b/svx/inc/svx/svx3ditems.hxx
index 1296636a61..558c1904cf 100644
--- a/svx/inc/svx/svx3ditems.hxx
+++ b/svx/inc/svx/svx3ditems.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svx3ditems.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -196,7 +196,7 @@ public:
Svx3DTwoSidedLightingItem(BOOL bVal = 0);
};
-class Svx3DLightcolor1Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor1Item : public SvxColorItem {
public:
Svx3DLightcolor1Item(const Color& rCol = Color(0xffcccccc));
};
@@ -206,37 +206,37 @@ public:
Svx3DLightcolor2Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor3Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor3Item : public SvxColorItem {
public:
Svx3DLightcolor3Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor4Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor4Item : public SvxColorItem {
public:
Svx3DLightcolor4Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor5Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor5Item : public SvxColorItem {
public:
Svx3DLightcolor5Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor6Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor6Item : public SvxColorItem {
public:
Svx3DLightcolor6Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor7Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor7Item : public SvxColorItem {
public:
Svx3DLightcolor7Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DLightcolor8Item : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DLightcolor8Item : public SvxColorItem {
public:
Svx3DLightcolor8Item(const Color& rCol = Color(0x00000000));
};
-class Svx3DAmbientcolorItem : public SvxColorItem {
+class SVX_DLLPUBLIC Svx3DAmbientcolorItem : public SvxColorItem {
public:
Svx3DAmbientcolorItem(const Color& rCol = Color(0x00666666));
};
@@ -251,37 +251,37 @@ public:
Svx3DLightOnOff2Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff3Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff3Item : public SfxBoolItem {
public:
Svx3DLightOnOff3Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff4Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff4Item : public SfxBoolItem {
public:
Svx3DLightOnOff4Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff5Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff5Item : public SfxBoolItem {
public:
Svx3DLightOnOff5Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff6Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff6Item : public SfxBoolItem {
public:
Svx3DLightOnOff6Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff7Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff7Item : public SfxBoolItem {
public:
Svx3DLightOnOff7Item(BOOL bVal = 0);
};
-class Svx3DLightOnOff8Item : public SfxBoolItem {
+class SVX_DLLPUBLIC Svx3DLightOnOff8Item : public SfxBoolItem {
public:
Svx3DLightOnOff8Item(BOOL bVal = 0);
};
-class Svx3DLightDirection1Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection1Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection1Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.57735026918963, 0.57735026918963, 0.57735026918963));
};
@@ -291,32 +291,32 @@ public:
Svx3DLightDirection2Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection3Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection3Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection3Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection4Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection4Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection4Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection5Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection5Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection5Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection6Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection6Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection6Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection7Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection7Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection7Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
-class Svx3DLightDirection8Item : public SvxB3DVectorItem {
+class SVX_DLLPUBLIC Svx3DLightDirection8Item : public SvxB3DVectorItem {
public:
Svx3DLightDirection8Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
};
diff --git a/svx/inc/svx/viewpt3d.hxx b/svx/inc/svx/viewpt3d.hxx
index d881dc6b45..dbdcac36f3 100644
--- a/svx/inc/svx/viewpt3d.hxx
+++ b/svx/inc/svx/viewpt3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewpt3d.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -61,8 +61,8 @@ class SVX_DLLPUBLIC Viewport3D
protected:
basegfx::B3DHomMatrix aViewTf; // die eigentliche Transformationsmatrix
basegfx::B3DPoint aVRP; // View Reference Point
- basegfx::B3DVector aVPN; // View Plane Normal
- basegfx::B3DVector aVUV; // View Up Vector
+ basegfx::B3DVector aVPN; // View Plane Normal
+ basegfx::B3DVector aVUV; // View Up Vector
basegfx::B3DPoint aPRP; // Projection Reference Point(View-Koordinaten)
// bisher wird nur die Z-Koordinate beachtet
double fVPD; // View Plane Distance
@@ -118,9 +118,6 @@ class SVX_DLLPUBLIC Viewport3D
void SetViewWindow(double fX, double fY, double fW, double fH);
void GetViewWindow(double& rX, double& rY, double& rW, double& rH) const;
- // View-Window genau um das mit rTransform transformierte Volumen legen
- void FitViewToVolume(const basegfx::B3DRange& rVolume, const basegfx::B3DHomMatrix& rTransform);
-
void SetDeviceWindow(const Rectangle& rRect);
const Rectangle& GetDeviceWindow() const { return aDeviceRect; }
diff --git a/svx/inc/svx/volume3d.hxx b/svx/inc/svx/volume3d.hxx
index 5edbb3f9d0..514d567e73 100644
--- a/svx/inc/svx/volume3d.hxx
+++ b/svx/inc/svx/volume3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: volume3d.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -32,56 +32,5 @@
#define _VOLUME3D_HXX
#include <basegfx/range/b3drange.hxx>
-#include "svx/svxdllapi.h"
-
-//************************************************************
-// Vorausdeklarationen
-//************************************************************
-namespace basegfx
-{
- class B3DPolygon;
- class B3DPoint;
- class B3DHomMatrix;
-}
-
-/*************************************************************************
-|*
-|* dreidimensionales Volumen, symmetrisch zu den Koordinatenachsen
-|*
-\************************************************************************/
-
-class SVX_DLLPUBLIC Volume3D : public basegfx::B3DRange
-{
-public:
- Volume3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& r3DSize, bool bPosIsCenter = true);
- explicit Volume3D(const basegfx::B3DRange& rVol);
- Volume3D();
-
- Volume3D GetTransformVolume(const basegfx::B3DHomMatrix& rTfMatrix) const;
- void CreateWireframe(basegfx::B3DPolygon& rPoly3D, const basegfx::B3DHomMatrix* pTf = 0L) const;
-};
-
-/*************************************************************************
-|*
-|* Iterator, der die Eckpunkte eines Volumens berechnet; wenn eine Matrix
-|* uebergeben wird, werden die Punkte damit transformiert
-|*
-\************************************************************************/
-
-class Vol3DPointIterator
-{
-protected:
- const basegfx::B3DRange& rVolume;
- const basegfx::B3DHomMatrix* pTransform;
- basegfx::B3DVector a3DExtent;
- sal_uInt16 nIndex;
-
-public:
- Vol3DPointIterator(const basegfx::B3DRange& rVol, const basegfx::B3DHomMatrix* pTf = NULL);
-
- bool Next(basegfx::B3DPoint& rVec);
- void Reset() { nIndex = 0; }
-};
-
#endif // _VOLUME3D_HXX
diff --git a/svx/prj/d.lst b/svx/prj/d.lst
index fb4fa6b2ea..80f230721d 100644
--- a/svx/prj/d.lst
+++ b/svx/prj/d.lst
@@ -169,6 +169,7 @@ mkdir: %_DEST%\inc%_EXT%\svx
..\inc\svx\ruler.hxx %_DEST%\inc%_EXT%\svx\ruler.hxx
..\inc\rulritem.hxx %_DEST%\inc%_EXT%\svx\rulritem.hxx
..\inc\svx\scene3d.hxx %_DEST%\inc%_EXT%\svx\scene3d.hxx
+..\inc\svx\e3dsceneupdater.hxx %_DEST%\inc%_EXT%\svx\e3dsceneupdater.hxx
..\inc\svx\sdangitm.hxx %_DEST%\inc%_EXT%\svx\sdangitm.hxx
..\inc\svx\sderitm.hxx %_DEST%\inc%_EXT%\svx\sderitm.hxx
..\inc\svx\sdgcoitm.hxx %_DEST%\inc%_EXT%\svx\sdgcoitm.hxx
@@ -656,6 +657,7 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table
..\inc\svx\svdtext.hxx %_DEST%\inc%_EXT%\svx\svdtext.hxx
..\inc\svx\svdotable.hxx %_DEST%\inc%_EXT%\svx\svdotable.hxx
..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx
+..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx
..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx
..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 93ede44e8e..f2b603281d 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: EnhancedCustomShape3d.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,18 +33,14 @@
#include "EnhancedCustomShape3d.hxx"
#include <svx/svdetc.hxx>
#include <svx/svdmodel.hxx>
-#ifndef _SV_POLY_HXX
#include <tools/poly.hxx>
-#endif
#include <svditer.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdoashp.hxx>
#include <svtools/poolitem.hxx>
#include <svtools/itemset.hxx>
#include <svx/xfillit0.hxx>
-#ifndef SVX_XSFLCLIT_HXX
#include <svx/xsflclit.hxx>
-#endif
#include <svx/xit.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xflclit.hxx>
@@ -64,9 +60,7 @@
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <svx/sdr/properties/properties.hxx>
-#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARIR_HPP_
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
-#endif
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -87,6 +81,7 @@ void GetOrigin( SdrCustomShapeGeometryItem& rItem, double& rOriginX, double& rOr
rOriginY =-0.50;
}
}
+
void GetRotateAngle( SdrCustomShapeGeometryItem& rItem, double& rAngleX, double& rAngleY )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
@@ -100,6 +95,7 @@ void GetRotateAngle( SdrCustomShapeGeometryItem& rItem, double& rAngleX, double&
rAngleX *= F_PI180;
rAngleY *= F_PI180;
}
+
void GetSkew( SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rSkewAngle )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
@@ -112,6 +108,7 @@ void GetSkew( SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rS
}
rSkewAngle *= F_PI180;
}
+
void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, double& rBackwardDepth, double& rForwardDepth )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
@@ -135,6 +132,7 @@ void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, d
rForwardDepth *= fMap;
}
}
+
double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, double fDefault, const double* pMap )
{
double fRetValue = fDefault;
@@ -145,6 +143,7 @@ double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPrope
fRetValue *= *pMap;
return fRetValue;
}
+
drawing::ShadeMode GetShadeMode( SdrCustomShapeGeometryItem& rItem, const drawing::ShadeMode eDefault )
{
drawing::ShadeMode eRet( eDefault );
@@ -154,6 +153,7 @@ drawing::ShadeMode GetShadeMode( SdrCustomShapeGeometryItem& rItem, const drawin
*pAny >>= eRet;
return eRet;
}
+
sal_Int32 GetInt32( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Int32 nDefault )
{
sal_Int32 nRetValue = nDefault;
@@ -162,6 +162,7 @@ sal_Int32 GetInt32( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPro
*pAny >>= nRetValue;
return nRetValue;
}
+
sal_Bool GetBool( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Bool bDefault )
{
sal_Bool bRetValue = bDefault;
@@ -170,6 +171,7 @@ sal_Bool GetBool( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPrope
*pAny >>= bRetValue;
return bRetValue;
}
+
awt::Point GetPoint( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const awt::Point& rDefault )
{
awt::Point aRetValue( rDefault );
@@ -178,6 +180,7 @@ awt::Point GetPoint( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPr
*pAny >>= aRetValue;
return aRetValue;
}
+
drawing::Position3D GetPosition3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName,
const drawing::Position3D& rDefault, const double* pMap )
{
@@ -410,7 +413,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if( aPolyPoly.count() )
{
const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
- const Rectangle aBoundRect(FRound(aTempRange.getMinX()), FRound(aTempRange.getMinY()), FRound(aTempRange.getMaxX()), FRound(aTempRange.getMaxY()));
+ const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY()));
aBoundRect2d.Union( aBoundRect );
E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
@@ -499,8 +502,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
// Kameraeinstellungen, Perspektive ...
Camera3D& rCamera = (Camera3D&)pScene->GetCamera();
- const Volume3D& rVolume = pScene->GetBoundVolume();
- pScene->CorrectSceneDimensions();
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
pScene->NbcSetSnapRect( aSnapRect );
// InitScene replacement
@@ -573,8 +575,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
rCamera.SetPosAndLookAt( aNewCamPos, _aLookAt );
pScene->SetCamera( rCamera );
}
+
pScene->NbcSetTransform( aNewTransform );
- pScene->FitSnapRectToBoundVol();
///////////
// light //
@@ -663,7 +665,6 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
// SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer
// pScene->SetModel( pModel );
- pScene->InitTransformationSet();
pRet->SetSnapRect( CalculateNewSnapRect( pCustomShape, aBoundRect2d, pMap ) );
// removing placeholder objects
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.hxx b/svx/source/customshapes/EnhancedCustomShape3d.hxx
index 0bb4738512..dc6a6d77c0 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.hxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: EnhancedCustomShape3d.hxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -70,13 +70,9 @@ class EnhancedCustomShape3d
friend class Transformation2D;
protected :
-
-// static void Rotate( Vector3D& rPoint, const double x, const double y, const double z );
-// static void Rotate( basegfx::B3DPolyPolygon&, const Point3D& rRotateCenter, const double x, const double y, const double z );
static Rectangle CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rBoundRect, const double* pMap );
public :
-
static SdrObject* Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape );
};
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 000fdc997c..fe75592b6e 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dlgctl3d.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.226.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,101 +31,93 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+#include <svx/dlgctl3d.hxx>
#include <svx/dialogs.hrc>
-#include <svx/xflclit.hxx>
+#include <svx/view3d.hxx>
#include <svx/fmmodel.hxx>
+#include <svtools/itempool.hxx>
#include <svx/fmpage.hxx>
-#include <svx/view3d.hxx>
#include <svx/polysc3d.hxx>
-#include <svx/obj3d.hxx>
-#include <svx/camera3d.hxx>
-#include <svx/volume3d.hxx>
#include <svx/sphere3d.hxx>
#include <svx/cube3d.hxx>
-#include <vcl/event.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/style.hxx>
-
-#include <svx/dlgctl3d.hxx>
-#include <goodies/base3d.hxx>
-#include <tools/link.hxx>
-
-// #i58240#
-#ifndef _SVX_HELPID_HRC
+#include <vcl/svapp.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/polygn3d.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
#include "helpid.hrc"
-#endif
+#include <algorithm>
-/*************************************************************************
-|* 3D Preview Control
-|* Ctor
-\************************************************************************/
-Svx3DPreviewControl::Svx3DPreviewControl( Window* pParent, const ResId& rResId ) :
- Control ( pParent, rResId ),
- pModel ( NULL ),
- pFmPage ( NULL ),
- p3DView ( NULL ),
- pScene ( NULL ),
- p3DObj ( NULL ),
- nObjectType ( PREVIEW_OBJECTTYPE_SPHERE )
+//////////////////////////////////////////////////////////////////////////////
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
{
Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
}
-/*************************************************************************
-|* Ctor
-\************************************************************************/
-Svx3DPreviewControl::Svx3DPreviewControl( Window* pParent, WinBits nStyle ) :
- Control ( pParent, nStyle ),
- pModel ( NULL ),
- pFmPage ( NULL ),
- p3DView ( NULL ),
- pScene ( NULL ),
- p3DObj ( NULL ),
- nObjectType ( PREVIEW_OBJECTTYPE_SPHERE )
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, WinBits nStyle)
+: Control(pParent, nStyle),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
{
Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
}
-/*************************************************************************
-|* Dtor
-\************************************************************************/
Svx3DPreviewControl::~Svx3DPreviewControl()
{
- delete p3DView;
- delete pModel;
+ delete mp3DView;
+ delete mpModel;
}
-/*************************************************************************
-|* Svx3DPreviewControl::Construct
-\************************************************************************/
void Svx3DPreviewControl::Construct()
{
// Do never mirror the preview window. This explicitly includes right
// to left writing environments.
EnableRTL (FALSE);
-
SetMapMode( MAP_100TH_MM );
// Model
- pModel = new FmFormModel();
- pModel->GetItemPool().FreezeIdRanges();
+ mpModel = new FmFormModel();
+ mpModel->GetItemPool().FreezeIdRanges();
// Page
- pFmPage = new FmFormPage( *pModel, NULL );
- pModel->InsertPage( pFmPage, 0 );
+ mpFmPage = new FmFormPage( *mpModel, NULL );
+ mpModel->InsertPage( mpFmPage, 0 );
// 3D View
- p3DView = new E3dView( pModel, this );
+ mp3DView = new E3dView( mpModel, this );
+ mp3DView->SetBufferedOutputAllowed(true);
+ mp3DView->SetBufferedOverlayAllowed(true);
// 3D Scene
- pScene = new E3dPolyScene(p3DView->Get3DDefaultAttributes());
+ mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
- // Objekt
+ // initially create object
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
- // Kameraeinstellungen, Perspektive ...
- Camera3D& rCamera = (Camera3D&) pScene->GetCamera();
- const Volume3D& rVolume = pScene->GetBoundVolume();
+ // camera and perspective
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
double fW = rVolume.getWidth();
double fH = rVolume.getHeight();
double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
@@ -133,27 +125,25 @@ void Svx3DPreviewControl::Construct()
rCamera.SetAutoAdjustProjection(FALSE);
rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
basegfx::B3DPoint aLookAt;
- double fDefaultCamPosZ = p3DView->GetDefaultCamPosZ();
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
rCamera.SetPosAndLookAt(aCamPos, aLookAt);
- double fDefaultCamFocal = p3DView->GetDefaultCamFocal();
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
rCamera.SetFocalLength(fDefaultCamFocal);
rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
- pScene->SetCamera( rCamera );
- pFmPage->InsertObject( pScene );
-
- pScene->RotateX( DEG2RAD( 25 ) );
- pScene->RotateY( DEG2RAD( 40 ) ); // Weil es auch ein Wuerfel sein kann
+ mpScene->SetCamera( rCamera );
+ mpFmPage->InsertObject( mpScene );
- // SnapRects der Objekte ungueltig
- pScene->SetRectsDirty();
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
+ aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
+ mpScene->SetTransform(aRotation * mpScene->GetTransform());
- // Transformationen initialisieren, damit bei RecalcSnapRect()
- // richtig gerechnet wird
- pScene->InitTransformationSet();
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
- SfxItemSet aSet( pModel->GetItemPool(),
+ SfxItemSet aSet( mpModel->GetItemPool(),
XATTR_LINESTYLE, XATTR_LINESTYLE,
XATTR_FILL_FIRST, XATTR_FILLBITMAP,
0, 0 );
@@ -161,94 +151,74 @@ void Svx3DPreviewControl::Construct()
aSet.Put( XFillStyleItem( XFILL_SOLID ) );
aSet.Put( XFillColorItem( String(), Color( COL_WHITE ) ) );
-//-/ pScene->NbcSetAttributes( aSet, FALSE );
- pScene->SetMergedItemSet(aSet);
-
- // Default-Attribute holen (ohne markiertes Objekt)
-// SfxItemSet aDefaultSet = p3DView->Get3DAttributes();
+ mpScene->SetMergedItemSet(aSet);
// PageView
- SdrPageView* pPageView = p3DView->ShowSdrPage( pFmPage );
-// SdrPageView* pPageView = p3DView->ShowPage( pFmPage, Point() );
- p3DView->hideMarkHandles();
-
- // Szene markieren
- p3DView->MarkObj( pScene, pPageView );
+ SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
+ mp3DView->hideMarkHandles();
- // Initiale Groesse
- pScene->FitSnapRectToBoundVol();
-// Set3DAttributes(aDefaultSet);
+ // mark scene
+ mp3DView->MarkObj( mpScene, pPageView );
}
-/*************************************************************************
-|* Svx3DPreviewControl::Resize
-\************************************************************************/
void Svx3DPreviewControl::Resize()
{
- // Seite der Page
+ // size of page
Size aSize( GetSizePixel() );
aSize = PixelToLogic( aSize );
- pFmPage->SetSize( aSize );
+ mpFmPage->SetSize( aSize );
- // Groesse setzen
+ // set size
Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
(aSize.Height() - aObjSize.Height()) / 2);
Rectangle aRect( aObjPoint, aObjSize);
- pScene->SetSnapRect( aRect );
+ mpScene->SetSnapRect( aRect );
}
-/*************************************************************************
-|* Svx3DPreviewControl::Paint
-\************************************************************************/
-void Svx3DPreviewControl::Paint( const Rectangle& rRect )
+void Svx3DPreviewControl::Paint(const Rectangle& rRect)
{
- p3DView->CompleteRedraw( this, Region( rRect ) );
+ mp3DView->CompleteRedraw(this, Region(rRect));
}
-/*************************************************************************
-|* Svx3DPreviewControl::MouseButtonDown
-\************************************************************************/
-void Svx3DPreviewControl::MouseButtonDown( const MouseEvent& rMEvt )
+void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
{
- Control::MouseButtonDown( rMEvt );
+ Control::MouseButtonDown(rMEvt);
+
if( rMEvt.IsShift() && rMEvt.IsMod1() )
{
- SetObjectType( (nObjectType+1) % 2 );
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType())
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
}
}
-/*************************************************************************
-|* Svx3DPreviewControl::SetObjectType
-\************************************************************************/
-void Svx3DPreviewControl::SetObjectType( UINT16 nType )
+void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
{
- if( nObjectType != nType || !p3DObj)
+ if( mnObjectType != nType || !mp3DObj)
{
- SfxItemSet aSet(
- pModel->GetItemPool(),
- SDRATTR_START, SDRATTR_END,
- 0, 0);
-
- nObjectType = nType;
+ SfxItemSet aSet(mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0, 0);
+ mnObjectType = nType;
- if( p3DObj )
+ if( mp3DObj )
{
-//-/ p3DObj->TakeAttributes( aSet, FALSE, FALSE );
- aSet.Put(p3DObj->GetMergedItemSet());
-
- pScene->Remove3DObj( p3DObj );
- delete p3DObj;
- p3DObj = NULL;
+ aSet.Put(mp3DObj->GetMergedItemSet());
+ mpScene->Remove3DObj( mp3DObj );
+ delete mp3DObj;
+ mp3DObj = NULL;
}
switch( nType )
{
case PREVIEW_OBJECTTYPE_SPHERE:
{
- // Kugel erzeugen
- p3DObj = new E3dSphereObj(
- p3DView->Get3DDefaultAttributes(),
+ mp3DObj = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( 0, 0, 0 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
}
@@ -256,702 +226,356 @@ void Svx3DPreviewControl::SetObjectType( UINT16 nType )
case PREVIEW_OBJECTTYPE_CUBE:
{
- // Wuerfel erzeugen
- p3DObj = new E3dCubeObj(
- p3DView->Get3DDefaultAttributes(),
+ mp3DObj = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( -2500, -2500, -2500 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
}
break;
}
- // Rein in die Szene
- pScene->Insert3DObj( p3DObj );
-
-//-/ p3DObj->NbcSetAttributes( aSet, FALSE );
- p3DObj->SetMergedItemSet(aSet);
+ mpScene->Insert3DObj( mp3DObj );
+ mp3DObj->SetMergedItemSet(aSet);
- // Refresh
Resize();
}
}
-/*************************************************************************
-|* Svx3DPreviewControl::Get3DAttributes
-\************************************************************************/
SfxItemSet Svx3DPreviewControl::Get3DAttributes() const
{
- return( p3DView->Get3DAttributes( pScene ) );
+ return mp3DObj->GetMergedItemSet();
}
-/*************************************************************************
-|* Svx3DPreviewControl::Set3DAttributes
-\************************************************************************/
+
void Svx3DPreviewControl::Set3DAttributes( const SfxItemSet& rAttr )
{
- p3DView->Set3DAttributes( rAttr, pScene, TRUE );
+ mp3DObj->SetMergedItemSet(rAttr, true);
Resize();
}
-/*************************************************************************
-|* Svx3DPreviewControl::SetObjectType
-\************************************************************************/
-void Svx3DPreviewControl::Set3DObject( const E3dObject* pObj )
-{
- if( pObj->ISA( E3dCompoundObject ) )
- {
- pScene->Remove3DObj( p3DObj );
- delete p3DObj;
- p3DObj = (E3dCompoundObject*)pObj->Clone();
- pScene->Insert3DObj( p3DObj );
- Resize();
- }
- else if( pObj->ISA( E3dPolyScene ) )
- {
- SdrObject* pObject = pFmPage->RemoveObject( pScene->GetOrdNum() );
- SdrObject::Free( pObject );
- p3DObj = NULL;
- pScene = (E3dPolyScene*)pObj->Clone();
- pFmPage->InsertObject( pScene );
- Resize();
- }
-}
-
-/*************************************************************************
-|*
-|* 3D Preview Control
-|*
-\************************************************************************/
-
-SvxPreviewCtl3D::SvxPreviewCtl3D( Window* pParent, const ResId& rResId)
-: Control( pParent, rResId )
-{
- // Members initialisieren
- Init();
-}
-
-SvxPreviewCtl3D::SvxPreviewCtl3D( Window* pParent, WinBits nStyle)
-: Control( pParent, nStyle)
-{
- // Members initialisieren
- Init();
-}
-
-void SvxPreviewCtl3D::Init()
-{
- // Members mit Defaults fuellen
- bGeometryCube=FALSE;
- fRotateX=-20.0;
- fRotateY=45.0;
- fRotateZ=0.0;
- fDistance=10.0;
- fDeviceSize=1.5;
-
- // MapMode waehlen
- SetMapMode( MAP_100TH_MM );
-
- // Hintergrund in einem schoenen neutralen Grau
-// SetBackground( Wallpaper( Color( COL_GRAY ) ) );
-
- // Segmente
- nHorSegs = 24;
- nVerSegs = 12;
-
- // Normalenmodus
- nNormalMode = PREVIEW_NORMAL_MODE_OBJECT;
-
- // ShadeMode
- nShadeMode = PREVIEW_SHADEMODE_GOURAUD;
-
- // Geometrie erzeugen
- CreateGeometry();
-
- // Material initialisieren
- Color aColWhite(COL_WHITE);
- Color aColBlack(COL_BLACK);
-
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialAmbient);
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialDiffuse);
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialSpecular);
- aObjectMaterial.SetMaterial(aColBlack, Base3DMaterialEmission);
- aObjectMaterial.SetShininess(32);
-}
-
-SvxPreviewCtl3D::~SvxPreviewCtl3D()
-{
-}
-
-void SvxPreviewCtl3D::Paint( const Rectangle& )
-{
- // Base3D anfordern
- Base3D* pBase3D = Base3D::Create(this, nShadeMode == PREVIEW_SHADEMODE_DRAFT);
-
- Rectangle aVisible(Point(0,0), GetOutputSizePixel());
- aVisible = PixelToLogic(aVisible);
-
- // Orientierung
- basegfx::B3DHomMatrix mOrient;
- aCameraSet.SetObjectTrans(mOrient);
- aCameraSet.SetOrientation(
- basegfx::B3DPoint(0.0, 0.0, fDistance),
- basegfx::B3DVector(0.0, 0.0, 1.0),
- basegfx::B3DVector(0.0, 1.0, 0.0));
-// aCameraSet.SetOrientation(mOrient);
-
- // Matritzen setzen
- pBase3D->SetTransformationSet(&aCameraSet);
-
- // Licht setzen
- pBase3D->SetLightGroup(&aLights);
-
- // ShadeMode setzen
- if(nShadeMode == PREVIEW_SHADEMODE_FLAT || nShadeMode == PREVIEW_SHADEMODE_DRAFT)
- pBase3D->SetShadeModel(Base3DFlat);
- else if(nShadeMode == PREVIEW_SHADEMODE_GOURAUD)
- pBase3D->SetShadeModel(Base3DSmooth);
- else
- pBase3D->SetShadeModel(Base3DPhong);
-
- // Ausgaberechteck setzen
- aCameraSet.SetDeviceRectangle(-fDeviceSize, fDeviceSize, -fDeviceSize, fDeviceSize, FALSE);
- aCameraSet.SetFrontClippingPlane(fDistance - fDeviceSize);
- aCameraSet.SetBackClippingPlane(fDistance + fDeviceSize);
- aCameraSet.SetViewportRectangle(aVisible);
-
- // Matritzen setzen
- pBase3D->SetTransformationSet(&aCameraSet);
-
- // Werte fuer Objekt setzen
- pBase3D->SetActiveTexture();
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialAmbient), Base3DMaterialAmbient);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialDiffuse), Base3DMaterialDiffuse);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialSpecular), Base3DMaterialSpecular);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialEmission), Base3DMaterialEmission);
- pBase3D->SetShininess(aObjectMaterial.GetShininess());
-
- pBase3D->SetRenderMode(Base3DRenderFill);
- pBase3D->SetCullMode(Base3DCullBack);
-
- // ScissorRegion defaultmaessig disablen
- pBase3D->ActivateScissorRegion(FALSE);
-
- // Nicht flach
- pBase3D->SetForceFlat(FALSE);
-
- // Geometrie ausgeben
- DrawGeometryClip(pBase3D);
-}
-
-void SvxPreviewCtl3D::DrawGeometryClip(Base3D *pBase3D)
+//////////////////////////////////////////////////////////////////////////////
+
+#define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
+#define RADIUS_LAMP_SMALL (600.0)
+#define RADIUS_LAMP_BIG (1000.0)
+#define NO_LIGHT_SELECTED (0xffffffff)
+#define MAX_NUMBER_LIGHTS (8)
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, const ResId& rResId)
+: Svx3DPreviewControl(pParent, rResId),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, WinBits nStyle)
+: Svx3DPreviewControl(pParent, nStyle),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::~Svx3DLightControl()
+{
+ // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted
+ // with deletion of the DrawingLayer and model
+}
+
+void Svx3DLightControl::Construct2()
{
- // spezielles Clipping fuer OpenGL, um keine floating windows ueberzumalen
- if(pBase3D->GetBase3DType() == BASE3D_TYPE_OPENGL
- && GetOutDevType() == OUTDEV_WINDOW
- && pBase3D->GetTransformationSet())
{
- Window* pWin = (Window*)this;
- Region aClipRegion = pWin->GetActiveClipRegion();
-
- // ClipRegion ist gesetzt, benutze diese
- RegionHandle aRegionHandle = aClipRegion.BeginEnumRects();
- Rectangle aClipRect;
-
- while(aClipRegion.GetEnumRects(aRegionHandle, aClipRect))
- {
- if(aClipRect.IsOver(pBase3D->GetTransformationSet()->GetLogicalViewportBounds()))
- {
- // Viewport setzen
- pBase3D->SetScissorRegion(aClipRect, TRUE);
-
- // Zeichne alle Objekte
- pBase3D->StartScene();
- DrawGeometry(pBase3D);
- pBase3D->EndScene();
- }
- }
- aClipRegion.EndEnumRects(aRegionHandle);
+ // hide all page stuff, use control background (normally gray)
+ const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+ mp3DView->SetPageVisible(false);
+ mp3DView->SetApplicationBackgroundColor(aDialogColor);
+ mp3DView->SetApplicationDocumentColor(aDialogColor);
}
- else
- {
- // Zeichne alle Objekte
- pBase3D->StartScene();
- DrawGeometry(pBase3D);
- pBase3D->EndScene();
- }
-}
-
-void SvxPreviewCtl3D::DrawGeometry(Base3D *pBase3D)
-{
- pBase3D->DrawPolygonGeometry(aGeometry);
-}
-void SvxPreviewCtl3D::SetGeometry(BOOL bGeomCube)
-{
- if(bGeometryCube != bGeomCube)
{
- bGeometryCube = bGeomCube;
- CreateGeometry();
+ // create invisible expansion object
+ const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
+ mpExpansionObject = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
+ basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
+ mpScene->Insert3DObj( mpExpansionObject );
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpExpansionObject->SetMergedItemSet(aSet);
}
- Invalidate();
-}
-void SvxPreviewCtl3D::SetRotation(double fRotX, double fRotY, double fRotZ)
-{
- if(fRotX != fRotateX || fRotY != fRotateY || fRotZ != fRotateZ)
{
- fRotateX = fRotX;
- fRotateY = fRotY;
- fRotateZ = fRotZ;
- CreateGeometry();
+ // create lamp control object (Yellow lined object)
+ // base circle
+ const basegfx::B2DPolygon a2DCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE));
+ basegfx::B3DPolygon a3DCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DCircle));
+ basegfx::B3DHomMatrix aTransform;
+
+ aTransform.rotate(F_PI2, 0.0, 0.0);
+ aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
+ a3DCircle.transform(aTransform);
+
+ // create object for it
+ mpLampBottomObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DCircle),
+ true);
+ mpScene->Insert3DObj( mpLampBottomObject );
+
+ // half circle with stand
+ basegfx::B2DPolygon a2DHalfCircle;
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0));
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, -RADIUS_LAMP_PREVIEW_SIZE));
+ a2DHalfCircle.append(basegfx::tools::createPolygonFromEllipseSegment(
+ basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, F_2PI - F_PI2, F_PI2));
+ basegfx::B3DPolygon a3DHalfCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DHalfCircle));
+
+ // create object for it
+ mpLampShaftObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DHalfCircle),
+ true);
+ mpScene->Insert3DObj( mpLampShaftObject );
+
+ // initially invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
}
- Invalidate();
-}
-void SvxPreviewCtl3D::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
-{
- rRotX = fRotateX;
- rRotY = fRotateY;
- rRotZ = fRotateZ;
-}
-
-// Zugriffsfunktionen Materialien
-void SvxPreviewCtl3D::SetMaterial(Color rNew, Base3DMaterialValue eVal)
-{
- if(aObjectMaterial.GetMaterial(eVal) != rNew)
{
- aObjectMaterial.SetMaterial(rNew, eVal);
- Invalidate();
- }
-}
-
-Color SvxPreviewCtl3D::GetMaterial(Base3DMaterialValue eVal)
-{
- return aObjectMaterial.GetMaterial(eVal);
-}
-
-void SvxPreviewCtl3D::SetShininess(UINT16 nNew)
-{
- if(aObjectMaterial.GetShininess() != nNew)
- {
- aObjectMaterial.SetShininess(nNew);
- Invalidate();
+ // change camera settings
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(FALSE);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+
+ basegfx::B3DHomMatrix aNeutral;
+ mpScene->SetTransform(aNeutral);
}
-}
-UINT16 SvxPreviewCtl3D::GetShininess()
-{
- return aObjectMaterial.GetShininess();
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
}
-// Lichtquellen setzen
-void SvxPreviewCtl3D::SetLightGroup(B3dLightGroup* pNew)
+void Svx3DLightControl::ConstructLightObjects()
{
- if(pNew)
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
{
- aLights = *pNew;
- Invalidate();
- }
-}
-
-// View-Einstellungen
-void SvxPreviewCtl3D::SetUserDistance(double fNew)
-{
- if(fNew != fDistance)
- {
- fDistance = fNew;
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetDeviceSize(double fNew)
-{
- if(fNew != fDeviceSize)
- {
- fDeviceSize = fNew;
- Invalidate();
- }
-}
-
-// Zugriffsfunktionen Segmentierung
-void SvxPreviewCtl3D::SetHorizontalSegments(UINT16 nNew)
-{
- if(nNew != nHorSegs)
- {
- nHorSegs = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetVerticalSegments(UINT16 nNew)
-{
- if(nNew != nVerSegs)
- {
- nVerSegs = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetSegments(UINT16 nNewHor, UINT16 nNewVer)
-{
- if(nNewHor != nHorSegs || nNewVer != nVerSegs)
- {
- nHorSegs = nNewHor;
- nVerSegs = nNewVer;
- CreateGeometry();
- Invalidate();
- }
-}
-
-// Zugriff Normalenmodus
-void SvxPreviewCtl3D::SetNormalMode(UINT16 nNew)
-{
- if(nNew != nNormalMode)
- {
- nNormalMode = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-// Zugriff auf ShadeMode
-void SvxPreviewCtl3D::SetShadeMode(UINT16 nNew)
-{
- if(nNew != nShadeMode)
- {
- nShadeMode = nNew;
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::CreateGeometry()
-{
- // Wuerfel erzeugen fuer Objektgroesse
- basegfx::B3DRange aVolume;
- aVolume.expand(basegfx::B3DPoint(-1.0, -1.0, -1.0));
- aVolume.expand(basegfx::B3DPoint( 1.0, 1.0, 1.0));
-
- if(bGeometryCube)
- {
- // Wuerfel erzeugen
- aGeometry.CreateCube(aVolume);
- }
- else
- {
- // AHCTUNG: Das PreviewControl hat bis zu dieser Stelle KEINE
- // Begrenzung in der Anzahl der Hor/Ver Segmente. Diese wird hier nun
- // explizit eingeschraenkt.
- double fHSegs = (nHorSegs > 50) ? 50.0 : (double)nHorSegs;
- double fVSegs = (nVerSegs > 50) ? 50.0 : (double)nVerSegs;
-
- // Kugel erzeugen
- aGeometry.CreateSphere(aVolume, fHSegs, fVSegs);
- }
-
- if(nNormalMode != PREVIEW_NORMAL_MODE_OBJECT)
- {
- if(!(nNormalMode == PREVIEW_NORMAL_MODE_FLAT))
+ // get rid of evtl. existing light object
+ if(maLightObjects[a])
{
- aGeometry.CreateDefaultNormalsSphere();
+ mpScene->Remove3DObj(maLightObjects[a]);
+ delete maLightObjects[a];
+ maLightObjects[a] = 0;
}
- }
- // Gesetzte Rotation ausfuehren
- if(fRotateX != 0.0 || fRotateY != 0.0 || fRotateZ != 0.0)
- {
- basegfx::B3DHomMatrix aRotMat;
- if(fRotateY != 0.0)
- aRotMat.rotate(0.0, fRotateY * F_PI180, 0.0);
- if(fRotateX != 0.0)
- aRotMat.rotate(-fRotateX * F_PI180, 0.0, 0.0);
- if(fRotateZ != 0.0)
- aRotMat.rotate(0.0, 0.0, fRotateZ * F_PI180);
- aGeometry.Transform(aRotMat);
- }
-}
-
-/*************************************************************************
-|*
-|* 3D Light Control
-|*
-\************************************************************************/
-
-SvxLightPrevievCtl3D::SvxLightPrevievCtl3D( Window* pParent, const ResId& rResId)
-: SvxPreviewCtl3D(pParent, rResId)
-{
- // Members initialisieren
- Init();
-}
-
-SvxLightPrevievCtl3D::SvxLightPrevievCtl3D( Window* pParent, WinBits nStyle )
-: SvxPreviewCtl3D(pParent, nStyle)
-{
- // Members initialisieren
- Init();
-}
-
-void SvxLightPrevievCtl3D::Init()
-{
- // Do never mirror the preview window. This explicitly includes right
- // to left writing environments.
- EnableRTL (FALSE);
-
- // Lokale Parameter fuellen
- eSelectedLight = Base3DLightNone;
- fObjectRadius = 1.414;
- fDistanceToObject = 0.4;
- fScaleSizeSelected = 1.8;
- fLampSize = 0.1;
- nInteractionStartDistance = 5 * 5 * 2;
- bMouseMoved = FALSE;
- bGeometrySelected = FALSE;
-
- // Device groesser, da Lampen angezeigt werden
- SetDeviceSize(2.0);
-
- // Geometrie fuer Lampenobjekt erzeugen
- CreateLightGeometry();
-}
-
-SvxLightPrevievCtl3D::~SvxLightPrevievCtl3D()
-{
-}
-
-void SvxLightPrevievCtl3D::SelectLight(Base3DLightNumber eNew)
-{
- if(eNew != eSelectedLight)
- {
- eSelectedLight = eNew;
- bGeometrySelected = FALSE;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SelectGeometry()
-{
- if(!bGeometrySelected)
- {
- bGeometrySelected = TRUE;
- eSelectedLight = Base3DLightNone;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SetObjectRadius(double fNew)
-{
- if(fObjectRadius != fNew)
- {
- fObjectRadius = fNew;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SetDistanceToObject(double fNew)
-{
- if(fDistanceToObject != fNew)
- {
- fDistanceToObject = fNew;
- Invalidate();
+ if(GetLightOnOff(a))
+ {
+ const bool bIsSelectedLight(a == maSelectedLight);
+ basegfx::B3DVector aDirection(GetLightDirection(a));
+ aDirection.normalize();
+ aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
+
+ const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
+ E3dObject* pNewLight = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
+ mpScene->Insert3DObj(pNewLight);
+
+ basegfx::B3DHomMatrix aTransform;
+ aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
+ pNewLight->SetTransform(aTransform);
+
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem(String(), GetLightColor(a)));
+ pNewLight->SetMergedItemSet(aSet);
+
+ maLightObjects[a] = pNewLight;
+ }
}
}
-void SvxLightPrevievCtl3D::SetScaleSizeSelected(double fNew)
+void Svx3DLightControl::AdaptToSelectedLight()
{
- if(fScaleSizeSelected != fNew)
+ if(NO_LIGHT_SELECTED == maSelectedLight)
{
- fScaleSizeSelected = fNew;
- Invalidate();
+ // make mpLampBottomObject/mpLampShaftObject invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
}
-}
-
-void SvxLightPrevievCtl3D::SetLampSize(double fNew)
-{
- if(fLampSize != fNew)
+ else
{
- fLampSize = fNew;
- CreateLightGeometry();
- Invalidate();
- }
-}
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
-void SvxLightPrevievCtl3D::DrawGeometry(Base3D *pBase3D)
-{
- // call parent; zeichnet das Objekt selbst
- SvxPreviewCtl3D::DrawGeometry(pBase3D);
+ // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XLineColorItem(String(), COL_YELLOW));
+ aSet.Put( XLineWidthItem(0));
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
- // Lichter zeichnen
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
- {
- Base3DLightNumber eLightNum = (Base3DLightNumber)(Base3DLight0 + a);
- if(aLights.IsEnabled(eLightNum))
- DrawLightGeometry(eLightNum, pBase3D);
- }
-}
+ // adapt transformation of mpLampShaftObject
+ basegfx::B3DHomMatrix aTransform;
+ double fRotateY(0.0);
-void SvxLightPrevievCtl3D::DrawLightGeometry(Base3DLightNumber eLightNum,
- Base3D* pBase3D)
-{
- // Geometrie bereitstellen
- B3dGeometry aNew;
- basegfx::B3DHomMatrix aTrans;
- double fRadius = fObjectRadius + fDistanceToObject;
- Color aLineColor(COL_YELLOW);
- aNew = aLightGeometry;
-
- if(eLightNum == eSelectedLight)
- aTrans.scale(fScaleSizeSelected, fScaleSizeSelected, fScaleSizeSelected);
-
- basegfx::B3DVector aDirection(aLights.GetDirection(eLightNum));
- aDirection.normalize();
- aDirection *= fRadius;
- aTrans.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
-
- aNew.Transform(aTrans);
-
- // Material setzen
- Color aZwi;
- aZwi = aLights.GetIntensity(Base3DMaterialDiffuse, eLightNum);
- pBase3D->SetMaterial(aZwi, Base3DMaterialAmbient);
-// pBase3D->SetMaterial(aZwi, Base3DMaterialDiffuse);
- pBase3D->SetMaterial(aZwi, Base3DMaterialEmission);
- aZwi = aLights.GetIntensity(Base3DMaterialSpecular, eLightNum);
- pBase3D->SetMaterial(aZwi, Base3DMaterialSpecular);
-
- // Lampe Zeichnen
- pBase3D->SetRenderMode(Base3DRenderLine);
- pBase3D->DrawPolygonGeometry(aNew);
-
- if(eLightNum == eSelectedLight)
- {
- // Beleuchtung aus und Linienfarbe setzen
- BOOL bLightingWasEnabled = aLights.IsLightingEnabled();
- aLights.EnableLighting(FALSE);
- pBase3D->SetLightGroup(&aLights);
- pBase3D->SetLineWidth();
-
- // Kreis am Boden zeichnen
- basegfx::B3DPoint aPoint(0.0, -fRadius, fRadius);
- pBase3D->StartPrimitive(Base3DLineLoop);
- pBase3D->SetColor(aLineColor);
-
- double fWink;
- for(fWink=-F_PI;fWink < F_PI; fWink += F_2PI/24.0)
+ if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
{
- aPoint.setZ(-cos(fWink) * fRadius);
- aPoint.setX(-sin(fWink) * fRadius);
- pBase3D->AddVertex(aPoint);
+ fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
}
- pBase3D->EndPrimitive();
- // Kreisbogen zeichnen
- double fBodenWinkel = atan2(-aDirection.getX(), -aDirection.getZ());
- double fSinBoden = sin(fBodenWinkel) * fRadius;
- double fCosBoden = cos(fBodenWinkel) * fRadius;
- pBase3D->StartPrimitive(Base3DLineStrip);
- pBase3D->SetColor(aLineColor);
+ aTransform.rotate(0.0, fRotateY, 0.0);
+ mpLampShaftObject->SetTransform(aTransform);
+
+ // adapt transformation of selected light
+ E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
- for(fWink=-F_PI2;fWink < F_PI2; fWink += F_PI/12.0)
+ if(pSelectedLight)
{
- aPoint.setX(cos(fWink) * -fSinBoden);
- aPoint.setY(sin(fWink) * fRadius);
- aPoint.setZ(cos(fWink) * -fCosBoden);
- pBase3D->AddVertex(aPoint);
+ aTransform.identity();
+ aTransform.translate(
+ aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
+ pSelectedLight->SetTransform(aTransform);
}
- pBase3D->EndPrimitive();
-
- // Verbindung zeichnen
- pBase3D->StartPrimitive(Base3DLineStrip);
- pBase3D->SetColor(aLineColor);
- aPoint = basegfx::B3DPoint(0.0, -fRadius, 0.0);
- pBase3D->AddVertex(aPoint);
- aPoint.setX(-fSinBoden);
- aPoint.setZ(-fCosBoden);
- pBase3D->AddVertex(aPoint);
- aPoint.setY(0.0);
- pBase3D->AddVertex(aPoint);
- pBase3D->EndPrimitive();
-
- // Beleuchtung wieder eischalten
- aLights.EnableLighting(bLightingWasEnabled);
- pBase3D->SetLightGroup(&aLights);
}
}
-void SvxLightPrevievCtl3D::CreateLightGeometry()
+void Svx3DLightControl::TrySelection(Point aPosPixel)
{
- // Wuerfel erzeugen fuer Objektgroesse
- basegfx::B3DRange aVolume;
- aVolume.expand(basegfx::B3DPoint(-fLampSize, -fLampSize, -fLampSize));
- aVolume.expand(basegfx::B3DPoint( fLampSize, fLampSize, fLampSize));
+ if(mpScene)
+ {
+ const Point aPosLogic(PixelToLogic(aPosPixel));
+ const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
+ std::vector< const E3dCompoundObject* > aResult;
+ getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
- // Kugel erzeugen
- aLightGeometry.CreateSphere(aVolume, 4.0, 3.0);
-}
+ if(aResult.size())
+ {
+ // take the frontmost one
+ const E3dCompoundObject* pResult = aResult[0];
-// Selektion gueltig? D.h.: Lampe ist Selektiert un auch EINGESCHALTET
-BOOL SvxLightPrevievCtl3D::IsSelectionValid()
-{
- if((eSelectedLight != Base3DLightNone)
- && (aLights.GetLightObject(eSelectedLight).IsEnabled()))
- {
- return TRUE;
- }
- return FALSE;
-}
+ if(pResult == mp3DObj)
+ {
+ if(!mbGeometrySelected)
+ {
+ mbGeometrySelected = true;
+ maSelectedLight = NO_LIGHT_SELECTED;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
-// Selektierte Lampe Position in Polarkoordinaten holen/setzen
-// dabei geht Hor:[0..360.0[ und Ver:[-90..90] Grad
-void SvxLightPrevievCtl3D::GetPosition(double& rHor, double& rVer)
-{
- if(IsSelectionValid())
- {
- basegfx::B3DVector aDirection(aLights.GetDirection(eSelectedLight));
- aDirection.normalize();
- rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
- rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
- rHor /= F_PI180; // 0..360.0
- rVer /= F_PI180; // -90.0..90.0
- }
- if(IsGeometrySelected())
- {
- rHor = fRotateY;
- rVer = fRotateX;
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ if(maLightObjects[a] && maLightObjects[a] == pResult)
+ {
+ aNewSelectedLight = a;
+ }
+ }
+
+ if(aNewSelectedLight != maSelectedLight)
+ {
+ SelectLight(aNewSelectedLight);
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ }
}
}
-void SvxLightPrevievCtl3D::SetPosition(double fHor, double fVer)
+void Svx3DLightControl::Paint(const Rectangle& rRect)
{
- if(IsSelectionValid())
- {
- basegfx::B3DVector aDirection;
- fHor = (fHor * F_PI180) - F_PI; // -PI..PI
- fVer *= F_PI180; // -PI2..PI2
- aDirection.setX(cos(fVer) * -sin(fHor));
- aDirection.setY(sin(fVer));
- aDirection.setZ(cos(fVer) * -cos(fHor));
- aDirection.normalize();
- aLights.SetDirection(aDirection, eSelectedLight);
- Invalidate();
- }
- if(IsGeometrySelected())
- {
- SetRotation(fVer, fHor, fRotateZ);
- }
+ Svx3DPreviewControl::Paint(rRect);
}
-// Interaktion
-void SvxLightPrevievCtl3D::MouseButtonDown( const MouseEvent& rMEvt )
+void Svx3DLightControl::MouseButtonDown( const MouseEvent& rMEvt )
{
- BOOL bCallParent = TRUE;
+ bool bCallParent(true);
- // Status switchen
+ // switch state
if(rMEvt.IsLeft())
{
- if(IsSelectionValid() || bGeometrySelected)
+ if(IsSelectionValid() || mbGeometrySelected)
{
- bMouseMoved = FALSE;
- bCallParent = FALSE;
- aActionStartPoint = rMEvt.GetPosPixel();
+ mbMouseMoved = false;
+ bCallParent = false;
+ maActionStartPoint = rMEvt.GetPosPixel();
StartTracking();
}
else
@@ -959,48 +583,54 @@ void SvxLightPrevievCtl3D::MouseButtonDown( const MouseEvent& rMEvt )
// Einfacher Click ohne viel Bewegen, versuche eine
// Selektion
TrySelection(rMEvt.GetPosPixel());
- bCallParent = FALSE;
+ bCallParent = false;
}
}
// call parent
if(bCallParent)
- SvxPreviewCtl3D::MouseButtonDown(rMEvt);
+ {
+ Svx3DPreviewControl::MouseButtonDown(rMEvt);
+ }
}
-void SvxLightPrevievCtl3D::Tracking( const TrackingEvent& rTEvt )
+void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt )
{
if(rTEvt.IsTrackingEnded())
{
if(rTEvt.IsTrackingCanceled())
{
- if(bMouseMoved)
+ if(mbMouseMoved)
{
- // Interaktion abbrechen
- bMouseMoved = FALSE;
- if(bGeometrySelected)
+ // interrupt tracking
+ mbMouseMoved = false;
+
+ if(mbGeometrySelected)
{
- SetRotation(fSaveActionStartVer, fSaveActionStartHor, fSaveActionStartRotZ);
+ SetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
}
else
{
- SetPosition(fSaveActionStartHor, fSaveActionStartVer);
+ SetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
}
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
}
}
else
{
const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
- if(bMouseMoved)
+
+ if(mbMouseMoved)
{
- // Wurde interaktiv veraendert
+ // was change dinteractively
}
else
{
- // Einfacher Click ohne viel Bewegen, versuche eine
- // Selektion
+ // simple click without much movement, try selection
TrySelection(rMEvt.GetPosPixel());
}
}
@@ -1008,208 +638,402 @@ void SvxLightPrevievCtl3D::Tracking( const TrackingEvent& rTEvt )
else
{
const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
- Point aDeltaPos = rMEvt.GetPosPixel() - aActionStartPoint;
+ Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
- if(!bMouseMoved)
+ if(!mbMouseMoved)
{
- if(INT32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y())
- > nInteractionStartDistance)
+ if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > mnInteractionStartDistance)
{
- if(bGeometrySelected)
+ if(mbGeometrySelected)
{
- GetRotation(fSaveActionStartVer, fSaveActionStartHor, fSaveActionStartRotZ);
+ GetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
}
else
{
- // Start der Interaktion, Werte Sichern
- GetPosition(fSaveActionStartHor, fSaveActionStartVer);
+ // intercation start, save values
+ GetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
}
- bMouseMoved = TRUE;
+
+ mbMouseMoved = true;
}
}
- if(bMouseMoved)
+ if(mbMouseMoved)
{
- if(bGeometrySelected)
+ if(mbGeometrySelected)
{
- double fNewRotX = fSaveActionStartVer - ((double)aDeltaPos.Y());
- double fNewRotY = fSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewRotX = mfSaveActionStartVer - ((double)aDeltaPos.Y() * F_PI180);
+ double fNewRotY = mfSaveActionStartHor + ((double)aDeltaPos.X() * F_PI180);
- // Horizontal abgleichen
+ // cut horizontal
while(fNewRotY < 0.0)
- fNewRotY += 360.0;
- while(fNewRotY >= 360.0)
- fNewRotY -= 360.0;
+ {
+ fNewRotY += F_2PI;
+ }
+
+ while(fNewRotY >= F_2PI)
+ {
+ fNewRotY -= F_2PI;
+ }
- // Vertikal cutten
- if(fNewRotX < -90.0)
- fNewRotX = -90.0;
- if(fNewRotX > 90.0)
- fNewRotX = 90.0;
+ // cut vertical
+ if(fNewRotX < -F_PI2)
+ {
+ fNewRotX = -F_PI2;
+ }
+
+ if(fNewRotX > F_PI2)
+ {
+ fNewRotX = F_PI2;
+ }
- SetRotation(fNewRotX, fNewRotY, fSaveActionStartRotZ);
+ SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
}
else
{
- // Interaktion im vollen Gange
- double fNewPosHor = fSaveActionStartHor + ((double)aDeltaPos.X());
- double fNewPosVer = fSaveActionStartVer - ((double)aDeltaPos.Y());
+ // interaction in progress
+ double fNewPosHor = mfSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewPosVer = mfSaveActionStartVer - ((double)aDeltaPos.Y());
- // Horizontal abgleichen
+ // cut horizontal
while(fNewPosHor < 0.0)
+ {
fNewPosHor += 360.0;
+ }
+
while(fNewPosHor >= 360.0)
+ {
fNewPosHor -= 360.0;
+ }
- // Vertikal cutten
+ // cut vertical
if(fNewPosVer < -90.0)
+ {
fNewPosVer = -90.0;
+ }
+
if(fNewPosVer > 90.0)
+ {
fNewPosVer = 90.0;
+ }
SetPosition(fNewPosHor, fNewPosVer);
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
}
}
}
}
-// Selektion einer Lampe
-void SvxLightPrevievCtl3D::TrySelection(Point aPosPixel)
+void Svx3DLightControl::Resize()
+{
+ // set size of page
+ const Size aSize(PixelToLogic(GetSizePixel()));
+ mpFmPage->SetSize(aSize);
+
+ // set position and size of scene
+ mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
+}
+
+void Svx3DLightControl::SetObjectType(sal_uInt16 nType)
+{
+ // call parent
+ Svx3DPreviewControl::SetObjectType(nType);
+
+ // apply object rotation
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+ }
+}
+
+bool Svx3DLightControl::IsSelectionValid()
{
- BOOL bNewSelection(FALSE);
- Base3DLightNumber eNew = Base3DLightNone;
+ if((NO_LIGHT_SELECTED != maSelectedLight) && (GetLightOnOff(maSelectedLight)))
+ {
+ return true;
+ }
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
+ return false;
+}
+
+void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
+{
+ if(IsSelectionValid())
{
- Base3DLightNumber eActualLight = (Base3DLightNumber)(Base3DLight0 + a);
- if(aLights.IsEnabled(eActualLight))
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+ rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
+ rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
+ rHor /= F_PI180; // 0..360.0
+ rVer /= F_PI180; // -90.0..90.0
+ }
+ if(IsGeometrySelected())
+ {
+ rHor = mfRotateY;
+ rVer = mfRotateX;
+ }
+}
+
+void Svx3DLightControl::SetPosition(double fHor, double fVer)
+{
+ if(IsSelectionValid())
+ {
+ // set selected light's direction
+ fHor = (fHor * F_PI180) - F_PI; // -PI..PI
+ fVer *= F_PI180; // -PI2..PI2
+ basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
+ aDirection.normalize();
+
+ if(!aDirection.equal(GetLightDirection(maSelectedLight)))
{
- basegfx::B3DVector aLightPos(aLights.GetDirection(eActualLight));
- aLightPos.normalize();
- aLightPos *= GetObjectRadius() + GetDistanceToObject();
- basegfx::B3DPoint aScreenPos(aCameraSet.ObjectToViewCoor(aLightPos));
- Point aScreenPosPixel((long)(aScreenPos.getX() + 0.5), (long)(aScreenPos.getY() + 0.5));
- aScreenPosPixel = LogicToPixel(aScreenPosPixel);
- aScreenPosPixel -= aPosPixel;
- INT32 nDistance = (aScreenPosPixel.getX() * aScreenPosPixel.getX()) + (aScreenPosPixel.getY() * aScreenPosPixel.getY());
-
- if(nDistance < nInteractionStartDistance)
+ // set changed light direction at SdrScene
+ SfxItemSet aSet(mpModel->GetItemPool());
+
+ switch(maSelectedLight)
+ {
+ case 0: aSet.Put(Svx3DLightDirection1Item(aDirection)); break;
+ case 1: aSet.Put(Svx3DLightDirection2Item(aDirection)); break;
+ case 2: aSet.Put(Svx3DLightDirection3Item(aDirection)); break;
+ case 3: aSet.Put(Svx3DLightDirection4Item(aDirection)); break;
+ case 4: aSet.Put(Svx3DLightDirection5Item(aDirection)); break;
+ case 5: aSet.Put(Svx3DLightDirection6Item(aDirection)); break;
+ case 6: aSet.Put(Svx3DLightDirection7Item(aDirection)); break;
+ default:
+ case 7: aSet.Put(Svx3DLightDirection8Item(aDirection)); break;
+ }
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // correct 3D light's and LampFrame's geometries
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+ }
+ if(IsGeometrySelected())
+ {
+ if(mfRotateX != fVer || mfRotateY != fHor)
+ {
+ mfRotateX = fVer;
+ mfRotateY = fHor;
+
+ if(mp3DObj)
{
- eNew = eActualLight;
- bNewSelection = TRUE;
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
}
}
}
+}
- if(bNewSelection && eSelectedLight != eNew)
+void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
+{
+ if(IsGeometrySelected())
{
- // Auswaehlen
- SelectLight(eNew);
+ if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
+ {
+ mfRotateX = fRotX;
+ mfRotateY = fRotY;
+ mfRotateZ = fRotZ;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
- // Falls tatsaechlich eine andere Lampe selektiert
- // wurde, rufe den entsprechenden Callback
- if(aSelectionChangeCallback.IsSet())
- aSelectionChangeCallback.Call(this);
+ Invalidate();
+ }
+ }
}
- else
+}
+
+void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
+{
+ rRotX = mfRotateX;
+ rRotY = mfRotateY;
+ rRotZ = mfRotateZ;
+}
+
+void Svx3DLightControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ // call parent
+ Svx3DPreviewControl::Set3DAttributes(rAttr);
+
+ if(maSelectedLight != NO_LIGHT_SELECTED && !GetLightOnOff(maSelectedLight))
{
- // Punkt in logische Koordinaten umrechnen
- Point aPosLogic = PixelToLogic(aPosPixel);
+ // selected light is no more active, select new one
+ maSelectedLight = NO_LIGHT_SELECTED;
+ }
- // Punkte generieren
- basegfx::B3DPoint aHitFront(aPosLogic.X(), aPosLogic.Y(), 0.0);
- basegfx::B3DPoint aHitBack(aPosLogic.X(), aPosLogic.Y(), ZBUFFER_DEPTH_RANGE);
+ // local updates
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+}
- // Umrechnen
- aHitFront = aCameraSet.ViewToObjectCoor(aHitFront);
- aHitBack = aCameraSet.ViewToObjectCoor(aHitBack);
+void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
+{
+ if(nLightNumber > 7)
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
- // Eventuell die Geometrie des Beispielobjektes waehlen
- if(aGeometry.CheckHit(aHitFront, aHitBack, 0))
+ if(NO_LIGHT_SELECTED != nLightNumber)
+ {
+ if(!GetLightOnOff(nLightNumber))
{
- // Auswaehlen
- SelectGeometry();
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+ }
- // Falls tatsaechlich eine andere Lampe selektiert
- // wurde, rufe den entsprechenden Callback
- if(aSelectionChangeCallback.IsSet())
- aSelectionChangeCallback.Call(this);
+ if(nLightNumber != maSelectedLight)
+ {
+ maSelectedLight = nLightNumber;
+ mbGeometrySelected = false;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+}
+
+bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightOnOff1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ case 1 : return ((const Svx3DLightOnOff2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ case 2 : return ((const Svx3DLightOnOff3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ case 3 : return ((const Svx3DLightOnOff4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ case 4 : return ((const Svx3DLightOnOff5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ case 5 : return ((const Svx3DLightOnOff6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ case 6 : return ((const Svx3DLightOnOff7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ case 7 : return ((const Svx3DLightOnOff8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
}
}
+
+ return false;
}
-/*************************************************************************
-|*
-|* 3D Light Control Konstruktor
-|*
-\************************************************************************/
+Color Svx3DLightControl::GetLightColor(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightcolor1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
+ case 1 : return ((const Svx3DLightcolor2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
+ case 2 : return ((const Svx3DLightcolor3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
+ case 3 : return ((const Svx3DLightcolor4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
+ case 4 : return ((const Svx3DLightcolor5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
+ case 5 : return ((const Svx3DLightcolor6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
+ case 6 : return ((const Svx3DLightcolor7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
+ case 7 : return ((const Svx3DLightcolor8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
+ }
+ }
+
+ return Color(COL_BLACK);
+}
+
+basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightDirection1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
+ case 1 : return ((const Svx3DLightDirection2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
+ case 2 : return ((const Svx3DLightDirection3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
+ case 3 : return ((const Svx3DLightDirection4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
+ case 4 : return ((const Svx3DLightDirection5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
+ case 5 : return ((const Svx3DLightDirection6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
+ case 6 : return ((const Svx3DLightDirection7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
+ case 7 : return ((const Svx3DLightDirection8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
+ }
+ }
+
+ return basegfx::B3DVector();
+}
+
+//////////////////////////////////////////////////////////////////////////////
SvxLightCtl3D::SvxLightCtl3D( Window* pParent, const ResId& rResId)
: Control(pParent, rResId),
- aLightControl(this, 0),
- aHorScroller(this, WB_HORZ | WB_DRAG),
- aVerScroller(this, WB_VERT | WB_DRAG),
- aSwitcher(this, 0)
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
{
- // Members initialisieren
+ // init members
Init();
}
SvxLightCtl3D::SvxLightCtl3D( Window* pParent, WinBits nStyle )
: Control(pParent, nStyle),
- aLightControl(this, 0),
- aHorScroller(this, WB_HORZ | WB_DRAG),
- aVerScroller(this, WB_VERT | WB_DRAG),
- aSwitcher(this, 0)
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
{
- // Members initialisieren
+ // init members
Init();
}
void SvxLightCtl3D::Init()
{
// #i58240# set HelpIDs for scrollbars and switcher
- aHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
- aVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
- aSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
-
- // Lokale Parameter setzen
- bSphereUsed = TRUE;
- bVectorValid = FALSE;
+ maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
+ maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
+ maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
// Light preview
- aLightControl.Show();
- aLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
- aLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
+ maLightControl.Show();
+ maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
+ maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
// Horiz Scrollbar
- aHorScroller.Show();
- aHorScroller.SetRange(Range(0, 36000));
- aHorScroller.SetLineSize(100);
- aHorScroller.SetPageSize(1000);
- aHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maHorScroller.Show();
+ maHorScroller.SetRange(Range(0, 36000));
+ maHorScroller.SetLineSize(100);
+ maHorScroller.SetPageSize(1000);
+ maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Vert Scrollbar
- aVerScroller.Show();
- aVerScroller.SetRange(Range(0, 18000));
- aVerScroller.SetLineSize(100);
- aVerScroller.SetPageSize(1000);
- aVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maVerScroller.Show();
+ maVerScroller.SetRange(Range(0, 18000));
+ maVerScroller.SetLineSize(100);
+ maVerScroller.SetPageSize(1000);
+ maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Switch Button
- aSwitcher.Show();
- aSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
+ maSwitcher.Show();
+ maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
- // Selektion klaeren
+ // check selection
CheckSelection();
- // Neues Layout
+ // new layout
NewLayout();
}
@@ -1217,73 +1041,56 @@ SvxLightCtl3D::~SvxLightCtl3D()
{
}
-void SvxLightCtl3D::SetVector(const basegfx::B3DVector& rNew)
-{
- aVector = rNew;
- aVector.normalize();
- bVectorValid = TRUE;
-}
-
-const basegfx::B3DVector& SvxLightCtl3D::GetVector()
-{
- // Grobe Anbindung an altes Verhalten, um eine Reaktion zu haben
- aVector = aLightControl.GetLightGroup()->GetDirection(aLightControl.GetSelectedLight());
- aVector.normalize();
- return aVector;
-}
-
void SvxLightCtl3D::Resize()
{
// call parent
Control::Resize();
- // Neues Layout
+ // new layout
NewLayout();
}
void SvxLightCtl3D::NewLayout()
{
// Layout members
- Size aSize = GetOutputSizePixel();
- long nScrollSize = aHorScroller.GetSizePixel().Height();
+ const Size aSize(GetOutputSizePixel());
+ const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height());
- // Preview Fenster
+ // Preview control
Point aPoint(0, 0);
Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
- aLightControl.SetPosSizePixel(aPoint, aDestSize);
+ maLightControl.SetPosSizePixel(aPoint, aDestSize);
- // Horizontaler Scrollbar
+ // hor scrollbar
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- aHorScroller.SetPosSizePixel(aPoint, aDestSize);
+ maHorScroller.SetPosSizePixel(aPoint, aDestSize);
- // Vertikaler Scrollbar
+ // vert scrollbar
aPoint.X() = aSize.Width() - nScrollSize;
aPoint.Y() = 0;
aDestSize.Width() = nScrollSize;
aDestSize.Height() = aSize.Height() - nScrollSize;
- aVerScroller.SetPosSizePixel(aPoint, aDestSize);
+ maVerScroller.SetPosSizePixel(aPoint, aDestSize);
- // Button
+ // button
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- aSwitcher.SetPosSizePixel(aPoint, aDestSize);
+ maSwitcher.SetPosSizePixel(aPoint, aDestSize);
}
-// Selektion auf Gueltigkeit pruefen
void SvxLightCtl3D::CheckSelection()
{
- BOOL bSelectionValid = (aLightControl.IsSelectionValid()
- || aLightControl.IsGeometrySelected());
- aHorScroller.Enable(bSelectionValid);
- aVerScroller.Enable(bSelectionValid);
+ const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected());
+ maHorScroller.Enable(bSelectionValid);
+ maVerScroller.Enable(bSelectionValid);
if(bSelectionValid)
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
}
}
@@ -1291,8 +1098,7 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
-
+ maLightControl.GetPosition(fHor, fVer);
fHor += fDeltaHor;
fVer += fDeltaVer;
@@ -1302,18 +1108,19 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
if ( fVer < -90.0 )
return;
- aLightControl.SetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
-
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
+ maLightControl.SetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
}
void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
{
- KeyCode aCode = rKEvt.GetKeyCode();
+ const KeyCode aCode(rKEvt.GetKeyCode());
if( aCode.GetModifier() )
{
@@ -1324,71 +1131,98 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
switch ( aCode.GetCode() )
{
case KEY_SPACE:
- ;
+ {
break;
+ }
case KEY_LEFT:
+ {
move( -4.0, 0.0 ); // #i58242# changed move direction in X
break;
+ }
case KEY_RIGHT:
+ {
move( 4.0, 0.0 ); // #i58242# changed move direction in X
break;
+ }
case KEY_UP:
+ {
move( 0.0, 4.0 );
break;
+ }
case KEY_DOWN:
+ {
move( 0.0, -4.0 );
break;
+ }
case KEY_PAGEUP:
- {
- B3dLightGroup* pLights = aLightControl.GetLightGroup();
- int eLight = aLightControl.GetSelectedLight() - 1;
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
- if( eLight < Base3DLight0 )
+ if(nLight < 0)
+ {
+ nLight = 7;
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
{
- eLight = Base3DLight7;
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ nLight--;
}
+ }
+
+ if(nLight >= 0)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
- if( eLight >= Base3DLight0 )
+ if(maUserSelectionChangeCallback.IsSet())
{
- aLightControl.SelectLight((Base3DLightNumber)eLight);
- CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
+ maUserSelectionChangeCallback.Call(this);
}
- break;
}
+
+ break;
+ }
case KEY_PAGEDOWN:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
{
- B3dLightGroup* pLights = aLightControl.GetLightGroup();
- int eLight = aLightControl.GetSelectedLight() + 1;
+ nLight++;
+ }
- while( (eLight < Base3DLightNone) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight++;
+ if(nLight > 7)
+ {
+ nLight = 0;
- if( eLight == Base3DLightNone )
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
{
- eLight = Base3DLight0;
- while( (eLight < Base3DLightNone) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight++;
+ nLight++;
}
+ }
+
+ if(nLight <= 7)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
- if( eLight < Base3DLightNone )
+ if(maUserSelectionChangeCallback.IsSet())
{
- aLightControl.SelectLight((Base3DLightNumber)eLight);
- CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
+ maUserSelectionChangeCallback.Call(this);
}
- break;
}
+
+ break;
+ }
default:
+ {
Control::KeyInput( rKEvt );
break;
+ }
}
}
@@ -1396,20 +1230,20 @@ void SvxLightCtl3D::GetFocus()
{
Control::GetFocus();
- if( HasFocus() && IsEnabled() )
+ if(HasFocus() && IsEnabled())
{
CheckSelection();
- Size aFocusSize = aLightControl.GetOutputSizePixel();
+ Size aFocusSize = maLightControl.GetOutputSizePixel();
aFocusSize.Width() -= 4;
aFocusSize.Height() -= 4;
Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
- aFocusRect = aLightControl.PixelToLogic( aFocusRect );
+ aFocusRect = maLightControl.PixelToLogic( aFocusRect );
- aLightControl.ShowFocus( aFocusRect );
+ maLightControl.ShowFocus( aFocusRect );
}
}
@@ -1417,31 +1251,37 @@ void SvxLightCtl3D::LoseFocus()
{
Control::LoseFocus();
- aLightControl.HideFocus();
+ maLightControl.HideFocus();
}
IMPL_LINK( SvxLightCtl3D, ScrollBarMove, void*, EMPTYARG)
{
- INT32 nHor = aHorScroller.GetThumbPos();
- INT32 nVer = aVerScroller.GetThumbPos();
+ const sal_Int32 nHor(maHorScroller.GetThumbPos());
+ const sal_Int32 nVer(maVerScroller.GetThumbPos());
- aLightControl.SetPosition(
+ maLightControl.SetPosition(
((double)nHor) / 100.0,
((double)((18000 - nVer) - 9000)) / 100.0);
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
-
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //InteractiveChange(NULL);
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
return 0;
}
IMPL_LINK( SvxLightCtl3D, ButtonPress, void*, EMPTYARG)
{
- aLightControl.SetGeometry(bSphereUsed);
- bSphereUsed = !bSphereUsed;
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetSvx3DLightControl().GetObjectType())
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+
return 0;
}
@@ -1449,15 +1289,14 @@ IMPL_LINK( SvxLightCtl3D, InternalInteractiveChange, void*, EMPTYARG)
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
-
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //InteractiveChange(NULL);
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
return 0;
}
@@ -1466,26 +1305,13 @@ IMPL_LINK( SvxLightCtl3D, InternalSelectionChange, void*, EMPTYARG)
{
CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
-
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //SelectionChange(NULL);
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
return 0;
}
-// ...um Kompatibel zu bleiben, kann spaeter wieder raus
-/*
-IMPL_LINK( SvxLightCtl3D, InteractiveChange, void*, EMPTYARG)
-{
- return NULL;
-} */
-
-/*
-IMPL_LINK( SvxLightCtl3D, SelectionChange, void*, EMPTYARG)
-{
- return NULL;
-}*/
-
-
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
index 2a439705b1..0f52f80dff 100644
--- a/svx/source/engine3d/cube3d.cxx
+++ b/svx/source/engine3d/cube3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cube3d.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -66,9 +66,6 @@ E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, c
// uebergebene drueberbuegeln
aCubePos = aPos;
aCubeSize = r3DSize;
-
- // Geometrie erzeugen
- CreateGeometry();
}
E3dCubeObj::E3dCubeObj()
@@ -111,178 +108,6 @@ SdrObject *E3dCubeObj::DoConvertToPolyObj(BOOL /*bBezier*/) const
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dCubeObj::Get3DLineGeometry() const
-{
- basegfx::B3DPolyPolygon aRetval;
-
- // add geometry describing polygons to rLinePolyPolygon
- basegfx::B3DPolygon aNewUpper;
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(aNewUpper.getB3DPoint(0));
- aRetval.append(aNewUpper);
-
- basegfx::B3DPolygon aNewLower;
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewLower.append(aNewLower.getB3DPoint(0));
- aRetval.append(aNewLower);
-
- basegfx::B3DPolygon aNewVertical;
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dCubeObj::CreateGeometry()
-{
- basegfx::B3DPoint aPos(aCubePos);
- short nV1, nV2;
- UINT16 nSideBit = 0x0001;
-
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- if ( bPosIsCenter )
- aCubePos -= aCubeSize / 2;
-
- for (nV1 = 0; nV1 < 3; nV1++)
- {
- if ( nV1 == 0 ) nV2 = 2;
- else nV2 = nV1 - 1;
-
- // Nur die Flaechen erzeugen, fuer die ein Bit
- if ( nSideFlags & nSideBit )
- { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
- basegfx::B3DPolygon aRect3D;
-
- aRect3D.append(aPos); aPos[nV1] += aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] += aCubeSize[nV2];
- aRect3D.append(aPos); aPos[nV1] -= aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] -= aCubeSize[nV2];
-
- if(GetCreateNormals())
- {
- basegfx::B3DPolygon aNormals3D;
- basegfx::B3DVector aVecTmp;
-
- aVecTmp = aRect3D.getB3DPoint(0L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(1L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(2L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(3L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
-
- if(GetCreateTexture())
- {
- basegfx::B2DPolygon aTexture2D;
-
- aTexture2D.append(basegfx::B2DPoint(1.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 1.0));
- aTexture2D.append(basegfx::B2DPoint(1.0, 1.0));
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), FALSE);
- }
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
- }
- }
- nSideBit <<= 1;
- }
- aPos += aCubeSize;
-
- for (nV1 = 2; nV1 >= 0; nV1--)
- {
- if ( nV1 == 2 ) nV2 = 0;
- else nV2 = nV1 + 1;
-
- if ( nSideFlags & nSideBit )
- { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
- basegfx::B3DPolygon aRect3D;
- basegfx::B2DPolygon aTexture2D;
-
- aRect3D.append(aPos); aPos[nV1] -= aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] -= aCubeSize[nV2];
- aRect3D.append(aPos); aPos[nV1] += aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] += aCubeSize[nV2];
-
- if(GetCreateTexture())
- {
- aTexture2D.append(basegfx::B2DPoint(1.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 1.0));
- aTexture2D.append(basegfx::B2DPoint(1.0, 1.0));
- }
-
- if(GetCreateNormals())
- {
- basegfx::B3DPolygon aNormals3D;
- basegfx::B3DVector aVecTmp;
-
- aVecTmp = aRect3D.getB3DPoint(0L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(1L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(2L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(3L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
-
- if(GetCreateTexture())
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), FALSE);
- }
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
- }
- }
- nSideBit <<= 1;
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Zuweisungsoperator
|*
\************************************************************************/
@@ -312,7 +137,7 @@ void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
if(aCubePos != rNew)
{
aCubePos = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -321,7 +146,7 @@ void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
if(aCubeSize != rNew)
{
aCubeSize = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -330,7 +155,7 @@ void E3dCubeObj::SetPosIsCenter(BOOL bNew)
if(bPosIsCenter != bNew)
{
bPosIsCenter = bNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -339,7 +164,7 @@ void E3dCubeObj::SetSideFlags(UINT16 nNew)
if(nSideFlags != nNew)
{
nSideFlags = nNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/deflt3d.cxx b/svx/source/engine3d/deflt3d.cxx
index aa0f73b0ca..920b98efe4 100644
--- a/svx/source/engine3d/deflt3d.cxx
+++ b/svx/source/engine3d/deflt3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: deflt3d.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -54,7 +54,6 @@ void E3dDefaultAttributes::Reset()
// Compound-Objekt
bDefaultCreateNormals = TRUE;
bDefaultCreateTexture = TRUE;
- bDefaultUseDifferentBackMaterial = FALSE;
// Cube-Objekt
aDefaultCubePos = basegfx::B3DPoint(-500.0, -500.0, -500.0);
@@ -80,9 +79,6 @@ void E3dDefaultAttributes::Reset()
bDefaultExtrudeCharacterMode = FALSE;
bDefaultExtrudeCloseFront = TRUE;
bDefaultExtrudeCloseBack = TRUE;
-
- // Scene-Objekt
- bDefaultDither = TRUE;
}
// eof
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index bf732689d9..8188fcc221 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dragmt3d.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-// MIB 6.11.97: Die Reihenfolge der Includes mag verwundern, aber in dieser
-// Reihenfolge geht das durch den SCO GCC, in anderen nicht. Also bitte nicht
-// an der Reihenfolge drehen, wenn es nicht noetig ist. Das gleiche gilt
-// natuerlich auch fuer das hinzufuegen von Includes. Danke.
+#include <dragmt3d.hxx>
#include <tools/shl.hxx>
#include <svx/svdpagv.hxx>
#include <svx/dialmgr.hxx>
@@ -43,35 +40,18 @@
#include <svx/obj3d.hxx>
#include <svx/polysc3d.hxx>
#include <svx/e3dundo.hxx>
-#include "dragmt3d.hxx"
-
#include <svx/dialogs.hrc>
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
TYPEINIT1(E3dDragMethod, SdrDragMethod);
/*************************************************************************
|*
-|* Parameter fuer Interaktion eines 3D-Objektes
-|*
-\************************************************************************/
-
-SV_IMPL_PTRARR(E3dDragMethodUnitGroup, E3dDragMethodUnit*);
-
-/*************************************************************************
-|*
-|* Timing-Qualitaeten
-|*
-\************************************************************************/
-
-#define E3D_GOOD_TIME Time(0,0)
-#define E3D_BAD_TIME Time(0,0,1)
-#define E3D_WANTED_TIME Time(0,0,0,25)
-#define E3D_WAITTIME_TIL_REDRAW (5)
-
-/*************************************************************************
-|*
|* Konstruktor aller 3D-DragMethoden
|*
\************************************************************************/
@@ -82,110 +62,57 @@ E3dDragMethod::E3dDragMethod (
E3dDragConstraint eConstr,
BOOL bFull)
: SdrDragMethod(_rView),
- eConstraint(eConstr),
- bMoveFull(bFull),
- bMovedAtAll(FALSE)
+ meConstraint(eConstr),
+ mbMoveFull(bFull),
+ mbMovedAtAll(FALSE)
{
// Fuer alle in der selektion befindlichen 3D-Objekte
// eine Unit anlegen
- long nCnt = rMark.GetMarkCount();
+ const long nCnt(rMark.GetMarkCount());
+ static bool bDoInvalidate(false);
+
for(long nObjs = 0;nObjs < nCnt;nObjs++)
{
- SdrObject *pObj = rMark.GetMark(nObjs)->GetMarkedSdrObj();
- if(pObj && pObj->ISA(E3dObject))
+ E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
+
+ if(pE3dObj)
{
- E3dObject* p3DObj = (E3dObject*)pObj;
- E3dDragMethodUnit* pNewUnit = new E3dDragMethodUnit;
- DBG_ASSERT(pNewUnit, "AW: Kein Speicher");
+ // fill new interaction unit
+ E3dDragMethodUnit aNewUnit;
+ aNewUnit.mp3DObj = pE3dObj;
- // Neue Unit einrichten
- pNewUnit->p3DObj = p3DObj;
+ // get transformations
+ aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
- // Transformationen holen
- pNewUnit->aInitTransform = pNewUnit->aTransform = p3DObj->GetTransform();
- if(p3DObj->GetParentObj())
- pNewUnit->aDisplayTransform = p3DObj->GetParentObj()->GetFullTransform();
- pNewUnit->aInvDisplayTransform = pNewUnit->aDisplayTransform;
- pNewUnit->aInvDisplayTransform.invert();
+ if(pE3dObj->GetParentObj())
+ {
+ // get transform between object and world, normally scene transform
+ aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform();
+ aNewUnit.maInvDisplayTransform.invert();
+ }
// SnapRects der beteiligten Objekte invalidieren, um eine
// Neuberechnung beim Setzen der Marker zu erzwingen
- p3DObj->SetRectsDirty();
-
- if(bMoveFull)
+ if(bDoInvalidate)
{
- // Timings merken
- pNewUnit->nOrigQuality = p3DObj->GetScene()->GetDisplayQuality();
+ pE3dObj->SetRectsDirty();
}
- else
+
+ if(!mbMoveFull)
{
- // Drahtgitterdarstellung fuer Parent-Koodinaten erzeugen
- pNewUnit->aWireframePoly.clear();
- p3DObj->CreateWireframe(pNewUnit->aWireframePoly, NULL);
- pNewUnit->aWireframePoly.transform(pNewUnit->aTransform);
+ // create wireframe visualisation for parent coordinate system
+ aNewUnit.maWireframePoly.clear();
+ aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
+ aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
}
// FullBound ermitteln
- aFullBound.Union(p3DObj->GetSnapRect());
+ maFullBound.Union(pE3dObj->GetSnapRect());
// Unit einfuegen
- aGrp.Insert((const E3dDragMethodUnit*&)pNewUnit, aGrp.Count());
- }
- }
-
- // Link auf den Timer setzen
- aCallbackTimer.SetTimeoutHdl( LINK( this, E3dDragMethod, TimerInterruptHdl) );
-}
-
-/*************************************************************************
-|*
-\************************************************************************/
-
-IMPL_LINK(E3dDragMethod, TimerInterruptHdl, void*, EMPTYARG)
-{
- // Alle beteiligten Szenen neu zeichnen
- UINT16 nCnt = aGrp.Count();
- E3dScene* pScene = NULL;
- UINT32 nNewTime(0);
-
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- {
- if(aGrp[nOb]->p3DObj->GetScene() != pScene)
- {
- pScene = aGrp[nOb]->p3DObj->GetScene();
- INT32 nOldQual = pScene->GetDisplayQuality();
- if(nOldQual != 255)
- {
- if(nOldQual == 0)
- nOldQual = 30;
- else if(nOldQual <= 64)
- nOldQual = 64;
- else
- nOldQual = 255;
-
- pScene->SetDisplayQuality((UINT8)nOldQual);
- pScene->SetChanged();
- pScene->BroadcastObjectChange();
-
- if(nOldQual != 255)
- {
- Time aLast = pScene->GetLastPaintTime();
- if(nOldQual == 30)
- nNewTime = aLast.GetTime() * (50 * E3D_WAITTIME_TIL_REDRAW);
- else
- nNewTime = aLast.GetTime() * (200 * E3D_WAITTIME_TIL_REDRAW);
- }
- }
+ maGrp.push_back(aNewUnit);
}
}
-
- if(nNewTime)
- {
- // Timer reset
- aCallbackTimer.SetTimeout(nNewTime);
- aCallbackTimer.Start();
- }
- return 0L;
}
/*************************************************************************
@@ -204,22 +131,24 @@ void E3dDragMethod::TakeComment(XubString& /*rStr*/) const
FASTBOOL E3dDragMethod::Beg()
{
- if(eConstraint == E3DDRAG_CONSTR_Z)
+ if(E3DDRAG_CONSTR_Z == meConstraint)
{
- UINT16 nCnt = aGrp.Count();
- DragStat().Ref1() = aFullBound.Center();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+ DragStat().Ref1() = maFullBound.Center();
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- aGrp[nOb]->nStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
- aGrp[nOb]->nLastAngle = 0;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
+ rCandidate.mnLastAngle = 0;
}
}
else
{
- aLastPos = DragStat().GetStart();
+ maLastPos = DragStat().GetStart();
}
- if(!bMoveFull)
+ if(!mbMoveFull)
{
Show();
}
@@ -235,52 +164,30 @@ FASTBOOL E3dDragMethod::Beg()
FASTBOOL E3dDragMethod::End(FASTBOOL /*bCopy*/)
{
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
- if(bMoveFull)
- {
- // Timer stoppen
- aCallbackTimer.Stop();
-
- if(bMovedAtAll)
- {
- // Original-Qualitaet restaurieren
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- aGrp[nOb]->p3DObj->GetScene()->SetDisplayQuality(aGrp[nOb]->nOrigQuality);
- }
- }
- else
+ if(!mbMoveFull)
{
// WireFrame ausblenden
Hide();
}
// Alle Transformationen anwenden und UnDo's anlegen
- if(bMovedAtAll)
+ if(mbMovedAtAll)
{
rView.BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_ROTATE));
- UINT16 nOb;
- for(nOb=0;nOb<nCnt;nOb++)
- {
- aGrp[nOb]->p3DObj->SetTransform(aGrp[nOb]->aTransform);
- rView.AddUndo(new E3dRotateUndoAction(aGrp[nOb]->p3DObj->GetModel(),
- aGrp[nOb]->p3DObj, aGrp[nOb]->aInitTransform,
- aGrp[nOb]->aTransform));
- }
- rView.EndUndo();
+ sal_uInt32 nOb(0);
- // An allen beteiligten Szenen SnapRect neu setzen und
- // BoundVolume der Kamera neu bestimmen, da sich die Geometrie
- // tatsaechlich geaendert haben kann
- E3dScene* pScene = NULL;
for(nOb=0;nOb<nCnt;nOb++)
{
- if(aGrp[nOb]->p3DObj->GetScene() != pScene)
- {
- pScene = aGrp[nOb]->p3DObj->GetScene();
- pScene->CorrectSceneDimensions();
- }
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ rView.AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
+ rCandidate.mp3DObj, rCandidate.maInitTransform,
+ rCandidate.maTransform));
}
+ rView.EndUndo();
}
return TRUE;
@@ -294,22 +201,17 @@ FASTBOOL E3dDragMethod::End(FASTBOOL /*bCopy*/)
void E3dDragMethod::Brk()
{
- if(bMoveFull)
+ if(mbMoveFull)
{
- // Timer stoppen
- aCallbackTimer.Stop();
-
- if(bMovedAtAll)
+ if(mbMovedAtAll)
{
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
// Transformation restaurieren
- aGrp[nOb]->p3DObj->SetTransform(aGrp[nOb]->aInitTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
-
- // Original-Qualitaet restaurieren
- aGrp[nOb]->p3DObj->GetScene()->SetDisplayQuality(aGrp[nOb]->nOrigQuality);
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
}
}
}
@@ -328,43 +230,7 @@ void E3dDragMethod::Brk()
void E3dDragMethod::Mov(const Point& /*rPnt*/)
{
- bMovedAtAll = TRUE;
- if(bMoveFull)
- {
- UINT32 nNewTime = 0L;
-
- // Darstellungsqualitaet bestimmen
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- {
- E3dScene* pScene = aGrp[nOb]->p3DObj->GetScene();
- if(pScene)
- {
- Time aLast = pScene->GetLastPaintTime();
- if(aLast.GetTime())
- {
- INT32 nActQual = pScene->GetDisplayQuality();
-
- // nur weiter ueberlegen, wenn die Qualitaet ueber null liegt
- if(nActQual)
- {
- INT32 nNewQual = nActQual + (E3D_WANTED_TIME.GetTime() - aLast.GetTime());
- if(nNewQual < 0L)
- nNewQual = 0L;
- if(nNewQual > 255L)
- nNewQual = 255L;
- pScene->SetDisplayQuality((UINT8)nNewQual);
- }
- }
- UINT32 nTime = aLast.GetTime() * (25 * E3D_WAITTIME_TIL_REDRAW);
- nNewTime = (nTime > nNewTime) ? nTime : nNewTime;
- }
- }
-
- // Timer reset
- aCallbackTimer.SetTimeout(nNewTime);
- aCallbackTimer.Start();
- }
+ mbMovedAtAll = true;
}
/*************************************************************************
@@ -376,36 +242,33 @@ void E3dDragMethod::Mov(const Point& /*rPnt*/)
// for migration from XOR to overlay
void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager, ::sdr::overlay::OverlayObjectList& rOverlayList)
{
- sal_uInt16 nCnt(aGrp.Count());
+ const sal_uInt32 nCnt(maGrp.size());
basegfx::B2DPolyPolygon aResult;
- for(sal_uInt16 nOb(0); nOb < nCnt; nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
SdrPageView* pPV = rView.GetSdrPageView();
- if(pPV)
+ if(pPV && pPV->HasMarkedObjPageView())
{
- if(pPV->HasMarkedObjPageView())
+ const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
+ const sal_uInt32 nPlyCnt(aCandidate.count());
+
+ if(nPlyCnt)
{
- const sal_uInt32 nPntCnt(aGrp[nOb]->aWireframePoly.count());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
+ const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
- if(nPntCnt > 1L)
- {
- for(sal_uInt32 b(0L); b < nPntCnt; b += 2L)
- {
- basegfx::B3DPoint aStart = aGrp[nOb]->aDisplayTransform * aGrp[nOb]->aWireframePoly.getB3DPoint(b);
- aStart = rCameraSet.WorldToViewCoor(aStart);
+ // transform to relative scene coordinates
+ basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
- basegfx::B3DPoint aEnd = aGrp[nOb]->aDisplayTransform * aGrp[nOb]->aWireframePoly.getB3DPoint(b+1L);
- aEnd = rCameraSet.WorldToViewCoor(aEnd);
+ // transform to 2D view coordinates
+ aPolyPolygon.transform(rVCScene.getObjectTransformation());
- basegfx::B2DPolygon aTempPoly;
- aTempPoly.append(basegfx::B2DPoint(aStart.getX(), aStart.getY()));
- aTempPoly.append(basegfx::B2DPoint(aEnd.getX(), aEnd.getY()));
- aResult.append(aTempPoly);
- }
- }
+ aResult.append(aPolyPolygon);
}
}
}
@@ -433,47 +296,52 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
: E3dDragMethod(_rView, rMark, eConstr, bFull)
{
// Zentrum aller selektierten Objekte in Augkoordinaten holen
- UINT16 nCnt = aGrp.Count();
- E3dScene *pScene = NULL;
+ const sal_uInt32 nCnt(maGrp.size());
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ if(nCnt)
{
- basegfx::B3DPoint aObjCenter = aGrp[nOb]->p3DObj->GetCenter();
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- aObjCenter *= aGrp[nOb]->aInitTransform;
- aObjCenter *= aGrp[nOb]->aDisplayTransform;
- aObjCenter = rCameraSet.WorldToEyeCoor(aObjCenter);
- aGlobalCenter += aObjCenter;
-
- if(aGrp[nOb]->p3DObj->ISA(E3dScene))
- pScene = (E3dScene*)aGrp[nOb]->p3DObj;
- }
+ const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
+
+ if(pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
- // Teilen durch Anzahl
- if(nCnt > 1)
- aGlobalCenter /= (double)nCnt;
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
+ const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
- // Gruppe schon gesetzt? Sonst gruppe irgendeines Objektes
- // (erstes) holen
- if(!pScene && nCnt)
- {
- if(aGrp[0]->p3DObj)
- pScene = aGrp[0]->p3DObj->GetScene();
- }
+ aObjCenter = aTransform * aObjCenter;
+ maGlobalCenter += aObjCenter;
+ }
- if(pScene)
- {
- // 2D-Koordinaten des Controls Rotationszentrum holen
- Point aRotCenter2D = Ref1();
+ // Teilen durch Anzahl
+ if(nCnt > 1)
+ {
+ maGlobalCenter /= (double)nCnt;
+ }
+
+ // get rotate center and transform to 3D eye coordinates
+ basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
- // In Augkoordinaten transformieren
- basegfx::B3DPoint aRotCenter(aRotCenter2D.X(), aRotCenter2D.Y(), 0.0);
- aRotCenter = pScene->GetCameraSet().ViewToEyeCoor(aRotCenter);
+ // from world to relative scene using inverse getObjectTransformation()
+ basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
+ aInverseObjectTransform.invert();
+ aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
+
+ // from 3D view to 3D eye
+ basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+ aRotCenter3D = aInverseViewToEye * aRotCenter3D;
// X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus
// Rotationspunkt im Raum benutzen
- aGlobalCenter.setX(aRotCenter.getX());
- aGlobalCenter.setY(aRotCenter.getY());
+ maGlobalCenter.setX(aRotCenter3D.getX());
+ maGlobalCenter.setY(aRotCenter3D.getY());
+ }
}
}
@@ -491,7 +359,7 @@ void E3dDragRotate::Mov(const Point& rPnt)
if(DragStat().CheckMinMoved(rPnt))
{
// Modifier holen
- UINT16 nModifier = 0;
+ sal_uInt16 nModifier = 0;
if(rView.ISA(E3dView))
{
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
@@ -499,26 +367,28 @@ void E3dDragRotate::Mov(const Point& rPnt)
}
// Alle Objekte rotieren
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
// Rotationswinkel bestimmen
double fWAngle, fHAngle;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
- if(eConstraint == E3DDRAG_CONSTR_Z)
+ if(E3DDRAG_CONSTR_Z == meConstraint)
{
fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) -
- aGrp[nOb]->nStartAngle) - aGrp[nOb]->nLastAngle;
- aGrp[nOb]->nLastAngle = (long)fWAngle + aGrp[nOb]->nLastAngle;
+ rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
+ rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle;
fWAngle /= 100.0;
fHAngle = 0.0;
}
else
{
- fWAngle = 90.0 * (double)(rPnt.X() - aLastPos.X())
- / (double)aFullBound.GetWidth();
- fHAngle = 90.0 * (double)(rPnt.Y() - aLastPos.Y())
- / (double)aFullBound.GetHeight();
+ fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
+ / (double)maFullBound.GetWidth();
+ fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
+ / (double)maFullBound.GetHeight();
}
long nSnap = 0;
@@ -537,51 +407,55 @@ void E3dDragRotate::Mov(const Point& rPnt)
// Transformation bestimmen
basegfx::B3DHomMatrix aRotMat;
- if(eConstraint & E3DDRAG_CONSTR_Y)
+ if(E3DDRAG_CONSTR_Y & meConstraint)
{
if(nModifier & KEY_MOD2)
aRotMat.rotate(0.0, 0.0, fWAngle);
else
aRotMat.rotate(0.0, fWAngle, 0.0);
}
- else if(eConstraint & E3DDRAG_CONSTR_Z)
+ else if(E3DDRAG_CONSTR_Z & meConstraint)
{
if(nModifier & KEY_MOD2)
aRotMat.rotate(0.0, fWAngle, 0.0);
else
aRotMat.rotate(0.0, 0.0, fWAngle);
}
- if(eConstraint & E3DDRAG_CONSTR_X)
+ if(E3DDRAG_CONSTR_X & meConstraint)
{
aRotMat.rotate(fHAngle, 0.0, 0.0);
}
// Transformation in Eye-Koordinaten, dort rotieren
// und zurueck
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- basegfx::B3DHomMatrix aTransMat = aGrp[nOb]->aDisplayTransform;
- aTransMat *= rCameraSet.GetOrientation();
- aTransMat.translate(-aGlobalCenter.getX(), -aGlobalCenter.getY(), -aGlobalCenter.getZ());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
+ aTransMat *= aViewInfo3D.getOrientation();
+ aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
aTransMat *= aRotMat;
- aTransMat.translate(aGlobalCenter.getX(), aGlobalCenter.getY(), aGlobalCenter.getZ());
- aTransMat *= rCameraSet.GetInvOrientation();
- aTransMat *= aGrp[nOb]->aInvDisplayTransform;
+ aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
+ aTransMat *= aInverseOrientation;
+ aTransMat *= rCandidate.maInvDisplayTransform;
// ...und anwenden
- aGrp[nOb]->aTransform *= aTransMat;
- if(bMoveFull)
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.transform(aTransMat);
+ rCandidate.maWireframePoly.transform(aTransMat);
Show();
}
}
- aLastPos = rPnt;
+ maLastPos = rPnt;
DragStat().NextMove(rPnt);
}
}
@@ -612,33 +486,33 @@ E3dDragMove::E3dDragMove(SdrDragView &_rView,
E3dDragConstraint eConstr,
BOOL bFull)
: E3dDragMethod(_rView, rMark, eConstr, bFull),
- eWhatDragHdl(eDrgHdl)
+ meWhatDragHdl(eDrgHdl)
{
- switch(eWhatDragHdl)
+ switch(meWhatDragHdl)
{
case HDL_LEFT:
- aScaleFixPos = aFullBound.RightCenter();
+ maScaleFixPos = maFullBound.RightCenter();
break;
case HDL_RIGHT:
- aScaleFixPos = aFullBound.LeftCenter();
+ maScaleFixPos = maFullBound.LeftCenter();
break;
case HDL_UPPER:
- aScaleFixPos = aFullBound.BottomCenter();
+ maScaleFixPos = maFullBound.BottomCenter();
break;
case HDL_LOWER:
- aScaleFixPos = aFullBound.TopCenter();
+ maScaleFixPos = maFullBound.TopCenter();
break;
case HDL_UPLFT:
- aScaleFixPos = aFullBound.BottomRight();
+ maScaleFixPos = maFullBound.BottomRight();
break;
case HDL_UPRGT:
- aScaleFixPos = aFullBound.BottomLeft();
+ maScaleFixPos = maFullBound.BottomLeft();
break;
case HDL_LWLFT:
- aScaleFixPos = aFullBound.TopRight();
+ maScaleFixPos = maFullBound.TopRight();
break;
case HDL_LWRGT:
- aScaleFixPos = aFullBound.TopLeft();
+ maScaleFixPos = maFullBound.TopLeft();
break;
default:
// Bewegen des Objektes, HDL_MOVE
@@ -648,8 +522,8 @@ E3dDragMove::E3dDragMove(SdrDragView &_rView,
// Override wenn IsResizeAtCenter()
if(rView.IsResizeAtCenter())
{
- eWhatDragHdl = HDL_USER;
- aScaleFixPos = aFullBound.Center();
+ meWhatDragHdl = HDL_USER;
+ maScaleFixPos = maFullBound.Center();
}
}
@@ -666,64 +540,82 @@ void E3dDragMove::Mov(const Point& rPnt)
if(DragStat().CheckMinMoved(rPnt))
{
- if(eWhatDragHdl == HDL_MOVE)
+ if(HDL_MOVE == meWhatDragHdl)
{
// Translation
// Bewegungsvektor bestimmen
- basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - aLastPos.X()), (double)(rPnt.Y() - aLastPos.Y()), 32768.0);
+ basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0);
basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0);
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
// Modifier holen
- UINT16 nModifier = 0;
+ sal_uInt16 nModifier(0);
+
if(rView.ISA(E3dView))
{
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
nModifier = rLastMouse.GetModifier();
}
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
-
- // Bewegungsvektor von View-Koordinaten nach Aug-Koordinaten
- basegfx::B3DPoint aMoveHead(rCameraSet.ViewToEyeCoor(aGlobalMoveHead));
- basegfx::B3DPoint aMoveTail(rCameraSet.ViewToEyeCoor(aGlobalMoveTail));
-
- // Eventuell Bewegung von XY-Ebene auf XZ-Ebene umschalten
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // move coor from 2d world to 3d Eye
+ basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()));
+ basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
+ aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
+
+ basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
+ basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+
+ aMoveHead3D = aInverseViewToEye * aMoveHead3D;
+ aMoveTail3D = aInverseViewToEye * aMoveTail3D;
+
+ // eventually switch movement from XY to XZ plane
if(nModifier & KEY_MOD2)
{
- double fZwi = aMoveHead.getY();
- aMoveHead.setY(aMoveHead.getZ());
- aMoveHead.setZ(fZwi);
+ double fZwi = aMoveHead3D.getY();
+ aMoveHead3D.setY(aMoveHead3D.getZ());
+ aMoveHead3D.setZ(fZwi);
- fZwi = aMoveTail.getY();
- aMoveTail.setY(aMoveTail.getZ());
- aMoveTail.setZ(fZwi);
+ fZwi = aMoveTail3D.getY();
+ aMoveTail3D.setY(aMoveTail3D.getZ());
+ aMoveTail3D.setZ(fZwi);
}
// Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten
- aMoveHead = rCameraSet.EyeToWorldCoor(aMoveHead);
- aMoveHead *= aGrp[nOb]->aInvDisplayTransform;
- aMoveTail = rCameraSet.EyeToWorldCoor(aMoveTail);
- aMoveTail *= aGrp[nOb]->aInvDisplayTransform;
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
+
+ aMoveHead3D = aCompleteTrans * aMoveHead3D;
+ aMoveTail3D = aCompleteTrans* aMoveTail3D;
- // Transformation bestimmen
+ // build transformation
basegfx::B3DHomMatrix aTransMat;
- basegfx::B3DPoint aTranslate(aMoveHead - aMoveTail);
+ basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
- // ...und anwenden
- aGrp[nOb]->aTransform *= aTransMat;
- if(bMoveFull)
+ // ...and apply
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.transform(aTransMat);
+ rCandidate.maWireframePoly.transform(aTransMat);
Show();
}
}
@@ -733,98 +625,122 @@ void E3dDragMove::Mov(const Point& rPnt)
// Skalierung
// Skalierungsvektor bestimmen
Point aStartPos = DragStat().GetStart();
- basegfx::B3DPoint aGlobalScaleStart((double)(aStartPos.X()), (double)(aStartPos.Y()), 32768.0);
- basegfx::B3DPoint aGlobalScaleNext((double)(rPnt.X()), (double)(rPnt.Y()), 32768.0);
- basegfx::B3DPoint aGlobalScaleFixPos((double)(aScaleFixPos.X()), (double)(aScaleFixPos.Y()), 32768.0);
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- basegfx::B3DPoint aObjectCenter(aGrp[nOb]->p3DObj->GetCenter());
- aGlobalScaleStart.setZ(aObjectCenter.getZ());
- aGlobalScaleNext.setZ(aObjectCenter.getZ());
- aGlobalScaleFixPos.setZ(aObjectCenter.getZ());
-
- // Skalierungsvektor von View-Koordinaten nach Aug-Koordinaten
- basegfx::B3DPoint aScStart(rCameraSet.ViewToEyeCoor(aGlobalScaleStart));
- basegfx::B3DPoint aScNext(rCameraSet.ViewToEyeCoor(aGlobalScaleNext));
- basegfx::B3DPoint aScFixPos(rCameraSet.ViewToEyeCoor(aGlobalScaleFixPos));
-
- // Einschraenkungen?
- switch(eWhatDragHdl)
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
+
+ // transform from 2D world view to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y()));
+ basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y()));
+ basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y()));
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
+ aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
+ aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
+
+ basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
+ basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
+ basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
+
+ // constraints?
+ switch(meWhatDragHdl)
{
case HDL_LEFT:
case HDL_RIGHT:
- // Einschraenken auf X -> Y gleichsetzen
+ // constrain to auf X -> Y equal
aScNext.setY(aScFixPos.getY());
break;
case HDL_UPPER:
case HDL_LOWER:
- // Einschraenken auf Y -> X gleichsetzen
+ // constrain to auf Y -> X equal
aScNext.setX(aScFixPos.getX());
break;
default:
break;
}
- // ScaleVector in Augkoordinaten bestimmen
+ // get scale vector in eye coordinates
basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
aScaleVec.setZ(1.0);
if(aScaleVec.getX() != 0.0)
+ {
aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
+ }
else
+ {
aScaleVec.setX(1.0);
+ }
if(aScaleVec.getY() != 0.0)
+ {
aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
+ }
else
+ {
aScaleVec.setY(1.0);
+ }
- // Mit SHIFT-Taste?
+ // SHIFT-key used?
if(rView.IsOrtho())
{
if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
{
- // X ist am groessten
+ // X is biggest
aScaleVec.setY(aScaleVec.getX());
}
else
{
- // Y ist am groessten
+ // Y is biggest
aScaleVec.setX(aScaleVec.getY());
}
}
- // Transformation bestimmen
- basegfx::B3DHomMatrix aNewTrans = aGrp[nOb]->aInitTransform;
- aNewTrans *= aGrp[nOb]->aDisplayTransform;
- aNewTrans *= rCameraSet.GetOrientation();
+ // build transformation
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
+ aNewTrans *= rCandidate.maDisplayTransform;
+ aNewTrans *= aViewInfo3D.getOrientation();
aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
- aNewTrans *= rCameraSet.GetInvOrientation();
- aNewTrans *= aGrp[nOb]->aInvDisplayTransform;
+ aNewTrans *= aInverseOrientation;
+ aNewTrans *= rCandidate.maInvDisplayTransform;
// ...und anwenden
- aGrp[nOb]->aTransform = aNewTrans;
- if(bMoveFull)
+ rCandidate.maTransform = aNewTrans;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.clear();
- aGrp[nOb]->p3DObj->CreateWireframe(aGrp[nOb]->aWireframePoly, NULL);
- aGrp[nOb]->aWireframePoly.transform(aGrp[nOb]->aTransform);
+ rCandidate.maWireframePoly.clear();
+ rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
+ rCandidate.maWireframePoly.transform(rCandidate.maTransform);
Show();
}
}
}
- aLastPos = rPnt;
+ maLastPos = rPnt;
DragStat().NextMove(rPnt);
}
}
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
new file mode 100644
index 0000000000..c138acdde0
--- /dev/null
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: e3dsceneupdater.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/e3dsceneupdater.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pObject)
+: mpScene(0),
+ mpViewInformation3D(0)
+{
+ // Secure old 3D transformation stack before modification
+ if(pObject)
+ {
+ const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject);
+
+ if(pE3dObject)
+ {
+ mpScene = pE3dObject->GetScene();
+
+ if(mpScene && mpScene->GetScene() == mpScene)
+ {
+ // if there is a scene and it's the outmost scene, get current 3D range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ const basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ if(aAllContentRange.isEmpty())
+ {
+ // no content, nothing to do
+ mpScene = 0;
+ }
+ else
+ {
+ // secure current 3D transformation stack
+ mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(rVCScene.getViewInformation3D(aAllContentRange));
+ }
+ }
+ }
+ }
+}
+
+E3DModifySceneSnapRectUpdater::~E3DModifySceneSnapRectUpdater()
+{
+ if(mpScene && mpViewInformation3D)
+ {
+ // after changing parts of the scene, use the secured last 3d transformation stack and the new content
+ // range to calculate a new, eventually expanded or shrunk, 2D geometry for the scene and apply it.
+ // Get new content range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ // only change when there is still content; else let scene stay at old SnapRect
+ if(!aAllContentRange.isEmpty())
+ {
+ // check if object transform of scene has changed
+ if(mpViewInformation3D->getObjectTransformation() != mpScene->GetTransform())
+ {
+ // If Yes, it needs to be updated since it's - for historical reasons -
+ // part of the basic 3d transformation stack of the scene
+ drawinglayer::geometry::ViewInformation3D* pNew = new drawinglayer::geometry::ViewInformation3D(
+ mpScene->GetTransform(), // replace object transformation with new local transform
+ mpViewInformation3D->getOrientation(),
+ mpViewInformation3D->getProjection(),
+ mpViewInformation3D->getDeviceToView(),
+ mpViewInformation3D->getViewTime(),
+ mpViewInformation3D->getExtendedInformationSequence());
+ delete mpViewInformation3D;
+ mpViewInformation3D = pNew;
+ }
+
+ // transform content range to scene-relative coordinates using old 3d transformation stack
+ aAllContentRange.transform(mpViewInformation3D->getObjectToView());
+
+ // build 2d relative content range
+ basegfx::B2DRange aSnapRange(
+ aAllContentRange.getMinX(), aAllContentRange.getMinY(),
+ aAllContentRange.getMaxX(), aAllContentRange.getMaxY());
+
+ // transform to 2D world coordiantes using scene's 2D transformation
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to (old) integer
+ const Rectangle aNewSnapRect(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
+
+ // set as new SnapRect and invalidate bound volume
+ if(mpScene->GetSnapRect() != aNewSnapRect)
+ {
+ mpScene->SetSnapRect(aNewSnapRect);
+ mpScene->InvalidateBoundVolume();
+ }
+ }
+ }
+
+ delete mpViewInformation3D;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/e3dundo.cxx b/svx/source/engine3d/e3dundo.cxx
index 3853b4b93a..a564149499 100644
--- a/svx/source/engine3d/e3dundo.cxx
+++ b/svx/source/engine3d/e3dundo.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dundo.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -35,6 +35,7 @@
#include <svx/outlobj.hxx>
#include <svx/view3d.hxx>
#include <svx/scene3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
/************************************************************************/
@@ -85,8 +86,8 @@ E3dRotateUndoAction::~E3dRotateUndoAction ()
\************************************************************************/
void E3dRotateUndoAction::Undo ()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
pMy3DObj->SetTransform(aMyOldRotation);
- pMy3DObj->GetScene()->CorrectSceneDimensions();
}
/************************************************************************\
@@ -96,8 +97,8 @@ void E3dRotateUndoAction::Undo ()
\************************************************************************/
void E3dRotateUndoAction::Redo ()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
pMy3DObj->SetTransform(aMyNewRotation);
- pMy3DObj->GetScene()->CorrectSceneDimensions();
}
/*************************************************************************
@@ -146,15 +147,8 @@ E3dAttributesUndoAction::~E3dAttributesUndoAction()
\************************************************************************/
void E3dAttributesUndoAction::Undo()
{
- //pObject->SetItemSetAndBroadcast(aOldSet);
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
pObject->SetMergedItemSetAndBroadcast(aOldSet);
-
- if(pObject->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObject)->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
/*************************************************************************
@@ -164,15 +158,8 @@ void E3dAttributesUndoAction::Undo()
\************************************************************************/
void E3dAttributesUndoAction::Redo()
{
- //pObject->SetItemSetAndBroadcast(aNewSet);
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
pObject->SetMergedItemSetAndBroadcast(aNewSet);
-
- if(pObject->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObject)->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
/*************************************************************************
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
index fe7f7ddb49..a08fe4e753 100644
--- a/svx/source/engine3d/extrud3d.cxx
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: extrud3d.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.25.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -48,6 +48,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
// #110094# DrawContact section
@@ -89,9 +90,6 @@ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const basegfx::B2DP
// set extrude depth
GetProperties().SetObjectItemDirect(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5)));
-
- // Geometrie erzeugen
- CreateGeometry();
}
E3dExtrudeObj::E3dExtrudeObj()
@@ -117,183 +115,6 @@ void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::GetFrontSide()
-{
- basegfx::B3DPolyPolygon aRetval;
-
- if(maExtrudePolygon.count())
- {
- basegfx::B2DPolyPolygon aTemp(maExtrudePolygon);
- aTemp.removeDoublePoints();
- aTemp = basegfx::tools::correctOrientations(aTemp);
- const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
-
- if(basegfx::ORIENTATION_POSITIVE == aOrient)
- {
- aTemp.flip();
- }
-
- aRetval = basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aTemp);
- }
-
- return aRetval;
-}
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::GetBackSide(const basegfx::B3DPolyPolygon& rFrontSide)
-{
- basegfx::B3DPolyPolygon aBackSide(rFrontSide);
-
- if(GetExtrudeDepth() != 0)
- {
- // eventuell Skalieren
- if(GetPercentBackScale() != 100)
- {
- // #i74056#
- aBackSide = ImpScalePoly(aBackSide, (double)GetPercentBackScale() / 100.0);
- }
-
- // Verschieben
- basegfx::B3DHomMatrix aTrans;
- aTrans.translate(0.0, 0.0, (double)GetExtrudeDepth());
- aBackSide.transform(aTrans);
- }
-
- return aBackSide;
-}
-
-/*************************************************************************
-|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::Get3DLineGeometry() const
-{
- return maLinePolyPolygon;
-}
-
-void E3dExtrudeObj::CreateGeometry()
-{
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- // #78972# prepare new line geometry creation
- maLinePolyPolygon.clear();
-
- // Polygon als Grundlage holen
- basegfx::B3DPolyPolygon aFrontSide(GetFrontSide());
-
- if(aFrontSide.count())
- {
- if(GetExtrudeDepth() != 0)
- {
- // Hinteres Polygon erzeugen
- basegfx::B3DPolyPolygon aBackSide(GetBackSide(aFrontSide));
-
- // Was muss erzeugt werden?
- if(!aFrontSide.isClosed())
- {
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
- }
-
- double fTextureDepth(1.0);
- double fTextureStart(0.0);
-
- // Texturen erzeugen?
- if(!GetCreateTexture())
- {
- fTextureStart = fTextureDepth = 0.0;
- }
-
- // Falls Texturen erzeugen Randbreite fuer diese bestimmen
- double fSurroundFactor(1.0);
-
- if(GetCreateTexture())
- {
- const basegfx::B3DPolygon aFirstPolygon(aFrontSide.getB3DPolygon(0L));
- const double fLength(basegfx::tools::getLength(aFirstPolygon));
- const double fArea(basegfx::tools::getArea(aFirstPolygon));
- fSurroundFactor = fLength / sqrt(fArea);
- fSurroundFactor = (double)((long)(fSurroundFactor - 0.5));
- if(fSurroundFactor == 0.0)
- fSurroundFactor = 1.0;
- }
-
- // #i28528#
- basegfx::B3DPolyPolygon aFrontLines;
- basegfx::B3DPolyPolygon aBackLines;
- basegfx::B3DPolyPolygon aInBetweenLines;
-
- // Segment erzeugen
- ImpCreateSegment(
- aFrontSide,
- aBackSide,
- 0L,
- 0L,
- GetCloseFront(), // #107245# bExtrudeCloseFront,
- GetCloseBack(), // #107245# bExtrudeCloseBack,
- (double)GetPercentDiagonal() / 200.0,
- GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
- GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
- GetSmoothLids(), // #107245# GetExtrudeSmoothFrontBack(),
- fSurroundFactor,
- fTextureStart,
- fTextureDepth,
- GetCreateNormals(),
- GetCreateTexture(),
- GetCharacterMode(), // #107245# bExtrudeCharacterMode,
- FALSE,
- // #78972#
- &aFrontLines,
- &aBackLines,
- &aInBetweenLines);
-
- // #78972#
- // Simply add them for Extrudes
- maLinePolyPolygon.append(aFrontLines);
- maLinePolyPolygon.append(aInBetweenLines);
- maLinePolyPolygon.append(aBackLines);
- }
- else
- {
- // nur ein Polygon erzeugen
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
-
- // Fuer evtl. selbst erzeugte Normalen
- basegfx::B3DPolyPolygon aNormalsFront(ImpCreateByPattern(aFrontSide));
-
- // Extrudevektor bilden
- basegfx::B3DVector aNormal(0.0, 0.0, (double)GetExtrudeDepth());
-
- // Normalen und Vorderseite selbst erzeugen
- aNormalsFront = ImpAddFrontNormals(aNormalsFront, aNormal);
- ImpCreateFront(aFrontSide, aNormalsFront, GetCreateNormals(), GetCreateTexture());
-
- // #78972#
- maLinePolyPolygon.append(aFrontSide);
- }
-
- // #i28528#
- if(!GetReducedLineGeometry())
- {
- basegfx::B3DPolyPolygon aNewPolyPoly(ImpCompleteLinePolygon(maLinePolyPolygon, aFrontSide.count(), sal_False));
- // append horizontal lines
- maLinePolyPolygon.append(aNewPolyPoly);
- }
-
- //ImpCorrectLinePolygon(maLinePolyPolygon, aFrontSide.count());
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Identifier zurueckgeben
|*
\************************************************************************/
@@ -318,9 +139,6 @@ void E3dExtrudeObj::operator=(const SdrObject& rObj)
const E3dExtrudeObj& r3DObj = (const E3dExtrudeObj&)rObj;
maExtrudePolygon = r3DObj.maExtrudePolygon;
-
- // #95519# copy LinePolygon info, too
- maLinePolyPolygon = r3DObj.maLinePolyPolygon;
}
/*************************************************************************
@@ -334,7 +152,7 @@ void E3dExtrudeObj::SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew)
if(maExtrudePolygon != rNew)
{
maExtrudePolygon = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -382,22 +200,68 @@ BOOL E3dExtrudeObj::IsBreakObjPossible()
SdrAttrObj* E3dExtrudeObj::GetBreakObj()
{
- // create PathObj
- basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(GetBackSide(GetFrontSide()));
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+ basegfx::B3DPolyPolygon aFrontSide;
+ basegfx::B3DPolyPolygon aBackSide;
- if(pPathObj)
+ if(maExtrudePolygon.count())
{
- // Attribute setzen
- SfxItemSet aSet(GetObjectItemSet());
+ basegfx::B2DPolyPolygon aTemp(maExtrudePolygon);
+ aTemp.removeDoublePoints();
+ aTemp = basegfx::tools::correctOrientations(aTemp);
+ const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
+
+ if(basegfx::ORIENTATION_POSITIVE == aOrient)
+ {
+ aTemp.flip();
+ }
+
+ aFrontSide = basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aTemp);
+ }
+
+ if(aFrontSide.count())
+ {
+ aBackSide = aFrontSide;
- // Linien aktivieren, um Objekt garantiert sichtbar zu machen
- aSet.Put(XLineStyleItem(XLINE_SOLID));
+ if(GetExtrudeDepth())
+ {
+ basegfx::B3DHomMatrix aTransform;
+
+ if(100 != GetPercentBackScale())
+ {
+ // scale polygon from center
+ const double fScaleFactor(GetPercentBackScale() / 100.0);
+ const basegfx::B3DRange aPolyPolyRange(basegfx::tools::getRange(aBackSide));
+ const basegfx::B3DPoint aCenter(aPolyPolyRange.getCenter());
+
+ aTransform.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
+ aTransform.scale(fScaleFactor, fScaleFactor, fScaleFactor);
+ aTransform.translate(aCenter.getX(), aCenter.getY(), aCenter.getZ());
+ }
+
+ // translate by extrude depth
+ aTransform.translate(0.0, 0.0, (double)GetExtrudeDepth());
+
+ aBackSide.transform(aTransform);
+ }
+ }
+
+ if(aBackSide.count())
+ {
+ // create PathObj
+ basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide);
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+
+ if(pPathObj)
+ {
+ SfxItemSet aSet(GetObjectItemSet());
+ aSet.Put(XLineStyleItem(XLINE_SOLID));
+ pPathObj->SetMergedItemSet(aSet);
+ }
- pPathObj->SetMergedItemSet(aSet);
+ return pPathObj;
}
- return pPathObj;
+ return 0;
}
// eof
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index c4f007e5fb..02a0cf267b 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: float3d.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -236,7 +236,6 @@ __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
aCtlLightPreview ( this, SVX_RES( CTL_LIGHT_PREVIEW ) ),
- pLightGroup ( NULL ),
aImgLightOn ( SVX_RES( RID_SVXIMAGE_LIGHT_ON ) ),
aImgLightOff ( SVX_RES( RID_SVXIMAGE_LIGHT_OFF ) ),
@@ -400,9 +399,9 @@ __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
// Preview-Callback
aLink = LINK( this, Svx3DWin, ChangeLightCallbackHdl );
- aCtlLightPreview.SetUserInteractiveChangeCallback( aLink );
+ aCtlLightPreview.SetUserInteractiveChangeCallback(aLink);
aLink = LINK( this, Svx3DWin, ChangeSelectionCallbackHdl );
- aCtlLightPreview.SetUserSelectionChangeCallback( aLink );
+ aCtlLightPreview.SetUserSelectionChangeCallback(aLink);
aSize = GetOutputSizePixel();
SetMinOutputSizePixel( aSize );
@@ -433,8 +432,6 @@ __EXPORT Svx3DWin::~Svx3DWin()
delete pConvertTo3DItem;
delete pConvertTo3DLatheItem;
- delete pLightGroup;
-
if(mpRemember2DAttributes)
delete mpRemember2DAttributes;
@@ -447,10 +444,7 @@ void Svx3DWin::Construct()
aBtnGeo.Check();
Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
aLink.Call( &aBtnGeo );
-
aCtlLightPreview.Hide();
- pLightGroup = new B3dLightGroup();
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
}
// -----------------------------------------------------------------------
@@ -464,7 +458,7 @@ void Svx3DWin::Reset()
ClickUpdateHdl( NULL );
// Nichts selektieren, um Fehler beim erstselektieren zu vermeiden
- aCtlLightPreview.GetPreviewControl().SelectLight(Base3DLight0);
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(0);
}
bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const
@@ -640,7 +634,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
{
aNumHorizontal.SetValue( nValue );
// evtl. am Ende...
- aCtlLightPreview.GetPreviewControl().SetHorizontalSegments( (UINT16)nValue );
+ // aCtlLightPreview.GetSvx3DLightControl().SetHorizontalSegments( (UINT16)nValue );
bUpdate = TRUE;
}
else if( aNumHorizontal.IsEmptyFieldValue() )
@@ -667,8 +661,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
{
aNumVertical.SetValue( nValue );
// evtl. am Ende...
- aCtlLightPreview.GetPreviewControl().SetVerticalSegments( (UINT16)nValue );
- //aCtlPreview.SetVerticalSegments( (UINT16)nValue );
+ //aCtlLightPreview.GetSvx3DLightControl().SetVerticalSegments( (UINT16)nValue );
bUpdate = TRUE;
}
else if( aNumVertical.IsEmptyFieldValue() )
@@ -1006,8 +999,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
-
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight0 );
bUpdate = TRUE;
}
}
@@ -1028,7 +1019,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight1 )) )
{
SetUILightState( aBtnLight1, bOn );
- pLightGroup->Enable( bOn, Base3DLight0 );
bUpdate = TRUE;
}
if( aBtnLight1.GetState() == STATE_DONTKNOW )
@@ -1046,13 +1036,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight0 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight0 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 2 (Farbe)
@@ -1064,8 +1048,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
-
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight1 );
bUpdate = TRUE;
}
}
@@ -1086,7 +1068,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight2 )) )
{
SetUILightState( aBtnLight2, bOn );
- pLightGroup->Enable( bOn, Base3DLight1 );
bUpdate = TRUE;
}
if( aBtnLight2.GetState() == STATE_DONTKNOW )
@@ -1104,13 +1085,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight1 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight1 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 3 (Farbe)
@@ -1122,8 +1097,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight2 );
-
bUpdate = TRUE;
}
}
@@ -1144,7 +1117,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight3)) )
{
SetUILightState( aBtnLight3, bOn );
- pLightGroup->Enable( bOn, Base3DLight2 );
bUpdate = TRUE;
}
if( aBtnLight3.GetState() == STATE_DONTKNOW )
@@ -1162,13 +1134,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight2 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight2 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 4 (Farbe)
@@ -1180,8 +1146,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight3 );
-
bUpdate = TRUE;
}
}
@@ -1202,7 +1166,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight4 )) )
{
SetUILightState( aBtnLight4, bOn );
- pLightGroup->Enable( bOn, Base3DLight3 );
bUpdate = TRUE;
}
if( aBtnLight4.GetState() == STATE_DONTKNOW )
@@ -1220,13 +1183,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight3 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight3 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 5 (Farbe)
@@ -1238,8 +1195,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight4 );
-
bUpdate = TRUE;
}
}
@@ -1260,7 +1215,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight5 )) )
{
SetUILightState( aBtnLight5, bOn );
- pLightGroup->Enable( bOn, Base3DLight4 );
bUpdate = TRUE;
}
if( aBtnLight5.GetState() == STATE_DONTKNOW )
@@ -1278,13 +1232,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight4 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight4 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 6 (Farbe)
@@ -1296,8 +1244,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight5 );
-
bUpdate = TRUE;
}
}
@@ -1318,7 +1264,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight6 )) )
{
SetUILightState( aBtnLight6, bOn );
- pLightGroup->Enable( bOn, Base3DLight5 );
bUpdate = TRUE;
}
if( aBtnLight6.GetState() == STATE_DONTKNOW )
@@ -1336,13 +1281,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight5 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight5 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 7 (Farbe)
@@ -1354,8 +1293,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight6 );
-
bUpdate = TRUE;
}
}
@@ -1376,7 +1313,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight7 )) )
{
SetUILightState( aBtnLight7 , bOn );
- pLightGroup->Enable( bOn, Base3DLight6 );
bUpdate = TRUE;
}
if( aBtnLight7.GetState() == STATE_DONTKNOW )
@@ -1394,13 +1330,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight6 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight6 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 8 (Farbe)
@@ -1412,8 +1342,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight7 );
-
bUpdate = TRUE;
}
}
@@ -1434,7 +1362,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight8 )) )
{
SetUILightState( aBtnLight8, bOn );
- pLightGroup->Enable( bOn, Base3DLight7 );
bUpdate = TRUE;
}
if( aBtnLight8.GetState() == STATE_DONTKNOW )
@@ -1452,13 +1379,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight7 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight7 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Umgebungslicht
@@ -1470,8 +1391,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetGlobalAmbientLight( aColor );
-
bUpdate = TRUE;
}
}
@@ -1630,7 +1549,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialDiffuse );
ColorLB* pLb = &aLbMatColor;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1652,7 +1570,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const Svx3DMaterialEmissionItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialEmission );
ColorLB* pLb = &aLbMatEmission;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1674,7 +1591,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const Svx3DMaterialSpecularItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialSpecular );
ColorLB* pLb = &aLbMatSpecular;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1696,7 +1612,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
UINT16 nValue = ((const Svx3DMaterialSpecularIntensityItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetShininess( nValue );
if( nValue != aMtrMatSpecularIntensity.GetValue() )
{
aMtrMatSpecularIntensity.SetValue( nValue );
@@ -1749,8 +1664,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( bUpdate || bOnly3DChanged )
{
// Preview updaten
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
-
SfxItemSet aSet(rAttrs);
// set LineStyle hard to XLINE_NONE when it's not set so that
@@ -1764,6 +1677,32 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
aSet.Put(XFillColorItem(String(), Color(COL_WHITE)));
aCtlPreview.Set3DAttributes(aSet);
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aSet);
+
+ // try to select light corresponding to active button
+ sal_uInt32 nNumber(0xffffffff);
+
+ if(aBtnLight1.IsChecked())
+ nNumber = 0;
+ else if(aBtnLight2.IsChecked())
+ nNumber = 1;
+ else if(aBtnLight3.IsChecked())
+ nNumber = 2;
+ else if(aBtnLight4.IsChecked())
+ nNumber = 3;
+ else if(aBtnLight5.IsChecked())
+ nNumber = 4;
+ else if(aBtnLight6.IsChecked())
+ nNumber = 5;
+ else if(aBtnLight7.IsChecked())
+ nNumber = 6;
+ else if(aBtnLight8.IsChecked())
+ nNumber = 7;
+
+ if(nNumber != 0xffffffff)
+ {
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nNumber);
+ }
}
// handle state of converts possible
@@ -1774,9 +1713,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
// -----------------------------------------------------------------------
void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
{
- // 2D-Attribute und alle anderen holen
-// rAttrs.Put( aCtlPreview.Get3DAttributes() );
-
// get remembered 2d attributes from the dialog
if(mpRemember2DAttributes)
{
@@ -1974,6 +1910,8 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
Image aImg;
basegfx::B3DVector aVector;
Color aColor;
+ const SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+
// Licht 1 Farbe
if( aLbLight1.GetSelectEntryCount() )
{
@@ -1992,8 +1930,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 1 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight0 );
- rAttrs.Put(Svx3DLightDirection1Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
}
}
else
@@ -2018,8 +1955,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 2 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight1 );
- rAttrs.Put(Svx3DLightDirection2Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
}
}
else
@@ -2043,8 +1979,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 3 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight2 );
- rAttrs.Put(Svx3DLightDirection3Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
}
}
else
@@ -2068,8 +2003,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 4 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight3 );
- rAttrs.Put(Svx3DLightDirection4Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
}
}
else
@@ -2093,8 +2027,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 5 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight4 );
- rAttrs.Put(Svx3DLightDirection5Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
}
}
else
@@ -2118,8 +2051,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 6 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight5 );
- rAttrs.Put(Svx3DLightDirection6Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
}
}
else
@@ -2143,8 +2075,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 7 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight6 );
- rAttrs.Put(Svx3DLightDirection7Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
}
}
else
@@ -2168,8 +2099,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 8 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight7 );
- rAttrs.Put(Svx3DLightDirection8Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
}
}
else
@@ -2958,30 +2888,12 @@ IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
p == &aLbMatEmission ||
p == &aLbMatSpecular )
{
- aColor = ( ( (ColorLB*)p )->GetSelectEntryColor() );
-
- Base3DMaterialValue eType = Base3DMaterialDiffuse;
- //if( p == &aLbMatColor )
- if( p == &aLbMatEmission )
- eType = Base3DMaterialEmission;
- else if( p == &aLbMatSpecular )
- eType = Base3DMaterialSpecular;
-
- //aCtlPreview.SetMaterial( aColor, eType );
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, eType );
-
aLbMatFavorites.SelectEntryPos( 0 );
-
bUpdatePreview = TRUE;
}
// Beleuchtung
else if( p == &aLbAmbientlight )
{
- Color aColor2 = aLbAmbientlight.GetSelectEntryColor();
- pLightGroup->SetGlobalAmbientLight( aColor2 );
-
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- //aCtlPreview.SetLightGroup( pLightGroup );
bUpdatePreview = TRUE;
}
else if( p == &aLbLight1 ||
@@ -2993,17 +2905,6 @@ IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
p == &aLbLight7 ||
p == &aLbLight8 )
{
- Color aColor2 = ( (ColorLB*)p )->GetSelectEntryColor();
- USHORT nLightSource = GetLightSource();
-
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
-
- pLightGroup->SetIntensity( aColor2,
- Base3DMaterialDiffuse,
- (Base3DLightNumber) nLightSource );
-
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- //aCtlPreview.SetLightGroup( pLightGroup );
bUpdatePreview = TRUE;
}
else if( p == &aLbShademode )
@@ -3025,27 +2926,20 @@ IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField )
// Material
if( pField == &aMtrMatSpecularIntensity )
{
- UINT16 nValue = (UINT16) ( (MetricField*)pField )->GetValue();
- //aCtlPreview.SetShininess( nValue );
- aCtlLightPreview.GetPreviewControl().SetShininess( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aNumHorizontal )
{
- UINT16 nValue = (UINT16) ( (NumericField*)pField )->GetValue();
- aCtlLightPreview.GetPreviewControl().SetHorizontalSegments( nValue );
- //aCtlPreview.SetHorizontalSegments( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aNumVertical )
{
- UINT16 nValue = (UINT16) ( (NumericField*)pField )->GetValue();
- aCtlLightPreview.GetPreviewControl().SetVerticalSegments( nValue );
- //aCtlPreview.SetVerticalSegments( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aMtrSlant )
+ {
bUpdatePreview = TRUE;
+ }
if( bUpdatePreview == TRUE )
UpdatePreview();
@@ -3063,19 +2957,25 @@ IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn )
USHORT nLightSource = GetLightSource( pBtn );
ColorLB* pLb = GetLbByButton( pBtn );
Color aColor( pLb->GetSelectEntryColor() );
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
+ SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+ const bool bOnOff(GetUILightState( *(ImageButton*)pBtn ));
- pLightGroup->SetIntensity( aColor,
- Base3DMaterialDiffuse,
- (Base3DLightNumber) nLightSource );
-
- pLightGroup->Enable( GetUILightState( *(ImageButton*)pBtn ), (Base3DLightNumber) nLightSource );
+ switch(nLightSource)
+ {
+ case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break;
+ case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break;
+ case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break;
+ case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break;
+ case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break;
+ case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break;
+ case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break;
+ default:
+ case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break;
+ }
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- aCtlLightPreview.GetPreviewControl().SelectLight( (Base3DLightNumber) nLightSource );
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource);
aCtlLightPreview.CheckSelection();
-
- //aCtlPreview.SetLightGroup( pLightGroup );
}
return( 0L );
}
@@ -3099,9 +2999,6 @@ IMPL_LINK( Svx3DWin, DoubleClickHdl, void*, EMPTYARG )
IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
{
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
- //aCtlPreview.SetLightGroup( pLightGroup );
-
return( 0L );
}
@@ -3110,11 +3007,10 @@ IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
IMPL_LINK( Svx3DWin, ChangeSelectionCallbackHdl, void*, EMPTYARG )
{
- Base3DLightNumber eLight = aCtlLightPreview.GetPreviewControl().GetSelectedLight();
-
- PushButton* pBtn = NULL;
+ const sal_uInt32 nLight(aCtlLightPreview.GetSvx3DLightControl().GetSelectedLight());
+ PushButton* pBtn = 0;
- switch( eLight )
+ switch( nLight )
{
case 0: pBtn = &aBtnLight1; break;
case 1: pBtn = &aBtnLight2; break;
@@ -3233,6 +3129,7 @@ void Svx3DWin::UpdatePreview()
// Attribute holen und im Preview setzen
GetAttr( aSet );
aCtlPreview.Set3DAttributes( aSet );
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes( aSet );
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
new file mode 100644
index 0000000000..1067fbf776
--- /dev/null
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperhittest3d.cxx,v $
+ * $Revision: 1.1.2.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/scene3d.hxx>
+#include <svditer.hxx>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImplPairDephAndObject
+{
+private:
+ const E3dCompoundObject* mpObject;
+ double mfDepth;
+
+public:
+ ImplPairDephAndObject(const E3dCompoundObject* pObject, double fDepth)
+ : mpObject(pObject),
+ mfDepth(fDepth)
+ {}
+
+ // for ::std::sort
+ bool operator<(const ImplPairDephAndObject& rComp) const
+ {
+ return (mfDepth < rComp.mfDepth);
+ }
+
+ // data read access
+ const E3dCompoundObject* getObject() const { return mpObject; }
+ double getDepth() const { return mfDepth; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ class CutFindProcessor : public BaseProcessor3D
+ {
+ private:
+ // the start and stop point for the cut vector
+ basegfx::B3DPoint maFront;
+ basegfx::B3DPoint maBack;
+
+ // the found cut points
+ ::std::vector< basegfx::B3DPoint > mo_rResult;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ CutFindProcessor(const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack)
+ : BaseProcessor3D(rViewInformation),
+ maFront(rFront),
+ maBack(rBack),
+ mo_rResult()
+ {}
+
+ // data access
+ const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return mo_rResult; }
+ };
+
+ void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // remember old and transform front, back to object coordinates
+ const basegfx::B3DPoint aLastFront(maFront);
+ const basegfx::B3DPoint aLastBack(maBack);
+ basegfx::B3DHomMatrix aInverseTrans(rPrimitive.getTransformation());
+ aInverseTrans.invert();
+ maFront *= aInverseTrans;
+ maBack *= aInverseTrans;
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations and front, back
+ updateViewInformation(aLastViewInformation3D);
+ maFront = aLastFront;
+ maBack = aLastBack;
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D, not used for hit test with planes, ignore. This
+ // means that also thick line expansion will not be hit-tested as
+ // PolyPolygonMaterialPrimitive3D
+ break;
+ }
+ case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D :
+ {
+ // HitTestPrimitive3D, force usage due to we are doing a hit test and this
+ // primitive only gets generated on 3d objects without fill, exactly for this
+ // purpose
+ const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate);
+ process(rPrimitive.getChildren());
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+
+ if(!maFront.equal(maBack))
+ {
+ const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon();
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ if(nPolyCount)
+ {
+ const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(0));
+ const sal_uInt32 nPointCount(aPolygon.count());
+
+ if(nPointCount > 2)
+ {
+ const basegfx::B3DVector aPlaneNormal(aPolygon.getNormal());
+
+ if(!aPlaneNormal.equalZero())
+ {
+ const basegfx::B3DPoint aPointOnPlane(aPolygon.getB3DPoint(0));
+ double fCut(0.0);
+
+ if(basegfx::tools::getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, maFront, maBack, fCut))
+ {
+ const basegfx::B3DPoint aCutPoint(basegfx::interpolate(maFront, maBack, fCut));
+
+ if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false))
+ {
+ mo_rResult.push_back(aCutPoint);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
+ }
+ }
+ }
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+void getAllHit3DObjectWithRelativePoint(
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ const E3dCompoundObject& rObject,
+ const drawinglayer::geometry::ViewInformation3D& rObjectViewInformation3D,
+ ::std::vector< basegfx::B3DPoint >& o_rResult)
+{
+ o_rResult.clear();
+
+ if(!rFront.equal(rBack))
+ {
+ // rObject is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject)
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives(rVCObject.getViewIndependentPrimitive3DSequence());
+
+ if(aPrimitives.hasElements())
+ {
+ // make BoundVolume empty and overlapping test for speedup
+ const basegfx::B3DRange aObjectRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aPrimitives, rObjectViewInformation3D));
+
+ if(!aObjectRange.isEmpty())
+ {
+ const basegfx::B3DRange aFrontBackRange(rFront, rBack);
+
+ if(aObjectRange.overlaps(aFrontBackRange))
+ {
+ // bound volumes hit, geometric cut tests needed
+ drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack);
+ aCutFindProcessor.process(aPrimitives);
+ o_rResult = aCutFindProcessor.getCutPoints();
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3dScene* fillViewInformation3DForCompoundObject(drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D, const E3dCompoundObject& rCandidate)
+{
+ // Search for root scene (outmost scene) of the 3d object since e.g. in chart, multiple scenes may
+ // be placed between object and outmost scene. On that search, remember the in-between scene's
+ // transformation for the correct complete ObjectTransformation. For historical reasons, the
+ // root scene's own object transformation is part of the scene's ViewTransformation, o do not
+ // add it. For more details, see ViewContactOfE3dScene::createViewInformation3D.
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rCandidate.GetParentObj());
+ E3dScene* pRootScene = 0;
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+
+ while(pParentScene)
+ {
+ E3dScene* pParentParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+
+ if(pParentParentScene)
+ {
+ // pParentScene is a in-between scene
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ }
+ else
+ {
+ // pParentScene is the root scene
+ pRootScene = pParentScene;
+ }
+
+ pParentScene = pParentParentScene;
+ }
+
+ if(pRootScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+
+ if(aInBetweenSceneMatrix.isIdentity())
+ {
+ o_rViewInformation3D = rVCScene.getViewInformation3D();
+ }
+ else
+ {
+ // build new ViewInformation containing all transforms for the candidate
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+ }
+ }
+ else
+ {
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(aEmptyParameters);
+ }
+
+ return pRootScene;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult)
+{
+ o_rResult.clear();
+ SdrObjList* pList = rScene.GetSubList();
+
+ if(pList && pList->GetObjCount())
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rScene.GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ SdrObjListIter aIterator(*pList, IM_DEEPNOGROUPS);
+ ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+
+ while(aIterator.IsMore())
+ {
+ const E3dCompoundObject* pCandidate = dynamic_cast< const E3dCompoundObject* >(aIterator.Next());
+
+ if(pCandidate)
+ {
+ fillViewInformation3DForCompoundObject(aViewInfo3D, *pCandidate);
+
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject);
+
+ if(aHitsWithObject.size())
+ {
+ const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[0]);
+ aDepthAndObjectResults.push_back(ImplPairDephAndObject(pCandidate, aPointInViewCoordinates.getZ()));
+ }
+ }
+ }
+ }
+
+ // fill nRetval
+ const sal_uInt32 nCount(aDepthAndObjectResults.size());
+
+ if(nCount)
+ {
+ // sort aDepthAndObjectResults by depth
+ ::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
+
+ // copy SdrObject pointers to return result set
+ ::std::vector< ImplPairDephAndObject >::iterator aIterator2(aDepthAndObjectResults.begin());
+
+ for(;aIterator2 != aDepthAndObjectResults.end(); aIterator2++)
+ {
+ o_rResult.push_back(aIterator2->getObject());
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate)
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, rCandidate);
+
+ if(pRootScene)
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject);
+
+ if(aHitsWithObject.size())
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx
new file mode 100644
index 0000000000..9c31d2ef5e
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.cxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperminimaldepth3d.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <helperminimaldepth3d.hxx>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ class MinimalDephInViewExtractor : public BaseProcessor3D
+ {
+ private:
+ // the value which will be fetched as result
+ double mfMinimalDepth;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ MinimalDephInViewExtractor(const geometry::ViewInformation3D& rViewInformation)
+ : BaseProcessor3D(rViewInformation),
+ mfMinimalDepth(DBL_MAX)
+ {}
+
+ // data access
+ double getMinimalDepth() const { return mfMinimalDepth; }
+ };
+
+ void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation3D);
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D
+ const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rCandidate);
+ const basegfx::B3DPolygon& rPolygon = rPrimitive.getB3DPolygon();
+ const sal_uInt32 nCount(rPolygon.count());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * rPolygon.getB3DPoint(a));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+ const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon();
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(a));
+ const sal_uInt32 nCount(aPolygon.count());
+
+ for(sal_uInt32 b(0); b < nCount; b++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * aPolygon.getB3DPoint(b));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
+ }
+ }
+ }
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// changed to create values using VCs, Primitive3DSequence and ViewInformation3D to allow
+// removal of old 3D bucket geometry. There is one slight difference in the result, it's
+// in [0.0 .. 1.0] for Z-Depth since the scaling of the scene as 2D object is no longer
+// part of the 3D transformations. This could be added since the ViewContactOfE3dScene is
+// given, but is not needed since the permutation of the depth values needs only be correct
+// relative to each other
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject)
+{
+ // this is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject).
+ // Get primitive sequence using VC
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives = rVCObject.getViewIndependentPrimitive3DSequence();
+ double fRetval(DBL_MAX);
+
+ if(aPrimitives.hasElements())
+ {
+ const E3dScene* pScene = rObject.GetScene();
+
+ if(pScene)
+ {
+ // get ViewInformation3D from scene using VC
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // the scene's object transformation is already part of aViewInfo3D.getObjectTransformation()
+ // for historical reasons (see ViewContactOfE3dScene::createViewInformation3D for more info)
+ // and the object's transform is part of aPrimitives (and taken into account when decomposing
+ // to PolygonHairlinePrimitive3D and PolyPolygonMaterialPrimitive3D). The missing part may be
+ // some Scene SdrObjects lying in-between which may need to be added. This is e.g. used in chart,
+ // and generally allowed in 3d scenes an their 3d object hierarchy
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rObject.GetParentObj());
+
+ while(pParentScene && pParentScene != pScene)
+ {
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ pParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+ }
+
+ // build new ViewInformation containing all transforms
+ const drawinglayer::geometry::ViewInformation3D aNewViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+
+ // create extractor helper, proccess geometry and get return value
+ drawinglayer::processor3d::MinimalDephInViewExtractor aExtractor(aNewViewInformation3D);
+ aExtractor.process(aPrimitives);
+ fRetval = aExtractor.getMinimalDepth();
+ }
+ }
+
+ return fRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.hxx b/svx/source/engine3d/helperminimaldepth3d.hxx
new file mode 100644
index 0000000000..6e3ea4b581
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperminimaldepth3d.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+#define INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class E3dCompoundObject;
+class E3dScene;
+
+//////////////////////////////////////////////////////////////////////////////
+/** support extracting the minimal depth of a 3d object in it's scene
+
+ @param rObject
+ The 3D Object from which the minimal depth needs to be calculated. The scene
+ is defined by the object already
+
+ @return
+ The minimal depth of this object in unified ViewCoordinates. This is the
+ Z-Coordinate of one object point in the range of [0.0 .. 1.0]. ViewCoordinates
+ means the transformations (esp. rotation) of the scene are taken into account
+
+*/
+// support extracting the minimal depth of a 3d object in it's scene
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+// eof
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 4e78fcf17b..40acc800c4 100644
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: lathe3d.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -102,9 +102,6 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyP
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
}
-
- // Geometrie erzeugen
- CreateGeometry();
}
/*************************************************************************
@@ -132,310 +129,6 @@ void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dLatheObj::Get3DLineGeometry() const
-{
- return maLinePolyPolygon;
-}
-
-/*************************************************************************
-|*
-|* 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
-void E3dLatheObj::CreateGeometry()
-{
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- // #78972#
- maLinePolyPolygon.clear();
-
- if(maPolyPoly2D.count())
- {
- // Polygon erzeugen
- // Eventuelle Anpassung der Segmentanzahlen
- basegfx::B2DPolyPolygon aLathePoly2D(CreateLathePolyPoly(maPolyPoly2D, GetVerticalSegments()));
- aLathePoly2D = basegfx::tools::correctOrientations(aLathePoly2D);
- const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aLathePoly2D.getB2DPolygon(0L));
-
- if(basegfx::ORIENTATION_NEGATIVE == aOrient)
- {
- aLathePoly2D.flip();
- }
-
- // #i28528#
- basegfx::B3DPolyPolygon aFrontLines;
- basegfx::B3DPolyPolygon aBackLines;
- basegfx::B3DPolyPolygon aInBetweenLines;
- basegfx::B3DPolyPolygon aLathePoly3D(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aLathePoly2D));
-
- // Spezialfall Einzelnes Polygon erzeugen
- BOOL bSinglePoly = (GetEndAngle() == 0 || GetHorizontalSegments() == 0);
- if(bSinglePoly)
- {
- // nur ein Polygon erzeugen
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
-
- // Fuer evtl. selbst erzeugte Normalen
- basegfx::B3DPolyPolygon aNormalsFront(ImpCreateByPattern(aLathePoly3D));
-
- // Normalen und Vorderseite selbst erzeugen
- aNormalsFront = ImpAddFrontNormals(aNormalsFront, basegfx::B3DVector(0.0, 0.0, 1.0));
- ImpCreateFront(aLathePoly3D, aNormalsFront, GetCreateNormals(), GetCreateTexture());
-
- // #i28528#
- aInBetweenLines.append(aLathePoly3D);
- }
- else
- {
- // Eventuell doppelseitig erzeugen?
- if(!aLathePoly3D.isClosed())
- {
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
- }
-
- // Seiten genenrieren?
- BOOL bCreateSides = ((GetEndAngle() < 3600 && !GetDoubleSided()) || (GetBackScale() != 100));
-
- // Polygone vorbereiten
- basegfx::B3DPolyPolygon aPrev, aFront, aBack, aNext;
-
- // Rotation vorbereiten
- double fAng = DEG2RAD(double(GetEndAngle()) / 10);
- basegfx::B3DHomMatrix aRotMat;
-
- // Skalierung vorbereiten
- double fScalePerStep(1.0);
-
- if(GetBackScale() != 100)
- {
- fScalePerStep = (((double)GetBackScale() - 100.0) / 100.0) / (double)GetHorizontalSegments();
- }
-
- // Texturen erzeugen?
- double fTextureDepth(1.0);
- double fTextureStart(0.0);
-
- if(!GetCreateTexture())
- {
- fTextureStart = fTextureDepth = 0.0;
- }
-
- // aPrev bis aBack ausfuellen als Startvorbereitung
- aRotMat.rotate(0.0, -(fAng / (double)GetHorizontalSegments()), 0.0);
- aPrev = aLathePoly3D;
- aPrev.transform(aRotMat);
- if(GetBackScale() != 100)
- {
- // #i74056#
- aPrev = ImpScalePoly(aPrev, 1.0 - fScalePerStep);
- }
- aRotMat.identity();
- aRotMat.rotate(0.0, fAng / (double)GetHorizontalSegments(), 0.0);
- aFront = aLathePoly3D;
- aBack = aLathePoly3D;
- aBack.transform(aRotMat);
- if(GetBackScale() != 100)
- {
- // #i74056#
- aBack = ImpScalePoly(aBack, 1.0 + fScalePerStep);
- }
-
- // Werte fuer Textur-Zwischensegmenterzeugung berechnen
- double fTmpStart(0.0);
- double fTmpLength(fTextureDepth / (double)GetHorizontalSegments());
- sal_uInt16 nUpperBound((sal_uInt16)GetHorizontalSegments());
-
- for(UINT16 a=0;a<nUpperBound;a++)
- {
- // Naechstes Polygon vorbereiten
- aNext = aLathePoly3D;
-
- // Rotieren
- if(!(a+2 == nUpperBound && GetEndAngle() == 3600))
- {
- aRotMat.identity();
- aRotMat.rotate(0.0, (fAng * (double)(a+2))/ (double)nUpperBound, 0.0);
- aNext.transform(aRotMat);
- }
-
- // Skalieren
- if(GetBackScale() != 100)
- {
- // #i74056#
- aNext = ImpScalePoly(aNext, 1.0 + (fScalePerStep * (double)(a+2)));
- }
-
- // Jetzt Segment erzeugen
- ImpCreateSegment(
- aFront,
- aBack,
- &aPrev,
- &aNext,
- (a == 0) && bCreateSides && GetCloseFront(), // #107245# bLatheCloseFront,
- (a == nUpperBound-1) && bCreateSides && GetCloseBack(), // #107245# bLatheCloseBack,
- ((double)GetPercentDiagonal() / 200.0)
- * (double(nUpperBound) / 6.0),
- GetSmoothNormals(), // #107245# GetLatheSmoothed(),
- GetSmoothNormals(), // #107245# GetLatheSmoothed(),
- GetSmoothLids(), // #107245# GetLatheSmoothFrontBack(),
- 1.0,
- fTmpStart,
- fTmpLength,
- GetCreateTexture(),
- GetCreateNormals(),
- GetCharacterMode(), // #107245# GetLatheCharacterMode(),
- TRUE,
- // #78972#
- &aFrontLines,
- &aBackLines,
- &aInBetweenLines);
-
- // naechsten Schritt vorbereiten
- fTmpStart += fTmpLength;
- aPrev = aFront;
- aFront = aBack;
- aBack = aNext;
- }
- }
-
- // #78972#
- // Simply add them for preparing line geometry
- maLinePolyPolygon.append(aFrontLines);
- maLinePolyPolygon.append(aInBetweenLines);
- maLinePolyPolygon.append(aBackLines);
-
- // #i28528#
- sal_Bool bClosedLines((3600 == GetEndAngle()) && (100 == GetBackScale()));
- basegfx::B3DPolyPolygon aNewPolyPoly(ImpCompleteLinePolygon(maLinePolyPolygon, aLathePoly3D.count(), bClosedLines));
-
- if(GetReducedLineGeometry())
- {
- // replace vertical with horizontal lines
- maLinePolyPolygon = aNewPolyPoly;
-
- // append front lines
- maLinePolyPolygon.append(aFrontLines);
-
- // append back lines
- maLinePolyPolygon.append(aBackLines);
- }
- else
- {
- // append horizontal lines
- maLinePolyPolygon.append(aNewPolyPoly);
- }
-
- //ImpCorrectLinePolygon(maLinePolyPolygon, aLathePoly3D.count());
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-basegfx::B2DPolyPolygon E3dLatheObj::CreateLathePolyPoly(const basegfx::B2DPolyPolygon& rPolyPoly2D, sal_uInt32 nVSegs)
-{
- basegfx::B2DPolyPolygon aRetval(rPolyPoly2D);
- const sal_uInt32 nCnt(aRetval.count());
- const basegfx::B2DPolygon aFirstOriginal(aRetval.getB2DPolygon(0L));
- sal_uInt32 nOrigSegmentCnt(aFirstOriginal.count());
-
- if(nOrigSegmentCnt && !aFirstOriginal.isClosed())
- {
- nOrigSegmentCnt -= 1;
- }
-
- if(nVSegs && nVSegs != nOrigSegmentCnt)
- {
- // make sure minimum is not too small, 3 edges for closed
- // and 2 edges for open obects
- sal_uInt32 nMinVSegs(aFirstOriginal.isClosed() ? 3L : 2L);
-
- if(nVSegs <= nMinVSegs)
- {
- nVSegs = nMinVSegs;
- }
-
- if(nVSegs != nOrigSegmentCnt)
- {
- // Erstes Polygon anpassen
- aRetval.setB2DPolygon(0L, CreateLathePoly(aRetval.getB2DPolygon(0L), nVSegs));
- GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
-
- // andere Polygone im richtigen Verhaeltnis anpassen,
- // aber nur, wenn Wert fuer erstes angepasst werden musste
- for(sal_uInt32 i(1L); i < nCnt; i++ )
- {
- basegfx::B2DPolygon aPoly2D(aRetval.getB2DPolygon(i));
- sal_uInt32 nSegCnt(aPoly2D.count());
-
- if(nSegCnt && !aPoly2D.isClosed())
- {
- nSegCnt -= 1;
- }
-
- sal_uInt32 nNewVSegs((nSegCnt * nVSegs) / nOrigSegmentCnt);
-
- // make sure min is not too small for subpolys, too
- if(nNewVSegs <= nMinVSegs)
- {
- nNewVSegs = nMinVSegs;
- }
-
- if(nNewVSegs && nNewVSegs != nSegCnt)
- {
- aRetval.setB2DPolygon(i, CreateLathePoly(aPoly2D, nNewVSegs));
- }
- }
- }
- }
-
- return aRetval;
-}
-
-basegfx::B2DPolygon E3dLatheObj::CreateLathePoly(const basegfx::B2DPolygon& rPoly2D, sal_uInt32 nVSegs)
-{
- // attention: Here number of SEGMENTS is given, while GetExpandedPolygon()
- // takes number of points. Calc PntNum first
- sal_uInt32 nNumPts(rPoly2D.isClosed() ? nVSegs : nVSegs + 1L);
-
- if(nNumPts && rPoly2D.count() && nNumPts != rPoly2D.count())
- {
- // create a expanded or compresssed poly with exactly nNum Points
- basegfx::B2DPolygon aRetval;
- const double fLength(basegfx::tools::getLength(rPoly2D));
- const double fDivisor(rPoly2D.isClosed() ? ((double)nNumPts) : ((double)(nNumPts - 1L)));
-
- for(sal_uInt32 a(0L); a < nNumPts; a++)
- {
- const double fRelativePos((double)a / fDivisor); // 0.0 .. 1.0 for open, less for closed (without 1.0 e.g. last point)
- const basegfx::B2DPoint aNewPoint(basegfx::tools::getPositionRelative(rPoly2D, fRelativePos, fLength));
- aRetval.append(aNewPoint);
- }
-
- // copy closed flag
- aRetval.setClosed(rPoly2D.isClosed());
- return aRetval;
- }
-
- return rPoly2D;
-}
-
-/*************************************************************************
-|*
|* Identifier zurueckgeben
|*
\************************************************************************/
@@ -460,9 +153,6 @@ void E3dLatheObj::operator=(const SdrObject& rObj)
const E3dLatheObj& r3DObj = (const E3dLatheObj&)rObj;
maPolyPoly2D = r3DObj.maPolyPoly2D;
-
- // #95519# copy LinePolygon info, too
- maLinePolyPolygon = r3DObj.maLinePolyPolygon;
}
/*************************************************************************
@@ -490,7 +180,7 @@ void E3dLatheObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -520,7 +210,7 @@ void E3dLatheObj::SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew)
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
}
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/makefile.mk b/svx/source/engine3d/makefile.mk
index 18ed727628..4c03f949e9 100644
--- a/svx/source/engine3d/makefile.mk
+++ b/svx/source/engine3d/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.15 $
+# $Revision: 1.15.18.1 $
#
# This file is part of OpenOffice.org.
#
@@ -43,6 +43,9 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES= \
+ $(SLO)$/e3dsceneupdater.obj \
+ $(SLO)$/helperminimaldepth3d.obj \
+ $(SLO)$/helperhittest3d.obj \
$(SLO)$/obj3d.obj \
$(SLO)$/scene3d.obj \
$(SLO)$/polysc3d.obj \
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 3de91a701b..1e16058af6 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: obj3d.cxx,v $
- * $Revision: 1.48 $
+ * $Revision: 1.48.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,7 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-
#include "svdstr.hrc"
#include "svdglob.hxx"
#include <svx/svdview.hxx>
@@ -52,8 +51,6 @@
#include <svx/xflclit.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include <goodies/base3d.hxx>
-#include <goodies/b3dtex.hxx>
#include <svx/xlnclit.hxx>
#include <svtools/metitem.hxx>
#include <svx/xtable.hxx>
@@ -87,9 +84,20 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <svx/e3dsceneupdater.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
/*************************************************************************
|*
|* Liste fuer 3D-Objekte
@@ -131,34 +139,51 @@ void E3dObjList::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertRea
}
}
+void E3dObjList::InsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason)
+{
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "Insert 3DObject in non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
+
+ // call parent
+ SdrObjList::InsertObject(pObj, nPos, pReason);
+
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
+}
+
SdrObject* E3dObjList::NbcRemoveObject(ULONG nObjNum)
{
- // Owner holen
DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
- //E3dObject* pOwner = (E3dObject*)GetOwnerObj();
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
// call parent
SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
- // FitSnapRectToBoundVol vorbereiten
- if(GetOwnerObj() && GetOwnerObj()->ISA(E3dScene))
- ((E3dScene*)GetOwnerObj())->CorrectSceneDimensions();
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
return pRetval;
}
SdrObject* E3dObjList::RemoveObject(ULONG nObjNum)
{
- // Owner holen
- DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
- //E3dObject* pOwner = (E3dObject*)GetOwnerObj();
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "3DObject is removed from non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
// call parent
SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
- // FitSnapRectToBoundVol vorbereiten
- if(GetOwnerObj() && GetOwnerObj()->ISA(E3dScene))
- ((E3dScene*)GetOwnerObj())->CorrectSceneDimensions();
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
return pRetval;
}
@@ -180,16 +205,18 @@ sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties()
TYPEINIT1(E3dObject, SdrAttrObj);
-E3dObject::E3dObject() :
- bTfHasChanged(TRUE),
- bBoundVolValid(TRUE),
- bIsSelected(FALSE)
+E3dObject::E3dObject()
+: maSubList(),
+ maLocalBoundVol(),
+ maTransformation(),
+ maFullTransform(),
+ mbTfHasChanged(true),
+ mbIsSelected(false)
{
- bIs3DObj = TRUE;
- pSub = new E3dObjList(NULL, NULL);
- pSub->SetOwnerObj(this);
- pSub->SetListKind(SDROBJLIST_GROUPOBJ);
- bClosedObj = TRUE;
+ bIs3DObj = true;
+ maSubList.SetOwnerObj(this);
+ maSubList.SetListKind(SDROBJLIST_GROUPOBJ);
+ bClosedObj = true;
}
/*************************************************************************
@@ -200,8 +227,6 @@ E3dObject::E3dObject() :
E3dObject::~E3dObject()
{
- delete pSub;
- pSub = NULL;
}
/*************************************************************************
@@ -210,16 +235,21 @@ E3dObject::~E3dObject()
|*
\************************************************************************/
-void E3dObject::SetSelected(BOOL bNew)
+void E3dObject::SetSelected(bool bNew)
{
- // selbst setzen
- bIsSelected = bNew;
+ if((bool)mbIsSelected != bNew)
+ {
+ mbIsSelected = bNew;
+ }
- // bei SubObjekten setzen
- for ( ULONG i = 0; i < pSub->GetObjCount(); i++ )
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- if(pSub->GetObj(i) && pSub->GetObj(i)->ISA(E3dObject))
- ((E3dObject*)pSub->GetObj(i))->SetSelected(bNew);
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetSelected(bNew);
+ }
}
}
@@ -250,14 +280,13 @@ void E3dObject::SetRectsDirty(sal_Bool bNotMyself)
// call parent
SdrAttrObj::SetRectsDirty(bNotMyself);
- // Eigene SubListe AUCH behandeln
- if(pSub && pSub->GetObjCount())
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
{
- SdrObject* pObj = pSub->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
- ((E3dObject*)pObj)->SetRectsDirty(bNotMyself);
+ pCandidate->SetRectsDirty(bNotMyself);
}
}
}
@@ -320,7 +349,6 @@ void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
// Problem.
rInfo.bCanConvToPoly = FALSE;
rInfo.bCanConvToContour = FALSE;
-
rInfo.bCanConvToPathLineToArea = FALSE;
rInfo.bCanConvToPolyLineToArea = FALSE;
}
@@ -335,11 +363,15 @@ void E3dObject::NbcSetLayer(SdrLayerID nLayer)
{
SdrAttrObj::NbcSetLayer(nLayer);
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
- ULONG i;
- for ( i = 0; i < nObjCnt; i++ )
- pOL->GetObj(i)->NbcSetLayer(nLayer);
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->NbcSetLayer(nLayer);
+ }
+ }
}
/*************************************************************************
@@ -351,7 +383,7 @@ void E3dObject::NbcSetLayer(SdrLayerID nLayer)
void E3dObject::SetObjList(SdrObjList* pNewObjList)
{
SdrObject::SetObjList(pNewObjList);
- pSub->SetUpList(pNewObjList);
+ maSubList.SetUpList(pNewObjList);
}
/*************************************************************************
@@ -363,7 +395,7 @@ void E3dObject::SetObjList(SdrObjList* pNewObjList)
void E3dObject::SetPage(SdrPage* pNewPage)
{
SdrAttrObj::SetPage(pNewPage);
- pSub->SetPage(pNewPage);
+ maSubList.SetPage(pNewPage);
}
/*************************************************************************
@@ -375,7 +407,7 @@ void E3dObject::SetPage(SdrPage* pNewPage)
void E3dObject::SetModel(SdrModel* pNewModel)
{
SdrAttrObj::SetModel(pNewModel);
- pSub->SetModel(pNewModel);
+ maSubList.SetModel(pNewModel);
}
/*************************************************************************
@@ -391,35 +423,45 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
if(pScene)
{
- // pos ermitteln
- B3dTransformationSet& rTransSet = pScene->GetCameraSet();
- basegfx::B3DPoint aScaleCenter((double)rRef.X(), (double)rRef.Y(), 32768.0);
- aScaleCenter = rTransSet.ViewToEyeCoor(aScaleCenter);
+ // transform pos from 2D world to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
+
+ basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
// scale-faktoren holen
double fScaleX(xFact);
double fScaleY(yFact);
// build transform
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
basegfx::B3DHomMatrix mFullTransform(GetFullTransform());
basegfx::B3DHomMatrix mTrans(mFullTransform);
- mTrans *= rTransSet.GetOrientation();
- mTrans.translate(-aScaleCenter.getX(), -aScaleCenter.getY(), -aScaleCenter.getZ());
+ mTrans *= aViewInfo3D.getOrientation();
+ mTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
mTrans.scale(fScaleX, fScaleY, 1.0);
- mTrans.translate(aScaleCenter.getX(), aScaleCenter.getY(), aScaleCenter.getZ());
- mTrans *= rTransSet.GetInvOrientation();
+ mTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
+ mTrans *= aInverseOrientation;
mFullTransform.invert();
mTrans *= mFullTransform;
// anwenden
basegfx::B3DHomMatrix mObjTrans(GetTransform());
mObjTrans *= mTrans;
+
+ E3DModifySceneSnapRectUpdater aUpdater(this);
SetTransform(mObjTrans);
-
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pScene->CorrectSceneDimensions();
}
}
@@ -446,31 +488,33 @@ void E3dObject::NbcMove(const Size& rSize)
mInvDispTransform.invert();
}
- // BoundVolume von Weltkoordinaten in Eye-Koordinaten
- B3dTransformationSet& rTransSet = pScene->GetCameraSet();
- const Volume3D& rVol = pScene->GetBoundVolume();
- Volume3D aEyeVol = rVol.GetTransformVolume(rTransSet.GetOrientation());
+ // BoundVolume from 3d world to 3d eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
+ aEyeVol.transform(aViewInfo3D.getOrientation());
- // relativen Bewegungsvektor in Augkoordinaten bilden
+ // build relative movement vector in eye coordinates
basegfx::B3DPoint aMove(
(double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
(double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
0.0);
+ basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
+
+ // movement vektor to local coordinates of objects' parent
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(mInvDispTransform * aInverseOrientation);
- // Bewegungsvektor in lokale Koordinaten des Parents des Objektes
- basegfx::B3DPoint aPos;
- aMove = rTransSet.EyeToWorldCoor(aMove);
- aMove *= mInvDispTransform;
- aPos = rTransSet.EyeToWorldCoor(aPos);
- aPos *= mInvDispTransform;
- aMove = aMove - aPos;
+ aMove = aCompleteTrans * aMove;
+ aPos = aCompleteTrans * aPos;
- // Transformieren
- Translate(aMove);
+ // build transformation and apply
+ basegfx::B3DHomMatrix aTranslate;
+ aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pScene->CorrectSceneDimensions();
+ E3DModifySceneSnapRectUpdater aUpdater(pScene);
+ SetTransform(aTranslate * GetTransform());
}
}
@@ -482,55 +526,7 @@ void E3dObject::NbcMove(const Size& rSize)
SdrObjList* E3dObject::GetSubList() const
{
- return pSub;
-}
-
-/*************************************************************************
-|*
-|* Anzahl der Handles zurueckgeben
-|*
-\************************************************************************/
-
-sal_uInt32 E3dObject::GetHdlCount() const
-{
- // 8 Eckpunkte + 1 E3dVolumeMarker (= Wireframe-Darstellung)
- return 9L;
-}
-
-/*************************************************************************
-|*
-|* Handle-Liste fuellen
-|*
-\************************************************************************/
-
-void E3dObject::AddToHdlList(SdrHdlList& rHdlList) const
-{
- const basegfx::B2DPolyPolygon aPolyPoly(ImpCreateWireframePoly());
- const sal_uInt32 nPolyCount(aPolyPoly.count());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a += 3L)
- {
- const basegfx::B2DPolygon aPoly(aPolyPoly.getB2DPolygon(a));
- const basegfx::B2DPoint aPointA(aPoly.getB2DPoint(0L));
- const basegfx::B2DPoint aPointB(aPoly.getB2DPoint(1L));
- rHdlList.AddHdl(new SdrHdl(Point(FRound(aPointA.getX()), FRound(aPointA.getY())), HDL_BWGT));
- rHdlList.AddHdl(new SdrHdl(Point(FRound(aPointB.getX()), FRound(aPointB.getY())), HDL_BWGT));
- }
-
- if(nPolyCount)
- {
- E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPoly);
- rHdlList.AddHdl(pVolMarker);
- }
-}
-
-/*************************************************************************
-|*
-\************************************************************************/
-
-FASTBOOL E3dObject::HasSpecialDrag() const
-{
- return TRUE;
+ return &(const_cast< E3dObjList& >(maSubList));
}
/*************************************************************************
@@ -542,14 +538,14 @@ FASTBOOL E3dObject::HasSpecialDrag() const
void E3dObject::RecalcSnapRect()
{
maSnapRect = Rectangle();
- if(pSub && pSub->GetObjCount())
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
{
- SdrObject* pObj = pSub->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
- Rectangle aSubRect = ((E3dObject*)pObj)->GetSnapRect();
- maSnapRect.Union(aSubRect);
+ maSnapRect.Union(pCandidate->GetSnapRect());
}
}
}
@@ -576,16 +572,12 @@ void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
|*
\************************************************************************/
-void E3dObject::StructureChanged(const E3dObject* p3DObj)
+void E3dObject::StructureChanged()
{
if ( GetParentObj() )
{
- // Wenn sich im Child das BoundVolume geaendert hat, muessen
- // auch die der Parents angepasst werden
- if ( !p3DObj->bBoundVolValid )
- GetParentObj()->bBoundVolValid = FALSE;
-
- GetParentObj()->StructureChanged(p3DObj);
+ GetParentObj()->InvalidateBoundVolume();
+ GetParentObj()->StructureChanged();
}
}
@@ -599,11 +591,11 @@ void E3dObject::Insert3DObj(E3dObject* p3DObj)
{
DBG_ASSERT(p3DObj, "Insert3DObj mit NULL-Zeiger!");
SdrPage* pPg = pPage;
- pSub->InsertObject(p3DObj);
+ maSubList.InsertObject(p3DObj);
pPage = pPg;
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
NewObjectInserted(p3DObj);
- StructureChanged(this);
+ StructureChanged();
}
void E3dObject::Remove3DObj(E3dObject* p3DObj)
@@ -613,11 +605,11 @@ void E3dObject::Remove3DObj(E3dObject* p3DObj)
if(p3DObj->GetParentObj() == this)
{
SdrPage* pPg = pPage;
- pSub->RemoveObject(p3DObj->GetOrdNum());
+ maSubList.RemoveObject(p3DObj->GetOrdNum());
pPage = pPg;
- bBoundVolValid = FALSE;
- StructureChanged(this);
+ InvalidateBoundVolume();
+ StructureChanged();
}
}
@@ -657,53 +649,47 @@ E3dScene* E3dObject::GetScene() const
|*
\************************************************************************/
-void E3dObject::RecalcBoundVolume()
+basegfx::B3DRange E3dObject::RecalcBoundVolume() const
{
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
+ basegfx::B3DRange aRetval;
+ const sal_uInt32 nObjCnt(maSubList.GetObjCount());
if(nObjCnt)
{
- aBoundVol = Volume3D();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < nObjCnt; a++)
{
- SdrObject* pObj = pOL->GetObj(i);
-
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
- // Bei den Kindobjekten auch die lokalen Transformationen
- // beruecksichtigen
- E3dObject* p3DObj = (E3dObject*) pObj;
- const Volume3D& rVol = p3DObj->GetBoundVolume();
- const basegfx::B3DHomMatrix& rTf = p3DObj->GetTransform();
- aBoundVol.expand(rVol.GetTransformVolume(rTf));
- }
+ const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(maSubList.GetObj(a));
- aLocalBoundVol = aBoundVol;
+ if(p3DObject)
+ {
+ basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
+ aLocalRange.transform(p3DObject->GetTransform());
+ aRetval.expand(aLocalRange);
+ }
+ }
}
else
{
- // use local value
- aBoundVol = aLocalBoundVol;
+ // single 3D object
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
- // detect if lines are displayed
- const SfxItemSet& rSet = GetMergedItemSet();
- XLineStyle aLineStyle = ((const XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
-
- if(aLineStyle != XLINE_NONE)
+ if(pVCOfE3D)
{
- // expand BoundVolume with 1/2 line width
- sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ // BoundVolume is without 3D object transformation, use correct sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform());
- if(nLineWidth)
+ if(xLocalSequence.hasElements())
{
- double fExpand(nLineWidth / 2.0);
- aBoundVol.grow(fExpand);
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters);
+
+ aRetval = drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aLocalViewInformation3D);
}
}
}
- bBoundVolValid = TRUE;
+ return aRetval;
}
/*************************************************************************
@@ -712,25 +698,19 @@ void E3dObject::RecalcBoundVolume()
|*
\************************************************************************/
-const Volume3D& E3dObject::GetBoundVolume() const
+const basegfx::B3DRange& E3dObject::GetBoundVolume() const
{
- if ( !bBoundVolValid )
+ if(maLocalBoundVol.isEmpty())
{
- ((E3dObject*)this)->RecalcBoundVolume();
+ const_cast< E3dObject* >(this)->maLocalBoundVol = RecalcBoundVolume();
}
- return aBoundVol;
+ return maLocalBoundVol;
}
-/*************************************************************************
-|*
-|* Mittelpunkt liefern
-|*
-\************************************************************************/
-
-basegfx::B3DPoint E3dObject::GetCenter()
+void E3dObject::InvalidateBoundVolume()
{
- return GetBoundVolume().getCenter();
+ maLocalBoundVol.reset();
}
/*************************************************************************
@@ -741,17 +721,16 @@ basegfx::B3DPoint E3dObject::GetCenter()
void E3dObject::SetBoundVolInvalid()
{
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- SdrObject* pObj = pOL->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
- ((E3dObject*) pObj)->SetBoundVolInvalid();
+ if(pCandidate)
+ {
+ pCandidate->SetBoundVolInvalid();
+ }
}
}
@@ -763,40 +742,43 @@ void E3dObject::SetBoundVolInvalid()
void E3dObject::SetTransformChanged()
{
- bTfHasChanged = TRUE;
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
+ mbTfHasChanged = true;
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- SdrObject* pObj = pOL->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
- ((E3dObject*) pObj)->SetTransformChanged();
+ if(pCandidate)
+ {
+ pCandidate->SetTransformChanged();
+ }
}
}
/*************************************************************************
|*
|* hierarchische Transformation ueber alle Parents bestimmen, in
-|* aFullTfMatrix ablegen und diese zurueckgeben
+|* maFullTransform ablegen und diese zurueckgeben
|*
\************************************************************************/
const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
{
- if(bTfHasChanged)
+ if(mbTfHasChanged)
{
- E3dObject* pThis = (E3dObject*)this;
- pThis->aFullTfMatrix = aTfMatrix;
+ basegfx::B3DHomMatrix aNewFullTransformation(maTransformation);
+
if ( GetParentObj() )
- pThis->aFullTfMatrix *= GetParentObj()->GetFullTransform();
- pThis->bTfHasChanged = FALSE;
+ {
+ aNewFullTransformation = GetParentObj()->GetFullTransform() * aNewFullTransformation;
+ }
+
+ const_cast< E3dObject* >(this)->maFullTransform = aNewFullTransformation;
+ const_cast< E3dObject* >(this)->mbTfHasChanged = false;
}
- return aFullTfMatrix;
+ return maFullTransform;
}
/*************************************************************************
@@ -807,7 +789,7 @@ const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
{
- return aTfMatrix;
+ return maTransformation;
}
/*************************************************************************
@@ -818,22 +800,12 @@ const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
{
- aTfMatrix = rMatrix;
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Transformationsmatrix auf Einheitsmatrix zuruecksetzen
-|*
-\************************************************************************/
-
-void E3dObject::NbcResetTransform()
-{
- aTfMatrix.identity();
- SetTransformChanged();
- StructureChanged(this);
+ if(maTransformation != rMatrix)
+ {
+ maTransformation = rMatrix;
+ SetTransformChanged();
+ StructureChanged();
+ }
}
/*************************************************************************
@@ -844,245 +816,27 @@ void E3dObject::NbcResetTransform()
void E3dObject::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
{
- // #110094#-14 SendRepaintBroadcast();
- NbcSetTransform(rMatrix);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Transformationsmatrix zuruecksetzen mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::ResetTransform()
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcResetTransform();
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Translation
-|*
-\************************************************************************/
-
-void E3dObject::NbcTranslate(const basegfx::B3DVector& rTrans)
-{
- aTfMatrix.translate(rTrans.getX(), rTrans.getY(), rTrans.getZ());
- SetTransformChanged();
- StructureChanged(this);
-}
-/*************************************************************************
-|*
-|* Translation mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::Translate(const basegfx::B3DVector& rTrans)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcTranslate(rTrans);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Skalierungen
-|*
-\************************************************************************/
-
-void E3dObject::NbcScaleX(double fSx)
-{
- aTfMatrix.scale(fSx, 1.0, 1.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScaleY(double fSy)
-{
- aTfMatrix.scale(1.0, fSy, 1.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScaleZ(double fSz)
-{
- aTfMatrix.scale(1.0, 1.0, fSz);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScale(double fSx, double fSy, double fSz)
-{
- aTfMatrix.scale(fSx, fSy, fSz);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* gleichmaessige Skalierung
-|*
-\************************************************************************/
-
-void E3dObject::NbcScale(double fS)
-{
- aTfMatrix.scale(fS, fS, fS);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Skalierungen mit mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::ScaleX(double fSx)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleX(fSx);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::ScaleY(double fSy)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleY(fSy);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::ScaleZ(double fSz)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleZ(fSz);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::Scale(double fSx, double fSy, double fSz)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScale(fSx, fSy, fSz);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::Scale(double fS)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScale(fS);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Rotationen mit Winkel in Radiant
-|*
-\************************************************************************/
-
-void E3dObject::NbcRotateX(double fAng)
-{
- aTfMatrix.rotate(fAng, 0.0, 0.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcRotateY(double fAng)
-{
- aTfMatrix.rotate(0.0, fAng, 0.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcRotateZ(double fAng)
-{
- aTfMatrix.rotate(0.0, 0.0, fAng);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Rotationen mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::RotateX(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateX(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::RotateY(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateY(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::RotateZ(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateZ(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+ if(rMatrix != maTransformation)
+ {
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetTransform(rMatrix);
+ SetChanged();
+ BroadcastObjectChange();
+ if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+ }
}
/*************************************************************************
|*
|* Linien fuer die Wireframe-Darstellung des Objekts dem uebergebenen
-|* basegfx::B3DPolygon hinzufuegen. Als default wird das BoundVolume verwendet.
+|* basegfx::B3DPolygon hinzufuegen
|*
\************************************************************************/
-void E3dObject::CreateWireframe(basegfx::B3DPolygon& rWirePoly, const basegfx::B3DHomMatrix* pTf) const
+basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const
{
- GetBoundVolume().CreateWireframe(rWirePoly, pTf);
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
+ return basegfx::tools::createCubePolyPolygonFromB3DRange(aBoundVolume);
}
/*************************************************************************
@@ -1118,57 +872,6 @@ void E3dObject::TakeObjNamePlural(XubString& rName) const
/*************************************************************************
|*
-|* Wireframe-PolyPolygon erzeugen
-|*
-\************************************************************************/
-
-basegfx::B2DPolyPolygon E3dObject::ImpCreateWireframePoly() const
-{
- basegfx::B2DPolyPolygon aRetval;
- E3dScene* pScene = GetScene();
-
- if(pScene)
- {
- basegfx::B3DPolygon aPoly3D;
- CreateWireframe(aPoly3D, 0L);
- const sal_uInt32 nPntCnt(aPoly3D.count());
-
- if(nPntCnt)
- {
- const Volume3D aVolume(pScene->FitInSnapRect());
- pScene->GetCameraSet().SetDeviceVolume(aVolume, sal_False);
- pScene->GetCameraSet().SetObjectTrans(GetFullTransform());
-
- for(sal_uInt32 a(0L); a < nPntCnt;)
- {
- basegfx::B3DPoint aPointA(aPoly3D.getB3DPoint(a++));
- aPointA = pScene->GetCameraSet().ObjectToViewCoor(aPointA);
- basegfx::B3DPoint aPointB(aPoly3D.getB3DPoint(a++));
- aPointB = pScene->GetCameraSet().ObjectToViewCoor(aPointB);
- basegfx::B2DPolygon aTmpPoly;
- aTmpPoly.append(basegfx::B2DPoint(aPointA.getX(), aPointA.getY()));
- aTmpPoly.append(basegfx::B2DPoint(aPointB.getX(), aPointB.getY()));
- aRetval.append(aTmpPoly);
- }
- }
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Drag-Polygon zurueckgeben
-|*
-\************************************************************************/
-
-basegfx::B2DPolyPolygon E3dObject::TakeXorPoly(sal_Bool /*bDetail*/) const
-{
- return ImpCreateWireframePoly();
-}
-
-/*************************************************************************
-|*
|* Zuweisungsoperator
|*
\************************************************************************/
@@ -1180,74 +883,19 @@ void E3dObject::operator=(const SdrObject& rObj)
const E3dObject& r3DObj = (const E3dObject&) rObj;
if (r3DObj.GetSubList())
{
- // feststellen, ob alle SubObjekte selektiert oder
- // deselektiert sind
- BOOL bAllSelected = TRUE;
- BOOL bNoneSelected = TRUE;
- UINT32 nObjCnt = r3DObj.GetSubList()->GetObjCount();
-
- ULONG i;
- for (i = 0; i < nObjCnt; i++)
- {
- SdrObject* pObj = r3DObj.GetSubList()->GetObj(i);
- if(pObj && pObj->ISA(E3dObject))
- {
- E3dObject* p3DObj = (E3dObject*)pObj;
- if(p3DObj->GetSelected())
- bNoneSelected = FALSE;
- else
- bAllSelected = FALSE;
- }
- }
-
- if(bAllSelected || bNoneSelected)
- {
- // Normales verhalten
- pSub->CopyObjects(*r3DObj.GetSubList());
- }
- else
- {
- // Spezielle SubListe aufstellen, kopieren
- SdrObjList aOwnSubList(*r3DObj.GetSubList());
-
- // Alle nicht selektierten Objekte rausschmeissen
- for(i = 0;i < aOwnSubList.GetObjCount();i++)
- {
- SdrObject* pObj = aOwnSubList.GetObj(i);
- if(pObj && pObj->ISA(E3dObject))
- {
- E3dObject* p3DObj = (E3dObject*)pObj;
- if(!p3DObj->GetSelected())
- {
- aOwnSubList.NbcRemoveObject(pObj->GetOrdNum());
- i--;
- SdrObject::Free( pObj );
- }
- }
- }
-
- // jetzt diese Liste kopieren
- pSub->CopyObjects(aOwnSubList);
-
- // Hier noch ein FitSnapRect einleiten
- if(ISA(E3dScene))
- ((E3dScene&)r3DObj).FitSnapRectToBoundVol();
- }
+ maSubList.CopyObjects(*r3DObj.GetSubList());
}
// BoundVol kann uebernommen werden, da die Childs auch kopiert werden
- bBoundVolValid = r3DObj.bBoundVolValid;
- aBoundVol = r3DObj.aBoundVol;
- aLocalBoundVol = r3DObj.aLocalBoundVol;
-
- aTfMatrix = r3DObj.aTfMatrix;
+ maLocalBoundVol = r3DObj.maLocalBoundVol;
+ maTransformation = r3DObj.maTransformation;
// Da sich der Parent geaendert haben kann, Gesamttransformation beim
// naechsten Mal auf jeden Fall neu bestimmen
SetTransformChanged();
// Selektionsstatus kopieren
- bIsSelected = r3DObj.bIsSelected;
+ mbIsSelected = r3DObj.mbIsSelected;
}
/*************************************************************************
@@ -1273,8 +921,8 @@ void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
{
SdrAttrObj::SaveGeoData (rGeo);
- ((E3DObjGeoData &) rGeo).aLocalBoundVol = aLocalBoundVol;
- ((E3DObjGeoData &) rGeo).aTfMatrix = aTfMatrix;
+ ((E3DObjGeoData &) rGeo).maLocalBoundVol = maLocalBoundVol;
+ ((E3DObjGeoData &) rGeo).maTransformation = maTransformation;
}
/*************************************************************************
@@ -1285,11 +933,10 @@ void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
{
- aLocalBoundVol = ((E3DObjGeoData &) rGeo).aLocalBoundVol;
- NbcSetTransform (((E3DObjGeoData &) rGeo).aTfMatrix);
-
+ maLocalBoundVol = ((E3DObjGeoData &) rGeo).maLocalBoundVol;
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ NbcSetTransform(((E3DObjGeoData &) rGeo).maTransformation);
SdrAttrObj::RestGeoData (rGeo);
- GetScene()->FitSnapRectToBoundVol();
}
/*************************************************************************
@@ -1304,14 +951,18 @@ void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
void E3dObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
{
- // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
- // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
- // dafuer gibt es den
+ // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
+ // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
+ // dafuer gibt es den
SetGlueReallyAbsolute(TRUE);
// SendRepaintBroadcast();
double fWinkelInRad = nWink/100 * F_PI180;
- NbcRotateZ(fWinkelInRad);
+
+ basegfx::B3DHomMatrix aRotateZ;
+ aRotateZ.rotate(0.0, 0.0, fWinkelInRad);
+ NbcSetTransform(aRotateZ * GetTransform());
+
SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
// zum Urpsung des Blattes
@@ -1337,22 +988,25 @@ TYPEINIT1(E3dCompoundObject, E3dObject);
|*
\************************************************************************/
-E3dCompoundObject::E3dCompoundObject() : E3dObject()
+E3dCompoundObject::E3dCompoundObject()
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
{
// Defaults setzen
E3dDefaultAttributes aDefault;
SetDefaultAttributes(aDefault);
-
- bGeometryValid = FALSE;
- bFullTfIsPositive = TRUE;
}
-E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault) : E3dObject()
+E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault)
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
{
// Defaults setzen
SetDefaultAttributes(rDefault);
-
- bGeometryValid = FALSE;
}
void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
@@ -1360,10 +1014,8 @@ void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
// Defaults setzen
aMaterialAmbientColor = rDefault.GetDefaultAmbientColor();
- aBackMaterial = rDefault.GetDefaultBackMaterial();
bCreateNormals = rDefault.GetDefaultCreateNormals();
bCreateTexture = rDefault.GetDefaultCreateTexture();
- bUseDifferentBackMaterial = rDefault.GetDefaultUseDifferentBackMaterial();
}
/*************************************************************************
@@ -1378,879 +1030,165 @@ E3dCompoundObject::~E3dCompoundObject ()
/*************************************************************************
|*
-|* Start der Geometrieerzeugung ankuendigen
-|*
-\************************************************************************/
-
-void E3dCompoundObject::StartCreateGeometry()
-{
- // Geometriestart mitteilen
- aDisplayGeometry.StartDescription();
-
- // Lokales Volumen reset
- aLocalBoundVol = Volume3D();
-
- // Geometrie ist ab jetzt gueltig, um ein rekursives weiteres
- // Erzeugen zu verhindern
- bGeometryValid = TRUE;
-}
-
-/*************************************************************************
-|*
-|* Identifier zurueckgeben
+|* Drag-Polygon zurueckgeben
|*
\************************************************************************/
-UINT16 E3dCompoundObject::GetObjIdentifier() const
+basegfx::B2DPolyPolygon E3dCompoundObject::TakeXorPoly() const
{
- return E3D_COMPOUNDOBJ_ID;
-}
-
-/*************************************************************************
-|*
-|* SnapRect berechnen
-|*
-\************************************************************************/
+ basegfx::B2DPolyPolygon aRetval;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
-void E3dCompoundObject::RecalcSnapRect()
-{
- E3dScene* pScene = GetScene();
- if(pScene)
+ if(pRootScene)
{
- // Objekttransformation uebernehmen
- const Volume3D& rBoundVol = GetBoundVolume();
- maSnapRect = Rectangle();
-
- if(!rBoundVol.isEmpty())
- {
- const basegfx::B3DHomMatrix& rTrans = GetFullTransform();
- Vol3DPointIterator aIter(rBoundVol, &rTrans);
- basegfx::B3DPoint aTfVec;
- while ( aIter.Next(aTfVec) )
- {
- aTfVec = pScene->GetCameraSet().WorldToViewCoor(aTfVec);
- Point aPoint((long)(aTfVec.getX() + 0.5), (long)(aTfVec.getY() + 0.5));
- maSnapRect.Union(Rectangle(aPoint, aPoint));
- }
- }
- bSnapRectDirty = FALSE;
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
+ aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
+ aViewInfo3D.getObjectToView() * GetTransform());
+ aRetval.transform(rVCScene.getObjectTransformation());
}
+
+ return aRetval;
}
/*************************************************************************
|*
-|* BoundVolume holen. Falls die Geometrie ungueltig ist, diese neu
-|* erzeugen und das BoundVol neu berechnen
+|* Anzahl der Handles zurueckgeben
|*
\************************************************************************/
-const Volume3D& E3dCompoundObject::GetBoundVolume() const
+sal_uInt32 E3dCompoundObject::GetHdlCount() const
{
- // Geometrie aktuell?
- if(!bGeometryValid)
- {
- // Neu erzeugen und eine Neubestimmung des BoundVol erzwingen
- E3dCompoundObject* pThis = (E3dCompoundObject*)this;
- pThis->ReCreateGeometry();
- pThis->bBoundVolValid = FALSE;
- }
-
- // call parent
- return E3dObject::GetBoundVolume();
+ // 8 Eckpunkte + 1 E3dVolumeMarker (= Wireframe-Darstellung)
+ return 9L;
}
/*************************************************************************
|*
-|* Give out simple line geometry
+|* Handle-Liste fuellen
|*
\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::Get3DLineGeometry() const
+void E3dCompoundObject::AddToHdlList(SdrHdlList& rHdlList) const
{
- basegfx::B3DPolyPolygon aRetval;
- const B3dEntityBucket& rEntityBucket = GetDisplayGeometry().GetEntityBucket();
- const GeometryIndexValueBucket& rIndexBucket = GetDisplayGeometry().GetIndexBucket();
- sal_uInt32 nPolyCounter(0L);
- sal_uInt32 nEntityCounter(0L);
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
- while(nPolyCounter < rIndexBucket.Count())
+ if(pRootScene)
{
- // next primitive
- sal_uInt32 nUpperBound(rIndexBucket[nPolyCounter++].GetIndex());
- basegfx::B3DPoint aLastPoint;
- sal_Bool bLastLineVisible(rEntityBucket[nUpperBound - 1].IsEdgeVisible());
-
- if(bLastLineVisible)
- {
- aLastPoint = rEntityBucket[nUpperBound - 1].Point();
- }
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
- while(nEntityCounter < nUpperBound)
+ if(!aBoundVolume.isEmpty())
{
- basegfx::B3DPoint aNewPoint(rEntityBucket[nEntityCounter].Point());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
- if(bLastLineVisible)
+ for(sal_uInt32 a(0); a < 8; a++)
{
- if(aLastPoint != aNewPoint)
+ basegfx::B3DPoint aPos3D;
+
+ switch(a)
{
- // fill polygon
- basegfx::B3DPolygon aNewPoly;
- aNewPoly.append(aLastPoint);
- aNewPoly.append(aNewPoint);
-
- // create line geometry for polygon in eye coor to
- // have it always orthogonal to camera plane
- aRetval.append(aNewPoly);
+ case 0 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 1 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 2 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 3 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 4 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 5 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 6 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 7 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
}
- }
- bLastLineVisible = rEntityBucket[nEntityCounter++].IsEdgeVisible();
- aLastPoint = aNewPoint;
- }
- }
-
- return aRetval;
-}
+ // to 3d view coor
+ aPos3D *= aViewInfo3D.getObjectToView() * GetTransform();
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dCompoundObject::DestroyGeometry()
-{
- // Alle Objekte in der Sub-Liste zerstoeren. Dies sind die
- // zur Visualisierung des Objektes verwendeten Hilfsobjekte
- pSub->Clear();
- delete pSub;
- pSub = new E3dObjList(NULL, NULL);
- pSub->SetOwnerObj(this);
- pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+ // create 2d relative scene
+ basegfx::B2DPoint aPos2D(aPos3D.getX(), aPos3D.getY());
- // Neue Geometrie zerstoeren
- aDisplayGeometry.Erase();
+ // to 2d world coor
+ aPos2D *= rVCScene.getObjectTransformation();
- // BoundVols resetten
- aLocalBoundVol = Volume3D();
- bBoundVolValid = FALSE;
- StructureChanged(this);
-
- // Geometrie ist ungueltig
- bGeometryValid = FALSE;
-}
-
-void E3dCompoundObject::CreateGeometry()
-{
- // Geometrie ist gueltig, um rekursion zu verhindern
- bGeometryValid = TRUE;
-
- // Eventuell entstandene Geometrie noch korrigieren
- // und Default -Normalen oder -Texturkoordinaten erzeugen
- if(bCreateNormals)
- {
- if(GetNormalsKind() > 1)
- aDisplayGeometry.CreateDefaultNormalsSphere();
- if(GetNormalsInvert())
- aDisplayGeometry.InvertNormals();
+ rHdlList.AddHdl(new SdrHdl(Point(basegfx::fround(aPos2D.getX()), basegfx::fround(aPos2D.getY())), HDL_BWGT));
+ }
+ }
}
- if(bCreateTexture)
+ const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
+
+ if(aPolyPolygon.count())
{
- aDisplayGeometry.CreateDefaultTexture(
- ((GetTextureProjectionX() > 0) ? B3D_CREATE_DEFAULT_X : FALSE)
- |((GetTextureProjectionY() > 0) ? B3D_CREATE_DEFAULT_Y : FALSE),
- GetTextureProjectionX() > 1);
+ E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPolygon);
+ rHdlList.AddHdl(pVolMarker);
}
-
- // Das Ende der Geometrieerzeugung anzeigen
- aDisplayGeometry.EndDescription();
-}
-
-void E3dCompoundObject::ReCreateGeometry()
-{
- // Geometrie zerstoeren
- DestroyGeometry();
-
- // ... und neu erzeugen
- CreateGeometry();
}
/*************************************************************************
|*
-|* Geometrieerzeugung
-|*
\************************************************************************/
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- BOOL bHintIsComplex, BOOL bOutline)
-{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++)
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
-}
-
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- BOOL bHintIsComplex, BOOL bOutline)
-{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++ )
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormal3D(rPolyPolygonNormal.getB3DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b), aNormal3D.getB3DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
-}
-
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- const basegfx::B2DPolyPolygon& rPolyPolygonTexture,
- BOOL bHintIsComplex, BOOL bOutline)
+FASTBOOL E3dCompoundObject::HasSpecialDrag() const
{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++ )
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormal3D(rPolyPolygonNormal.getB3DPolygon(a));
- const basegfx::B2DPolygon aTexture2D(rPolyPolygonTexture.getB2DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b), aNormal3D.getB3DPoint(b), aTexture2D.getB2DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
+ return TRUE;
}
/*************************************************************************
|*
-|* Hilfsfunktionen zur Geometrieerzeugung
+|* Identifier zurueckgeben
|*
\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpGrowPoly(
- const basegfx::B3DPolyPolygon& rPolyPolyGrow,
- const basegfx::B3DPolyPolygon& rPolyPolyNormals,
- double fFactor)
-{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCount(rPolyPolyGrow.count());
- const bool bClosed(rPolyPolyGrow.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- const basegfx::B3DPolygon aPolyGrow(rPolyPolyGrow.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormals(rPolyPolyNormals.getB3DPolygon(a));
- const sal_uInt32 nPointCount(aPolyGrow.count());
- basegfx::B3DPolygon aNewPolyGrow;
-
- for(sal_uInt32 b(0L); b < nPointCount; b++)
- {
- aNewPolyGrow.append(aPolyGrow.getB3DPoint(b) + (aPolyNormals.getB3DPoint(b) * fFactor));
- }
-
- aNewPolyGrow.setClosed(bClosed);
- aRetval.append(aNewPolyGrow);
- }
-
- return aRetval;
-}
-
-basegfx::B2VectorOrientation E3dCompoundObject::ImpGetOrientationInPoint(
- const basegfx::B3DPolygon& rPolygon,
- sal_uInt32 nIndex)
-{
- sal_uInt32 nPntCnt(rPolygon.count());
- basegfx::B2VectorOrientation eRetval(basegfx::ORIENTATION_NEUTRAL);
-
- if(nIndex < nPntCnt)
- {
- const basegfx::B3DPoint aMid(rPolygon.getB3DPoint(nIndex));
- const basegfx::B3DPoint aPre(rPolygon.getB3DPoint((nIndex == 0L) ? nPntCnt - 1L : nIndex - 1L));
- const basegfx::B3DPoint aPos(rPolygon.getB3DPoint((nIndex == nPntCnt - 1L) ? 0L : nIndex + 1L));
- const basegfx::B3DVector aVecA(aPre - aMid);
- const basegfx::B3DVector aVecB(aPos - aMid);
- const basegfx::B3DVector aNormal(aVecA.getPerpendicular(aVecB));
-
- if(aNormal.getZ() > 0.0)
- {
- eRetval = basegfx::ORIENTATION_POSITIVE;
- }
- else if(aNormal.getZ() < 0.0)
- {
- eRetval = basegfx::ORIENTATION_NEGATIVE;
- }
- }
-
- return eRetval;
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpCorrectGrownPoly(
- const basegfx::B3DPolyPolygon& aToBeCorrected,
- const basegfx::B3DPolyPolygon& aOriginal)
-{
- const sal_uInt32 aOriginalCount(aOriginal.count());
- const sal_uInt32 aToBeCorrectedCount(aToBeCorrected.count());
- const bool bClosed(aToBeCorrected.isClosed());
-
- if(aOriginalCount == aToBeCorrectedCount)
- {
- basegfx::B3DPolyPolygon aRetval;
-
- for(sal_uInt32 a(0L); a < aToBeCorrectedCount; a++)
- {
- const basegfx::B3DPolygon aCorr(aToBeCorrected.getB3DPolygon(a));
- const basegfx::B3DPolygon aOrig(aOriginal.getB3DPolygon(a));
- const sal_uInt32 aOrigCount(aOrig.count());
- const sal_uInt32 aCorrCount(aCorr.count());
-
- if(aOrigCount == aCorrCount && aOrigCount > 2L)
- {
- sal_uInt32 nNumDiff(0L);
- sal_uInt32 nDoneStart(0xffffffff);
-
- // Testen auf Anzahl Aenderungen
- sal_uInt32 b;
-
- for(b = 0L; b < aOrigCount; b++)
- {
- const basegfx::B2VectorOrientation eOrig(ImpGetOrientationInPoint(aOrig, b));
- const basegfx::B2VectorOrientation eCorr(ImpGetOrientationInPoint(aCorr, b));
-
- if(eOrig != eCorr)
- {
- nNumDiff++;
- }
- else
- {
- if(nDoneStart == 0xffffffff)
- {
- // eventuellen Startpunkt auf gleiche Orientierung legen
- nDoneStart = b;
- }
- }
- }
-
- if(nNumDiff == aOrigCount)
- {
- // Komplett umgedreht, alles auf einen Punkt
- const basegfx::B3DRange aCorrRange = basegfx::tools::getRange(aCorr);
- basegfx::B3DPolygon aNew;
-
- aNew.append(aCorrRange.getCenter(), aCorrCount);
- aRetval.append(aNew);
- }
- else if(nNumDiff)
- {
- // es gibt welche, nDoneStart ist gesetzt. Erzeuge (und
- // setze) nDoneEnd
- sal_uInt32 nDoneEnd(nDoneStart);
- sal_uInt32 nStartLoop(0L);
- BOOL bInLoop(FALSE);
- basegfx::B3DPolygon aNew(aCorr);
-
- // einen step mehr in der Schleife, um Loops abzuschliessen
- BOOL bFirstStep(TRUE);
-
- while(nDoneEnd != nDoneStart || bFirstStep)
- {
- bFirstStep = FALSE;
-
- // nCandidate ist Kandidat fuer Test
- const sal_uInt32 nCandidate((nDoneEnd == aOrigCount - 1L) ? 0L : nDoneEnd + 1L);
- const basegfx::B2VectorOrientation eOrig(ImpGetOrientationInPoint(aOrig, nCandidate));
- const basegfx::B2VectorOrientation eCorr(ImpGetOrientationInPoint(aCorr, nCandidate));
-
- if(eOrig == eCorr)
- {
- // Orientierung ist gleich
- if(bInLoop)
- {
- // Punkte innerhalb bInLoop auf ihr Zentrum setzen
- basegfx::B3DPoint aMiddle;
- sal_uInt32 nCounter(0L);
- sal_uInt32 nStart(nStartLoop);
-
- while(nStart != nCandidate)
- {
- aMiddle += aCorr.getB3DPoint(nStart);
- nCounter++;
- nStart = (nStart == aOrigCount - 1L) ? 0L : nStart + 1L;
- }
-
- // Mittelwert bilden
- aMiddle /= (double)nCounter;
-
- // Punkte umsetzen
- nStart = nStartLoop;
- while(nStart != nCandidate)
- {
- aNew.setB3DPoint(nStart, aMiddle);
- nStart = (nStart == aOrigCount - 1L) ? 0L : nStart + 1L;
- }
-
- // Loop beenden
- bInLoop = FALSE;
- }
- }
- else
- {
- // Orientierung unterschiedlich
- if(!bInLoop)
- {
- // Start eines Loop mit geaenderter Orientierung
- nStartLoop = nCandidate;
- bInLoop = TRUE;
- }
- }
-
- // Weitergehen
- nDoneEnd = nCandidate;
- }
-
- aRetval.append(aNew);
- }
- else
- {
- // no change, append original
- aRetval.append(aCorr);
- }
- }
- else
- {
- // less than 2 -> no change, append original
- aRetval.append(aCorr);
- }
- }
-
- aRetval.setClosed(bClosed);
- return aRetval;
- }
- else
- {
- return aToBeCorrected;
- }
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpScalePoly(
- const basegfx::B3DPolyPolygon& rPolyPolyScale,
- double fFactor)
-{
- basegfx::B3DPolyPolygon aRetval(rPolyPolyScale);
- const basegfx::B3DRange aPolyPolyRange(basegfx::tools::getRange(rPolyPolyScale));
- const basegfx::B3DPoint aCenter(aPolyPolyRange.getCenter());
- basegfx::B3DHomMatrix aTransform;
-
- aTransform.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
- aTransform.scale(fFactor, fFactor, fFactor);
- aTransform.translate(aCenter.getX(), aCenter.getY(), aCenter.getZ());
- aRetval.transform(aTransform);
-
- return aRetval;
-}
-
-void E3dCompoundObject::ImpCreateFront(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- BOOL bDoCreateNormals,
- BOOL bDoCreateTexture)
-{
- // Vorderseite
- if(bDoCreateNormals)
- {
- if(bDoCreateTexture)
- {
- // create default texture polygon
- const basegfx::B3DRange aRange(basegfx::tools::getRange(rPolyPoly3D));
- const double fScaleX(0.0 == aRange.getWidth() ? 1.0 : 1.0 / aRange.getWidth());
- const double fScaleY(0.0 == aRange.getHeight() ? 1.0 : 1.0 / aRange.getHeight());
- const double fScaleZ(0.0 == aRange.getDepth() ? 1.0 : 1.0 / aRange.getDepth());
- basegfx::B3DHomMatrix aTrans3DTo2D;
-
- aTrans3DTo2D.translate(-aRange.getMinX(), -aRange.getMinY(), -aRange.getMinZ());
- aTrans3DTo2D.scale(fScaleX, -fScaleY, fScaleZ);
- aTrans3DTo2D.translate(0.0, 1.0, 0.0);
- basegfx::B2DPolyPolygon aPolyTexture(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPolyPoly3D, aTrans3DTo2D));
-
- AddGeometry(rPolyPoly3D, rFrontNormals, aPolyTexture, TRUE);
- }
- else
- {
- AddGeometry(rPolyPoly3D, rFrontNormals, TRUE);
- }
- }
- else
- {
- AddGeometry(rPolyPoly3D, TRUE);
- }
-}
-
-void E3dCompoundObject::ImpCreateBack(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bDoCreateNormals,
- BOOL bDoCreateTexture)
-{
- // flip polys
- basegfx::B3DPolyPolygon aPolyPoly3D(rPolyPoly3D);
- basegfx::B3DPolyPolygon aBackNormals(rBackNormals);
- aPolyPoly3D.flip();
- aBackNormals.flip();
-
- // use ImpCreateFront with flipped polys
- ImpCreateFront(aPolyPoly3D, aBackNormals, bDoCreateNormals, bDoCreateTexture);
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpCreateByPattern(const basegfx::B3DPolyPolygon& rPattern)
-{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCount(rPattern.count());
- const bool bClosed(rPattern.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- basegfx::B3DPolygon aNew;
- aNew.append(basegfx::B3DPoint(), rPattern.getB3DPolygon(a).count());
- aNew.setClosed(bClosed);
- aRetval.append(aNew);
- }
-
- return aRetval;
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddFrontNormals(
- const basegfx::B3DPolyPolygon& rNormalsFront,
- const basegfx::B3DPoint& rOffset)
+UINT16 E3dCompoundObject::GetObjIdentifier() const
{
- basegfx::B3DPoint aBackOffset(-rOffset);
- return ImpAddBackNormals(rNormalsFront, aBackOffset);
+ return E3D_COMPOUNDOBJ_ID;
}
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddBackNormals(
- const basegfx::B3DPolyPolygon& rNormalsBack,
- const basegfx::B3DPoint& rOffset)
-{
- basegfx::B3DPolyPolygon aRetval;
- basegfx::B3DVector aOffset(rOffset);
- aOffset.normalize();
- basegfx::B3DPoint aValue(aOffset);
- const sal_uInt32 nPolyCount(rNormalsBack.count());
- const bool bClosed(rNormalsBack.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- const basegfx::B3DPolygon aPoly(rNormalsBack.getB3DPolygon(a));
- const sal_uInt32 nPointCount(aPoly.count());
- basegfx::B3DPolygon aNew;
-
- for(sal_uInt32 b(0L); b < nPointCount; b++)
- {
- aNew.append(aPoly.getB3DPoint(b) + aValue);
- }
-
- aNew.setClosed(bClosed);
- aRetval.append(aNew);
- }
-
- return aRetval;
-}
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddInBetweenNormals(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rPolyPolyNormals,
- BOOL bSmoothed)
+void E3dCompoundObject::RecalcSnapRect()
{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCnt(rPolyPolyFront.count());
- const bool bClosed(rPolyPolyFront.isClosed());
-
- // Verbindungsstuecke
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
- {
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormalPoly(rPolyPolyNormals.getB3DPolygon(a));
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
-
- if(aPoly3DBack.isClosed())
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(nPntCnt - 1L) - aPoly3DFront.getB3DPoint(nPntCnt - 1L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(0L) - aPoly3DFront.getB3DPoint(nPntCnt - 1L));
- basegfx::B3DVector aNormal(aVecA.getPerpendicular(aVecB));
- aNormal.normalize();
- basegfx::B3DPolygon aNewPoly;
-
- for(sal_uInt32 i(0L); i < nPntCnt; i++)
- {
- const basegfx::B3DVector aVecC(aPoly3DBack.getB3DPoint(i) - aPoly3DFront.getB3DPoint(i));
- const basegfx::B3DVector aVecD(aPoly3DFront.getB3DPoint((i + 1L == nPntCnt) ? 0L : i + 1L) - aPoly3DFront.getB3DPoint(i));
- basegfx::B3DVector aNextNormal(aVecC.getPerpendicular(aVecD));
- aNextNormal.normalize();
- basegfx::B3DVector aNew;
-
- if(bSmoothed)
- {
- basegfx::B3DVector aMidNormal(aNormal + aNextNormal);
- aMidNormal.normalize();
- aNew = aNormalPoly.getB3DPoint(i) + aMidNormal;
- }
- else
- {
- aNew = aNormalPoly.getB3DPoint(i) + aNormal;
- }
-
- aNew.normalize();
- aNewPoly.append(aNew);
- aNormal = aNextNormal;
- }
-
- aNewPoly.setClosed(bClosed);
- aRetval.append(aNewPoly);
- }
- else
- {
- basegfx::B3DVector aNormal;
-
- if(aPoly3DBack.getB3DPoint(0L) == aPoly3DFront.getB3DPoint(0L))
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(1L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(0L));
- aNormal = aVecA.getPerpendicular(aVecB);
- }
- else
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(0L) - aPoly3DFront.getB3DPoint(0L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(0L));
- aNormal = aVecA.getPerpendicular(aVecB);
- }
-
- aNormal.normalize();
- basegfx::B3DVector aNew(aNormalPoly.getB3DPoint(0L) + aNormal);
- aNew.normalize();
- basegfx::B3DPolygon aNewPoly;
- aNewPoly.append(aNew);
-
- for(sal_uInt32 i(1L); i < nPntCnt; i++)
- {
- basegfx::B3DVector aNextNormal;
-
- if(i + 1L == nPntCnt)
- {
- aNextNormal = aNormal;
- }
- else
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(i) - aPoly3DFront.getB3DPoint(i));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(i + 1L) - aPoly3DFront.getB3DPoint(i));
- aNextNormal = aVecA.getPerpendicular(aVecB);
- }
-
- aNextNormal.normalize();
-
- if(bSmoothed)
- {
- basegfx::B3DVector aMidNormal(aNormal + aNextNormal);
- aMidNormal.normalize();
- aNew = aNormalPoly.getB3DPoint(i) + aMidNormal;
- }
- else
- {
- aNew = aNormalPoly.getB3DPoint(i) + aNormal;
- }
-
- aNew.normalize();
- aNewPoly.append(aNew);
- aNormal = aNextNormal;
- }
-
- aNewPoly.setClosed(bClosed);
- aRetval.append(aNewPoly);
- }
- }
-
- return aRetval;
-}
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+ maSnapRect = Rectangle();
-void E3dCompoundObject::ImpCreateInBetween(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bDoCreateNormals,
- double fSurroundFactor,
- double fTextureStart,
- double fTextureDepth,
- BOOL bRotateTexture90)
-{
- const sal_uInt32 nPolyCnt(rPolyPolyFront.count());
- bool bDoCreateTexture(0.0 != fTextureDepth);
- double fPolyLength(0.0), fPolyPos(0.0);
- sal_uInt32 nLastIndex(0L);
-
- // Verbindungsstuecke
- if(bDoCreateNormals)
+ if(pRootScene)
{
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
- {
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormalsFront(rFrontNormals.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormalsBack(rBackNormals.getB3DPolygon(a));
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
- const sal_uInt32 nPrefillIndex(aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L);
- basegfx::B3DPolygon aRect3D;
- basegfx::B3DPolygon aNormal3D;
- basegfx::B2DPolygon aTexture2D;
-
- aRect3D.append(basegfx::B3DPoint(), 4L);
- aNormal3D.append(basegfx::B3DPoint(), 4L);
- aTexture2D.append(basegfx::B2DPoint(), 4L);
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(nPrefillIndex));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(nPrefillIndex));
- aNormal3D.setB3DPoint(3L, aPolyNormalsFront.getB3DPoint(nPrefillIndex));
- aNormal3D.setB3DPoint(2L, aPolyNormalsBack.getB3DPoint(nPrefillIndex));
-
- if(bDoCreateTexture)
- {
- fPolyLength = basegfx::tools::getLength(aPoly3DFront);
- fPolyPos = 0.0;
- nLastIndex = aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L;
+ // get VC of 3D candidate
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
- if(bRotateTexture90)
- {
- // X,Y vertauschen
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fTextureStart, (1.0 - fPolyPos) * fSurroundFactor));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fTextureStart + fTextureDepth, (1.0 - fPolyPos) * fSurroundFactor));
- }
- else
- {
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart + fTextureDepth));
- }
- }
-
- for(sal_uInt32 i(aPoly3DFront.isClosed() ? 0L : 1L); i < nPntCnt; i++)
- {
- aRect3D.setB3DPoint(0L, aRect3D.getB3DPoint(3L));
- aRect3D.setB3DPoint(1L, aRect3D.getB3DPoint(2L));
-
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(i));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(i));
-
- aNormal3D.setB3DPoint(0L, aNormal3D.getB3DPoint(3L));
- aNormal3D.setB3DPoint(1L, aNormal3D.getB3DPoint(2L));
-
- aNormal3D.setB3DPoint(3L, aPolyNormalsFront.getB3DPoint(i));
- aNormal3D.setB3DPoint(2L, aPolyNormalsBack.getB3DPoint(i));
-
- if(bDoCreateTexture)
- {
- // Texturkoordinaten ermitteln
- basegfx::B3DVector aPart(aPoly3DFront.getB3DPoint(i) - aPoly3DFront.getB3DPoint(nLastIndex));
- fPolyPos += aPart.getLength() / fPolyLength;
- nLastIndex = i;
-
- // Der Abschnitt am Polygon entspricht dem Teil
- // von fPolyPos bis fPolyPos+fPartLength
-
- aTexture2D.setB2DPoint(0L, aTexture2D.getB2DPoint(3L));
- aTexture2D.setB2DPoint(1L, aTexture2D.getB2DPoint(2L));
-
- if(bRotateTexture90)
- {
- // X,Y vertauschen
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fTextureStart, (1.0 - fPolyPos) * fSurroundFactor));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fTextureStart + fTextureDepth, (1.0 - fPolyPos) * fSurroundFactor));
- }
- else
- {
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart + fTextureDepth));
- }
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), FALSE);
- }
- }
- }
- }
- else
- {
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
+ if(pVCOfE3D)
{
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- basegfx::B3DPolygon aRect3D;
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
- const sal_uInt32 nPrefillIndex(aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L);
-
- aRect3D.append(basegfx::B3DPoint(), 4L);
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(nPrefillIndex));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(nPrefillIndex));
+ // get 3D primitive sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DSequence());
- for(sal_uInt32 i(aPoly3DFront.isClosed() ? 0L : 1L); i < nPntCnt; i++)
+ if(xLocalSequence.hasElements())
{
- aRect3D.setB3DPoint(0L, aRect3D.getB3DPoint(3L));
- aRect3D.setB3DPoint(1L, aRect3D.getB3DPoint(2L));
-
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(i));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(i));
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
+ // get BoundVolume
+ basegfx::B3DRange aBoundVolume(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aViewInfo3D));
+
+ // transform bound volume to relative scene coordinates
+ aBoundVolume.transform(aViewInfo3D.getObjectToView());
+
+ // build 2d relative scene range
+ basegfx::B2DRange aSnapRange(
+ aBoundVolume.getMinX(), aBoundVolume.getMinY(),
+ aBoundVolume.getMaxX(), aBoundVolume.getMaxY());
+
+ // transform to 2D world coordiantes
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to integer
+ maSnapRect = Rectangle(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
}
}
}
@@ -2270,16 +1208,9 @@ void E3dCompoundObject::operator=(const SdrObject& rObj)
// weitere Parameter kopieren
const E3dCompoundObject& r3DObj = (const E3dCompoundObject&) rObj;
- aDisplayGeometry = r3DObj.aDisplayGeometry;
bCreateNormals = r3DObj.bCreateNormals;
bCreateTexture = r3DObj.bCreateTexture;
- bGeometryValid = r3DObj.bGeometryValid;
-
- // neu ab 383:
aMaterialAmbientColor = r3DObj.aMaterialAmbientColor;
-
- aBackMaterial = r3DObj.aBackMaterial;
- bUseDifferentBackMaterial = r3DObj.bUseDifferentBackMaterial;
}
/*************************************************************************
@@ -2288,572 +1219,14 @@ void E3dCompoundObject::operator=(const SdrObject& rObj)
|*
\************************************************************************/
-// #110988# test if given hit candidate point is inside bound volume of object
-sal_Bool E3dCompoundObject::ImpIsInsideBoundVolume(const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, const Point& /*rPnt*/) const
-{
- const Volume3D& rBoundVol = ((E3dCompoundObject*)this)->GetBoundVolume();
-
- if(!rBoundVol.isEmpty())
- {
- double fXMax = rFront.getX();
- double fXMin = rBack.getX();
-
- if(fXMax < fXMin)
- {
- fXMax = rBack.getX();
- fXMin = rFront.getX();
- }
-
- if(rBoundVol.getMinX() <= fXMax && rBoundVol.getMaxX() >= fXMin)
- {
- double fYMax = rFront.getY();
- double fYMin = rBack.getY();
-
- if(fYMax < fYMin)
- {
- fYMax = rBack.getY();
- fYMin = rFront.getY();
- }
-
- if(rBoundVol.getMinY() <= fYMax && rBoundVol.getMaxY() >= fYMin)
- {
- double fZMax = rFront.getZ();
- double fZMin = rBack.getZ();
-
- if(fZMax < fZMin)
- {
- fZMax = rBack.getZ();
- fZMin = rFront.getZ();
- }
-
- if(rBoundVol.getMinZ() <= fZMax && rBoundVol.getMaxZ() >= fZMin)
- {
- return sal_True;
- }
- }
- }
- }
-
- return sal_False;
-}
-
-SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* /*pVisiLayer*/) const
-{
- E3dPolyScene* pScene = (E3dPolyScene*)GetScene();
-
- if(pScene)
- {
- // get HitLine in ObjectKoordinates
- // set ObjectTrans
- basegfx::B3DHomMatrix mTransform = GetFullTransform();
- pScene->GetCameraSet().SetObjectTrans(mTransform);
-
- // create HitPoint Front und Back, transform to object coordinates
- basegfx::B3DPoint aFront(rPnt.X(), rPnt.Y(), 0.0);
- basegfx::B3DPoint aBack(rPnt.X(), rPnt.Y(), ZBUFFER_DEPTH_RANGE);
- aFront = pScene->GetCameraSet().ViewToObjectCoor(aFront);
- aBack = pScene->GetCameraSet().ViewToObjectCoor(aBack);
-
- if(ImpIsInsideBoundVolume(aFront, aBack, rPnt))
- {
- // Geometrie herstellen
- if(!bGeometryValid)
- ((E3dCompoundObject*)this)->ReCreateGeometry();
-
- // 3D Volumes schneiden sich, teste in der Geometrie
- // auf Basis der Projektion weiter
- if(((E3dCompoundObject*)this)->aDisplayGeometry.CheckHit(aFront, aBack, nTol))
- {
- return ((E3dCompoundObject*)this);
- }
- }
- }
-
- return 0L;
-}
-
-/*************************************************************************
-|*
-|* Schattenattribute holen
-|*
-\************************************************************************/
-
-Color E3dCompoundObject::GetShadowColor() const
-{
- return ((SdrShadowColorItem&)(GetObjectItem(SDRATTR_SHADOWCOLOR))).GetColorValue();
-}
-
-BOOL E3dCompoundObject::DrawShadowAsOutline() const
-{
- const SfxItemSet& rSet = GetObjectItemSet();
- XFillStyle eFillStyle = (